Advertisement
Paragorn

Advent 07

Dec 7th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | None | 0 0
  1. shell.run("clear")
  2. -- Variablen Vergeben
  3. Richtung = "Hoch"
  4. print("Bitte nenne mir Hoehe und Breite!")
  5. print("Vorsicht ich laufe nach rechts.")
  6. print(" ")
  7. write("Farm-Hoehe betraegt: ")
  8. Lang = io.read() - 1
  9. Lang2 = Lang + 1
  10. term.setCursorPos(1,5)
  11. write("Farm-Breite ist: ")
  12. Breit = io.read()
  13. print(" ")
  14. print("Ich arbeite in 5 Sekunden!")
  15. sleep(5)
  16. -- Funktionen
  17. function Wechsel()
  18.  if Richtung == "Hoch" then
  19.   turtle.turnRight()
  20.   turtle.forward()
  21.   turtle.turnLeft()
  22.   Richtung = "Runter"
  23.  elseif Richtung == "Runter" then
  24.   turtle.turnRight()
  25.   turtle.forward()
  26.   turtle.turnLeft()
  27.   Richtung = "Hoch"
  28.  end
  29. end
  30.  
  31. -- Programm
  32. turtle.select(1)
  33. for i = 1,Breit do
  34. print("Ich bin in Reihe: "..i)
  35.  if Richtung == "Hoch" then
  36.   turtle.dig()
  37.   turtle.place()
  38.   for i = 1,Lang do
  39.    turtle.up()
  40.    turtle.dig()
  41.    turtle.place()
  42.   end
  43.   Wechsel()
  44.  elseif Richtung == "Runter" then
  45.   turtle.dig()
  46.   turtle.place()
  47.   for i = 1,Lang do
  48.    turtle.down()
  49.    turtle.dig()
  50.    turtle.place()
  51.   end
  52.   Wechsel()
  53.  end
  54. end
  55.  
  56. if Richtung == "Runter" then
  57.  for i = 1,Lang do
  58.   turtle.down()
  59.  end
  60. end
  61.  
  62. print("Ich laufe Nachhause")
  63. turtle.turnLeft()
  64. for i = 1,Breit do
  65.  turtle.forward()
  66. end
  67. turtle.turnRight()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement