def test_minimax_scoring_when_leaf_is_not_reached_but_game_is_a_draw(self): mancala_mock = mock.Mock() mancala_mock.game_board_log = [[[2, 0, 3, 0, 0, 0], [1, 1, 1, 1, 1, 0], [15, 15]]] game_over = False player = Player(1, "minimax", mancala_mock) assert player.minimax_score(mancala_mock, 0, game_over) == 50
def test_minimax_scoring_when_leaf_is_not_reached_but_opposite_player_is_winning( self): mancala_mock = mock.Mock() mancala_mock.game_board_log = [[[0, 0, 3, 0, 0, 0], [0, 4, 5, 0, 8, 0], [23, 12]]] game_over = False player = Player(1, "minimax", mancala_mock) assert player.minimax_score(mancala_mock, 0, game_over) == 0
def test_minimax_scoring_when_leaf_is_reached_and_game_is_a_draw(self): mancala_mock = mock.Mock() mancala_mock.game_board_log = [[[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [28, 28]]] mancala_mock.winning_player = 0 game_over = True player = Player(1, "minimax", mancala_mock) assert player.minimax_score(mancala_mock, 0, game_over) == 50
def test_minimax_scoring_when_leaf_is_reached_and_opposite_player_wins( self): mancala_mock = mock.Mock() mancala_mock.game_board_log = [[[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [14, 6]]] mancala_mock.winning_player = 2 game_over = True player = Player(1, "minimax", mancala_mock) assert player.minimax_score(mancala_mock, 0, game_over) == 0
def test_minimax_scoring_with_depth_when_leaf_is_not_reached_but_current_player_is_winning( self): mancala_mock = mock.Mock() mancala_mock.game_board_log = [[[0, 4, 5, 0, 8, 0], [0, 0, 3, 0, 0, 0], [12, 23]]] depth = 3 game_over = False player = Player(1, "minimax", mancala_mock) assert player.minimax_score(mancala_mock, depth, game_over) == 100 - depth
def test_minimax_scoring_with_depth_when_leaf_is_reached_and_current_player_wins( self): mancala_mock = mock.Mock() mancala_mock.game_board_log = [[[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [14, 6]]] mancala_mock.winning_player = 1 depth = 8 game_over = True player = Player(1, "minimax", mancala_mock) assert player.minimax_score(mancala_mock, depth, game_over) == 100 - depth