From f3b154e429c3e10424044959072037d67f12abb0 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Sat, 3 May 2008 16:50:16 +0000 Subject: [PATCH] made compatible with python 2.4 --- src/tictactoe.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/tictactoe.py b/src/tictactoe.py index 083375cbe..9adf0da80 100644 --- a/src/tictactoe.py +++ b/src/tictactoe.py @@ -270,24 +270,32 @@ class TicTacToeBoard: for d in xrange(-strike, strike): # vertical check try: - tallyI = tallyI + 1 if self.board[r+d][c] == p else 0 + tallyI = tallyI + 1 + if self.board[r+d][c] != p: + tallyI = 0 except IndexError: pass # horizontal check try: - tally_ = tally_ + 1 if self.board[r][c+d] == p else 0 + tally_ = tally_ + 1 + if self.board[r][c+d] != p: + tally_ = 0 except IndexError: pass # diagonal checks try: - tallyL = tallyL + 1 if self.board[r+d][c+d] == p else 0 + tallyL = tallyL + 1 + if self.board[r+d][c+d] != p: + tallyL = 0 except IndexError: pass try: - tallyF = tallyF + 1 if self.board[r+d][c-d] == p else 0 + tallyF = tallyF + 1 + if self.board[r+d][c-d] != p: + tallyF = 0 except IndexError: pass