Project 2 — TurnRed
Requirements (100 points)
Your task is to implement a grid game called TurnRed. The grid is composed of squares that are either blue or red. Clicking a square toggles its color and the colors of its cardinal neighbors (up, down, left, and right). The goal of the game is to turn all the squares red.
User Interface
The game form should consist of a 10x10 grid of squares. These squares can be buttons, picture boxes, panels, or any other controls you want to use. You also may want to define a custom control for the squares. The controls used for the game grid must be created and added programmatically -- do not use the Form Designer for the game grid.
The game form should also provide the following features:
- Start a new game. If a game is in progress, you should prompt the user to see if he wants to quit the current game.
- Undo the last move. The number of undos should be unlimited. You will probably want to use a stack (System.Collections.Generic.Stack) to keep track of the user's history of moves.
- Open a separate options form to allow the user to customize square colors and square size.
The options form should allow the user to select the two square colors (make use of the ColorDialog control for this) and the square size (a HScrollBar is a good choice for this). There should also be two buttons, one confirming the changes and one reverting to the previous settings. If you wish, you can also add a button to restore the original settings.
Functionality
You should use a Settings file to keep track of the two square colors, the square size, and the location of the form between executions of your app.
To begin a game, set all the squares to red (or whatever the winning color is) and perform a number of random clicks to shuffle the board. You can fix the number of clicks to be a constant -- about 8 to 12 is a good number. These shuffle clicks should have the same effect as a normal user click.
Extra Credit (10 points)
Preview Settings (5 points)
Update the main form as the user is trying out different settings in the options form.
More Options (5 points)
Allow the user to change the number of squares in the grid and the number of random shuffle moves at the beginning of a game. These settings should also be saved.