|
1 | 1 | from permuta import Perm |
2 | 2 | from permuta.misc import DIR_EAST, DIR_NORTH, DIR_SOUTH, DIR_WEST, DIRS |
3 | 3 | from tilescopethree.strategies import point_placement, requirement_placement |
4 | | -from tilescopethree.strategies.equivalence_strategies.point_placements import \ |
5 | | - place_point_of_requirement |
6 | 4 | from tilings import Obstruction, Requirement, Tiling |
7 | 5 |
|
8 | 6 | pytest_plugins = [ |
|
14 | 12 |
|
15 | 13 |
|
16 | 14 | def test_point_placement(diverse_tiling, no_point_tiling): |
| 15 | + print(no_point_tiling) |
| 16 | + print(no_point_tiling.positive_cells) |
17 | 17 | strats = list(point_placement(diverse_tiling)) |
18 | | - assert len(strats) == 3 * len(DIRS) |
19 | | - |
| 18 | + assert len(strats) == 5 * len(DIRS) |
20 | 19 | strats = list(requirement_placement(no_point_tiling)) |
21 | | - assert len(strats) == 3 * len(DIRS) |
| 20 | + assert len(strats) == 9 * len(DIRS) |
22 | 21 | strats = list(point_placement(no_point_tiling)) |
23 | | - assert len(strats) == 0 |
| 22 | + assert len(strats) == 3 * len(DIRS) |
24 | 23 |
|
25 | 24 |
|
26 | 25 | def test_place_point_of_requirement_point_only(diverse_tiling): |
27 | | - tiling = place_point_of_requirement(diverse_tiling, 0, 0, DIR_WEST) |
| 26 | + tiling = diverse_tiling.place_point_of_gridded_permutation( |
| 27 | + diverse_tiling.requirements[0][0], 0, DIR_WEST) |
28 | 28 | assert tiling == Tiling( |
29 | 29 | obstructions=[ |
30 | 30 | Obstruction(Perm((0,)), [(1, 0)]), |
@@ -53,13 +53,43 @@ def test_place_point_of_requirement_point_only(diverse_tiling): |
53 | 53 | Requirement(Perm((0, 2, 1)), [(0, 3), (0, 4), (1, 4)]), |
54 | 54 | Requirement(Perm((0, 2, 1)), [(0, 3), (0, 4), (3, 4)])]]) |
55 | 55 |
|
56 | | - assert tiling == place_point_of_requirement(diverse_tiling, 0, 0, DIR_EAST) |
57 | | - assert tiling == place_point_of_requirement( |
58 | | - diverse_tiling, 0, 0, DIR_NORTH) |
59 | | - assert tiling == place_point_of_requirement( |
60 | | - diverse_tiling, 0, 0, DIR_SOUTH) |
| 56 | + assert tiling == diverse_tiling.place_point_of_gridded_permutation( |
| 57 | + diverse_tiling.requirements[0][0], 0, DIR_EAST) |
| 58 | + assert tiling == diverse_tiling.place_point_of_gridded_permutation( |
| 59 | + diverse_tiling.requirements[0][0], 0, DIR_NORTH) |
| 60 | + assert tiling == diverse_tiling.place_point_of_gridded_permutation( |
| 61 | + diverse_tiling.requirements[0][0], 0, DIR_SOUTH) |
61 | 62 |
|
62 | | - tiling = place_point_of_requirement(diverse_tiling, 1, 0, DIR_WEST) |
| 63 | + print(Tiling( |
| 64 | + obstructions=[ |
| 65 | + Obstruction(Perm((0,)), [(2, 0)]), |
| 66 | + Obstruction(Perm((0,)), [(2, 2)]), |
| 67 | + Obstruction(Perm((0, 1)), [(1, 0), (1, 0)]), |
| 68 | + Obstruction(Perm((0, 1)), [(1, 0), (1, 2)]), |
| 69 | + Obstruction(Perm((0, 1)), [(1, 2), (1, 2)]), |
| 70 | + Obstruction(Perm((0, 1)), [(3, 1), (3, 1)]), |
| 71 | + Obstruction(Perm((0, 1)), [(2, 3), (2, 3)]), |
| 72 | + Obstruction(Perm((0, 1)), [(2, 3), (4, 3)]), |
| 73 | + Obstruction(Perm((0, 1)), [(4, 3), (4, 3)]), |
| 74 | + Obstruction(Perm((1, 0)), [(1, 0), (1, 0)]), |
| 75 | + Obstruction(Perm((1, 0)), [(1, 2), (1, 0)]), |
| 76 | + Obstruction(Perm((1, 0)), [(1, 2), (1, 2)]), |
| 77 | + Obstruction(Perm((1, 0)), [(3, 1), (3, 1)]), |
| 78 | + Obstruction(Perm((1, 0)), [(2, 3), (2, 3)]), |
| 79 | + Obstruction(Perm((1, 0)), [(2, 3), (4, 3)]), |
| 80 | + Obstruction(Perm((1, 0)), [(4, 3), (4, 3)]), |
| 81 | + Obstruction(Perm((0, 1, 2)), [(0, 0), (1, 3), (1, 3)]), |
| 82 | + Obstruction(Perm((0, 2, 3, 1)), [(0, 2), (1, 3), (1, 3), (4, 2)])], |
| 83 | + requirements=[ |
| 84 | + [Requirement(Perm((0,)), [(3, 1)])], |
| 85 | + [Requirement(Perm((0,)), [(1, 0)]), |
| 86 | + Requirement(Perm((0,)), [(1, 2)])], |
| 87 | + [Requirement(Perm((0,)), [(2, 3)]), |
| 88 | + Requirement(Perm((0,)), [(4, 3)])], |
| 89 | + [Requirement(Perm((1, 0)), [(0, 4), (0, 3)]), |
| 90 | + Requirement(Perm((0, 2, 1)), [(0, 3), (0, 4), (1, 4)])]])) |
| 91 | + tiling = diverse_tiling.place_point_of_gridded_permutation( |
| 92 | + diverse_tiling.requirements[1][0], 0, DIR_WEST) |
63 | 93 | assert tiling == Tiling( |
64 | 94 | obstructions=[ |
65 | 95 | Obstruction(Perm((0,)), [(2, 0)]), |
@@ -90,14 +120,16 @@ def test_place_point_of_requirement_point_only(diverse_tiling): |
90 | 120 | Requirement(Perm((0, 2, 1)), [(0, 3), (0, 4), (1, 4)])]]) |
91 | 121 |
|
92 | 122 | tiling = Tiling(requirements=[[Requirement(Perm((0,)), [(0, 0)])]]) |
93 | | - assert place_point_of_requirement(tiling, 0, 0, DIR_SOUTH) == Tiling( |
| 123 | + assert tiling.place_point_of_gridded_permutation(tiling.requirements[0][0], |
| 124 | + 0, DIR_SOUTH) == Tiling( |
94 | 125 | obstructions=[Obstruction(Perm((0, 1)), [(0, 0), (0, 0)]), |
95 | 126 | Obstruction(Perm((1, 0)), [(0, 0), (0, 0)])], |
96 | 127 | requirements=[[Requirement(Perm((0,)), [(0, 0)])]]) |
97 | 128 |
|
98 | 129 |
|
99 | 130 | def test_place_point_of_requirement(no_point_tiling): |
100 | | - tiling = place_point_of_requirement(no_point_tiling, 2, 1, DIR_WEST) |
| 131 | + tiling = no_point_tiling.place_point_of_gridded_permutation( |
| 132 | + no_point_tiling.requirements[2][0], 1, DIR_WEST) |
101 | 133 | tiling2 = Tiling( |
102 | 134 | obstructions=[ |
103 | 135 | Obstruction(Perm((0, 1)), [(0, 1), (1, 3)]), |
|
0 commit comments