8-10 yrs old

Computer Science

Math & Economics

Use Code Builder to build a rail line representing number lines, line segments, and rays.

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 use the agent place on move command.
• Students will understand how to use the agent move command.
• Students will understand how to set the agent’s active slot.
• Students will understand how to use a loop command.
• Students will be able to identify points on a line and differentiate between lines, line segments, and rays. (CCSS.MATH.CONTENT.4.G.A.1)

### Guiding Ideas

Before beginning, students should be able to create player chat commands and have some experience and understanding of agent movement.

Agents can be used to place blocks from their inventory in any direction.

Agents can place items like rail on top of blocks.

Agents can carry more than one type of block or item in their inventory slots.

Points, lines, line segments, and rays are used to represent numbers in two dimensions.

### Student Activities

This activity can be completed by individual students, or by students working in pairs sharing the same world.

Students will be using chat commands to build four rail segments that represent:

• numbers on a line
• a line segment
• a line
• a ray

1. At the spawn point students will find an NPC that will explain their first task. A model rail line and written instructions can be found on an adjacent chalkboard.

Students are to use their agent to place 50 gravel blocks parallel to the red sandstone. They are to then code their agent to place 50 rails on top of the gravel blocks. Every 10th rail should be an regular rail that is used to designate each number on the line.

Students should be encouraged to explore what commands work best, but students new to Code Builder will have success using these three commands to accomplish the task:

First on chat command (With player standing on top of the red sandstone block next to the number 0) . . .

• agent teleport to player
• agent turn [left or right]

Second on chat command (with gravel in agent inventory and agent at the starting point facing the intended direction) . . .

• agent [place on move] <true>
• agent move [forward] by (50)

Third on chat command (with regular rail in inventory slot 2 and powered rail in slot 1 and the agent at the starting point facing the intended direction) . . .

• agent set active slot (2)
• agent [place on move] <true>
• agent move forward by (1)
• agent set active slot (1)
• agent move [forward] by (9)

The agent will complete the first segment of the rail line. The command can be issued again, or encourage students to experiment with the loop command:

repeat (5) times do

2. The second challenge is to use similar commands to instruct the agent to first build the gravel rail bed and then build a rail line covering a three-number line segment of their choice. Students can copy and then modify their code from the previous task.

3. The third challenge requires students to fill in a line completely between the two arrows. NPCs are located at each end to remind the students that the arrows represent a line continuing in both directions.

4. The final challenge asks the students to use similar code to construct a ray. They get to determine the starting point and the rail line will continue in the direction of the arrow off into the air. Students riding this ray will find themselves splashing into a pond at the end.

### Performance Expectations

Students will demonstrate their understanding of agent commands by coding their agent to build a gravel bed to place rails upon.

They will use code to place rails that represent numbers and the space between numbers on top of the gravel bed.

They will use a repeat loop to instruct their agent to build 5 rail segments.

Students will generate several 3D representations of lines, line segments, and rays.

Students should be able to answer the following questions:

• How is a repeat command useful?
• Can you think of a way to use your agent to build the rail bed and then place the rails on top of it using just one on chat command?
• How is a line different from a ray?
• How is a line segment different from a line? A ray?

#### Skills

• Critical Thinking

#### Supporting Files

World File

World file for student use