HAPPY MONDAY!!!
Today's Problem of the Day is to implement an automated version of our favorite childhood game, tic-tac-toe. Your program can assign random moves for X and O or you can implement some AI to favor one over the other. When someone wins print out the board and who won. If the game is going to be a draw print out the board and print out that it will be a draw.
Based on these conditions your program should never print out a full board unless the final move is a game winning move. If a game is going to end in a draw just print out the board. The program should run until X or O has won 10 games.
Also don't forget, if you have any fun problems you'd like to see on here then please submit them at http://www.problemotd.com/suggest/
Comments:
gulliverbear - 10 years, 8 months ago
random choice moves
reply permalink
Max Burstein - 10 years, 8 months ago
Nicely done!
reply permalink
Pearce Keesling - 10 years, 8 months ago
I wrote a Tic Tac Toe AI recently, if someone wants to see a (probably bad) example of how to do TicTacToe AI feel free to look. https://github.com/h3ckboy/TicTacToe
reply permalink
Hueho - 10 years, 8 months ago
Mammoth of a program, but it's because it uses minimax decision trees to play, plus a lil bit of randomness.
I think they probably work, at least the program doesn't crash and output correct games.
For anybody wanting to run it: - RAM heavy, be careful. - I used RubiniusX to speed up a bit
reply permalink