One of the things I look for in a project is that it is extensible. That means that a reasonable and simple version can be done but that students who want to do more or who want to challenge themselves can make a very special version that is really them. One such project that I have used in a small way is a slot machine program. One of my co-workers came up with a fairly simple assignment of this type.
1. Slot Machine – Create a slot machine with 3 “slots” (containing pictures or colors). For each round, clear the slots until the user clicks on it (or a button below the picture), and then assign a random color/picture. Allow the user to place a bet and keep track of money won or lost depending on the outcome of the spin.
Beginning students create some fairly simple applications to solve this project. Many of them look something like the following.
I have seen student projects that involve a number of simple variables and a long series of if statements. I am too lazy to do it that way myself and incorporated some arrays and loops in my sample program. By adding arrays and loops the door is opened to a wife range of more complicated features. The sample below incorporates 9 different “rows” with a total of 27 different possible winning values.
It also includes scatter prizes and a bonus game for some conditions. Obviously it has more visual elements as well. Conceptually though is it just an extension and enhancement of the first program.
One of the ideas I am working on it helping students from the simple to the more complicated. By showing them how the addition of arrays and looks I hope to show them how to plan for enhancement, extension and addition of more features to an initially simple program. We’ll see how it works.