2 points · by integraleq · 16y ago · 14 comments
git://github.com/inteq/Tic-Tac-Toe.git
I would like to issue a challenge to see if you can find a way to beat my tic-tac-toe program. I would definitely appreciate any feedback that will help me improve the brains of the cpu opponent. It is console driven and not pretty on the outside. Thanks!
After a few minutes trying different strategies:
If I win the coin toss I'm winning the game, every time. If I lose the coin toss it always ends in a draw.
Transcript (of 7 wins): http://dl.dropbox.com/u/142733/tictactoe.txt
Assuming I win the coin toss, I always choose a corner for my first move. The CPU should then take the center but it never does. This ensures I always win.
That said, great job so far. It's very close to perfect IMO.
Tic-tac-toe is basically a solved game which should make it easy to code.
$ python tictactoe.py
Enter H or T to decide if you will go first:h
Enter 'X' or 'O' to select the shape that you want to use:x
#### Initial Game Board State
[-1, -1, -1]
[-1, -1, -1]
[-1, -1, -1]
Enter the slot(location) where you want to place your shape:(available slots are :'0', '1', '2', '3', '4', '5', '6', '7', '8'):1
you have chosen to place an 'X' at 1.
#### Game Board State After Move By:player
[-1, 'X', -1]
[-1, -1, -1]
[-1, -1, -1]Check out http://en.wikipedia.org/wiki/Tic-tac-toe#Strategy for the description of the algorithm.
http://github.com/RichardBronosky/Tic-Tac-Toe
The forked network for this project is interesting. Is this for a class or something?