예제 #1
0
    def test_pen_down_pen_up(self):
        self.begin_for_testing()
        forward(2)
        pen_up()
        forward(2)
        pen_down(block.GOLD_BLOCK)
        forward(2)

        self.assertEqual(
            {
                (100, 200, 300): "gold_block",
                (100, 200, 301): "gold_block",
                (100, 200, 302): "air",
                (100, 200, 303): "air",
                (100, 200, 304): "gold_block",
                (100, 200, 305): "gold_block",
                (100, 200, 306): ("piston", {
                    "facing": "south"
                })
            }, self.game.tiles)
예제 #2
0
    def test_show_that_pen_up_is_currently_destructive(self):

        # future: enhance the library so that this isn't destructive

        self.begin_for_testing()
        forward(3)

        self.begin_for_testing()
        pen_up()
        forward(1)

        self.assertEqual(
            {
                (100, 200, 300): "air",
                (100, 200, 301): ("piston", {
                    "facing": "south"
                }),  # the second turtle, overwriting the first path
                (100, 200, 302): "gold_block",
                (100, 200, 303): ("piston", {
                    "facing": "south"
                })  # the original turtle
            },
            self.game.tiles)