mirror of
https://gitlab.com/MisterBiggs/wordle.jl.git
synced 2025-06-16 06:36:40 +00:00
getting advanced
This commit is contained in:
parent
0f2b5696a8
commit
285ee90d82
31
wordle.jl
31
wordle.jl
@ -18,6 +18,23 @@ function check_known(word, knowns)
|
||||
return true
|
||||
end
|
||||
|
||||
function check_wrong(word, wrongs)
|
||||
if isempty(wrongs)
|
||||
return true
|
||||
end
|
||||
|
||||
for wrong in wrongs
|
||||
l, i = wrong
|
||||
if word[i] == only(l)
|
||||
return false
|
||||
else
|
||||
continue
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
begin
|
||||
words = readdlm("wordle.txt")[:]
|
||||
@ -40,18 +57,26 @@ end
|
||||
# SERAI 3.52
|
||||
|
||||
begin
|
||||
banned = "pnisrblwgyox" |> collect
|
||||
contained = "t" |> collect
|
||||
knowns = "de..." |> collect |> enumerate
|
||||
wrongs = []
|
||||
banned = "erahiync" |> collect
|
||||
contained = "ulp" |> collect
|
||||
knowns = "s...." |> collect |> enumerate
|
||||
wrongs = [('s', 5), ('u', 2), ('l', 3), ('p', 4)] # (letter, index)
|
||||
@assert length(knowns) == 5
|
||||
|
||||
i = 0
|
||||
for word in words
|
||||
if any(occursin.(banned, word))
|
||||
continue
|
||||
end
|
||||
if all(occursin.(contained, word))
|
||||
if check_known(word, knowns)
|
||||
if check_wrong(word, wrongs)
|
||||
println(word)
|
||||
i += 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
println("Possibilities: ", i)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user