[Tutor] tic tac toe data structure
Sat, 3 Jun 2000 22:46:55 -0500 (CDT)
The frequency of my posts to the list lately is directly proportional to my
enthusiasm with learning Python! I'm really looking forward to this summer
when I'll have some real concentrated time to learn. It's going to be lots
of Python and Zope for me until the kids come back to school in Sept.
Anyway, I was talking with a couple of our AP C++ students the other day,
and they showed me the tic tac toe program they'd written. I immediately
thought that it would be a fun little program to write in Python. I've been
pondering a bit and wonder if anyone could offer a couple suggestions.
1. The tic tac toe "board" is a 3x3 matrix. What would be the best data
structure for representing the board? I know that NumPy (I think that's the
name) does matrices, but that seems like overkill. Would a list of lists
e.g., board = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
2. I have yet to fully wrap my brain around OOP. Would this be a good chance
to attempt an OO approach?
3. Is there an accepted method of handling game-type logic? I've never
programmed a game before. What's the best way to organize the computer's
Tim Wilson | Visit Sibley online: | Check out:
Henry Sibley HS | http://www.isd197.k12.mn.us/ | http://www.zope.org/
W. St. Paul, MN | | http://slashdot.org/
email@example.com | <dtml-var pithy_quote> | http://linux.com/