SHOW:
|
|
- or go back to the newest paste.
1 | x = 0 | |
2 | t = 0 | |
3 | cyclet = 0 | |
4 | cycles = 0 | |
5 | print("x is "..x) | |
6 | print("t is "..t) | |
7 | print("cyclet is "..cyclet) | |
8 | print("cycles are "..cycles) | |
9 | ||
10 | function main() | |
11 | if x < 8 then | |
12 | while x < 8 do | |
13 | turtle.dig() | |
14 | turtle.forward() | |
15 | x = x + 1 | |
16 | end | |
17 | end | |
18 | end | |
19 | ||
20 | function cycleCounter() | |
21 | if x == 8 then | |
22 | cycles = cycles + 1 | |
23 | print(cycles) | |
24 | end | |
25 | end | |
26 | ||
27 | function turn() | |
28 | if x == 8 and cyclet == 0 and t == 0 then | |
29 | while x == 8 do | |
30 | - | if t == 0 then |
30 | + | |
31 | turtle.turnRight() | |
32 | turtle.dig() | |
33 | turtle.forward() | |
34 | turtle.turnRight() | |
35 | x = 0 | |
36 | t = 1 | |
37 | end | |
38 | end | |
39 | end | |
40 | end | |
41 | end | |
42 | ||
43 | function turnTwo() | |
44 | if x == 8 and cyclet == 0 and t == 1 then | |
45 | while x == 8 do | |
46 | print("turn two") | |
47 | turtle.turnLeft() | |
48 | - | if t == 1 then |
48 | + | |
49 | turtle.forward() | |
50 | turtle.turnLeft() | |
51 | x = 0 | |
52 | t = 0 | |
53 | end | |
54 | end | |
55 | end | |
56 | end | |
57 | end | |
58 | ||
59 | function endCycle() | |
60 | if cycles == 8 then | |
61 | turtle.digDown() | |
62 | turtle.down() | |
63 | turtle.turnLeft() | |
64 | turtle.turnLeft() | |
65 | cycles = 0 | |
66 | t = 0 | |
67 | x = 0 | |
68 | print("new cycle") | |
69 | if cyclet == 0 then | |
70 | cyclet = 1 | |
71 | else | |
72 | cyclet = 0 | |
73 | end | |
74 | end | |
75 | end | |
76 | ||
77 | function turnThree() | |
78 | if x == 8 and cyclet == 1 and t == 0 then | |
79 | while x == 8 do | |
80 | print("turn three") | |
81 | turtle.turnLeft() | |
82 | turtle.dig() | |
83 | - | if cyclet == 1 then |
83 | + | |
84 | - | if t == 0 then |
84 | + | |
85 | x = 0 | |
86 | t = 1 | |
87 | end | |
88 | end | |
89 | end | |
90 | end | |
91 | end | |
92 | ||
93 | function turnFour() | |
94 | if x == 8 then and cyclet == 1 and t == 1 then | |
95 | while x == 8 do | |
96 | print("turn four") | |
97 | turtle.turnRight() | |
98 | turtle.dig() | |
99 | turtle.forward() | |
100 | turtle.turnRight() | |
101 | - | if cyclet == 1 then |
101 | + | |
102 | - | if t == 1 then |
102 | + | |
103 | end | |
104 | end | |
105 | end | |
106 | end | |
107 | end | |
108 | ||
109 | while true do | |
110 | main() | |
111 | cycleCounter() | |
112 | endCycle() | |
113 | turn() | |
114 | turnTwo() | |
115 | turnThree() | |
116 | turnFour() | |
117 | end |