# Walled Fortress

8-10 yrs old

Computer Science

Build a walled fortress around a village using Code Builder and the player agent.

Submitted By: John Miller

January 25, 2019

#### Skills

• Critical Thinking

#### Supporting Files

World File

World file for student use

### Learning Objectives

• Students will write a coding loop that will allow their agent to build a wall.
• Students will be able to define a simple design problem that includes specified criteria for success. (NGSS 3-5 ETS1-1)

### Guiding Ideas

Before beginning, students should be comfortable with controlling the movement of their agent and be familiar with the repeat loop. Click here to learn more about agent movement.

A loop allows coded statements to be repeated.

It is often wise to test small code segments first before committing to longer segments or multiple loops.

### Student Activities

Working individually, or in small groups, program the agent to build a wall at least three blocks tall and one block wide around the village. Follow the red sandstone foundation to make sure the entire village is secure.

Allow students to build the wall out of any material they wish. They will need to place their block choice in the agent’s inventory before beginning.

They can begin building the wall at any location and work in short or long segments.

They will need several agent commands such as:

• teleport to player
• place on move <true>
• turn [left, right]
• move [forward, back, up, down, left, right]

They will likely need a loop command as well:

• repeat x times do, where x represents the height of the wall

Students needing a little help getting started may benefit from this wall building tutorial.

### Performance Expectations

Students should openly reflect and share their progress, both successes and failures. Encourage students to reach a consensus and support innovative thinking.

Students should be able to answer the following questions:

• What is a loop? How were loops useful in this task?
• What problem do I need to solve? How will I know that I solved it?
• What was the most difficult challenge I had to overcome?
• Was my agent able to continue building around a corner? What might that code look like?

If time allows, capture and share images of code that did not work and ask students to identify reasons why.

#### Skills

• Critical Thinking

#### Supporting Files

World File

World file for student use