View difference between Paste ID: FHSvRipY and xNgqQXWH
SHOW: | | - or go back to the newest paste.
1-
--- farming first just move
1+
--- Weed. Get rid of flowers for 5 of 7
2
3
local tArgs = { ... }
4
if #tArgs ~= 2 then
5-
	print( "Usage: farm <length> <width>" )
5+
	print( "Usage: weed <length> <width>" )
6
	return
7
end
8
9
local length  = tonumber( tArgs[1] )
10
local width  = tonumber( tArgs[2] )
11
local leftRight = 0
12
print ( "Farming"..length.."by "..width.."." )
13
14-
--- move in a zig zag fashion around the farm using nested loops
14+
--- move in a zig zag fashion around the weeds using nested loops
15
16
for w=1, width do
17
	for l=1, length do
18
		turtle.digDown()
19-
		turtle.select(16)
19+
20-
		turtle.placeDown()
20+
21-
		turtle.select(15)
21+
22-
		turtle.placeDown()
22+
23
		turtle.turnRight()
24
	else
25
		turtle.turnLeft()
26
	end
27
	
28
	turtle.forward()
29
	
30
	if(leftRight) == 0 then
31
		turtle.turnRight()
32
	else
33
		turtle.turnLeft()
34
	end
35
	
36
	if leftRight == 0 then
37
		leftRight = 1
38
	else
39
		leftRight = 0
40
	end
41
end
42
43
--- Get back to where you once belonged.
44
--- Need to code else for even numbered width later
45
	
46
	if width%2 ~= 0 then
47
		for n=1, length do
48
			turtle.forward()
49
		end
50
		
51
		turtle.turnRight()
52
		
53
		for n=1, width do
54
			turtle.forward()
55
		end
56
		turtle.turnRight()		
57
	end