# The Variable Coding Challenge in Scratch

In my 6th grade Web 2.0 class, I have the pleasure of spending 8-10 classes with them learning computer programming. Many kids have a little experience with Scratch at this point, through their elementary tech classes. I like to build on this experience by adding on some more advanced coding topics.

One CS topic we cover is variables. Kids learn that a variable is a storage location in the computer for information, and that variables must be declared, assigned, and then they can be substituted into expressions. We practice first by analyzing a program and extending it.

Students work with me to add an extra variable, “weight of pet”. Then we add the weight of the pet to your weight on earth, divide the total by 6, and tell you the weight of both you and your pet on the moon.

Before introducing their work time assignment, we watch a video about pair programming. I like this video and think it’s fun, cute, age appropriate and to the point.

We go over the norms of pair programming, I partner the kids up, and give them an assignment. They can choose one of the four variable challenges listed here. They must create a Scratch program that uses variables, “ask” blocks, and math operations to complete the challenge.

*Challenge 1: Patrick and Spongebob are going shopping. Spongebob needs snail chow and Patrick needs Krabby Patties. Each box of snail chow costs $2.19. Each Krabby Patty costs $6.25. The cashier should ask how many boxes of snail chow and how many Krabby Patties they want, and store the amounts as variables. Tell Spongebob and Patrick how much their total bill is.*

*Challenge 2: Fluffy is getting new carpet installed in her apartment. She knows the length and width of her family room and bedroom. When she goes carpet shopping, she finds out the carpet she wants is $3.50 per square foot. Also, there’s a $250 installation fee. Fluffy should use variables for the length and width of the family room, and calculate the total cost of the carpet. *

*Challenge 3: Kanye has a rectangular hot tub, but he’s under water restrictions, so he needs to keep track of how many gallons of water he’s using. Kim knows there are 231 cubic inches in one gallon. She should ask Kanye for the length, width, and height of his hot tub and store them as variables. Then, she should calculate how many gallons are needed to fill the hot tub.*

*Challenge 4: Neville and Hermione are helping Hagrid take care of his reptiles. His lizards eat 7 crickets each day. The bearded dragons eat 18 crickets each day. The juvenile Norwegian Ridgebacks eat 95 crickets each day. The kids need to purchase a week’s worth of crickets. They should ask Hagrid how many lizards, bearded dragons, and Norwegian Ridgebacks there are, and store those as variables. Calculate the number of crickets needed for a WEEK and say how many need to be bought.*

The kids found the challenges very engaging! They worked hard and the pair programming protocol worked overall quite well for them.

Their programs were adorable, clever and fun. Here were some of them!

The Patrick / Spongebob Challenge:

- These students laughed and laughed at their funny sound effects and animation.

https://scratch.mit.edu/projects/76306266/#editor - A little different programming solution that re-uses the input variables. It works well!

https://scratch.mit.edu/projects/76696962/#editor

The Fluffy Carpet Challenge:

- These kids worked so hard designing the perfect costumes for Fluffy the rock and the carpet salesman. https://scratch.mit.edu/projects/76306458/#player
- These kids spent a lot of time recording audio and their program is absolutely amazing. At press time, it had a math mistake which is a quite common misconception for kids. I’ll post the link to the program and the original pic of the code here. Program: https://scratch.mit.edu/projects/76297504/#editor

The kids nested the math operations without really paying attention to the order of operations.

The Kim and Kanye Hot Tub Challenge:

- These kids did a great job modeling the math and even drew a boxy hot tub.

https://scratch.mit.edu/projects/76307002/#editor - I think Kanye would approve of this program. Slightly different math, accurate volume calculation (assuming input is inches).

https://scratch.mit.edu/projects/77124304/#editor

Neville and Hermione Reptile Challenge:

- An interesting implementation that involves using events and messages to turn this into sort of animation. https://scratch.mit.edu/projects/76718870/#editor
- Cute program with little wizards in it, and slightly different math. https://scratch.mit.edu/projects/75931612/#editor

These were exemplars – there were some groups who were unsuccessful at the start, and as we’re in a standards-based system, the kids get as long as they want to show me they’ve mastered the use of variables. Many of them will get it as we work through the next few programming challenges. Overall I was so pleased and proud with their engagement, creativity, and attention to the precision in this task.

The problems I selected are very similar to word problems they’d be assigned in sixth-grade math class. Sixth grade is a big year for learning about variables and expressions, unit prices, area, and volume of rectangular prisms. The thinking is a little different when writing a computer program versus doing a word problem on paper, or with a calculator. The feedback is instantaneous, and you tend to test your program on several different inputs to see if you get reasonable answers. It’s easy to go back and revise your thinking if you have made a mistake, and more rewarding when you get the expression right. There are many correct ways to complete a task, some of which can involve quite a bit of creativity.

# MinecraftEDU in the classroom: My first few lessons.

This semester, I’m teaching an enrichment class using MinecraftEDU. We have 40 minutes at the end of the day, every other day, for a semester. In my class, I have seven girls and 21 boys, all seventh- and eighth- graders.

From the beginning, I told them that I had been reading a lot about Minecraft and playing some over the summer, and that some of my teacher friends felt it could be used as an educational tool, while others were not convinced. I wanted to test the idea that you could use Minecraft in education.

The plan is and continues to be that every day, we will either download an existing lesson from the Minecraft EDU World Library and try it and review it, or we’ll create our own lesson with an educational goal in mind. Every day, a different student blogger will write about our experiences.

We have used several lessons from the Worlds Library and blogged about them here!

http://prestonminecraft.weebly.com/

After trying a few canned lessons, I created a world that was mostly empty except for border areas for groups of students, and chests with some building supplies such as stone, redstone, doors, levers, and lamps. I told the students I wanted to try a group building activity where they make an interactive learning experience using redstone. Perhaps a quiz with questions students can answer. I was vague about what I wanted, knowing what they gave me would be different than my expectations anyway.

I split the class into four groups and put them in this world.

We reviewed, briefly, norms for how to act in a creative Minecraft situation, and worked for two class periods – along with opening and closing and logistical things, the students probably had 60 minutes of build time. This is what the world looks like now.

Almost none of the students actually created an interactive quiz, but almost all of them did create something. Some of their creations, as you can see, are very creative and interesting. They’re learning new building techniques from each other and by trial-and-error.

There were some amazing things going on and some problems that I need to address.

Amazing things:

- If students didn’t know how to accomplish something, they were resourceful in figuring it out. For example, one student wanted to create a display that shoots fireworks if you click the right lever. He researched how to make fireworks in Minecraft, gave me a list of supplies he needed, and planned the display. The student who created the waterfall display did similar research and gave me a supply list.
- Students were constantly iterating on their designs and learning from them. One of my students said “I realized that you could click any lever and all of my lamps would come on, so I had to re-wire all of the redstone.
- Students were teaming up and creating structures together. A group of three students made an underground house with redstone-activated doors and a labyrinth inside.

On the topic of problems I need to address:

- I have one or two students who have decided to take on the role of griefers. I saw one doing Google searches on how to get around border blocks in MinecraftEDU, and then he took what he learned to enter other student areas and damage their structures. Another student would log off, log on under a different name, say bad words in the chat, and then log back on again. The class is very big, as you can tell, with 28 students, so I didn’t catch every problem right away. It created a very bad vibe.
- When a student discovers building supplies stashed somewhere, their first instinct is to take them and use them to build. Groups of students complained often that their supplies kept getting stolen. I see this as a problem-solving opportunity so we can work out a system for you to have private areas to keep items you want later. Perhaps signs next to chests and a class rule about what to do when you see a chest that is labeled. Students asked me for Ender Chests which you can lock, but I hesistated, not knowing anything about Ender Chests. My own inexperience with Minecraft is a limitation at times.
- I would say there can be cliques in the building world – for example, the girls tend to stick together and build separately from the boys, and the boys tend to team up with their close friends and ignore other groups. Community building, creating an atmosphere of trust and respect, needs to be done intentionally and explicitly, and I went into Minecraft building without doing enough of that up front.

This first creative world is clever and I intend to set up a day in which we have groups of students come in for tours of the redstone build. Students will have to create signs and arrows that show how to get around their creations and use them. By the end of the semester, I want students to create a world with missions that teach something of educational value and give other classes a tour through it.

This class is so weird. It’s messing with what I know about public schooling. Kids are so engaged and excited by it. I can’t point to many math or science or social studies standards that we can progressively understand by using Minecraft. Students seem to be having fun, working together, and making creative things. Is there educational value in just that? Could I measure the impact of Minecraft if I wanted to? Is this a valuable class?

Those are questions I’ll be thinking about as we progress here.

## Recent Comments