WM. wrote:
I am using Python 26 on a Windows XP
OK, here are the three lines mentioned following the error message.
Traceback (most recent call last):
File "C:\Python26\TicTacToeD.py", line 165, in <module>
main()
File "C:\Python26\TicTacToeD.py", line 150, in main
DisplayBoard(board)
File "C:\Python26\TicTacToeD.py", line 68, in DisplayBoard
print "\n\t", board[1], "|", board[2], "|", board[3]
TypeError: 'function' object is unsubscriptable
line 165 = main()
def main():
DisplayInstruct()
puter, human = Pieces()
turn = X
board = NewBoard
DisplayBoard(board)
line 150 = DisplayBoard(board)
line 69
def DisplayBoard(board):
"""Display board on screen."""
print "\n\t", board[1], "|", board[2], "|", board[3]
print "\t", "______"
print "\t", board[4], "|", board[5], "|", board[6]
print "\t", "______"
print "\t", board[7], "|", board[8], "|", board[9], "\n"
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor
so you have this
def NewBoard():
"""Create new game board."""
board = []
for square in range(NUM_SQUARES):
board.append(EMPTY)
return board
for your DisplayBoard I have this;
def new_board():
"""Create new game board."""
board = []
for square in range(NUM_SQUARES):
board.append(EMPTY)
return board
def display_board(board):
"""Display game board on screen."""
print "\n\t", board[0], "|", board[1], "|", board[2]
print "\t", "---------"
print "\t", board[3], "|", board[4], "|", board[5]
print "\t", "---------"
print "\t", board[6], "|", board[7], "|", board[8], "\n"
--
Powered by Gentoo GNU/LINUX
http://www.linuxcrazy.com
pgp.mit.edu
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor