Skip to content

Commit

Permalink
fix: improve cli response validation
Browse files Browse the repository at this point in the history
  • Loading branch information
hrishikeshrt committed Feb 27, 2022
1 parent 4be783c commit 7e956fd
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,18 @@
print("\n".join(description))
solver = WordleSolver(None)
while solver.num_attempts < MAXIMUM_ATTEMPTS:
print(f"\nAttempt {solver.num_attempts + 1}\n=========")
print(f"\nAttempt {solver.num_attempts + 1}\n=========\n")
if len(solver.valid_words) < 10:
print(f"Valid Words: {solver.valid_words}")
print(f"Suggestions: {solver.best_options()[:5]}")
_word = input("Word chosen: ")
_result = input("Result obtained: ")
_word = ""
while not _word.strip():
_word = input("Chosen word: ")

_result = ""
while not _result.strip():
_result = input("Obtained result: ")

if _result.strip() == "22222":
print("\nCongratulations!")
break
Expand All @@ -89,7 +95,9 @@
else:
wordle.show()
while not wordle.solved and not wordle.failed:
guess = input("Guess: ")
guess = ""
while not guess.strip():
guess = input("Guess: ")
wordle.guess(guess)

if args.get("random") and wordle.failed:
Expand Down

0 comments on commit 7e956fd

Please sign in to comment.