Razara

chess Bishop

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