Word search: Difference between revisions
m
→{{header|Julia}}
Line 1,313:
end
function wordmatrix(filename, usepropernames = true)
words = [lowercase(line) for line in readlines(filename)
if match(r"^[a-zA-Z]+$", line) != nothing && (usepropernames ||
match(r"^[a-z]", line) != nothing) && length(line) >= minwordsize && length(line) <= ncols]
n =
for i in 1:n
grid = LetterGrid()
Line 1,336:
end
end
throw("Failed to place words after $n attempts")
end
Line 1,410:
end
printresult(wordmatrix("words.txt", false))
</lang>{{output}}<pre>
Attempts:
Number of words: 25
9
zero [4, 6] to [1, 9] air [7, 7] to [9, 7]
asp [1, 3] to [1, 1]
</pre>
|