Advertisement
Blazuno

Untitled

Nov 4th, 2021 (edited)
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. print ("Length?")
  2. length = read ()
  3. print ("Width?")
  4. width = read ()
  5. turnLeft = false
  6. firstLine = true
  7.  
  8. function placeColumn(length, firstLine)
  9. local firstLine = firstLine
  10. print(firstline)
  11. if firstLine == true then
  12. for i=1,length do
  13. turtle.forward()
  14. turtle.placeDown()
  15. firstLine = false
  16. end
  17. else
  18. for i=1,length-1 do
  19. turtle.forward()
  20. turtle.placeDown()
  21. end
  22. end
  23. return firstLine
  24. end
  25.  
  26.  
  27.  
  28. function changeRow (turnLeft)
  29. local turnLeft = turnLeft
  30. print(turnLeft)
  31. if turnLeft == true then
  32. turtle.turnLeft()
  33. turtle.forward()
  34. turtle.turnLeft ()
  35. turtle.placeDown()
  36. turnLeft = false
  37. else
  38. turtle.turnRight()
  39. turtle.forward()
  40. turtle.turnRight ()
  41. turtle.placeDown()
  42. turnLeft = true
  43. end
  44. return turnLeft
  45. end
  46.  
  47. function placeLand(firstLine, length, turnLeft, width)
  48. local turnLeft
  49. for i=1,width do
  50. firstLine = placeColumn(length, firstLine)
  51. turnLeft = changeRow(turnLeft)
  52. end
  53. end
  54.  
  55. placeLand(firstLine, length, turnLeft, width)
  56.  
  57.  
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement