# 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 Responsible class: `TTTGame`, method `is_over`. Explanation: `TTTGame.is_over` determines whether play should stop. It returns True when the board is full or when either player has three in a row using `check_winner`. The game logic and win/draw detection are implemented on the `TTTGame` class. ### Determining which actions are available at a particular state Responsible class: `TTTGame`, method `get_actions`. Explanation: `TTTGame.get_actions` inspects `state["board"]` and returns a list of indices for empty spaces (those containing `'-'`). The game class encapsulates available-move generation for the current board state. ### Showing the board Responsible class: `TTTView`, primarily `print_board`, `format_row`, and `format_value`. Explanation: `TTTView` handles all screen display. `print_board(state)` arranges rows and separators, `format_row` formats a single row, and `format_value` prints an `X`, `O`, or the index for an empty spot. The view is responsible for how the board is presented. ### Choosing which action to play on a turn Responsible classes: `TTTHumanPlayer` and `TTTComputerPlayer`. Explanation: Players decide moves. `TTTHumanPlayer.choose_action(state)` prompts the user and returns the selected index. `TTTComputerPlayer.choose_action(state)` to use a strategy (here `RandomStrategy`) and returns the chosen move. So the player classes and any strategy objects they use are responsible for selecting the action to play on a turn. ## 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 | | | | ### 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?