Razara

chess Queen

May 19th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.83 KB | None | 0 0
  1. --TODO: add return to start
  2.  
  3. tArgs = {...}
  4. color = tArgs[1]
  5. function select(i)
  6.     turtle.select(i+ (color == "white" and 0 or 6))
  7. end
  8. function buildBase()
  9.         select(1)
  10.         for y = 1,5 do
  11.                 for x = 1,4 do
  12.                                         turtle.placeDown()
  13.                                         turtle.forward()
  14.                 end
  15.             if y < 5 then
  16.                 if y%2 ~= 0 then
  17.                                         turtle.turnRight()
  18.                                         turtle.placeDown()
  19.                                         turtle.forward()
  20.                                         turtle.turnRight()
  21.                 else
  22.                                         turtle.turnLeft()
  23.                                         turtle.placeDown()
  24.                                         turtle.forward()
  25.                                         turtle.turnLeft()
  26.                 end
  27.                         end
  28.         end
  29.         turtle.placeDown()
  30. end
  31.  
  32. function buildMid()
  33.     turtle.back()
  34.     turtle.back()
  35.     turtle.turnLeft()
  36.     turtle.forward()
  37.     turtle.forward()
  38.    
  39.     for i = 1,5 do
  40.         turtle.up()
  41.         turtle.placeDown()
  42.     end
  43.    
  44.     select(3)
  45.     turtle.up()
  46.     turtle.placeDown()
  47.    
  48.     select(6)
  49.     turtle.placeDown()
  50.     turtle.up()
  51.     turtle.placeDown()
  52.    
  53.     turtle.back()
  54.     turtle.back()
  55.     turtle.down()
  56.     turtle.down()
  57.    
  58.     sideDown()
  59.     turnCorner()
  60.     sideUp()
  61.     turnCorner()
  62.     sideDown()
  63.     turnCorner()
  64.     sideUp()
  65.  
  66. end
  67.  
  68.  function turnCorner()
  69.         turtle.turnRight()
  70.         turtle.forward()
  71.         turtle.forward()
  72.         turtle.turnLeft()
  73.         turtle.forward()
  74.         turtle.forward()
  75.         turtle.turnLeft()
  76.  end
  77.  
  78.  function sideDown()
  79.    
  80.    
  81.     select(2)
  82.     turtle.forward()
  83.     turtle.turnLeft()
  84.     turtle.place()
  85.     turtle.turnRight()
  86.     turtle.back()
  87.     select(3)
  88.     turtle.place()
  89.  
  90.     select(2)
  91.     turtle.down()
  92.     turtle.forward()
  93.     turtle.turnLeft()
  94.     turtle.place()
  95.     turtle.turnRight()
  96.     turtle.back()
  97.     turtle.place()
  98.    
  99.     select(4)
  100.     turtle.down()
  101.     turtle.place()
  102.    
  103.     select(3)
  104.     turtle.down()
  105.     turtle.place()
  106.    
  107.     select(4)
  108.     turtle.down()
  109.     turtle.place()
  110.    
  111.     select(3)
  112.     turtle.down()
  113.     turtle.place()
  114. end
  115.  
  116.  function sideUp()
  117.     select(3)
  118.     turtle.place()
  119.     turtle.up()
  120.    
  121.     select(4)
  122.     turtle.place()
  123.     turtle.up()
  124.    
  125.     select(3)
  126.     turtle.place()
  127.     turtle.up()
  128.    
  129.     select(4)
  130.     turtle.place()
  131.     turtle.up()
  132.    
  133.     select(2)
  134.     turtle.forward()
  135.     turtle.turnLeft()
  136.     turtle.place()
  137.     turtle.turnRight()
  138.     turtle.back()
  139.     turtle.place()
  140.     turtle.up()
  141.    
  142.     select(2)
  143.     turtle.forward()
  144.     turtle.turnLeft()
  145.     turtle.place()
  146.     turtle.turnRight()
  147.     turtle.back()
  148.     select(3)
  149.     turtle.place()
  150. end
  151.  
  152. function returnToStart()
  153.  
  154.     for i = 1,5 do
  155.         turtle.down()
  156.     end
  157.    
  158.     turtle.turnLeft()
  159.     turtle.forward()
  160.     turtle.forward()
  161.     turtle.turnRight()
  162. end
  163.  
  164.  
  165. buildBase()
  166. buildMid()
  167. returnToStart()
Advertisement
Add Comment
Please, Sign In to add comment