concept GameState in category deep learning
appears as: GameState

This is an excerpt from Manning's book Deep Learning and the Game of Go.
The GameState class includes all the stones of the board, as well as tracking whose turn it is and what the previous state was.
Now that you’ve implemented the rules for placing and capturing stones on a Board, let’s move on to playing games by capturing the current state of a game in a GameState class. Roughly speaking, game state knows about the board position, the next player, the previous game state, and the last move that has been played. What follows is just the beginning of the definition. You’ll add more functionality to GameState throughout this section. Again, you put this into goboard_slow.py.
Listing 3.10. Encoding game state for a game of Go
class GameState(): def __init__(self, board, next_player, previous, move): self.board = board self.next_player = next_player self.previous_state = previous self.last_move = move def apply_move(self, move): #1 if move.is_play: next_board = copy.deepcopy(self.board) next_board.place_stone(self.next_player, move.point) else: next_board = self.board return GameState(next_board, self.next_player.other, self, move) @classmethod def new_game(cls, board_size): if isinstance(board_size, int): board_size = (board_size, board_size) board = Board(*board_size) return GameState(board, Player.black, None, None)At this point, you can already decide when a game is over by adding the following code to your GameState class.