1.6 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
game.py is the file, the TTTgame class is responsible for checking whether the game is over.
Determining which actions are available at a particular state
TTTgame get_next_state() method is generating the list of actions based on the current state.
Showing the board
TTTview generates the formatting and it is called in get_action()
Choosing which action to play on a turn
TTTHuman player class, allows user to play actions base on list of availible actions.
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 | X | O |
---+---+--- ---+---+--- ---+---+--- ---+---+---
X | X | x | X |x X | O | O | x |
---+---+--- ---+---+--- ---+---+--- ---+---+---
| | | | O | | | |
For #1, choosing 6 wins the game For # 2 choosing 6 blocks 0 from winning. For #3 choosing 0 gives a win on the next turn regardless of where 0 blocks. For #4 choosing 4 means 0 has block, then if x chooses 6 then win in 2 or 3.
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?
I think 0 menas the game is fair, 1 is more x wins a negative is more o wins.