Checking if the player has won
This commit is contained in:
@@ -58,3 +58,10 @@ class Game:
|
||||
@return For example `"p _ n g _ i n"`.
|
||||
"""
|
||||
return " ".join(c if c in self.guesses else BLANK for c in self.word)
|
||||
|
||||
@property
|
||||
def won(self) -> bool:
|
||||
"""!
|
||||
@brief True when every letter of the word has been guessed.
|
||||
"""
|
||||
return all(c in self.guesses for c in self.word)
|
||||
|
||||
Reference in New Issue
Block a user