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