Word wheel: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added wording to the REXX section header and the output section.) |
(Added Wren) |
||
Line 500: | Line 500: | ||
number of word wheel words in the dictionary: 212 |
number of word wheel words in the dictionary: 212 |
||
</pre> |
|||
=={{header|Wren}}== |
|||
{{libheader|Wren-sort}} |
|||
<lang ecmascript>import "io" for File |
|||
import "/sort" for Find |
|||
var letters = ["d", "e", "e", "g", "k", "l", "n", "o","w"] |
|||
var words = File.read("unixdict.txt").split("\n") |
|||
var found = [] |
|||
for (word in words) { |
|||
if (word.count > 2 && word.count <= 9 && word.indexOf("k") >= 0) { |
|||
var lets = letters.toList |
|||
var ok = true |
|||
for (c in word) { |
|||
var ix = Find.first(lets, c) |
|||
if (ix == - 1) { |
|||
ok = false |
|||
break |
|||
} |
|||
lets.removeAt(ix) |
|||
} |
|||
if (ok) found.add(word) |
|||
} |
|||
} |
|||
System.print("The following %(found.count) words are the solutions to the puzzle:") |
|||
System.print(found.join("\n"))</lang> |
|||
{{out}} |
|||
<pre> |
|||
The following 17 words are the solutions to the puzzle: |
|||
eke |
|||
elk |
|||
keel |
|||
keen |
|||
keg |
|||
ken |
|||
keno |
|||
knee |
|||
kneel |
|||
knew |
|||
know |
|||
knowledge |
|||
kong |
|||
leek |
|||
week |
|||
wok |
|||
woke |
|||
</pre> |
</pre> |