Skip to content

Commit 130e9bb

Browse files
committed
Quick Test
0 parents  commit 130e9bb

File tree

6 files changed

+331
-0
lines changed

6 files changed

+331
-0
lines changed

Makefile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
all: deploy
2+
3+
build:
4+
pxt build
5+
6+
deploy:
7+
pxt deploy
8+
9+
test:
10+
pxt test

README.md

+293
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,293 @@
1+
### @activities 1
2+
3+
### @explicitHints 1
4+
5+
## Introduction
6+
7+
### Introduction step @unplugged
8+
9+
![Lesson 2](/static/china-tutorials/agentdig.gif)
10+
11+
# Welcome to Moon Base
12+
13+
**Unit 3. Lesson 2** - Mineral Samples!
14+
15+
## Activity 1
16+
17+
### Step 1
18+
19+
**Activity 1 - Agent Dig 1**: Select the ``||user:on chat command||`` block and rename it to **dig1**.
20+
21+
#### ~ tutorialhint
22+
23+
```blocks
24+
user.onChat("dig1", function () {
25+
26+
})
27+
```
28+
29+
### Step 2
30+
31+
Program your Agent to destroy **1** block **down** and move **1** block **down** by using an ``||agent:agent destroy down||`` and ``||agent:agent move down||``.
32+
33+
#### ~ tutorialhint
34+
35+
```blocks
36+
user.onChat("dig1", function () {
37+
agent.destroy(SixDirection.Down)
38+
agent.move(SixDirection.Down, 1)
39+
})
40+
```
41+
42+
Hint: Make sure you select **down** from the drop-down menu.
43+
44+
### Step 3
45+
46+
Make sure that your Agent repeats this action **10** times. Use a ``||loops:repeat||`` block.
47+
48+
#### ~ tutorialhint
49+
50+
```blocks
51+
user.onChat("dig1", function () {
52+
for (let i = 0; i < 10; i++) {
53+
agent.destroy(SixDirection.Down)
54+
agent.move(SixDirection.Down, 1)
55+
}
56+
})
57+
```
58+
59+
### Step 4
60+
61+
Add more commands inside your ``||user:on chat command||`` block to program your Agent to **collect all the items** with the help of ``||agent:agent collect all||`` block. After that, program your Agent to return to the surface. Use ``||agent:agent move||`` **up** by **10** blocks.
62+
63+
#### ~ tutorialhint
64+
65+
```blocks
66+
user.onChat("dig1", function () {
67+
for (let i = 0; i < 10; i++) {
68+
agent.destroy(SixDirection.Down)
69+
agent.move(SixDirection.Down, 1)
70+
}
71+
agent.collectAll()
72+
agent.move(SixDirection.Up, 10)
73+
})
74+
```
75+
Hint: Make sure the ``||agent:agent collect all||``and ``||agent:agent move up||`` blocks are **not** inside the a ``||loops:repeat||`` block. The Agent needs to move 10 blocks up to return to the surface.
76+
77+
### Step 5
78+
79+
Go to the Minecraft world and type your command. Once completed, right-click on your Agent to see the inventory. Remove **Moon rocks** and keep only **rare minerals**. Place rare minerals in the yellow minerals box. You will be teleported to the next Activity.
80+
81+
#### ~ tutorialhint
82+
83+
Hint: You can always reset the Activity by clicking a reset button inside the NPC Guide. You can open the box by right-clicking on it. Once you are done, you will be teleported to the next Activity.
84+
85+
## Activity 2
86+
87+
### Step 1
88+
89+
**Activity 2 - Agent Dig 2**: Select a new ``||user:on chat command||`` block and rename it to **dig2**.
90+
91+
#### ~ tutorialhint
92+
93+
```blocks
94+
user.onChat("dig2", function () {
95+
96+
})
97+
```
98+
99+
### Step 2
100+
101+
Program your Agent to dig a **2** block wide hole. Get your Agent to destroy **1** block **down**, move **1** block **down** and destroy **1** block **forward** from the same location. Use ``||agent:agent destroy down||``, ``||agent:agent move down||`` and ``||agent:agent destroy forward||`` blocks.
102+
103+
#### ~ tutorialhint
104+
105+
```blocks
106+
user.onChat("dig2", function () {
107+
agent.destroy(SixDirection.Down)
108+
agent.move(SixDirection.Down, 1)
109+
agent.destroy(SixDirection.Forward)
110+
})
111+
```
112+
113+
### Step 3
114+
115+
Now program your Agent to dig this hole **20** blocks **deep**. Program your Agent to repeat the actions **20** times.
116+
117+
#### ~ tutorialhint
118+
119+
```blocks
120+
user.onChat("dig2", function () {
121+
for (let i = 0; i < 20; i++) {
122+
agent.destroy(SixDirection.Down)
123+
agent.move(SixDirection.Down, 1)
124+
agent.destroy(SixDirection.Forward)
125+
}
126+
})
127+
```
128+
129+
### Step 4
130+
131+
Program your Agent to collect only **diamonds** with the help of ``||agent:agent collect item||`` block and return to the surface with the help of ``||agent:agent move up||`` block.
132+
133+
#### ~ tutorialhint
134+
135+
```blocks
136+
user.onChat("dig2", function () {
137+
for (let i = 0; i < 20; i++) {
138+
agent.destroy(SixDirection.Down)
139+
agent.move(SixDirection.Down, 1)
140+
agent.destroy(SixDirection.Forward)
141+
}
142+
agent.collect(blocks.item(Item.Diamond))
143+
agent.move(SixDirection.Up, 20)
144+
})
145+
```
146+
Hint: Don't forget to select a **diamond** egg from the drop-down menu. The Agent needs to move 20 blocks up to return to the surface.
147+
148+
### Step 5
149+
150+
Go to the Minecraft world and type your command. Check your Agent's inventory and place **diamonds** to the yellow Moon minerals box. You will be teleported to the next Activity.
151+
152+
#### ~ tutorialhint
153+
154+
```blocks
155+
user.onChat("dig2", function () {
156+
for (let i = 0; i < 20; i++) {
157+
agent.destroy(SixDirection.Down)
158+
agent.move(SixDirection.Down, 1)
159+
agent.destroy(SixDirection.Forward)
160+
}
161+
agent.collect(Item.Diamond)
162+
agent.move(SixDirection.Up, 20)
163+
})
164+
```
165+
166+
Hint: You can always reset the Activity by clicking a reset button inside the NPC Guide.
167+
168+
## Activity 3
169+
170+
### Step 1
171+
172+
**Activity 3 - Agent Dig 3**: Select a new ``||user:on chat command||`` block and rename it to **dig3**.
173+
174+
#### ~ tutorialhint
175+
176+
```blocks
177+
user.onChat("dig3", function () {
178+
179+
})
180+
```
181+
182+
### Step 2
183+
184+
Program your Agent to dig a **4** block **wide** hole. Make the Agent repeat a pattern of breaking and then moving down a layer.
185+
186+
#### ~ tutorialhint
187+
188+
```blocks
189+
user.onChat("dig3", function () {
190+
agent.destroy(SixDirection.Down)
191+
agent.move(SixDirection.Down, 1)
192+
agent.destroy(SixDirection.Forward)
193+
agent.move(SixDirection.Forward, 1)
194+
agent.destroy(SixDirection.Right)
195+
agent.move(SixDirection.Right, 1)
196+
agent.destroy(SixDirection.Back)
197+
agent.move(SixDirection.Back, 1)
198+
agent.move(SixDirection.Left, 1)
199+
})
200+
```
201+
Hint: The pattern is ``||agent:agent destroy down||``, ``||agent:agent move down||``, ``||agent:agent destroy forward||``, ``||agent:agent move forward||``, ``||agent:agent destroy right||``, ``||agent:agent move right||``, ``||agent:agent destroy back||``, ``||agent:agent move back||`` and ``||agent:agent move left||`` blocks.
202+
203+
### Step 3
204+
205+
Now program your Agent to dig the hole **10** block **deep** hole. You can do it using ``||loops:repeat||`` block.
206+
207+
#### ~ tutorialhint
208+
209+
```blocks
210+
user.onChat("dig3", function () {
211+
for (let i = 0; i < 10; i++) {
212+
agent.destroy(SixDirection.Down)
213+
agent.move(SixDirection.Down, 1)
214+
agent.destroy(SixDirection.Forward)
215+
agent.move(SixDirection.Forward, 1)
216+
agent.destroy(SixDirection.Right)
217+
agent.move(SixDirection.Right, 1)
218+
agent.destroy(SixDirection.Back)
219+
agent.move(SixDirection.Back, 1)
220+
agent.move(SixDirection.Left, 1)
221+
}
222+
})
223+
```
224+
225+
### Step 4
226+
227+
Program your Agent to collect only **diamonds** and **emeralds** from digging, using 2 ``||agent:agent collect item||`` blocks.
228+
229+
#### ~ tutorialhint
230+
231+
```blocks
232+
user.onChat("dig3", function () {
233+
for (let i = 0; i < 10; i++) {
234+
agent.destroy(SixDirection.Down)
235+
agent.move(SixDirection.Down, 1)
236+
agent.destroy(SixDirection.Forward)
237+
agent.move(SixDirection.Forward, 1)
238+
agent.destroy(SixDirection.Right)
239+
agent.move(SixDirection.Right, 1)
240+
agent.destroy(SixDirection.Back)
241+
agent.move(SixDirection.Back, 1)
242+
agent.move(SixDirection.Left, 1)
243+
}
244+
agent.collect(Item.Diamond)
245+
agent.collect(Item.Emerald)
246+
})
247+
```
248+
249+
Hint: Don't forget to select diamond and emerald eggs from the drop-down menu.
250+
251+
### Step 5
252+
253+
Program your Agent to return to the surface. Use ``||agent:agent move||`` **up** block. Your Agent needs to move **10** blocks **up**. Once you are done with coding, go to the Minecraft world and type your command to see your Agent dig.
254+
255+
#### ~ tutorialhint
256+
257+
```blocks
258+
user.onChat("dig3", function () {
259+
for (let i = 0; i < 10; i++) {
260+
agent.destroy(SixDirection.Down)
261+
agent.move(SixDirection.Down, 1)
262+
agent.destroy(SixDirection.Forward)
263+
agent.move(SixDirection.Forward, 1)
264+
agent.destroy(SixDirection.Right)
265+
agent.move(SixDirection.Right, 1)
266+
agent.destroy(SixDirection.Back)
267+
agent.move(SixDirection.Back, 1)
268+
agent.move(SixDirection.Left, 1)
269+
}
270+
agent.collect(Item.Diamond)
271+
agent.collect(Item.Emerald)
272+
agent.move(SixDirection.Up, 10)
273+
})
274+
```
275+
276+
### Step 6 @tutorialCompleted
277+
278+
In the Minecraft world, remove the **minerals** from the Agent's inventory and place them in the yellow Moon minerals box to power up the last transmitter and complete the lesson.
279+
280+
## Activity 4
281+
282+
### Step 1
283+
284+
**Activity 4 - Your Activity!**: Program your Agent to dig or collect items for you! Use ``||agent:agent destroy forward||``, ``||agent:agent collect item||`` blocks.
285+
286+
### Finish
287+
288+
**Well done! You have completed the lesson.**
289+
290+
291+
```package
292+
nether
293+
```

main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

pxt.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "agent-dig",
3+
"version": "0.0.0",
4+
"description": "",
5+
"dependencies": {
6+
"core": "*"
7+
},
8+
"files": [
9+
"README.md",
10+
"main.ts"
11+
],
12+
"testFiles": [
13+
"test.ts"
14+
],
15+
"public": false,
16+
"preferredEditor": "tsprj"
17+
}

test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// tests go here; this will not be compiled when this package is used as a library

tsconfig.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"noImplicitAny": true,
5+
"outDir": "built",
6+
"rootDir": "."
7+
},
8+
"exclude": ["pxt_modules/**/*test.ts"]
9+
}

0 commit comments

Comments
 (0)