SHOW:
|
|
- or go back to the newest paste.
1 | - | function line(dlina) |
1 | + | function line(dlina,from) |
2 | for x = 1 , dlina do | |
3 | if turtle.getItemCount() == 0 then | |
4 | turtle.select(2) | |
5 | end | |
6 | turtle.turnRight() | |
7 | searchBlock(from) | |
8 | turtle.placeDown() | |
9 | turtle.turnLeft() | |
10 | turtle.forward() | |
11 | end | |
12 | - | function square(dlina) |
12 | + | |
13 | function square(dlina,from) | |
14 | - | line(dlina) |
14 | + | |
15 | line(dlina,from) | |
16 | turtle.turnRight() | |
17 | end | |
18 | - | function cube(length,height) |
18 | + | |
19 | function cube(length,height,from) | |
20 | - | square(length) |
20 | + | |
21 | square(length,from) | |
22 | turtle.up() | |
23 | ||
24 | end | |
25 | end | |
26 | - | function pyramid(size) |
26 | + | |
27 | function pyramid(size,from) | |
28 | squareSize = size | |
29 | squareNum = math.ceil(size / 2) | |
30 | - | square(squareSize) |
30 | + | |
31 | square(squareSize,from) | |
32 | turtle.forward() | |
33 | turtle.turnRight() | |
34 | turtle.up() | |
35 | turtle.forward() | |
36 | turtle.turnLeft() | |
37 | squareSize = squareSize - 2 | |
38 | end | |
39 | end | |
40 | - | turtle.select(5) |
40 | + | |
41 | - | pyramid(size) |
41 | + | pyramid(size, 5) |
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) |
54 | + | pyramid(size, 9) |
55 | - | pyramid(size) |
55 | + | |
56 | ||
57 | function searchBlock(from) | |
58 | current = from | |
59 | turtle.select(current) | |
60 | while turtle.getItemCount() == 0 do | |
61 | current = current + 1 | |
62 | turtle.select(current) | |
63 | end | |
64 | ||
65 | end | |
66 | function house(lenght, height) | |
67 | cube(lenght,height, 1) | |
68 | roof(lenght) | |
69 | - | cube(10, 1) |
69 | + | |
70 | - | roof(10, 5, 9) |
70 | + | |
71 | -- PROGRAM | |
72 | house(7, 3) |