# Lesson 12: Looking Ahead with Minecraft

## Overview

This lesson was originally created for the Hour of Code, alongside the Minecraft team. Students will get the chance to practice ideas that they have learned up to this point, as well as getting a sneak peek at conditionals!

## Purpose

This set of puzzles will work to solidify and build on the knowledge of loops, and introduce conditionals. By pairing these two concepts together, students will be able to explore the potential for creating fun and innovative programs in a new and exciting environment.

## Objectives

### Students will be able to:

• Define circumstances when certain parts of a program should run and when they shouldn't.
• Determine whether a conditional is met based on criteria.

## Preparation

• Play through the puzzles associated with this lesson to find any potential problem areas for your class.
• Make sure every student has a journal.

## Vocabulary

• Condition - Something a program checks to see if it is true before allowing an action.
• Conditionals - Statements that only run under certain conditions.

# Teaching Guide

## Warm Up (15 min)

### Introduction

Gather the class together and ask two volunteers to walk straight in some direction in the classroom. If they encounter a chair out of place, they must step over it. If they reach a wall, they must sit down.

Once all of the students are sitting down, ask how you would program a robot to respond to a wall or a chair. Remind students that you cannot simply say "Step over chair" unless you know there is a chair, and you will not always know there is a chair. It might be helpful to translate the task into instructions like:

• while there is a path ahead
• walk forward
• if there is a chair, step over it
• sit down

Tell students they will be using conditionals during this lesson. Give the definition of:

• Condition: A statement that a program checks to see if it is true or false. If true, an action is taken. Otherwise, the action is ignored.
• Conditionals: Statements that only run under certain conditions.

Open up a discussion of when you might use a conditional in your code.

## Main Activity (30 min)

### Online Puzzles

Students are in for a real treat with this lesson. It's likely most of your students have heard of Minecraft, but give a brief introduction for those that may not know.

Minecraft is a game of cubes. You can play as Alex or Steve as you work through mazes. You'll need to avoid lava, pick up items, and explore in a world made up of cubes of things.

Demonstrate one of the puzzles to the class (we recommend puzzle 11.) Once all questions have been addressed, transition students to computers and let them start pair programming.

## Wrap Up (15 min)

### Journaling

Having students write about what they learned, why it’s useful, and how they feel about it can help solidify any knowledge they obtained today and build a review sheet for them to look to in the future.

#### Journal Prompts:

• Draw a feeling face to show how you felt during today’s lesson.
• Draw something else you could have built in this minecraft world.
• Can you draw a scene where someone is using a conditional?

## Extended Learning

#### More Minecraft

If you find that your class really enjoys the Minecraft environment, here are some links to other Minecraft games they can play online. These games will also teach basic coding skills.

View on Code Studio

### Student Instructions

Add a second `move forward` block to reach the sheep.

View on Code Studio

### Student Instructions

Wood is a very important resource. Many things are made from it. Walk to the tree and use the `destroy` block command to chop it down.

View on Code Studio

### Student Instructions

Sheep-shearing time! Use the `shear` command to gather wool from both sheep.

View on Code Studio

### Student Instructions

View on Code Studio

### Student Instructions

Every house starts with a wall. Build the first part of your house by putting the `place` and `move forward` commands inside the repeat loop.

View on Code Studio

### Student Instructions

Build the rest of your house from any material you'd like. The `repeat` command will come in handy.

View on Code Studio

### Student Instructions

View on Code Studio

### Student Instructions

View on Code Studio

### Student Instructions

View on Code Studio

### Student Instructions

• Challenge
• 11
• 12
• (click tabs to see student view)
View on Code Studio

### Student Instructions

Lava is hiding beneath some of these blocks, which you'll need to cover up before moving forward. An `if` command will come in handy here. Add a `move forward` command in the correct place to mine these blocks.

View on Code Studio

### Student Instructions

Now things are getting tricky. Mine 3 redstone, but don’t fall in the lava. Use an `if` command to place cobblestone over any lava you uncover.

• Practice
• 13
• (click tabs to see student view)
View on Code Studio

### Student Instructions

• Free Play
• 14
• (click tabs to see student view)
View on Code Studio

Teaching Tip

This is a free-play level. This is not only a great place to point students who are progressing quickly, but a place for all students to really express their creativity. While students are not actually required to write any code in this level, doing so will allow them to apply what they have learned in a way that is more meaningful to them. Encourage your students to take their time here.

## Standards Alignment

#### CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
• 1B-AP-10 - Create programs that include sequences, events, loops, and conditionals.