diff --git a/src/lib/turtle/Printer.hx b/src/lib/turtle/Printer.hx index 67f9289..fe47f8d 100644 --- a/src/lib/turtle/Printer.hx +++ b/src/lib/turtle/Printer.hx @@ -37,29 +37,32 @@ class Printer { // Turn left or right if (x % 2 == (inverse ? 1 : 0)) { - Turtle.turnRight(); + Turtle.turnLeft(); Turtle.forward(); - Turtle.turnRight(); + Turtle.turnLeft(); } else { - Turtle.turnLeft(); + Turtle.turnRight(); Turtle.forward(); - Turtle.turnLeft(); + Turtle.turnRight(); } } } public function execute() { + Turtle.up(); // We place the block below us so move up. + for (i in 0...structure.height()) { var layer = structure.getLayer(i); var inverse = i % 2 == 0; printLayer(layer, inverse); - // Don't go up on the last layer - if (i != structure.height() - 1) { - Turtle.up(); + // Don't go up or turn around on the last layer + if (i == structure.height() - 1) { + continue; } + Turtle.up(); Turtle.turnLeft(); Turtle.turnLeft(); }