Sudoku Application
by
Wilson Saunders

Introduction:
The BREW Sudoku applicatoin allows the user to solve Sudoku puzzles on their BREW enabled phone. It was written for the purpose of showing Wilson Saunders' aptitude at using the BREW user interface.

View from the user:
The user starts in the main menu. He or she is presented with seven options; "Blank Grid", "Easy", "Medium"," Hard", "Help", "Credits", and "Exit". The User can navigate these options by pressing the up or down keys on the direction pad. The options "Blank Grid", "Easy"," Medium" and "Hard" will take the user to the grid control screen which will be discussed later. The "Help" option will take the user to a new screen where instructions on how to play the game are contained. To return to the main menu the user is prompted to press the clear button. The "Credits" option will take the user to a new screen where Wilson Saunders is given credit for creating this wonderful program. Once again the user in prompted to press the clear button to return to the main menu.

The grid control screen displays the standard nine by nine Sudoku puzzle grid. One of the grid squares is selected and is indicated by a light blue back ground. The user can move the cursor around with the direction pad buttons. The number buttons enters the values 1 thru 9 into the selected square. At the bottom of the screen are three word the center of which is highlighted. The center word is the active option. When the user presses the left or right soft key the active options switches the option to the left or right respectively. Pressing the Ok button in the center of the direction pad activates the selected option.

The grid control commands are "Main Menu", "Note", "Clear", and "Lock". When "Main Menu" command is activated the program shifts back to the Main Menu and the grid data is lost. When the "Note" command is activated the program turns the value in the selected grid square into a little note at the corner of that square. One square can display multiple notes. This feature is not implemented yet. When the "Clear" command is activated the entire grid is made blank. When the "Lock" command is activated all squares with a number in it will get locked. Locked squares can not be modified and are meant to represent the original numbers provided in a Sudoku puzzle. Of course the user is free to lock the numbers when ever he or she feels like.
Click here to download Source Code
View from the programming classes:

The Sudoku application's UI consists of C++ classes. They are MainMenu, IgridCtrl, GridSlideCtrl, Grid, DepGrid, HelpScreen, and CreditScreen. MainMenu is a wrapper class for all the other classes. It receives events from the main event controller and based on the internal state value handles the event or passes it to another event handler. Its draw function renders the menu screen with the current selection in bold.

The IgridCtrl handles the game screen. It maintains a Grid, a DepGrid, and a GridSlideCtrl. It also handles key press events that allow the user to interact with its internal classes.

The Grid Class contains 81 integer values in an array that represent the sudoku grid.

The DepGrid contains a two dimensional array of integers. The first dimension represents grid locations . The second dimension is an array of the 20 grid locations that the first grid location depends on. The DepGrid class assists in theenforcement sudoku rules.

The GridSlideCtrl is th soft key handler of this program. It swaps active options when a soft key is pressed and activates that option when the select/OK key is pressed. The actual handling takes place in IgridCtrl but the GridSlideCtrl holds the data and is responsible for rendering.

The HelpScreen class contains an array of AEECHAR arrays. When its Draw function is called the text stored in its array is drawn to the screen. It is controlled by the HandleEvent in MainMenu.

The CreditScreen class contains an array of AEECHAR arrays. When its Draw function is called the text stored in its array is drawn to the screen. It is controlled by the HandleEvent in MainMenu.



Click here to download Source Code

This website is hosted for free by free website - Webs.com. Get your own Free Website now!