commit 663127de306e090d7135cf7c7389fe8439eb7a26 parent 696dd3b60260ed72eabc0d35d053e0ea9b7905b1 Author: Samir Parikh <noreply@samirparikh.com> Date: Fri, 18 Feb 2022 02:55:09 +0000 update game play logic to increment win counter Diffstat:
M | guess_number.cgi | | | 8 | +++++--- |
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/guess_number.cgi b/guess_number.cgi @@ -68,9 +68,11 @@ sub process_guess { # we first check whether the guess is correct # guess is correct! - return ("Congratulations! You guessed that the correct number - was $state->{NUMBER}!", 'won') - if ( $guess == $state->{NUMBER} ); + if ( $guess == $state->{NUMBER} ) { + $state->{WON}++; + return ("Congratulations! You guessed that the correct number + was $state->{NUMBER}!", 'won'); + } # if the guess is not correct AND we are out of guesses... return ("Sorry, you ran out of turns. The number was $state->{NUMBER}.",