'get a copy of this Game state'

def copy(self):

    other = GameState(self.size, self.komi)
    other.board = self.board.copy()
    other.current_player = self.current_player
    other.ko = self.ko
    other.handicaps = list(self.handicaps)
    other.history = list(self.history)
    other.num_black_prisoners = self.num_black_prisoners
    other.num_white_prisoners = self.num_white_prisoners
    other.enforce_superko = self.enforce_superko
    other.current_hash = self.current_hash.copy()
    other.previous_hashes = self.previous_hashes.copy()
    def get_copy(s, set_copies={}):
        if (id(s) not in set_copies):
            set_copies[id(s)] = set(s)
        return set_copies[id(s)]
    for x in range(self.size):
        for y in range(self.size):
            other.group_sets[x][y] = get_copy(self.group_sets[x][y])
            other.liberty_sets[x][y] = get_copy(self.liberty_sets[x][y])
    other.liberty_counts = self.liberty_counts.copy()
    return other
