Created
March 31, 2011 16:38
-
-
Save ChristinaMeno/896721 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tictactoe/apps/core/views.py b/tictactoe/apps/core/views.py | |
index 9da2f0e..edfaf4b 100644 | |
--- a/tictactoe/apps/core/views.py | |
+++ b/tictactoe/apps/core/views.py | |
@@ -113,21 +113,9 @@ def _get_computer(): | |
def create_computer_game(request): | |
bot = _get_computer() | |
- coin_toss = random.choice([0, 1]) | |
- | |
- if coin_toss == 0: | |
- game = Game(player1=request.user, player2=bot) | |
- else: | |
- game = Game(player1=bot, player2=request.user) | |
- | |
+ game = Game(player1=request.user, player2=bot) | |
game.save() | |
- if coin_toss == 1: | |
- board = game.get_board() | |
- move, board = _create_computer_move(game, board) | |
- | |
- GameMove(game=game, player=bot, move=move).save() | |
- | |
return redirect('view_game', game_id=game.id) | |
@login_required |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment