From 567b4240c9216b8601eba578447b64ca67b06d4a Mon Sep 17 00:00:00 2001 From: brulijam Date: Fri, 31 May 2024 22:09:38 +0000 Subject: [PATCH] Update src/main/programs/turtle-roomCreator.lua --- src/main/programs/turtle-roomCreator.lua | 30 ++++++++++-------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/main/programs/turtle-roomCreator.lua b/src/main/programs/turtle-roomCreator.lua index 64af110..c644418 100644 --- a/src/main/programs/turtle-roomCreator.lua +++ b/src/main/programs/turtle-roomCreator.lua @@ -8,13 +8,18 @@ function excavate(depth, width, height) end -- Return to starting position of each row if w < width then - turtle.turnRight() - turtle.turnRight() - for d = 1, depth do - turtle.forward() + turtle.back(depth) + if w % 2 == 0 then + turtle.turnRight() + else + turtle.turnLeft() + end + turtle.forward() + if w % 2 == 0 then + turtle.turnRight() + else + turtle.turnLeft() end - turtle.turnRight() - turtle.turnRight() end end -- Go back to starting position of each layer and go up @@ -24,9 +29,7 @@ function excavate(depth, width, height) else turtle.turnRight() end - for w = 1, width - 1 do - turtle.forward() - end + turtle.back(width * depth) if h % 2 == 0 then turtle.turnLeft() else @@ -36,14 +39,7 @@ function excavate(depth, width, height) end end -- Return to the starting position - turtle.turnRight() - turtle.turnRight() - for h = 1, height - 1 do - turtle.down() - end - for w = 1, width - 1 do - turtle.forward() - end + turtle.back(height * width) turtle.turnRight() turtle.turnRight() end