View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Summer 2006 Programming Assignment 1

Due: Friday, 26 May 2006
Simon is a simple electronic game that became quite popular in the 1980s. For a good description of Simon, see the Wikipedia article. Simon allows you to play three types of games:
  1. Simon Says: the player follows Simon's examples for four difficulty levels.
  2. Player Says: lets the user determine the sequence and then play it.
  3. Choose Your Color: a multi-player game that has up to four players (each player plays one button).
To see more complete descriptions of these games, see the Wikipedia article.

For this programming assignment, you are given a rudimentary version of Simon for Squeak and asked to add features to it. You will extend it to do the following:

The Squeak Simon

Uploaded Image: simon.png
Figure 1: Simon (Green Button Pressed)

To use the Squeak Simon, first download the code and install it. To file in the code, open a file list (World Menu::open...::file list), find and select the Simon-initial.st file; click the filein button to install the code. This should create a new category (cs2340-Simon) in the System Browser with the Simon code. To open a new Simon game, execute SimonGame newAsMorph.

Dealing with MV (Model-View) Separation

The Simon version included uses a paradigm for object-oriented user interfaces that is quite common. It separates the model (what the application does) from the view (how the application looks). None of the three classes included are visual elements that you see on the display. Instead, the visual elements are standard pluggable widgets that provide the view for their models (both SimonGame and SimonButton are subclasses of Model). For example, each visual button is a PluggableButtonMorph that has the corresponding SimonButton as its model. Check out these three methods in the SimonButton to see how button flashing is implemented:
When you see something with a # before it, that's a Symbol. Symbols can be used to have arbitrary execution happen at any time. someObject perform: #aMessage is the same as someObject aMessage. Pluggable interfaces use that to determine values. A PluggableButtonMorph determines its label, menu, and action it is to do when pressed based on symbols.

You do not have to separate the model and the view to write UI code in Squeak's Morphic interface; however, it is generally good object-oriented practice to do so. The programming assignments were designed to give you some first-hand experience with this paradigm. The intention is that you learn how to write user interfaces in this manner and see the benefits and drawbacks of this technique over a more ad hoc approach.

Grading Criteria

Collaboration Policy

You are not allowed to share your code with others in this class. You can give or receive incidental help (but not code) from others. This is an individal assignment; you turn in your own code. The only exception to this rule is if you want to complete this assignment using pair programming (read this page if you are interested).

Turn-in Site

Post Questions to the Newsgroup


Links to this Page