Advertisement
RTS_Dmitriy

first house

Dec 25th, 2024 (edited)
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function line(dlina)
  2.     for x = 1 , dlina do
  3.         if turtle.getItemCount() == 0 then
  4.             turtle.select(2)
  5.         end
  6.         turtle.turnRight()
  7.         turtle.placeDown()
  8.         turtle.turnLeft()
  9.         turtle.forward()
  10.     end
  11. end
  12. function square(dlina)
  13.     for b = 1, 4 do
  14.         line(dlina)
  15.         turtle.turnRight()
  16.     end
  17. end
  18. function cube(length,height)
  19.     for s = 1 , height do
  20.         square(length)
  21.         turtle.up()
  22.        
  23.     end
  24. end
  25.  
  26. function pyramid(size)
  27.     squareSize = size
  28.     squareNum = math.ceil(size / 2)
  29.     for y = 1, squareNum do
  30.         square(squareSize)
  31.         turtle.forward()
  32.         turtle.turnRight()
  33.         turtle.up()
  34.         turtle.forward()
  35.         turtle.turnLeft()
  36.         squareSize = squareSize - 2
  37.     end
  38. end
  39. function roof(size)
  40.     turtle.select(5)
  41.     pyramid(size)
  42.     half = math.ceil(size / 2)
  43.     for i = 1, half do
  44.         turtle.back()
  45.     end
  46.     turtle.turnLeft()
  47.     for i = 1, half do
  48.         turtle.forward()
  49.     end
  50.     turtle.turnRight()
  51.     for i = 1, half - 1 do
  52.         turtle.down()
  53.     end
  54.     turtle.select(6)
  55.     pyramid(size)
  56. end
  57.  
  58. function searchBlock(from)
  59.     current = from
  60.     turtle.select(current)
  61.     while turtle.getItemCount() == 0 do
  62.         current = current + 1
  63.         turtle.select(current)
  64.     end
  65.    
  66. end
  67.  
  68. -- PROGRAM
  69. cube(10, 1)
  70. roof(10, 5, 9)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement