1.9 KiB
Tic Tac Toe notes
Checkpoint 1 Notes
Which class is responsible for each of the following behaviors? For each, explain how the behavior is accomplished.
Checking to see whether the game is over
The game inspects the board for winning patterns (three identical non-empty marks in any row, column, or diagonal). It also checks whether there are any empty squares left — if there are none and there is no winner the result is a draw.
Determining which actions are available at a particular state
The function scans the board representation and returns the indices or coordinate pairs for empty cells. If the state is terminal it returns an empty list.
Showing the board
The view module provides formatting and printing utilities that convert the internal state into a nice 3x3 grid
Choosing which action to play on a turn
Scans the board for who went last; giving the next placement opportunity to the person who went before the move that was just played
Checkpoint 2 Notes
TTT Strategy
For each of the following board states, if you are playing as X and it's your turn, which action would you take? Why?
| O | O | | O | X | X | O |
---+---+--- ---+---+--- ---+---+--- ---+---+---
X | X | | X | X | O | O | |
---+---+--- ---+---+--- ---+---+--- ---+---+---
| | | | O | | | |
-
Place X at the middle right to win
-
Place the X in the middle right again to block my opponent from winning
-
Place X at the top left of the board to gain an opportunity to win on the next turn
-
Place X in the middle for possible opportunities in the future and to block the opponents O in the top middle from being of any use.
Initial game state
You can get the initial game state using game.get_initial_state().
Current reward is 0 so neither player has an advantage at the start.