def test_choose_square_from_full(): engine = SuperTicTacToe() opponent = Monkey() moves = build_move_list([ (0, 1), (1, 0), (0, 2), (2, 0), (0, 3), (3, 0), (0, 4), (4, 0), (0, 5), (5, 0), (0, 6), (6, 0), (0, 7), (7, 0), (0, 8), (8, 0), (0, 0)]) [engine.move(p, b, sq) for p, b, sq in moves] opponent.choose_square(engine, 0)
def test_choose_square(): engine = SuperTicTacToe() opponent = Monkey() for x in range(1000): assert_true(opponent.choose_square(engine, 1) in [0,1,2,3,4,5,6,7,8]) moves = build_move_list([ (0, 0), (0, 3), (3, 6), (6, 3), (3, 5), (5, 1), (1, 3), (3, 4), (4, 2), (2, 5), (5, 2), (2, 6), (6, 4)]) for player, board, square in moves: engine.move(player, board, square) possibilities = [i for i, sq in enumerate( engine.squares[square].squares) if sq is None] for x in range(1000): assert_true(opponent.choose_square(engine, square) in possibilities)