Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function farm (xLength, yLength)
- for x = 1, xLength, 1 do
- for y = 1, yLength, 1 do
- nineXNine(9,9)
- if y ~= yLength then
- goToNextJobY()
- end
- end
- if x ~= xLength then
- goToNextJobX(yLength)
- end
- end
- goHomeBig(xLength, yLength)
- end
- function goToNextJobX(yLength)
- turtle.turnRight()
- turtle.turnRight()
- goForward((yLength-1)*10)
- turtle.turnLeft()
- goForward(10)
- turtle.turnLeft()
- end
- function goToNextJobY()
- goForward(10)
- end
- function goHomeBig(xLength, yLength)
- turtle.turnRight()
- turtle.turnRight()
- goForward((yLength-1)*10)
- turtle.turnRight()
- goForward((xLength-1)*10)
- turtle.turnRight()
- end
- function nineXNine(targetLength, targetWidth)
- for width = 1, targetWidth, 1 do
- processLine(targetLength)
- if width == targetWidth then
- goHome(targetLength, targetWidth)
- elseif width%2 == 1 then
- turnRight()
- nextMoveIsRight = false
- else
- turnLeft()
- nextMoveIsRight = true
- end
- end
- end
- function processLine(targetLength)
- doWork()
- for length = 1, targetLength-1, 1 do
- turtle.forward()
- doWork()
- end
- end
- function doWork()
- selectSeeds()
- turtle.digDown()
- turtle.placeDown()
- end
- function selectSeeds()
- end
- function turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- end
- function turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- function turnAround()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function goForward(lengthToGo)
- for lengthWent = 1, lengthToGo, 1 do
- turtle.forward()
- end
- end
- function goHome(targetLength, targetWidth)
- if(targetWidth%2 == 1) then
- turnAround()
- goForward(targetLength-1)
- end
- turtle.turnRight()
- goForward(targetWidth-1)
- turtle.turnRight()
- end
- farm(3, 3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement