Advertisement
Paragorn

Advent 08

Dec 8th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. shell.run("clear")
  2. print("Wie oft soll ich Blumen sammeln?")
  3. write("Nenne eine Zahl: ")
  4. Anzahl = io.read() + 0
  5. Treibstoff = turtle.getFuelLevel() + 0
  6.  
  7. -- Check ob genug Treibstoff da ist --
  8. Gesamtkosten = 26 * Anzahl
  9. if Gesamtkosten >= Treibstoff then
  10.  print("Dafuer reicht mein Treibstoff nicht.")
  11.  return
  12. end
  13.  
  14. -- Funktion --
  15. function Vor( ZAHL , RICHTUNG )
  16.  for i = 1,ZAHL do
  17.   turtle.dig()
  18.   turtle.forward()
  19.  end
  20.  if RICHTUNG == "L" then
  21.   turtle.turnLeft()
  22.  elseif RICHTUNG == "R" then
  23.   turtle.turnRight()
  24.  end
  25. end
  26.  
  27. -- Basisprogramm --
  28. for i =1,Anzahl do
  29.  turtle.placeDown()
  30.  turtle.digDown()
  31.  turtle.down()
  32.  Vor(2,"L")
  33.  Vor(2,"L")
  34.  Vor(4,"L")
  35.  Vor(4,"L")
  36.  Vor(4,"L")
  37.  Vor(1,"L")
  38.  Vor(3,"R")
  39.  Vor(2,"R")
  40.  Vor(1)
  41.  turtle.dig()
  42.  turtle.turnRight()
  43.  Vor(1)
  44.  turtle.up()
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement