Rob Huddleston


The Dice Roller


One of the projects in the class is to use Scratch to create a simple dice-rolling application. This forces students to think through how the language can generate a random number and then apply that number to a variable, which can in turn be used by an if-else if-else block to pick an appropriate image to display. The project is first introduced using a standard six-sided die, but then students are further challenged to expand the program to roll not just one, but two dice, and so need to rethink their variable declarations. Later, they further expand the program to roll eight and even twenty-sided dice.

Later, students recreate this exact project using Python, which gives them a change to directly compare-and-contrast the languages and see that syntax is all that changes: once they figure out the logic of a program in one language, they will be able to apply that same logic to solving the same problem in other languges.


There's nothing particularly difficult from a coding perspective of this project, which is why it works so well. Everyone in the class has rolled dice before, so they get the basic concept. However, many have never really stopped to consider what dice are: simple yet highly functional random number generators.

Because they are able to easily grasp the concept behind the app, they can focus on how to solve the problem within first Scratch, then Python.

At the end of the class session, they have created something cool, but more important, they know they've created something cool. The sense of accomplishment helps them realize that programming isn't nearly as hard or scary as they once thought, and that, in the end, is my true goal for the class. I don't want to teach them programming so much as I want to teach them that they need not fear programming.