I published a little program called Ballistic in DC's NANY.
One the users there decided to test the permutation function with seventeen letters and it gives up an error.
Here I have run the uncompiled script for the sake of debugging.
Also the function is included below.
Code: Select all
;http://www.autohotkey.com/board/topic/32472-anagram-bot/#entry206401 function by [VxE]
;returns a newline-seperated list of all unique permutations of the input set.
; Note that the length of the list will be (N!)
twister_Permutate(set,delimeter="",trim="", presc=""){
d := SubStr(delimeter,1,1)
StringSplit, m, set, %d%, %trim%
IfEqual, m0, 1, return m1 d presc
Loop %m0%
{
remains := m1
Loop % m0-2
x := A_Index + 1, remains .= d m%x%
list .= twister_Permutate(remains, d, trim, m%m0% d presc)"`n"
mx := m1
Loop % m0-1
x := A_Index + 1, m%A_Index% := m%x%
m%m0% := mx
}
return substr(list, 1, -1)
}
Any clues?