From: Austin Obyrne <austin.obyrne@hotmail.com>
Subject: Re: How to shuffle/jumble letters of a given word?
Date: Tue, 30 Jun 2015 05:29:55 -0700 (PDT)
Date: 2015-06-30T05:29:55-07:00 [thread overview]
Message-ID: <03b78b5c-d263-4398-97b5-e613c92cb07d@googlegroups.com> (raw)
In-Reply-To: <24d183ce-77b6-4fe1-a95e-0ff5ef72c7bd@googlegroups.com>
On Sunday, June 28, 2015 at 3:06:29 PM UTC+1, Trish Cayetano wrote:
> I am creating a "text twist game" where you guess the words in a jumbled manner. How do I set the code to shuffle the letters?
>
> Example: word to be guessed is HELLO
>
> What should be displayed is: LOLEH or LELHO
>
> Thanks in advance!
There are 10 ways of shuffling 'Hello'
In my program source code (posted earlier)the parameters "Step" and "Repeats" may be set as follows'
Step Repeats
1 5
2 2
3 1
4 1
5 1
These have been tested and they all work.
*They may not all be suitable for your purposes on the occasion but they do work technically.
Try them.
The source code I posted earlier will copy 'n paste directly into your AdaGide editor for immediate running.
These results will often need some user-assistance but at least you can see what is available to you for your program.
Also,
Herewith is a program that will calculate the scrambling parameters for you as general options to insert for 'Step' and 'Repeat' in your scrambling program
WITH Ada.Text_IO;
WITH Ada.Integer_Text_IO;
PROCEDURE Find_Scrambling_Parameters IS
-------------------------------------------------------------------------
--| This utility calculates the number of parameters that may be used
--| to scramble a particular number in that many ways.
--| Copyright © 2015 Austin O'Byrne.
--| Last modified April 2015.
-------------------------------------------------------------------------
SUM : Integer;
Number : CONSTANT Integer:= 5; - - Number (Wordlength) for analysing as parameters
Line_Number: Integer;
View : Character;
BEGIN -- Find_Scrambling_Parameters
SUM := 0;
Line_Number:=0;
Ada.Text_IO.New_Line(2);
Ada.Text_IO.Put(Item => " Step Times Parameters space ");
Ada.Text_IO.New_Line(2);
FOR I in 1 .. Number LOOP
Line_Number := Line_Number + 1;
SUM := SUM + Number / I;
Ada.Integer_Text_IO.Put(Item => I, Width => 20);
Ada.Integer_Text_IO.Put(Item => Number/ I, Width => 10);
Ada.Integer_Text_IO.Put(Item => Sum, Width => 10);
Ada.Text_IO.New_Line;
IF Line_Number REM 50 = 0 THEN --stalls program for viewing
Ada.Text_IO.Put(Item => " ");
Ada.Text_IO.Put(Item => " - press any key/return to continue > ");
Ada.Text_IO.Get(Item => View);
END IF;
END LOOP;
Ada.Text_IO.Put(Item => " There are ");
Ada.Integer_Text_IO.Put(Item => Sum, Width => 2);
Ada.Text_IO.Put(Item => " secret ways of scrambling this string of ciphertext. ");
END Find_Scrambling_Parameters;
(This should copy ' n paste directly into 'AdaGide' also).
Cheers,
Come back if you wish.
Austin
next prev parent reply other threads:[~2015-06-30 12:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-28 14:06 How to shuffle/jumble letters of a given word? Trish Cayetano
2015-06-28 15:52 ` David Botton
2015-06-28 16:01 ` Anh Vo
2015-06-28 21:07 ` Simon Wright
2015-06-28 21:23 ` Jeffrey R. Carter
2015-06-29 8:05 ` Simon Wright
2015-06-29 8:13 ` Dmitry A. Kazakov
2015-06-29 18:04 ` Jeffrey R. Carter
2015-07-02 20:56 ` Randy Brukardt
2015-06-29 13:42 ` darkestkhan
2015-06-29 20:21 ` Austin Obyrne
2015-06-29 21:45 ` MM
2015-06-30 12:29 ` Austin Obyrne [this message]
2015-07-01 10:40 ` darkestkhan
2015-08-09 21:50 ` David Thompson
2015-08-10 15:20 ` darkestkhan
2015-07-11 15:29 ` Trish Cayetano
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox