Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Spacing between sapplings?")
- spacing = tonumber(read())
- print("Enter grid size")
- gridSize = tonumber(read())
- slot = 1
- direction = 0
- placed = 0
- switchNum = 64
- function plant()
- down = true
- ups = -1
- while down == true do
- down = turtle.down()
- ups = ups+1
- end
- turtle.up()
- turtle.select(slot)
- if placed > switchNum then
- slot = slot+1
- turtle.select(slot)
- switchNum = placed+63
- end
- turtle.placeDown()
- placed = placed+1
- while ups > 1 do
- turtle.up()
- ups = ups-1
- end
- end
- function line()
- lineLength = gridSize
- while lineLength > 0 do
- moveX = spacing
- while moveX > 0 do
- turtle.forward()
- moveX = moveX-1
- end
- plant()
- lineLength = lineLength-1
- end
- end
- function level()
- desiredLines = gridSize
- while desiredLines > 0 do
- if direction == 0 then
- plant()
- line()
- moveX = spacing
- turtle.turnRight()
- while moveX > 0 do
- turtle.forward()
- moveX = moveX-1
- end
- turtle.turnRight()
- direction = 1
- desiredLines = desiredLines-1
- end
- if direction == 1 then
- plant()
- line()
- moveX = spacing
- turtle.turnLeft()
- while moveX > 0 do
- turtle.forward()
- moveX = moveX-1
- end
- turtle.turnLeft()
- direction = 0
- desiredLines = desiredLines-1
- end
- end
- end
- level()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement