©2005 Felleisen, Proulx, et. al.
In this problem set you will learn about the Model-View-Control design pattern for separating the concerns when designing programs with GUI views. You will implement a model for a game (Connect Four) and for a simple calculator. Optionally, you will design a user interface for your model.
When designing programs with user interfaces, the main concern is in making sure that the computer performs the desired tasks correctly. This is the model for the program, the brains behind the observed behavior.
It is possible to design several different representations of the model's operations, the views. For example, a result of a sorting algorithm may be printed out as a list of values, saved to a file, shown as a bar chart, or, even be played as a musical scale. User selecting a state when entering an address into a GUI form may be given a scrolling list, a drop-down menu, a text field into which the information is typed, ar a choice of radio buttons, one for each state.
The connection between the model and one or more views of the values represented by the model and model's behavior is the controller - the glue between the user and the program.
While your assignment involves all three parts, the key focus is on the model part of the program. The interactions with the user are not the required part of this homework. You are encouraged to do at least some of the extra credit parts to gain some experience with the user interface design.
The game Connect Four is played with a vertical board that has seven columns of slots, each designed to hold up to six pegs. Two players take turns inserting their pegs (red or black) into the columns, one peg per turn. The player who manages to connect four of her pegs in a line (vertical, horizontal, or diagonal) wins the game. The game ends in a tie if the whole board gets filled without either player connecting four.