Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added exit functionality to the game

  • Loading branch information...
commit d34defcd0905ae655abd1e5d059283d9329ef374 1 parent be34201
alimjiwa alimjiwa authored
Showing with 9 additions and 0 deletions.
  1. +1 −0  web/templates/exit.txt
  2. +8 −0 web/views.py
1  web/templates/exit.txt
View
@@ -0,0 +1 @@
+You have successfully exited the game
8 web/views.py
View
@@ -121,6 +121,9 @@ def player_guess(game, current_player, guess):
Called when a player makes a guess.
"""
app.logger.debug('Player %s just guessed "%s"', current_player.phone, guess)
+
+
+
# Set the players guess
current_player.guess = guess
@@ -134,6 +137,11 @@ def player_guess(game, current_player, guess):
if player.guess is None:
round_ready = False
+ # if player guess = exit, then drop them from the game
+ if guess=="exit":
+ current_player.game_id = None
+ return render_template('exit.txt')
+
if round_ready:
return guesses_complete(game, current_round)
Please sign in to comment.
Something went wrong with that request. Please try again.