Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
39
Task/Anagrams/LiveCode/anagrams.livecode
Normal file
39
Task/Anagrams/LiveCode/anagrams.livecode
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
on mouseUp
|
||||
put mostCommonAnagrams(url "http://wiki.puzzlers.org/pub/wordlists/unixdict.txt")
|
||||
end mouseUp
|
||||
|
||||
function mostCommonAnagrams X
|
||||
put 0 into maxCount
|
||||
repeat for each word W in X
|
||||
get sortChars(W)
|
||||
put W & comma after A[it]
|
||||
add 1 to C[it]
|
||||
if C[it] >= maxCount then
|
||||
if C[it] > maxCount then
|
||||
put C[it] into maxCount
|
||||
put char 1 to -2 of A[it] into winnerList
|
||||
else
|
||||
put cr & char 1 to -2 of A[it] after winnerList
|
||||
end if
|
||||
end if
|
||||
end repeat
|
||||
return winnerList
|
||||
end mostCommonAnagrams
|
||||
|
||||
function sortChars X
|
||||
get charsToItems(X)
|
||||
sort items of it
|
||||
return itemsToChars(it)
|
||||
end sortChars
|
||||
|
||||
function charsToItems X
|
||||
repeat for each char C in X
|
||||
put C & comma after R
|
||||
end repeat
|
||||
return char 1 to -2 of R
|
||||
end charsToItems
|
||||
|
||||
function itemsToChars X
|
||||
replace comma with empty in X
|
||||
return X
|
||||
end itemsToChars
|
||||
Loading…
Add table
Add a link
Reference in a new issue