thaile4ever

plateform

Dec 17th, 2012
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. local tArgs = {...}
  2.  
  3. local size = math.floor( tonumber(tArgs[1]))
  4.  
  5. os.loadAPI("/lib/adt")
  6.  
  7. function buildSlice(n)
  8. if n==nil then
  9. n=1
  10. end
  11.  
  12. for j=1, n do
  13. adt.forward()
  14. adt.placeDown()
  15. end
  16.  
  17.  
  18.  
  19.  
  20. if #tArgs ~= 2 then
  21. print("Incorrect usage of program!")
  22. print("build <width> <length>")
  23. else
  24. local width = math.floor( tonumber(tArgs[1]) )
  25. local length = math.floor( tonumber(tArgs[2]) )
  26.  
  27.  
  28. local side = math.floor( width/2 )
  29.  
  30. adt.turnLeft()
  31. adt.forward(side)
  32. adt.turnRight()
  33. adt.placeDown()
  34.  
  35. for i = 1, width do
  36.  
  37. buildSlice(length)
  38.  
  39.  
  40. if math.fmod(i,2) == 0 then
  41. adt.turnLeft()
  42. adt.forward()
  43. adt.turnLeft()
  44. else
  45. adt.turnRight()
  46. adt.forward()
  47. adt.turnRight()
  48. end
  49.  
  50. adt.placeDown()
  51.  
  52. end
  53. end
Advertisement
Add Comment
Please, Sign In to add comment