March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 deletions
|
|
@ -19,6 +19,16 @@ Procedure.s sortWord(word$)
|
|||
ProcedureReturn word$
|
||||
EndProcedure
|
||||
|
||||
;for a faster and more advanced alternative replace the previous procedure with this code
|
||||
; Procedure.s sortWord(word$) ;returns a string with the letters of the word sorted
|
||||
; Protected wordLength = Len(word$)
|
||||
; Protected Dim letters.c(wordLength)
|
||||
;
|
||||
; PokeS(@letters(), word$) ;overwrite the array with the strings contents
|
||||
; SortArray(letters(), #PB_Sort_Ascending, 0, wordLength - 1)
|
||||
; ProcedureReturn PeekS(@letters(), wordLength) ;return the arrays contents
|
||||
; EndProcedure
|
||||
|
||||
|
||||
tmpdir$ = GetTemporaryDirectory()
|
||||
filename$ = tmpdir$ + "unixdict.txt"
|
||||
|
|
@ -43,15 +53,20 @@ If ReceiveHTTPFile("http://www.puzzlers.org/pub/wordlists/unixdict.txt", filenam
|
|||
Else
|
||||
; if no
|
||||
anaMap(key$)\anas = word$ ; applying a new record
|
||||
anaMap()\isana + 1
|
||||
anaMap()\isana = 1
|
||||
EndIf
|
||||
|
||||
If anaMap()\isana > maxAnagrams ;make note of maximum anagram count
|
||||
maxAnagrams = anaMap()\isana
|
||||
EndIf
|
||||
|
||||
Until Eof(1)
|
||||
CloseFile(1)
|
||||
DeleteFile(filename$)
|
||||
|
||||
;----- output -----
|
||||
ForEach anaMap()
|
||||
If anaMap()\isana >= 4 ; only emit what had 4 or more hits.
|
||||
If anaMap()\isana = maxAnagrams ; only emit elements that have the most hits
|
||||
PrintN(anaMap()\anas)
|
||||
EndIf
|
||||
Next
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue