2.5 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
TTTGame. TTTGame.is_over checks to see if one of the following is true: 1) the board is full, 2) X is in a winning state, or 3) O is in a winning state.
Determining which actions are available at a particular state
TTTGame. TTTGame.get_actions checks each location on the board to see if it has been filled with an X or an O and returns the indices of each location that has neither.
Showing the board
TTTView. TTTView.print_board prints the state of the first three locations on the board, a divider, the state of the second three locations, another divider, and the state of the final three locations.
Choosing which action to play on a turn
TTTHumanPlayer or TTTComputerPlayer. TTTHumanPlayer.choose_action gets the possible actions that can be done and allows the user to pick one. TTTComputerPlayer chooses an action based on the strategy the computer is using.
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 | | | |
For the first one, I would put an X on the rightmost cell in the middle row. This would allow me to get a win. For the second one, I would put it in the same position as I would have in the first. This prevents O from winning on the next turn and puts me one turn away from winning, assuming the opponent doesn't block that route. For the third one, I would put it in the top left. This gives me two possible ways to win, and since the opponent only has one turn after mine before I get to go again, they cannot stop me from winning. For the last one, I would put it in the center. The opponent has to block by placing an O in the bottom right, and then I can put an X in the leftmost cell of the middle row. This leads to two possible ways to win again.
Initial game state
You can get the inital game state using game.get_initial_state(). What is the current and future reward for this state? What does this mean?
The current and future reward for this state is 1. This means the state favors player X assuming both players continue using the same look ahead strategy.