示例#1
0
def test_second_turn_corner_opening(player_mark):
    other_mark = Game.FIRST_PLAYER_MARK
    ai = AI(player_mark)
    board = Board()
    board._rows = [[other_mark, ' ', ' '], [' ', ' ', ' '], [' ', ' ', ' ']]
    assert ai._second_turn(board.representation()) == (1, 1)

    board._rows = [[' ', ' ', other_mark], [' ', ' ', ' '], [' ', ' ', ' ']]
    assert ai._second_turn(board.representation()) == (1, 1)

    board._rows = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', other_mark]]
    assert ai._second_turn(board.representation()) == (1, 1)

    board._rows = [[' ', ' ', ' '], [' ', ' ', ' '], [other_mark, ' ', ' ']]
    assert ai._second_turn(board.representation()) == (1, 1)
示例#2
0
def test_second_turn_center_opening(player_mark):
    other_mark = Game.FIRST_PLAYER_MARK
    ai = AI(player_mark)
    board = Board()
    board._rows = [[' ', ' ', ' '], [' ', other_mark, ' '], [' ', ' ', ' ']]
    for _ in range(100):
        assert ai._second_turn(board.representation()) in product((0, 2),
                                                                  (0, 2))