Checkers board structure
- by Ockonal
Hello guys, I'm implement checkers (game) board with python. Here is how I switch it to the need structure
[8][8] array:
_matrix = []
for i in xrange(8):
_matrix.append( [' '] * 8 )
for row in xrange(0, 8):
for col in xrange(0, 8):
if _darkQuad(row, col) == True:
_matrix[row][col] = '#'
else:
_matrix[row][col] = '-'
def _darkQuad(row, col):
return ((row%2) == (col%2))
def _printDebugBoard():
for row in xrange(0, 8):
for col in xrange(0, 8):
print _matrix[row][col]
print ''
This should do my board like:
# - # - # - # -
- # - # - # - #
...
But the result is:
- - - - - - - -
# # # # # # # #
- - - - - - - -
# # # # # # # #
- - - - - - - -
# # # # # # # #
- - - - - - - -
# # # # # # # #
What's wrong?