lab_tic_tac_toe/notes.md

2.2 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

ttt game is responsible for this. Looking at the definition is_over it checks to see if the board is full and also if either player 1 or 2 won based on the x's and o's. If this happens then the game is over.

Determining which actions are available at a particular state

Again, this is ttt game. Under the definition of get_actions it returns a list of indices of empty spaces. It checks the board and sees the spaces that are empty which then shows possible actions for the player.

Showing the board

ttt view is respoinsible for this one. it has a definition that says print_board. It divides the board into 3 rows of 3 and after each row it prints a divider.

Choosing which action to play on a turn

If we are playing with just humans which at this point we are, ttt human player is responsible. choose_action gets the list of available actions and then prompts the human to choose an action.

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 | | | |

board #1: position 0, to block the O's from getting 3 in a row. board #2: position 6, to block the O's from getting 3 in a row. board #3: position 0, because I do not need to block O's and this will allow me to have 2 places to get 3 in a row. board #4: position 4, because I will be tring to get 3 in a row.

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?

currently there is no reward for the inital state because all the spots are blank and nobody has won yet. We could also be at a this state after the game resets. Either a player will gain a point by winning or nobody gets a point if there is no winner.