SHARE
TWEET

plant

a guest Jun 15th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. write("Abstand zwischen den Baeumen: ")
  2. distanceBetween = read()
  3.  
  4. function turn180()
  5.   turtle.turnLeft()
  6.   turtle.turnLeft()
  7. end
  8.  
  9. function walk(distance)
  10.   for i=1, distance do
  11.     if turtle.detect() then
  12.       turtle.dig()
  13.     end
  14.     turtle.forward()
  15.   end
  16. end
  17.  
  18. function plant()
  19.   turn180()
  20.   turtle.select(1)
  21.   turtle.place()
  22.   turn180()
  23. end
  24.  
  25. write("Breite der Plantage(in Baeumen): ")
  26. plantationWidth = read()
  27.  
  28. write("Laenge der Plantage(in Baeumen): ")
  29. plantationLength = read()
  30.  
  31. nextTurn = 0 -- 0=right 1=left
  32. for i=1, plantationWidth do
  33.   for j=1, plantationLength-1 do
  34.     plant()
  35.     walk(distanceBetween)
  36.   end
  37.   plant()
  38.  
  39. if nextTurn == 0 then
  40.     turtle.turnRight()
  41.     walk(distanceBetween+1)
  42.      
  43.     turtle.turnRight()
  44.     walk(2)
  45.        
  46.     nextTurn = nextTurn + 1
  47.   elseif nextTurn == 1 then
  48.     turtle.turnLeft()
  49.     walk(distanceBetween+1)
  50.    
  51.     turtle.turnLeft()
  52.     walk(2)
  53.    
  54.     nextTurn = nextTurn - 1
  55.   end
  56. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top