Advertisement
Z4i

15x15 Square

Z4i
Feb 23rd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. local pos = 1
  2. local count = 0
  3.  
  4. function check()
  5.     if turtle.getItemCount() == 0 then
  6.         if pos ~= 15 then
  7.             pos = pos + 1
  8.         else
  9.             pos = 1
  10.         end
  11.         turtle.select(pos)
  12.     end
  13. end
  14.  
  15. function light()
  16.     turtle.select(16)
  17.     turtle.placeDown()
  18.     turtle.select(pos)
  19. end
  20.  
  21. function place()
  22.     for i = 1, 15 do
  23.         turtle.forward()
  24.         check()
  25.         if count % 8 == 0 then
  26.             light()
  27.         else
  28.             turtle.placeDown()
  29.         end
  30.         count = count + 1
  31.     end
  32. end
  33.  
  34. function right()
  35.     turtle.turnRight()
  36.     turtle.forward()
  37.     turtle.turnRight()
  38.     check()
  39.     if count % 8 == 0 then
  40.         light()
  41.     else
  42.         turtle.placeDown()
  43.     end
  44.     count = count + 1
  45. end
  46.  
  47. function left()
  48.     turtle.turnLeft()
  49.     turtle.forward()
  50.     turtle.turnLeft()
  51.     check()
  52.     if count % 8 == 0 then
  53.         light()
  54.     else
  55.         turtle.placeDown()
  56.     end
  57.     count = count + 1
  58.    
  59. end
  60.  
  61. for i = 0, 13, 2 do
  62.     place()
  63.     right()
  64.     place()
  65.     left()
  66. end
  67. place()
  68. left()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement