SHOW:
|
|
- or go back to the newest paste.
1 | - | q = 1 |
1 | + | |
2 | for x = 1 , dlina do | |
3 | - | turtle.select(q) |
3 | + | |
4 | turtle.select(2) | |
5 | end | |
6 | - | q = q + 1 |
6 | + | |
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 | - | squareNum = math.ceil( size / 2 ) |
29 | + | |
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 | - | half = math.ceil( size / 2 ) |
43 | + | for i = 1, half do |
44 | - | for x = 1, half do |
44 | + | turtle.back() |
45 | - | turtle.back() |
45 | + | end |
46 | turtle.turnLeft() | |
47 | - | turtle.turnLeft() |
47 | + | for i = 1, half do |
48 | - | for x = 1, half do |
48 | + | turtle.forward() |
49 | end | |
50 | turtle.turnRight() | |
51 | - | turtle.turnRight() |
51 | + | for i = 1, half - 1 do |
52 | - | for x = 1, half - 1 do |
52 | + | turtle.down() |
53 | - | turtle.down() |
53 | + | end |
54 | turtle.select(6) | |
55 | - | turtle.select(6) |
55 | + | pyramid(size) |
56 | end | |
57 | ||
58 | - | length = math.random(3, 7) |
58 | + | function searchBlock(from) |
59 | - | roof(length) |
59 | + | current = from |
60 | - | function house() |
60 | + | turtle.select(current) |
61 | - | cube() |
61 | + | while turtle.getItemCount() == 0 do |
62 | current = current + 1 | |
63 | - | roof(size) |
63 | + | turtle.select(current) |
64 | end | |
65 | - | |
65 | + | |
66 | end | |
67 | ||
68 | -- PROGRAM | |
69 | cube(10, 1) | |
70 | roof(10, 5, 9) |