def test_solve_rotated_one_tile_problem(): tile = TETROMINOS["T"] tileset = many(tile) board = Irregular([(1, 0), (0, 1), (1, 1), (1, 2)]) problem = board.tile_with_set(tileset) solution = problem.solve() assert solution is not None
def test_solve_one_tile_problem(): tile = TETROMINOS["T"] tileset = many(tile) board = Irregular(tile) problem = board.tile_with_set(tileset) solution = problem.solve() assert solution is not None
def test_solve_arbitrary_two_tile_problem(tile): tile = TETROMINOS["T"] tileset = many(tile) board = Irregular(tile + [(x, y + 100) for x, y in tile]) problem = board.tile_with_set(tileset) solution = problem.solve() assert solution is not None
def test_one_tile_problem_is_correct_with_heuristics(): tile = TETROMINOS["T"] tileset = many(tile) board = Irregular(tile) problem = board.tile_with_set(tileset).with_heuristics() problem.make_problem() a = problem.array assert a.shape == (1, 4)
def test_rotated_one_tile_problem_is_correct(): tile = TETROMINOS["T"] tileset = many(tile) board = Irregular([(1, 0), (0, 1), (1, 1), (1, 2)]) problem = board.tile_with_set(tileset) problem.make_problem() a = problem.array assert a.shape == (1, 4)
def test_not_too_many_tile_positions(tile, x, y): assume(x * y % len(tile) == 0) tileset = many(tile) rectangle = Rectangle(x, y) board = Irregular(set(rectangle.squares + tile)) assume(len(board.squares) % len(tile) == 0) expected_size = x * y max_positions = 4 * expected_size problem = board.tile_with_set(tileset) problem.make_problem() a = problem.array n_positions, size = a.shape assert size == expected_size assert n_positions <= max_positions