♥ ’s turn. |
Criss-cross
Stacked-up
In-a-row
Tic-tac-toe
Toe-tac-tic
Tic-tac-tro
Tro-tac-tic
Tic-tac-T
|
Three of a kind horizontally, vertically, or diagonally wins.
♥
(X)
vs.
♠
(O)
|
A lot of computer scientists have worked on tic-tac-toe.
... When you make bad moves it gets very exciting. ... It was a good learning experience for me, writing my tic-tac-toe program.
—Donald Ervin Knuth in
“Writing a tic-tac-toe program”
|
Exercises
- Make this program set the tally values equal to zero when the
Reset
button is pressed. - What is Death Bingo?
- Why do you think a tie in tic-tac-toe is sometimes called a “Cat's Game”?
- What is the historical significance of the word
BINGO
in this context? - Implement Stacked-up, Criss-cross, Toe-tac-tic, Tic-tac-tro, and Tro-tac-tic. Create a unique symbol and color scheme for each game.
- This program can play against itself. It can also play against other compatible programs but not as quickly. What slows it down?
- This program isn't very smart. It usually (but not always) just guesses what move to play next.
- How could you make the program play tic-tac-toe like an expert?
- How could you make the program learn how to play a game.
- Improve the program so that it can play tic-tac-toe like an expert.
- Improve the program so that it can play any game like an expert.
- Improve the program so that it can learn how to play any game well.
- Tic-tac-T is a game designed for guessers.
To win, a player’s last move must be the middle cell of the top row resulting in two simultaneous bingos; otherwise, the players tie.
- Why is tic-tac-T not a good game for non-guessers?
- Assuming any available move is equally likely to be a guesser’s next move:
- Which player is more likely to win—the guesser that guesses first or second?
- What is the probability that a guesser will win? Use math to prove your answer.
- Use this program to simulate two guessers playing tic-tac-T. Simulate playing about 100, 1000, and 10,000 games at least once. Describe the simulations you performed. On average, how many times did a player win after about 100, 1000, and 10,000 games were played?
- Is the program provided a good simulation of two guessers playing tic-tac-T? Why or why not?