made compatible with python 2.4
This commit is contained in:
parent
99f2997d27
commit
f3b154e429
|
@ -270,24 +270,32 @@ class TicTacToeBoard:
|
||||||
for d in xrange(-strike, strike):
|
for d in xrange(-strike, strike):
|
||||||
# vertical check
|
# vertical check
|
||||||
try:
|
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:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# horizontal check
|
# horizontal check
|
||||||
try:
|
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:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# diagonal checks
|
# diagonal checks
|
||||||
try:
|
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:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
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:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue