Declare That the Player Has Won
Learn to code the game rules and decide the winners of the game.
We'll cover the following
Once the game starts, it only stops if the player enters “stop” when he enters a proposal. Even if the player finds all the hidden letters, the game goes on and keeps asking for more letters. We'll now change the code to stop the game as soon as the player has found all the letters.
Let's discuss the improved code
First, let's replace the hidden word with a word containing only one letter in line 3 so that testing is faster (we only need to enter one letter to win).
Get hands-on with 1400+ tech skills courses.