SHOW:
|
|
- or go back to the newest paste.
1 | width = tonumber(arg[1]) | |
2 | length = tonumber(arg[2]) | |
3 | - | current_x = 0 |
3 | + | height = tonumber(arg[3]) |
4 | - | current_y = 0 |
4 | + | |
5 | require("movement") | |
6 | - | function move_back_to ( y ) |
6 | + | |
7 | - | turtle.turnLeft() |
7 | + | -- mod three layers |
8 | - | turtle.turnLeft() |
8 | + | for z=0,(math.floor(height/3)-1) do |
9 | - | while current_y > y do |
9 | + | layer = 3*z+1 |
10 | - | turtle.dig() |
10 | + | move_z_to(layer) |
11 | - | turtle.forward() |
11 | + | for x=0,(width-1) do |
12 | - | current_y = current_y - 1 |
12 | + | if x % 2 == 0 then |
13 | for y=0,(length-1) do | |
14 | - | turtle.turnLeft() |
14 | + | move_to(x,y) |
15 | - | turtle.turnLeft() |
15 | + | turtle.digUp() |
16 | turtle.digDown() | |
17 | end | |
18 | - | function move_forward_to ( y ) |
18 | + | else |
19 | - | while current_y < y do |
19 | + | for y=0,(length-1) do |
20 | - | turtle.dig() |
20 | + | move_to(x,length-y-1) |
21 | - | turtle.forward() |
21 | + | turtle.digUp() |
22 | - | current_y = current_y + 1 |
22 | + | turtle.digDown() |
23 | - | end |
23 | + | end |
24 | end | |
25 | end | |
26 | - | function move_left_to ( x ) |
26 | + | |
27 | - | turtle.turnLeft() |
27 | + | |
28 | - | while current_x > x do |
28 | + | -- remainder term |
29 | - | turtle.dig() |
29 | + | for z=0,((height%3)-1) do |
30 | - | turtle.forward() |
30 | + | layer = 3*math.floor(height/3)+z |
31 | - | current_x = current_x - 1 |
31 | + | move_z_to(layer) |
32 | for x=0,(width-1) do | |
33 | - | turtle.turnRight() |
33 | + | if x % 2 == 0 then |
34 | for y=0,(length-1) do | |
35 | move_to(x,y) | |
36 | - | function move_right_to ( x ) |
36 | + | end |
37 | - | turtle.turnRight() |
37 | + | else |
38 | - | while current_x < x do |
38 | + | for y=0,(length-1) do |
39 | - | turtle.dig() |
39 | + | move_to(x,length-y-1) |
40 | - | turtle.forward() |
40 | + | end |
41 | - | current_x = current_x + 1 |
41 | + | end |
42 | end | |
43 | - | turtle.turnLeft() |
43 | + | |
44 | ||
45 | -- go back | |
46 | - | function move_to ( x , y ) |
46 | + | |
47 | move_z_to(0) | |
48 | - | if x > current_x then |
48 | + |