Browse files

added exit functionality to the game

  • Loading branch information...
1 parent be34201 commit d34defcd0905ae655abd1e5d059283d9329ef374 @alimjiwa alimjiwa committed Mar 31, 2012
Showing with 9 additions and 0 deletions.
  1. +1 −0 web/templates/exit.txt
  2. +8 −0 web/views.py
View
1 web/templates/exit.txt
@@ -0,0 +1 @@
+You have successfully exited the game
View
8 web/views.py
@@ -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)

0 comments on commit d34defc

Please sign in to comment.