Skip to content

Commit 0ef54cd

Browse files
Update tower builder ghost code
1 parent b639de3 commit 0ef54cd

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

tutorials/python-islands/island-7/tower_builder/tower_builder_1.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,20 +127,23 @@ Code the part of the flowchart shown in black to place glowstone at the top of y
127127
- Place glowstone forwards
128128

129129
```ghost
130+
def create_layer():
131+
agent.set_slot(1)
132+
for sides in range(4):
133+
agent.place(DOWN)
134+
agent.move(FORWARD, 1)
135+
agent.place(DOWN)
136+
agent.move(FORWARD, 1)
137+
agent.turn_left()
138+
130139
agent.set_item(STONE, 64, 1)
131140
agent.set_item(GLOWSTONE, 1, 2)
132-
agent.set_slot(1)
133141
134142
for i in range(3):
135143
agent.move(UP, 1)
136-
for j in range(4):
137-
agent.place(DOWN)
138-
agent.move(FORWARD, 1)
139-
agent.place(DOWN)
140-
agent.move(FORWARD, 1)
141-
agent.turn_right()
144+
create_layer()
142145
143-
agent.set_slot(2)
144146
agent.move(RIGHT, 1)
147+
agent.set_slot(2)
145148
agent.place(FORWARD)
146149
```

0 commit comments

Comments
 (0)