Example #1
0
def test_heuristic_3_complex():
    game = Game()
    board = Board()
    game.set_heuristic_score = check_potential_win
    board.board = [['?', '?', '?', '?', '?', '?', '?'],
                   ['?', '?', '?', '?', '?', '?', '?'],
                   ['?', '?', '1', '?', '1', '?', '?'],
                   ['?', '?', '?', '?', '?', '?', '?'],
                   ['?', '?', '1', '?', '1', '1', '?'],
                   ['?', '1', '1', '?', '1', '?', '?']]
    assert game.heuristic_score(board) == 5
Example #2
0
def test_heuristic_2_w():
    game = Game()
    board = Board()
    game.set_heuristic_score = check_potential_win_two_weighted
    board.board = [['?', '?', '?', '?', '?', '?', '?'],
                   ['?', '?', '?', '?', '?', '?', '?'],
                   ['?', '?', '?', '?', '?', '?', '?'],
                   ['?', '?', '?', '?', '2', '?', '?'],
                   ['?', '?', '2', '?', '2', '2', '?'],
                   ['?', '2', '2', '?', '2', '2', '2']]
    assert game.heuristic_score(board) == -29
Example #3
0
def test_heuristic_is_diagonal_getting_double_counted_2():
    game = Game()
    board = Board()
    game.set_heuristic_score = check_potential_win
    board.board = [['?', '?', '?', '?', '?', '?', '1'],
                   ['?', '?', '?', '?', '?', '1', '?'],
                   ['?', '?', '?', '?', '1', '?', '?'],
                   ['?', '?', '?', '?', '?', '?', '?'],
                   ['?', '?', '?', '?', '?', '?', '?'],
                   ['?', '?', '?', '?', '?', '?', '?']]
    assert game.heuristic_score(board) == 1