Skip to content

Commit

Permalink
Make solver sort resulting wordlists everytime
Browse files Browse the repository at this point in the history
  • Loading branch information
idontwantcookies committed Jan 18, 2022
1 parent 0f41713 commit 4f8c214
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/wordle.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ defmodule Wordle do
def solve(wordlist, right_word, guesses, complement) do
guess = best_guess(wordlist, complement)
{guesses, feedback} = Game.guess(right_word, guess, guesses)
complement = Solver.complement(complement, guess)
wordlist = Solver.feedback(wordlist, guess, feedback)
complement = complement |> Solver.complement(guess) |> WordStats.order_by_scores()

solve(wordlist, right_word, guesses, complement)
wordlist
|> Solver.feedback(guess, feedback)
|> WordStats.order_by_scores()
|> solve(right_word, guesses, complement)
end

@spec feedback([binary], binary, binary) :: [binary]
Expand Down

0 comments on commit 4f8c214

Please sign in to comment.