View difference between Paste ID: V59nuUSp and YhZsaTAY
SHOW: | | - or go back to the newest paste.
1
-- G4NA2iFC
2
3
4-
local sizeX, sizeZ
4+
local sizeX
5-
local curX = 0, curZ = 0
5+
local sizeZ
6
local curX = 0
7
local curZ = 0
8
local slot = 1
9
10-
sizeZ = tonumber(sizeY)
10+
11
sizeX = tonumber(sizeX)
12
sizeZ = tonumber(sizeZ)
13
turtle.select(slot)
14
15
16
while true do
17
18
	while turtle.getItemCount(slot) == 0 do
19
		slot = slot % 16 + 1
20
		turtle.select(slot)
21
		sleep(0)
22
	end
23
	turtle.placeDown()
24
25
	if curX % 2 == 0 then
26
		if curZ == sizeZ - 1 then
27
			if curX == sizeX - 1 then
28
				return
29
			else
30
				turtle.turnRight()
31
				while not turtle.forward() do sleep(0) end
32
				turtle.turnRight()
33
				curX = curX + 1
34
			end
35-
			moveForward()				
35+
36
			curZ = curZ + 1
37
			while not turtle.forward() do sleep(0) end				
38
		end
39
	else --  curX % 2 ~= 0
40
			
41
		if curZ == 0 then
42
			if curX == sizeX - 1 then
43
				return
44
			else
45
				turtle.turnLeft()
46
				while not turtle.forward() do sleep(0) end
47
				turtle.turnLeft()
48
				curX = curX + 1
49
			end
50
		else
51
			curZ = curZ - 1
52
			while not turtle.forward() do sleep(0) end		
53
		end
54
55
	end
56
57
end