Anagrams Generator

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
akimotoiv
Posts: 2
Joined: 18 Feb 2015 12:12

Anagrams Generator

#1 Post by akimotoiv » 18 Feb 2015 12:18

Hello colleagues, okay?

I would like to know how to create a program in BATCH to generate Anagrams.

Or be a program where u enter any word and it will bring you the results "scrambled" and possibilities of that word.
This ends up involving mathematics (factor) where the word with 4 different letters manages just 24 combinations (4! = 4 * 3 * 2 * 1 = 24)

Example 3 letters which generates 6 combinations ....

mae
emu
eam
m
aem
love

Could you help me?

(sorry bad english --- google Tradutor --- Brazil )

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Anagrams Generator

#2 Post by foxidrive » 18 Feb 2015 19:22

akimotoiv wrote:Example 3 letters which generates 6 combinations ....

mae
emu
eam
m
aem
love


Why is m there and not ae and em etc? How come love is there?

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Anagrams Generator

#3 Post by ShadowThief » 18 Feb 2015 21:32

Love is there as a side effect of running the entire post through Google Translate.

Ame is Portuguese for love, apparently.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Anagrams Generator

#4 Post by foxidrive » 18 Feb 2015 23:18

ShadowThief wrote:Love is there as a side effect of running the entire post through Google Translate.

Ame is Portuguese for love, apparently.


Thanks, that explains that well.

I'm still curious about m. Maybe that was a translation error too.

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Anagrams Generator

#5 Post by ShadowThief » 18 Feb 2015 23:45

foxidrive wrote:
ShadowThief wrote:Love is there as a side effect of running the entire post through Google Translate.

Ame is Portuguese for love, apparently.


Thanks, that explains that well.

I'm still curious about m. Maybe that was a translation error too.

Google Translate says that's exactly what happened, though I can't fathom why. M in Portuguese (from what I can tell, anyway) is spelled eme.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Anagrams Generator

#6 Post by foxidrive » 19 Feb 2015 01:31

ShadowThief wrote:Google Translate says that's exactly what happened, though I can't fathom why. M in Portuguese (from what I can tell, anyway) is spelled eme.


Brilliant sleuthing!

There's a thread here that might help the OP. viewtopic.php?f=3&t=4585

akimotoiv
Posts: 2
Joined: 18 Feb 2015 12:12

Re: Anagrams Generator

#7 Post by akimotoiv » 19 Feb 2015 09:55

First, Thanks for the answer. And correcting the permutations would be.. Mae, mea, eam, ema,"ame"( verb to love in Portuguese, so the translation" love"), aem.... As for the link, helped much, but I am lost when appears" goto permutations" and" goto eof" could explain myself better? I'm newbie in batch.... I thank the attention outset.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Anagrams Generator

#8 Post by foxidrive » 19 Feb 2015 11:06

In Aacini's batch file at viewtopic.php?p=26332#p26332 change this

Code: Select all

rem Show unique permutations and number of repetitions
for /F "tokens=2,3 delims=[]=" %%a in ('set p[') do (
   echo %%b-  %%a
)
goto :EOF


and put the pause in like this

Code: Select all

rem Show unique permutations and number of repetitions
for /F "tokens=2,3 delims=[]=" %%a in ('set p[') do (
   echo %%b-  %%a
)
pause
goto :EOF


Then try the batch file and it will pause at the end.

That point in the batch file is the end of the code.
The batch file uses recursive calls to the same batch file to do the work.

Post Reply