-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsow
More file actions
83 lines (72 loc) · 1.17 KB
/
sow
File metadata and controls
83 lines (72 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
if not turtle then
print("Only turtle can run this program")
return
end
local soltNum = 1
function sowPlant()
while turtle.getItemCount(soltNum) == 0 and soltNum <= 16 do
soltNum = soltNum + 1
end
if soltNum > 16 then
return false
end
turtle.select(soltNum)
turtle.placeDown()
end
function forward()
while not turtle.forward() do
turtle.attack()
end
end
function up()
while not turtle.up() do
turtle.attackUp()
end
end
function down()
while not turtle.down() do
turtle.attackDown()
end
end
forward()
forward()
up()
turtle.turnLeft()
forward()
forward()
turtle.turnLeft()
forward()
turtle.turnRight()
turtle.select(soltNum)
sowPlant()
for j = 1, 9 do
for i = 1, 8 do
forward()
sowPlant()
end
if j % 2 == 1 and j ~= 9 then
turtle.turnRight()
forward()
sowPlant()
turtle.turnRight()
elseif j % 2 == 0 then
turtle.turnLeft()
forward()
sowPlant()
turtle.turnLeft()
end
end
turtle.turnLeft()
for i = 1, 7 do
forward()
end
turtle.turnLeft()
for i = 1, 10 do
forward()
end
down()
turtle.turnRight()
forward()
forward()
turtle.turnRight()
turtle.turnRight()