Wednesday, July 23, 2014

Scalable Programming Projects

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.

image

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. 

image

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.

2 comments:

John Olson said...

What are you using to develop your games with? I am still using Scratch because many students stumble with anything harder - I make Python an option for advanced learners at the end of the year.

Alfred Thompson said...

I use Visual Basic with my exploring computer science students after a brief turn at TouchDevelop. My honors students use C#. The simple example here was done in Visual Basic and the more complicated one is in C#. I'm looking at doing more games with my beginners using TouchDevelop because it is about half way between block languages like Scratch and pure text languages like Java, Python, C# and VB.