Exemple #1
0
    def __random_turn(self, state):
        self._say('..using a random guess with a game finish check.')

        empty_cells = self.__get_empty_cells(state)
        empty_ij = [(i, j) for i, j in np.nditer(empty_cells)]
        n = len(empty_ij)
        self.probs = np.zeros(state.shape)
        self.probs[empty_cells] = np.ones(n) / n

        for i, j in empty_ij:
            if utils.check_game_finish(self._update_state(state, i, j)):
                return i, j

        return random.choice(empty_ij)
Exemple #2
0
 def __is_win(self):
     return utils.check_game_finish(self.state)