Beispiel #1
0
    def test_basic_position_for_minus_player(self):
        board_state = ((-1, 1, 0),
                       (1, -1, 1),
                       (1, 0, 0))

        result_min_max = min_max(self._game_spec, board_state, -1, 8)
        result_min_max_alpha_beta = min_max_alpha_beta(self._game_spec, board_state, -1, 8)

        self.assertEqual(result_min_max[1], (2, 2))
        self.assertEqual(result_min_max_alpha_beta[1], (2, 2))
Beispiel #2
0
    def test_basic_position(self):
        # the best move is 2, 2 forcing a win with pluses next move, both players should select it
        board_state = ((0, 0, 0),
                       (-1, -1, 1),
                       (1, 0, 0))

        result_min_max = min_max(self._game_spec, board_state, 1, 8)
        result_min_max_alpha_beta = min_max_alpha_beta(self._game_spec, board_state, 1, 8)

        self.assertEqual(result_min_max[1], (2, 2))
        self.assertEqual(result_min_max_alpha_beta[1], (2, 2))
Beispiel #3
0
 def min_max_move_func(board_state, side, depth):
     return min_max_alpha_beta(game_spec, board_state, side, depth)[1]
Beispiel #4
0
 def choose_move_func(board_state, side):
     return min_max_alpha_beta(game_spec, board_state, side, 6)[1]
Beispiel #5
0
def min_max_move_func(board_state, side):
    return min_max_alpha_beta(connect_4_game_spec, board_state, side, 3)[1]
def min_max_move_func(board_state, side):
    return min_max_alpha_beta(tic_tac_toe_5_4_game_spec, board_state, side,
                              3)[1]