Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- Weed. Get rid of flowers for 5 of 7
- local tArgs = { ... }
- if #tArgs ~= 2 then
- print( "Usage: weed <length> <width>" )
- return
- end
- local length = tonumber( tArgs[1] )
- local width = tonumber( tArgs[2] )
- local leftRight = 0
- print ( "Farming"..length.."by "..width.."." )
- --- move in a zig zag fashion around the weeds using nested loops
- for w=1, width do
- for l=1, length do
- turtle.digDown()
- turtle.forward()
- end
- if leftRight == 0 then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- turtle.forward()
- if(leftRight) == 0 then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- if leftRight == 0 then
- leftRight = 1
- else
- leftRight = 0
- end
- end
- --- Get back to where you once belonged.
- --- Need to code else for even numbered width later
- if width%2 ~= 0 then
- for n=1, length do
- turtle.forward()
- end
- turtle.turnRight()
- for n=1, width do
- turtle.forward()
- end
- turtle.turnRight()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement