Lesson 19: Conditionals in Minecraft

Overview

This lesson gives students a chance to learn and practice conditionals. It features characters and settings from Minecraft, and students will complete tasks such as mining and building structures using their programs.

Purpose

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

Agenda

Warm Up (15 min)

Main Activity (30 min)

Wrap Up (15 min)

Extended Learning

View on Code Studio

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

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the Teachers

For the Students

Vocabulary

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

Support

Report a Bug

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 to solve this problem on Code.org. 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)

CSF Express Course - Website

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.

Ask the students if they have ever played Minecraft. If none have, move on to the main activity. If some have, ask those experts to explain the game to the class. If everyone in the class has already played, go ahead and move on to the online puzzles.

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:

  • What was today’s lesson about?
  • How did you feel during today’s lesson?
  • What did you enjoy about the puzzles today?
  • When did you use conditionals in this lesson? Why did you use them?

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.

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards (2017)

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