octokatherine / word-master

A Mastermind-like word guessing game
MIT License
381 stars 240 forks source link

Implementing the Give Up button #124 #125

Open ssaurab opened 2 years ago

ssaurab commented 2 years ago

Implementing the Give Up button. Resolves #124.

Play with the deployed version of this PR here: https://wordlgiveup.herokuapp.com (supports Desktop and Mobile)

Motivation

When you are out of words to guess, rather than filling in the remaining words in vain, give up and move on to next puzzle quicker.

Button Timing Details

Since showing a button that says Give Up from the start of a puzzle is annoying, it only appears 40s after each new puzzle is loaded. Reloading the page resets this timer.

Button Behavior

When clicked, it behaves as if the game is lost. That is, it resets the streak and sets the gameState to 'lost', thereby opening the EndGameModal.

Manual Testing

Benign bugs to fix in future:

  1. [Fixed in a new commit] If the wordle is completed within 40s, the next puzzle shows Give Up button much sooner (i.e. timer is not reset)
  2. Timer starts running even when user is in InfoModal
  3. [Fixed in a new commit] Closing EndGameModal using x instead of Play Again will have a redundant functionless Give Up button until the next game is started

Feature Video

https://user-images.githubusercontent.com/25542635/154793543-ef9f85b3-7fbc-4966-a479-b0219532f6b6.mp4

Addresses issue #124 cc: @octokatherine