# Build a Dam

8-10 yrs old

Computer Science

Math & Economics

Science

Build a dam using Code Builder and add a floodgate that will allow villagers to mine gold ore.

Submitted By: John Miller

January 25, 2019

#### Skills

• Critical Thinking

#### Supporting Files

World File

World file for student use

### Learning Objectives

• Students will understand how to initiate a player chat command.
• Students will learn how to use their agent to place blocks while moving.
• Students will plan and carry out fair tests in which variables are controlled and failure points are considered. (NGSS 3-5-ETS1-3)

### Guiding Ideas

Before beginning, students should understand how to use the Code Builder interface to locate player and agent commands.

Player agents can be used to move and place blocks in any direction and can be relied upon to return to the player when needed

Engineers design and test prototypes before using them in the real world.

Pistons move up or down when activated and can be used to model the action of a gate.

### Student Activities

Students can work individually or in pairs to complete this challenge. Time permitting, there are two tasks to complete:

1. Use the agent to build a small dam that will allow villagers to access gold ore.
2. Add a floodgate using just a sticky piston and a lever to control the water flow.

Students will need to investigate the dam site and determine how many blocks of sand they will need to stop the flow of water. The dam is to be built across the ravine in the space between the two red sandstone blocks. The dam should be built on top of the bedrock blocks.

Next, they should visit the workshop area where they will find a model foundation that they can use to test their designs and build a prototype.

They should use the agent to complete the build using player and agent commands. They should be able to complete this task by combining the following commands:

• on chat command “name”
• agent teleport to player
• agent [place on move] <true>
• agent move [forward, up, down, left, right] by num

Encourage students to test multiple options and share successful or innovative code with other groups. They may need to create multiple chat commands to complete the task.

To create a floodgate, students will need to attach a block of sand in the top row of their dam to an extended sticky piston that is next to a lever. Pushing the lever retracts the piston, thereby pulling the block of sand (the gate) open, releasing the water.

### Performance Expectations

Students will demonstrate their understanding by running their code with the teacher present.

Students will create and test an assortment of commands before building the dam. They can record their attempts and failures with screenshots to share at the end of the activity.

A working piston-driven floodgate allows the water flow to be controlled.

A prototype dam built by the agent can be found in the workshop area.

Students should be able to answer the following questions:

• What is the chat command used for?
• How did you get your agent to build with the blocks of sand?
• How did you determine the number of sand blocks you would need?
• When you discovered that some of the code you wrote didn’t work, what did you do?

#### Skills

• Critical Thinking

#### Supporting Files

World File

World file for student use