Page 1 of 1

Anagrams Generator

Posted: 18 Feb 2015 12:18
by akimotoiv
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 )

Re: Anagrams Generator

Posted: 18 Feb 2015 19:22
by foxidrive
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?

Re: Anagrams Generator

Posted: 18 Feb 2015 21:32
by ShadowThief
Love is there as a side effect of running the entire post through Google Translate.

Ame is Portuguese for love, apparently.

Re: Anagrams Generator

Posted: 18 Feb 2015 23:18
by foxidrive
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.

Re: Anagrams Generator

Posted: 18 Feb 2015 23:45
by ShadowThief
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.

Re: Anagrams Generator

Posted: 19 Feb 2015 01:31
by foxidrive
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

Re: Anagrams Generator

Posted: 19 Feb 2015 09:55
by akimotoiv
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.

Re: Anagrams Generator

Posted: 19 Feb 2015 11:06
by foxidrive
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.