Skip to content

Commit

Permalink
Merge pull request #31 from CausewayDigital/master
Browse files Browse the repository at this point in the history
Computing with Minecraft bug fixes
  • Loading branch information
gbaman authored Apr 22, 2022
2 parents cbf4b23 + 62fbeb7 commit 280530b
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 86 deletions.
Binary file modified computing/unit-2/build_area.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed computing/unit-2/example_house.png
Binary file not shown.
11 changes: 7 additions & 4 deletions computing/unit-2/lesson-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ player.onChat("road_1", function () {
```

## Step 5
We are almost ready to test our code, however there is one more important thing we have to do to make this code work properly. Change the center, or **Z** coordinate, to one number lower. In this example, this will be **68**. Now test your code. If you have coded correctly, you should see a road appear in place of the Grass.
We are almost ready to test our code, however there is one more important thing we have to do to make this code work properly. Change the center, or **Y** coordinate, to one number lower. In this example, this will be **68**. Now test your code. If you have coded correctly, you should see a road appear in place of the Grass.

### ~ tutorialhint
``` blocks
player.onChat("road_1", function () {
blocks.fill(
GRAY_CONCRETE,
world(-22, 68, -565),
world(-21, 68, -565),
world(61, 68, -569),
FillOperation.Replace
)
Expand All @@ -88,9 +88,12 @@ Repeat the steps for the second road.
player.onChat("road_2", function () {
blocks.fill(
GRAY_CONCRETE,
world(-22, 68, -565),
world(61, 68, -569),
world(-21, 68, -532),
world(61, 68, -536),
FillOperation.Replace
)
})
```

## Step 7
(Extension) With two roads done, build more using the code you have just created. When you are finished, go to the Unit 2 Lesson 1 NPC and ask for some carpet to make road markings with using your agent to place them.
2 changes: 1 addition & 1 deletion computing/unit-2/lesson-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Return to your ``||Loops:LOOPS||`` drawer and bring another ``||Loops:repeat [4]
Return to the ``||Agent:AGENT||`` toolbox drawer and add another ``||Agent:agent [place on move]||``, and set it to **true**. Test your code.

## Step 12
Return to the ``||Agent:AGENT||`` toolbox drawer and add another ``||Agent:agent set active slot||``, and set it to **2**. This means that your Agent will now start to use the materials set in the second slot of its inventory. In our example, this will be **Stone Slabs**.
Return to the ``||Agent:AGENT||`` toolbox drawer and add another ``||Agent:agent set active slot||``, and set it to **2**. Use another loop to make the agent move forward 5 blocks and then move left. Then move the agent back 5 blocks and move left again. This should be repeated 3 times to make the roof using **Stone Slabs**.

### ~ tutorialhint

Expand Down
13 changes: 9 additions & 4 deletions computing/unit-2/lesson-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

# Lesson 3: Code a Row of Houses

## Build Area @unplugged
We'll be building a house in this building zone in front of the Agency building. Here is an example building. It can be anything!

![Build area image](https://raw.githubusercontent.com/Mojang/EducationContent/master/computing/unit-2/build_area.png)

## Step 1
Manually build the house to your design specification. Do this in the designated construction zone, marked by yellow and black wool.
![](build_area.png)
![](example_house.png)
Manually build a house to your design specification. Do this in the designated construction zone, marked by yellow and black wool.

Press the back arrow to the left to view the example and location of the build area again.

## Step 2
Rename the **run** element of the ``||Player:on chat command||`` block to **clone_here**. Drag a ``||Blocks:clone from||`` code block to your ``||Player:on chat command||``.
Expand Down Expand Up @@ -53,7 +58,7 @@ player.onChat("clone_here.", function () {
```

## Step 5
Change the first set of coordinates (from **Step 9**) to the ``||Blocks:clone from||`` set in the code block, and the second set of coordinates (from **Step 10**) to the ``||Blocks:to||`` set below them. Remember, the image below has example coordinates.
Change the first set of coordinates to the ``||Blocks:clone from||`` set in the code block, and the second set of coordinates to the ``||Blocks:to||`` set below them. Remember, the image below has example coordinates.

The last coordinates are relative to your player, so your player will become the marker for the place you want to clone the house. You'll need to move your player each time you want to clone another house.

Expand Down
81 changes: 20 additions & 61 deletions computing/unit-3/lesson-1.md
Original file line number Diff line number Diff line change
@@ -1,104 +1,63 @@
### @explicitHints 1

# Lesson 1: Code a Park Fence

## Step 1
Rename the **run** element of the ``||Player:on chat command||`` block to **park_fence**.

Drag and drop the ``||Agent:agent set active slot||`` code block to the coding Workspace and add it to your ``||Player:on chat command||`` code block.

Drag and drop the ``||Agent:agent move [forward]||`` code block to the coding Workspace and add it to your ``||Player:on chat command||`` code block. Change **forward** to **up**.

#### ~ tutorialhint
### ~ tutorialhint
``` blocks
player.onChat("park_fence", function () {
agent.setSlot(1)
agent.move(UP, 1)
})
```
## Step 2
Drag the ``||Loops:repeat [4] times||`` into your ``||Player:on chat command||`` set and change it to **2**.
Drag the ``||Loops:repeat [4] times||`` into your ``||Player:on chat command||`` set and change it to **25**.

#### ~ tutorialhint
### ~ tutorialhint
``` blocks
player.onChat("park_fence", function () {
agent.setSlot(1)
agent.move(UP, 1)
for (let index = 0; index < 2; index++) {
for (let index = 0; index < 25; index++) {
}
})
```

## Step 3
Drag the ``||Agent:agent move [forward]||`` code block to the coding Workspace, add it to your ``||Player:on chat command||`` code block, inside the ``||Loops:repeat [2] times||`` loop, then set it to our first number, **25**.
Drag the ``||Agent:agent move [forward]||`` code block to the coding Workspace, add it to your ``||Player:on chat command||`` code block, inside the ``||Loops:repeat [25] times||`` loop, then set it to **1**.

Drag the ``||Agent:agent place [forward]||`` code block to the coding Workspace, add it to your ``||Player:on chat command||`` code block, inside the ``||Loops:repeats [2] times||`` loop, under the ``||Agent.agent move[forward]||`` code block, then change **forward** to **down**.
Drag the ``||Agent:agent place [forward]||`` code block to the coding Workspace, add it to your ``||Player:on chat command||`` code block, inside the ``||Loops:repeats [25] times||`` loop, under the ``||Agent.agent move[forward]||`` code block, then change **forward** to **back**.

#### ~ tutorialhint
### ~ tutorialhint
``` blocks
player.onChat("park_fence", function () {
agent.setSlot(1)
agent.move(UP, 1)
for (let index = 0; index < 2; index++) {
agent.move(FORWARD, 25)
agent.place(DOWN)
for (let index = 0; index < 25; index++) {
agent.move(FORWARD, 1)
agent.place(BACK)
}
})
```

## Step 4
Drag the ``||Agent:agent turn [left]||`` code block to your ``||PLayer:on chat command||`` code block, inside the ``||Loops:repeat [2] times||`` and set it to the direction your Agent needs to turn. In our example, this is **left**.
Drag the ``||Agent:agent turn [left]||`` code block to your ``||PLayer:on chat command||`` code block after the loop. Set it to the direction your Agent needs to turn. In our example, this is **left**.

#### ~ tutorialhint
### ~ tutorialhint
``` blocks
player.onChat("park_fence", function () {
agent.setSlot(1)
agent.move(UP, 1)
for (let index = 0; index < 2; index++) {
agent.move(FORWARD, 25)
agent.place(DOWN)
agent.turn(LEFT_TURN)
for (let index = 0; index < 25; index++) {
agent.move(FORWARD, 1)
agent.place(BACK)
}
agent.turn(LEFT_TURN)
})
```

## Step 5
Drag the ``||Agent:agent move [forward]||`` code block to your ``||Player:on chat command||`` code block, then set it to our second number, **23**.

Drag the ``||Agent:agent place[forward]||`` code block in your ``||Player:on chat command||`` code block, change **forward** to **down**.

#### ~ tutorialhint
``` blocks
player.onChat("park_fence", function () {
agent.setSlot(1)
agent.move(UP, 1)
for (let index = 0; index < 2; index++) {
agent.move(FORWARD, 25)
agent.place(DOWN)
agent.turn(LEFT_TURN)
agent.move(FORWARD, 23)
agent.place(DOWN)
}
})
```

## Step 6
Drag one more ``||Agent:agent turn [left]||`` code block to your ``||Player:on chat command||`` code block inside the **loop** and leave it set to **left**.

#### ~ tutorialhint
``` blocks
player.onChat("park_fence", function () {
agent.setSlot(1)
agent.move(UP, 1)
for (let index = 0; index < 2; index++) {
agent.move(FORWARD, 25)
agent.place(DOWN)
agent.turn(LEFT_TURN)
agent.move(FORWARD, 23)
agent.place(DOWN)
agent.turn(LEFT_TURN)
}
})
```

## Step 7
Test your code. Place your Agent on the starting block and run your code by pressing **T** to open the chat box and type **park_fence**.

This code will only do one side at a time. Make sure your agent has enough blocks to finish each side before you run! Ask the Unit 3 Lesson 1 NPC for more blocks if you need them.
17 changes: 13 additions & 4 deletions computing/unit-3/lesson-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@ player.onChat(" plant_flowers", function () {
```

## Step 4
Set the first number to **1** and the second to **5**, corresponding with the five slots in which you placed the flowers in **Step 2**.
Set the first number to **1** and the second to **5**, corresponding with the five slots in the agent's inventory.
#### ~ tutorialhint
``` blocks
player.onChat(" plant_flowers", function () {
for (let index = 0; index < 20; index++) {
agent.setSlot(Math.randomRange(1, 5))
}
})
```


## Step 5
Code your Agent randomly move around. Now visit the ``||Agent:Agent||``drawer and drag the ``||Agent:agent move [forward]||`` code block to the coding Workspace.
Expand All @@ -65,7 +74,7 @@ player.onChat(" plant_flowers", function () {
## Step 6
Add another ``||Math:pick random [0] to [10]||`` to replace the number oval of the ``||Agent:agent move [forward]||``. Change the second number of the ``||Math:pick random [0] to [10]||`` to **20**.

When this line of code is activated, your Agent will move forward to a random block between its current position and 20 blocks ahead.
When this line of code is added, your Agent will move forward to a random block between its current position and 20 blocks ahead.

#### ~ tutorialhint
``` blocks
Expand Down Expand Up @@ -151,6 +160,6 @@ player.onChat(" plant_flowers", function () {
```

## Step 11
Position your Agent and run the code. Position your Agent at one corner of your park, with the Agent facing the bulk of the park and with the main body of the park to the left. We have marked this in the image below with Yellow Wool.
Position your Agent and run the code. Position your Agent at one corner of your park, with the back of the Agent against a fence and with the main body of the park to the left.

Test your code. Your Agent should now move forward to a random location, plant two randomly selected flowers, move backward, do the same and move left to start again. This will create a random meadow of flowers.
Test your code. Your Agent should now move forward to a random location, plant two randomly selected flowers, move backward, do the same and move left to start again. This will create a random meadow of flowers.
22 changes: 11 additions & 11 deletions computing/unit-4/lesson-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ player.onChat("ocelot_wall", function () {
## Step 2
Drag the``||Positions:world [0] [0] [0]||`` oval onto your coding Workspace, replacing the **relative** coordinates oval already in there.

Now set the ``||Positions:world [0] [0] [0]||`` coordinates to the position you want to start building your wall. We have marked our intended start point with **Yellow Wool** in the picture below with the coordinates **-38, 69, -576**. Write the coordinates of your starting point, or first marker, in your workbook.
Now set the ``||Positions:world [0] [0] [0]||`` coordinates to the position you want to start building your wall. We have marked our intended start point with a **Gold Block** at the coordinates **-40, 69, -575**. Write the coordinates of your starting point, or first marker, in your workbook.

#### ~ tutorialhint
``` blocks
player.onChat("ocelot_wall", function () {
builder.teleportTo(world(-38, 69, -576))
builder.teleportTo(world(-40, 69, -575))
})
```

Expand All @@ -33,7 +33,7 @@ Tell the BUILDER the direction. Now, we need to tell it what direction to build

You will find a compass in your inventory.

As you move around, the **compass** does too. You can use this to find your North (the red dial is pointing North), East, South and West. The direction on the **compass** in the image below is West. This is the direction we want the ``||Builder:BUILDER||`` to work.
As you move around, the **compass** does too. You can use this to find your North (the red dial is pointing North), East, South and West. The direction on the **compass** is West. This is the direction we want the ``||Builder:BUILDER||`` to work.

## Step 4
Return to the ``||Builder:BUILDER||`` drawer and look for the ``||Builder:builder face [West (negative X)||`` code block. Add this to your main code and use the drop-down menu to set the correct direction for your build.
Expand All @@ -43,7 +43,7 @@ Note: If the direction your player is facing is East, North or South, change th
#### ~ tutorialhint
``` blocks
player.onChat("ocelot_wall", function () {
builder.teleportTo(world(-38, 69, -576))
builder.teleportTo(world(-40, 69, -575))
builder.face(WEST)
})
```
Expand All @@ -54,7 +54,7 @@ Now return to the ``||Builder:BUILDER||`` menu and drag a ``||Builder:builder mo
#### ~ tutorialhint
``` blocks
player.onChat("ocelot_wall", function () {
builder.teleportTo(world(-38, 69, -576))
builder.teleportTo(world(-40, 69, -575))
builder.face(WEST)
builder.move(FORWARD, 1)
})
Expand All @@ -68,7 +68,7 @@ Now drag a ``||Builder:builder turn [left]||`` code block to your main code.
#### ~ tutorialhint
``` blocks
player.onChat("ocelot_wall", function () {
builder.teleportTo(world(-38, 69, -576))
builder.teleportTo(world(-40, 69, -575))
builder.face(WEST)
builder.move(FORWARD, 21)
builder.turn(LEFT_TURN)
Expand All @@ -83,7 +83,7 @@ Add another ``||Builder:builder move [forward]||`` code block and change the num
#### ~ tutorialhint
``` blocks
player.onChat("ocelot_wall", function () {
builder.teleportTo(world(-38, 69, -576))
builder.teleportTo(world(-40, 69, -575))
builder.face(WEST)
builder.move(FORWARD, 21)
builder.turn(RIGHT_TURN)
Expand All @@ -99,7 +99,7 @@ This tells your builder to leave a trail of a given material in the path it trac
#### ~ tutorialhint
``` blocks
player.onChat("ocelot_wall", function () {
builder.teleportTo(world(-38, 69, -576))
builder.teleportTo(world(-40, 69, -575))
builder.face(WEST)
builder.move(FORWARD, 21)
builder.turn(RIGHT_TURN)
Expand All @@ -114,7 +114,7 @@ Use the drop-down menu to change the material element to the material you would
#### ~ tutorialhint
``` blocks
player.onChat("ocelot_wall", function () {
builder.teleportTo(world(-38, 69, -576))
builder.teleportTo(world(-40, 69, -575))
builder.face(WEST)
builder.move(FORWARD, 21)
builder.turn(RIGHT_TURN)
Expand All @@ -124,7 +124,7 @@ player.onChat("ocelot_wall", function () {
```

## Step 10
Run the code to build the walls.Test your code. ``||Builder:BUILDER||`` should now start at position **-38, 69, -576** and move West by **21** blocks, turn **left** and move **9** blocks while placing **Stone Bricks** on the way. The result is a small perimeter wall around your ocelot enclosure. You'll see this happens very fast in comparison to ``||Agent:Agent||`` and ``||Blocks:BLOCKS||`` in previous lessons. With a little preplanning, you can create huge structures in seconds.
Run the code to build the walls.Test your code. ``||Builder:BUILDER||`` should now start at position **--40, 69, -575** and move West by **21** blocks, turn **left** and move **9** blocks while placing **Stone Bricks** on the way. The result is a small perimeter wall around your ocelot enclosure. You'll see this happens very fast in comparison to ``||Agent:Agent||`` and ``||Blocks:BLOCKS||`` in previous lessons. With a little preplanning, you can create huge structures in seconds.

## Step 11
Add fencing and other details. This wall won't keep ocelots in, let's add fencing above to make sure they don't escape.
Expand All @@ -135,7 +135,7 @@ Repeat the above coding or adjust your existing code to do this. You will only n
#### ~ tutorialhint
``` blocks
player.onChat("ocelot_wall", function () {
builder.teleportTo(world(-38, 70, -576))
builder.teleportTo(world(-40, 69, -575))
builder.face(WEST)
builder.move(FORWARD, 21)
builder.turn(RIGHT_TURN)
Expand Down
2 changes: 1 addition & 1 deletion computing/unit-5/lesson-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Step 1
Wind turbines make up a wind farm. A ***wind turbine*** is like a windmill, where blades rotate when the wind hits them. In real life as the blades turn, the energy is converted to produce power. Before we start building our wind farm, let's consider a good position for one. In our example, we'll use the hill near our city. Let's use one of the methods we've learned to code a turbine, then clone it to make a farm.
``` template
```template
player.onChat("run", function(){
})
player.teleport(pos(19, 79, -413))
Expand Down

0 comments on commit 280530b

Please sign in to comment.