Word ladder: Difference between revisions
Content deleted Content added
m →{{header|Julia}}: save a step |
→{{header|Julia}}: variable names |
||
Line 40: | Line 40: | ||
<lang julia>const dict = Dict(word => length(word) for word in split(read("unixdict.txt", String), r"\s+")) |
<lang julia>const dict = Dict(word => length(word) for word in split(read("unixdict.txt", String), r"\s+")) |
||
function targeted_mutations( |
function targeted_mutations(str::AbstractString, target::AbstractString) |
||
working, tried = [[ |
working, tried = [[str]], Set{String}() |
||
while all(a -> a[end] != target, working) |
while all(a -> a[end] != target, working) |
||
newworking = Vector{Vector{String}}() |
newworking = Vector{Vector{String}}() |