Ejemplo n.º 1
0
    def test_find_orientation(self, encoding, inverse):
        characters = [
            "..OO.##...",
            ".##O#...#.",
            "...#..OO..",
            "OO...OO.##",
            ".OOO##O#..",
            "...O..#..O",
            "..........",
        ]
        patch = Patch.from_chars(characters)
        patch.apply(**encoding)

        if inverse is None:
            encoding["rotations"] = -encoding["rotations"] % 4
            inverse = encoding

        # Only check for the more complex pattern to avoid multiple matches
        pattern = ["....##", "##.#..", "..#..."]
        assert PatchMap.find_orientation(patch, pattern) == inverse
Ejemplo n.º 2
0
 def test_from_chars(self, basic_patch):
     patch = Patch.from_chars(basic_patch.characters, basic_patch.tile)
     assert patch is not basic_patch
     assert patch.tile == basic_patch.tile
     assert patch.characters == basic_patch.characters