comp.lang.ada
 help / color / mirror / Atom feed
From: darkestkhan <darkestkhan@gmail.com>
Subject: Re: How to shuffle/jumble letters of a given word?
Date: Wed, 1 Jul 2015 03:40:40 -0700 (PDT)
Date: 2015-07-01T03:40:40-07:00	[thread overview]
Message-ID: <1f55d283-1690-4503-a31d-730a08a633ef@googlegroups.com> (raw)
In-Reply-To: <03b78b5c-d263-4398-97b5-e613c92cb07d@googlegroups.com>

On Tuesday, June 30, 2015 at 12:29:57 PM UTC, Austin Obyrne wrote:
> 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'
> 

Only 10 ways? I know 7 ways to do it, I suspect that there are many more. And if you meant that there are only "10 possible results of shuffling" then you are way off the target (5! possible shuffles, which is 120)

> The source code I posted earlier will copy 'n paste directly into your AdaGide editor for immediate running.
> 

What if someone doesn't have AdaGide editor? Why even assume that anyone has AdaGide editor?

> These results will often need some user-assistance but at least you can see what is available to you for your program.
>

Like providing different scrambling parameters each time he changes word?
 
> 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;
> 
> 

I checked this program and can't see what it has to do with shuffling at all.

Here is what your program basically does (after cutting out all the I/O routines)

Number : Integer := 5;
Sum: Integer := 0;
for K in 1 .. Number loop
  Sum := Sum + Number / K;
end loop;

I fail to see how this is even connected to shuffling.

  reply	other threads:[~2015-07-01 10:40 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
2015-07-01 10:40   ` darkestkhan [this message]
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