Reformat all code with black formatter.
This commit is contained in:
1 parent
497c48f853
commit
7cf685b507
4 files changed
+67
-39
No files matched your search
@@ -6,7 +6,8 @@ import wordle
|
||||
def display_instructions():
|
||||
"""Print out instuctions before starting play."""
|
||||
|
||||
print(f"""Welcome to Wordle!
|
||||
print(
|
||||
f"""Welcome to Wordle!
|
||||
|
||||
Wordle has a hidden word of five letters, and you get to
|
||||
make up to six guesses to find out what it is.
|
||||
@@ -15,12 +16,13 @@ def display_instructions():
|
||||
* {wordle.display_result(wordle.LetterResult.CORRECT, "Correct!")}
|
||||
* {wordle.display_result(wordle.LetterResult.MOVE, "Correct, in a different location.")}
|
||||
* {wordle.display_result(wordle.LetterResult.INCORRECT, "Not in the word.")}
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def read_valid_guess(guess_number):
|
||||
while True:
|
||||
print(f"Guess {guess_number}: ", end='')
|
||||
print(f"Guess {guess_number}: ", end="")
|
||||
guess = input()
|
||||
if guess in wordle.dictionary():
|
||||
return guess
|
||||
@@ -29,9 +31,9 @@ def read_valid_guess(guess_number):
|
||||
|
||||
|
||||
def display_results(guess, results):
|
||||
print(" ", end='')
|
||||
print(" ", end="")
|
||||
for i in range(wordle.WORDLE_LENGTH):
|
||||
print(wordle.display_result(results[i], guess[i]), end='')
|
||||
print(wordle.display_result(results[i], guess[i]), end="")
|
||||
print("")
|
||||
|
||||
|
||||
@@ -56,5 +58,5 @@ def play_game():
|
||||
print(f"Sorry, no guesses remaining. The word was: {target}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
play_game()
|
||||
Reference in new issue
Block a user