From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.172.78 with SMTP id ba14mr33294317pac.1.1435747240869; Wed, 01 Jul 2015 03:40:40 -0700 (PDT) X-Received: by 10.140.94.19 with SMTP id f19mr196193qge.23.1435747240610; Wed, 01 Jul 2015 03:40:40 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!ff1no417428igc.0!news-out.google.com!4ni33206qgh.1!nntp.google.com!s91no191747qgd.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 1 Jul 2015 03:40:40 -0700 (PDT) In-Reply-To: <03b78b5c-d263-4398-97b5-e613c92cb07d@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=178.212.31.133; posting-account=nuF4hQoAAADjc2KKS1rOkzxWWEmaDrvx NNTP-Posting-Host: 178.212.31.133 References: <24d183ce-77b6-4fe1-a95e-0ff5ef72c7bd@googlegroups.com> <03b78b5c-d263-4398-97b5-e613c92cb07d@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1f55d283-1690-4503-a31d-730a08a633ef@googlegroups.com> Subject: Re: How to shuffle/jumble letters of a given word? From: darkestkhan Injection-Date: Wed, 01 Jul 2015 10:40:40 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:26553 Date: 2015-07-01T03:40:40-07:00 List-Id: 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 jumble= d manner. How do I set the code to shuffle the letters?=20 > >=20 > > Example: word to be guessed is HELLO > >=20 > > What should be displayed is: LOLEH or LELHO > >=20 > > Thanks in advance! >=20 > There are 10 ways of shuffling 'Hello' >=20 Only 10 ways? I know 7 ways to do it, I suspect that there are many more. A= nd 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 Ad= aGide editor for immediate running. >=20 What if someone doesn't have AdaGide editor? Why even assume that anyone ha= s AdaGide editor? > These results will often need some user-assistance but at least you can s= ee what is available to you for your program. > Like providing different scrambling parameters each time he changes word? =20 > Also, >=20 > Herewith is a program that will calculate the scrambling parameters for y= ou as general options to insert for 'Step' and 'Repeat' in your scrambling = program >=20 > 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 =A9 2015 Austin O'Byrne. > --| Last modified April 2015. > ------------------------------------------------------------------------- > SUM : Integer; > Number : CONSTANT Integer:=3D 5; - - Number (Wordlength) for analysing = as parameters > Line_Number: Integer; > View : Character; >=20 > BEGIN -- Find_Scrambling_Parameters > SUM :=3D 0; > Line_Number:=3D0; > Ada.Text_IO.New_Line(2); > Ada.Text_IO.Put(Item =3D> " Step Times Parameter= s space "); > Ada.Text_IO.New_Line(2); > FOR I in 1 .. Number LOOP > Line_Number :=3D Line_Number + 1; > SUM :=3D SUM + Number / I; > Ada.Integer_Text_IO.Put(Item =3D> I, Width =3D> 20); > Ada.Integer_Text_IO.Put(Item =3D> Number/ I, Width =3D> 10); > Ada.Integer_Text_IO.Put(Item =3D> Sum, Width =3D> 10); > Ada.Text_IO.New_Line; > IF Line_Number REM 50 =3D 0 THEN --stalls program for viewing > Ada.Text_IO.Put(Item =3D> " "); > Ada.Text_IO.Put(Item =3D> " - press any key/return to continue > ")= ; > Ada.Text_IO.Get(Item =3D> View); > END IF; > END LOOP; >=20 > Ada.Text_IO.Put(Item =3D> " There are "); > Ada.Integer_Text_IO.Put(Item =3D> Sum, Width =3D> 2); > Ada.Text_IO.Put(Item =3D> " secret ways of scrambling this string of= ciphertext. "); >=20 >=20 > END Find_Scrambling_Parameters; >=20 >=20 I checked this program and can't see what it has to do with shuffling at al= l. Here is what your program basically does (after cutting out all the I/O rou= tines) Number : Integer :=3D 5; Sum: Integer :=3D 0; for K in 1 .. Number loop Sum :=3D Sum + Number / K; end loop; I fail to see how this is even connected to shuffling.