Assignment 4

Due date: Monday November 8.


In this assignment you will program a Java version of a simple toy of a decade ago: Simon. In case you don't recall, Simon consists of a number of buttons of different colors. The machine flashes the buttons in some random order (it also plays a note associated with each color, but we will ignore this feature for now). The player then recreates the sequence by pushing the buttons in the proper order. The sequences grow in length whenever the player succeeds, and the game stops when the player is unable to replay the whole pattern.
In our simplified version, we will use 4 buttons and a separate panel to display the sequence. When the machine displays a sequence, it changes the colors of the panel accordingly. Then it waits for input from the user, records the buttons that the user pressed, and compares them with the sequence it just played. If the sequence matches, the game continues with a longer sequence. If the sequence doesn't match, the program indicates the length of the longest successful sequence, and asks the user whether it wants to play again.