Minecraft Pi
In this lesson, students will learn some simple programming in Python using Minecraft Pi edition.
Suggested time: 50-100 mins
Learning Objectives:
Curriculum Mapping:
KS2:
KS3:
What is Minecraft Pi:
Minecraft: Pi Edition is a version of Minecraft that’s designed to work on the Raspberry Pi. The Pi edition has the added feature that you can program it using either Python or Java.
What you will need
For each student / group, you will need:
Note: This lesson assumes that students already have some experience of using the Pis and that they have already installed the Raspbian Operating System. To find out how, click here
Starter:
Instruct students to setup their Raspberry Pis and hand out a copy of the Minecraft Pi installer files (along with installation instructions) for students to install. You can find the instructions here: http://pi.minecraft.net
Activity 1 (Installing & getting to know Minecraft Pi):
After all of the students have installed Minecraft Pi edition onto each of their Pis, give them a little time to play around with Minecraft to allow them to get to know the controls.
To launch Minecraft Pi Edition on the Pi:
Open an LX Terminal session
Suggested time: 50-100 mins
Learning Objectives:
- Understand and use sequence in an algorithm
- Understand and use iteration in an algorithm (FOR and WHILE loops)
- Understand and use selection in an algorithm (IF, Else and Else if)
Curriculum Mapping:
KS2:
- Design, write and debug programs that accomplish specific goals; solve problems by breaking them into smaller parts. Select, use and combine a variety of software on a range of digital devices to design and create a range of programs
- Use sequence, selection and repetition in programs; work with variables and various forms of input and output
- Use logical reasoning to explain how some simple algorithms work; detect and correct errors in algorithms and program
KS3:
- Use two or more programming languages, at least one of which is textual, to solve a variety of computational problems
What is Minecraft Pi:
Minecraft: Pi Edition is a version of Minecraft that’s designed to work on the Raspberry Pi. The Pi edition has the added feature that you can program it using either Python or Java.
What you will need
For each student / group, you will need:
- Raspberry Pi (with monitor, keyboard and mouse)
- 4gb SD Card (With Raspbian OS installed)
- Minecraft Pi installer files
Note: This lesson assumes that students already have some experience of using the Pis and that they have already installed the Raspbian Operating System. To find out how, click here
Starter:
Instruct students to setup their Raspberry Pis and hand out a copy of the Minecraft Pi installer files (along with installation instructions) for students to install. You can find the instructions here: http://pi.minecraft.net
Activity 1 (Installing & getting to know Minecraft Pi):
After all of the students have installed Minecraft Pi edition onto each of their Pis, give them a little time to play around with Minecraft to allow them to get to know the controls.
To launch Minecraft Pi Edition on the Pi:
Open an LX Terminal session
then, type in the command:
cd mcpi to change to the Minecraft Pi Edition game directory
followed by: ./minecraft-pi
Activity 2 (Networking the Raspberry Pis):
After about 20 minutes or so of playing around, invite the students to the front of the class and demonstrated the “Hello Minecraft World” script in Minecraft Pi Edition (click here)
Explain to class that they are going to do some programming in Minecraft using Python.
Start by giving each student a copy of the “Hello Minecraft World” python tutorial and ask them to attempt the first task. Those students who completed the task early can attempt the “Placing blocks” task.
Once the students have got to grips with the “Hello Minecraft World” tutorial, give each student a copy of the “Python programming using minecraft pi” student booklet and instruct them to attempt each of the tasks.
cd mcpi to change to the Minecraft Pi Edition game directory
followed by: ./minecraft-pi
Activity 2 (Networking the Raspberry Pis):
After about 20 minutes or so of playing around, invite the students to the front of the class and demonstrated the “Hello Minecraft World” script in Minecraft Pi Edition (click here)
Explain to class that they are going to do some programming in Minecraft using Python.
Start by giving each student a copy of the “Hello Minecraft World” python tutorial and ask them to attempt the first task. Those students who completed the task early can attempt the “Placing blocks” task.
Once the students have got to grips with the “Hello Minecraft World” tutorial, give each student a copy of the “Python programming using minecraft pi” student booklet and instruct them to attempt each of the tasks.
Important! Instructions for using Python with Minecraft Pi edition:
Before using Python to program in Minecraft, students need to create a new folder for their programs. Students will also need to copy the set of Minecraft instructions that allow it to connect it to Python. (Note: Not doing this is the main reason why students get errors when trying to run their code!)
1. Create a new folder four your python scripts:
Open the LXTerminal program, which can be found on your desktop or under the start menu.
Type in the following commands (exactly)
mkdir -p Documents/minecraft cd /Documents/minecraft
Alternatively: You can also create your folders using the Raspberry Pis built in file manager:
Before using Python to program in Minecraft, students need to create a new folder for their programs. Students will also need to copy the set of Minecraft instructions that allow it to connect it to Python. (Note: Not doing this is the main reason why students get errors when trying to run their code!)
1. Create a new folder four your python scripts:
Open the LXTerminal program, which can be found on your desktop or under the start menu.
Type in the following commands (exactly)
mkdir -p Documents/minecraft cd /Documents/minecraft
Alternatively: You can also create your folders using the Raspberry Pis built in file manager:
2. Copy the set of Minecraft instructions into your newly created folder to allow you to connect it to Python:
In LXTerminal program, type in the following command (exactly):
cd Documents
cd minecraft
cp -r ~/mcpi/api/python/* .
Note: make sure you include a space between * and . at the end of the last command.
In LXTerminal program, type in the following command (exactly):
cd Documents
cd minecraft
cp -r ~/mcpi/api/python/* .
Note: make sure you include a space between * and . at the end of the last command.
Plenary:
To finish the lesson, ask for a few volunteers to demonstrate some of their code. (Tip: Ensure that you allocate enough time at the end of the lesson for students to pack away the equipment!).
Resources:
http://pi.minecraft.net - Installation instructions and download link for Minecraft Pi edition
http://www.piprogramming.org/main/?page_id=261 - An introduction to programming Minecraft Pi edition.
http://arghbox.wordpress.com/2013/06/13/programming-minecraft-pi-with-python-early-draft - Programming minecraft pi with python (early draft)
http://arghbox.files.wordpress.com/2013/06/minecraftbook.pdf - Python programming / Using minecraft pi and codeacademy (Student booklet)
http://arghbox.files.wordpress.com/2013/06/teacheredition.pdf - Python programming / Using minecraft pi and codeacademy (Teacher instructions)
http://www.codecademy.com - Great start for learning Python
http://www.raspberrypi.org/learning/minecraft-pi/ - Getting started with programming the Minecraft world
http://arghbox.wordpress.com/2014/04/25/minecraft-pi-recipe-cards/ - Minecraft Pi recipe cards (These recipe cards include a selection of introductory tutorial for programming in Minecraft Pi edition using Python.)
http://www.stuffaboutcode.com/2013/04/minecraft-pi-edition-api-tutorial.html - Minecraft Pi. API tutorials: Collection of tutorials for programming Minecraft Pi edition such as creating massive structures at the click of a button, creating a real time clock or creating a programmable directional canon.
To finish the lesson, ask for a few volunteers to demonstrate some of their code. (Tip: Ensure that you allocate enough time at the end of the lesson for students to pack away the equipment!).
Resources:
http://pi.minecraft.net - Installation instructions and download link for Minecraft Pi edition
http://www.piprogramming.org/main/?page_id=261 - An introduction to programming Minecraft Pi edition.
http://arghbox.wordpress.com/2013/06/13/programming-minecraft-pi-with-python-early-draft - Programming minecraft pi with python (early draft)
http://arghbox.files.wordpress.com/2013/06/minecraftbook.pdf - Python programming / Using minecraft pi and codeacademy (Student booklet)
http://arghbox.files.wordpress.com/2013/06/teacheredition.pdf - Python programming / Using minecraft pi and codeacademy (Teacher instructions)
http://www.codecademy.com - Great start for learning Python
http://www.raspberrypi.org/learning/minecraft-pi/ - Getting started with programming the Minecraft world
http://arghbox.wordpress.com/2014/04/25/minecraft-pi-recipe-cards/ - Minecraft Pi recipe cards (These recipe cards include a selection of introductory tutorial for programming in Minecraft Pi edition using Python.)
http://www.stuffaboutcode.com/2013/04/minecraft-pi-edition-api-tutorial.html - Minecraft Pi. API tutorials: Collection of tutorials for programming Minecraft Pi edition such as creating massive structures at the click of a button, creating a real time clock or creating a programmable directional canon.