You are on page 1of 34

Android Game Suite

CS 430 Requirements Specification February 14th, 2010


Benjamin Carpenter Ryan Daugherty Jack Dehlin Jay Greene

Table of Contents 4.0 Connect Four....................................................................................................................11

1.0 Introduction This document specifies the requirements for the production and design of the Game Suite software for the Google Android operating system. The product will be a suite of five simple and easy games for a user to play. The games include a word search, connect four, battle ship, hangman, and a Sudoku. The first four games will be uniquely developed and the fifth will use an open source Sudoku. The user interface will be easy to use and allow the user to go in-between games with ease. It will use the cell phone operating system Android, which is on a lot of cell phones today. The android operating system uses a market place to sell applications for the phone. 1.1 Goals and objectives The goal of this project is to produce an interactive and entertaining application for the Android marketplace. This app will be a suite of several smaller games, one of which is open source, the rest custom made. They will be playable on any phone supporting the android operating system with access to the internet. 1.2 Statement of scope The only input to this project is the user's attention and strategic moves; and the only output is the entertainment that is a consequence of the input. 1.3 Software context The big picture of this project will be to provide entertainment for anyone with access to an Android device. 1.4 Major constraints Since this project can easily be broken down into many smaller functioning parts, there are few major constraints. As long as the Android Marketplace is up and running and people are still using the Android OS, it will be possible to market, maintain, and operate this application. 2.0 Usage scenario 2.1 User profiles Users of the system will be anyone who has a mobile device operating the Android OS with access to the Android Marketplace. The application will be accessible to everyone by these means and require only navigation of the menus and games through the touch-screen interface. 2.2 Use-cases Figures one and two show the different use cases for the game suite. Figure one show the interaction between the user and the Android OS. Figure two show the interaction between the user and the main menu.

Figure One: Use Case Diagram for interaction with the user and the Android OS

Figure Two: Use Case Diagram for interaction with the user and the main menu

3.0 Word Search 3.1 Data Description The word search utilizes a couple of different data objects. These objects are used for passing data around and keeping track of information. The data keeps track of selected letters, selected words, and game scores. 4

3.1.1 Data objects The first data object is the user. The user will select letters to make words for the word search. The letter themselves are characters. Multiple selected letters are formed to make a string. Once the user is content with the selected word, it can be submitted to check if it is actually a word. The second data object is the collection of selected words. These words are stored in the form of a string and an array of tiles. If the submitted word is correct it is appended to the collection of selected words. If it is wrong then the word is discarded. The third data object is the final score when the game is ended. The score is calculated by counting the number of letters submitted in the selected words. The game will locally keep the highest score for display. 3.1.2 Relationships The relationships between the data objects above can be seen in the figure below. The user will submit data and the program will pass around that data. 3.1.3 Complete data model

Figure three: Word Search Complete Data Model

3.1.4 Data dictionary All the data except for the high score is only stored when it is running. Once the program is ended all data will be discarded. The high score will be stored on the phones memory and shown at the startup screen. 3.2 Functional Model and Description 3.2.1 Description for Functions 3.2.1.1 Startup This function is initiated when the word search game is pressed from the home screen. The function starts a new activity that shows the main menu for the game. 5

3.2.1.2 New Game This function is initiated at the initial screen when the new game button is pressed. After the button is pressed, it creates a random puzzle, draws the board, then passes of the responsibility to the main game function. 3.2.1.2.1 Create Random Puzzle When a new game is started, this function randomly picks 81 numbers. The range of the numbers is 0 to 25 and is then converted to character to represent a letter. The letters are then stored in an array. 3.2.1.3 Main Game Function After a new game is started, the main game function runs functions to watch the user actions and act accordingly. 3.2.1.3.1 Draw the Board Every time an action or function is called the board is redrawn to show the changes. The function draws a 9x9 board with the letters inserted into each position. The function looks at an array to see which words were already correctly selected. These words are drawn a different color. 3.2.1.3.2 Select Letters This function is supported by the android onclicklistener. When a user selects a letter, it records it in an array. It keeps track of the order that the user presses the letters in. 3.2.1.4 Menu Functions During the game the user can press the menu button to bring up options. The menu option is used to conserve space on the screen. 3.2.1.4.1 Submit a Word After letters are selected the user can submit the word to see if it is a correct word. The function calls dictionary check and gets the result. If it is a word, then the word is added to the submitted word data object. If it is not a word, then the screen shakes. After the word functions are done, the selected is cleared with the clear function. 3.2.1.4.1.1 Dictionary Check

When a word is passed into this function it uses the Google online dictionary search. It gets the source page of the search and parses it to see if the word is in the dictionary. It returns the result. 3.2.1.4.2 Clear the Board This function clears the board of the selected letters. 3.2.1.4.3 Help This function displays the rules of the game. 3.2.1.4.4 View Submitted Words This function displays the words that have been submitted and that were in the dictionary. 3.2.1.4.5 Finish Game This function ends the current game and takes the user to the main menu of the game. The function uses the calculate score function then displays the score of the game. It ends the new game activity. 3.2.1.4.5.1 Calculate Score This function calculates the final score of the game. It does this by counting the number of letter in the submitted words data object. 3.2.1.5 High Score When a game is finished and the score is calculated, the score is compared to the high score. The higher score is then stored on the phone. The high score is displayed on the main screen of the game. 3.2.1.6 Exit Game This function exits the games main menu back to the game suites main menu. 3.2.2 Software Interface Description Word search uses one interface that the user can see. The one that they see is through the cell phone. The cell phone must be running the Android operating system. The game also interfaces with Google web dictionary search, but it is not seen. 3.2.2.1 External machine interfaces The game will run on two different machines. One is an emulator of a cell phone that is used for development and testing. The other is the users cell phone that hosts the game. The game must be compatible with the Android operating system. 7

3.2.2.2 External system interfaces To play the game, the user must be connected to the internet either through the phones data network or Wi-Fi. The Google web dictionary search is to check to make sure the word exists and is not seen by the user. 3.2.2.3 Human interface This is the main interface that the user will interact with. The interface will allow the user to use the phones touch screen services and analog buttons. This interface is clear and easy to use. It shows buttons and text so the user can understand what is going on. 3.2.3 Control flow description The control flow of the word search starts when the user starts a new game. After the new game is started there will be different states of the game. This continues till the game is finished. This described in section 5.0 and its subsections. 3.3 Behavioral Model and Description 3.3.1 Description for software behavior 3.3.1.1 Events 3.3.1.1.1 New Game Button Pressed A new game is started, puzzle made, board is drawn. 3.3.1.1.2 Letter Selected When the user touches a box, the box is documented. After it is documented then the board is redrawn with the box highlighted. This is done till another event happens. 3.3.1.1.3 Menu Button Pressed When the phones menu button is pressed a menu pops up. 3.3.1.1.4 Submit Button Pressed When the submit button is pressed the word is checked to see if it is misspelled or not positioned right. 3.3.1.1.5 Word is not misspelled Word is checked to see if they are in correct positions. 3.3.1.1.6 Word is misspelled Selected letters are cleared then the screen shakes.

3.3.1.1.7 Letters are in Correct Positions Word is appended to the submitted word data object then the selected letters are cleared. Letters can only be played if they touch the next letter in the vertical, horizontal, or diagonal direction. 3.3.1.1.8 Letters are not in Correct Positions Selected letters are cleared then the screen shakes. 3.3.1.1.9 Help Button Pressed The rules are shown in a dialog box. 3.3.1.1.10 View Submitted Button Pressed The correctly submitted words are shown in a dialog box. 3.3.1.1.11 Clear Selected Button Pressed Selected letters are cleared from the screen. 3.3.1.1.12 Finished Button Pressed Game is returned to the games home screen and the score is calculated and shown. 3.3.1.1.13 No High Score is found A default zero is displayed on the games home screen. 3.3.1.1.14 High Score is found The highest score is displayed on the games home screen. 3.3.1.2 States 3.3.1.2.1 Main Menu The main menu is displayed with the buttons for a new game and exit. 3.3.1.2.2 Select Letter The board is displayed where a user can select one or multiple letters. 3.3.1.2.3 In Game Menu A menu is displayed that gives the option to submit a word, clear the selection, view submitted, show help, finish game, or go back to select a letter. 3.3.1.2.3 Submit Word 9

Word goes through checks to see if it is a word and in the right position. Word will light up or the screen will shake. Returns to the select a letter screen with the selection cleared. 3.3.1.2.4 Clear Selection The board will be cleared of the selected and return to select a letter. 3.3.1.2.5 View Submitted A dialog box will show the correctly submitted words. 3.3.1.2.6 Show Help A dialog box will show the rules of the game. 3.3.1.2.7 Finish game The game will end a show a dialog box with the score. It will return to the main menu. 3.3.1.2.8 Display Score 0 When a score is not found then a default zero is displayed. 3.3.1.2.9 Display High Score Retrieves and displays high score from memory. 3.3.1.2.10 Shakes Screen Shifts screen by using an offset to appear to be shaking. 3.3.1.2.11 Highlights Letters Turns letters gold when the word is not misspelled and letters are in correct positions. 3.3.1.2.12 Highlight Letter Turns the selected box a different color. 3.3.2 State Transition Diagrams

10

Figure four: Word Search State Diagram

4.0 Connect Four 4.1 Data Description The Connect Four game keeps track of data such as current players turn, current locations of chips in the board, and end game scenarios. 4.1.1 Data objects The first data object is the user. Users will take turns selecting columns on the board in which to drop their chips. The board will be a seven by six array of slots. As each user selects columns to place their chips there locations on the board will be recorded to the array. At the end of each game when a player has achieved four of their chips in a row the number of wins for their color will be increased by one and stored locally. 4.1.2 Relationships The relationships between the data objects above can be seen in the figure below. The user will submit data and the program will pass around that data. 11

4.1.3 Data dictionary If the game is closed at the end of a round or before any player places a chip when a new game is started then no data is stored other than the tally of wins. If the game is closed mid round then the state of the board is stored locally and reinitialized upon re-launching the application. 4.2 Functional Model and Description 4.2.1 Description for Functions 4.2.1.1 Startup This function is initiated when the Connect Four game is pressed from the home screen. The function starts a new activity that shows the main menu for the game. 4.2.1.2 New Game This function is initiated at the initial screen when the new game button is pressed. After the button is pressed, it creates an empty board of seven by six, draws the board, then passes off the responsibility to the main game function. 4.2.1.3 Main Game Function After a new game is started, the main game function runs functions to watch the user actions and act accordingly. 4.2.1.3.1 Placing a Chip This function is supported by the android onclicklistener. When a player selects a column to place their chip the lowest empty space in that column is changed to their color. 4.2.1.3.2 Check for Victory Each time a chip is placed the game will check if that player has won by trying to find three adjacent chips of their color in any direction. 4.2.1.4 Menu Functions During the game the user can press the menu button to bring up options. The menu option is used to conserve space on the screen. 4.2.1.4.1 New Game This function clears the board and begins a new game. 4.2.1.4.2 Help This function displays the rules of the game.

12

4.2.1.4.4 View Wins This function displays the total number of wins for each color, black and red. 4.2.1.4.5 Exit This function ends the current game and takes the user to the main menu of the game. If any chips have been placed on the board the locations of those chips is stored on the devise and reloaded once the application is restarted. 4.2.2 Software Interface Description Connect Four uses one interface that the user can see. The one that they see is through the cell phone. The cell phone must be running the Android operating system. 4.2.2.1 External machine interfaces The game will run on two different machines. One is an emulator of a cell phone that is used for development and testing. The other is the users cell phone that hosts the game. The game must be compatible with the Android operating system. 4.2.2.3 Human interface This is the main interface that the user will interact with. The interface will allow the user to use the phones touch screen services and analog buttons. This interface is clear and easy to use. It shows buttons and text so the user can understand what is going on. 4.2.3 Control flow description The control flow of the Connect Four game starts when the user starts a new game. After the new game is started there will be different states of the game. This continues till the game is finished. 4.3 Behavioral Model and Description 4.3.1 Description for software behavior 4.3.1.1 Events 4.3.1.1.1 New Game Button Pressed A new game is started, empty board is drawn. 4.3.1.1.2 Column Selected When the user touches a box at the top of a column the lowest empty space in that column is switched to that users color. This is done until another event happens. 4.3.1.1.3 Menu Button Pressed 13

When the phones menu button is pressed a menu pops up. 4.3.1.1.4 Column is full The screen shakes and the player is allowed to select another column. 4.3.1.1.5 All Columns are full The game ends and a new one begins with an empty board. 4.3.1.1.6 Player Gets Four in a Row The score tally for the winning color is increased and a new game begins. 4.3.1.1.7 Help Button Pressed The rules are shown in a dialog box. 4.3.1.1.8 Exit Button Pressed Game is returned to the games home screen and the score is calculated and shown. 4.3.1.1.9 View Wins Button is pressed The total number of wins for each color is displayed. 4.3.1.2 States 4.3.1.2.1 Main Menu The main menu is displayed with the buttons for a new game and exit as well as the number of wins. 4.3.1.2.2 Select Column The board is displayed where a user can select a column to place their chip. The game checks to see if the newly placed chip makes the player a winner. 4.3.1.2.3 In Game Menu A menu is displayed that gives the option to start a new game, view wins, show help, end game, or go back to continue game. 4.3.1.2.6 Show Help A dialog box will show the rules of the game. 4.3.1.2.7 Exit game

14

The game will end a show a dialog box with the wins. It will store any currently placed chips and return to the main menu. 4.3.1.2.8 Display Wins 0 When a score is not found then a default zero is displayed. 4.3.1.2.9 Display Wins Retrieves and displays wins from memory. 4.3.1.2.10 Shakes Screen Shifts screen by using an offset to appear to be shaking. 4.3.2 State Transition Diagrams

15

Figure five: Connect Four Data Model

5.0 Battle Ship 5.1 Data Description The game battleship utilizes integer arrays to store locations of ships and moves played. There are also Strings that contain such things as high score tables and other user-related information. 5.1.1 Data objects The first integer array contains a list of ship placements made when the game first begins. The second array contains a list of moves made. By comparing the two, a 22x11 grid can be displayed. The top 11 coordinates displaying moves already played, the bottom 11 displaying the players remaining ships. 5.1.2 Relationships The data relationships can be seen in the graph below. The first two arrays are made independently through game progression. The Game Board is then computed by comparing the two. 5.1.3 Complete data model
Figure six: Battle Ship Complete Data Model

5.2 Functional Model and Description 5.2.1 Description for Functions 5.2.1.1 New Game When this function is initialized it sets up the data objects for the game. It allows for the user to customize their ship placements and randomizes a ship placement for the computer. It then generates the grid to be displayed. 16

5.2.1.2 Make Move Once the board is set up, the user is prompted to make a move. After a move is made, it is compared to the data arrays to check for hits, misses, repeats, etc. The process is then randomly repeated for the computer. 5.2.1.2 Game Over This function is called when the game recognizes that either the user or computer as hit every coordinate of the opposing ship placements. It will record a high score and prompt the user to play again. 5.2.2 Software Interface Description The software interface is the same as the previous programs. It requires a touch screen, Android-run device capable of internet connection. 5.2.3 Control flow description The control of the game jumps between the user and the computer as moves are made. It begins when the game is initialized and ships are placed and ends when a player has won. 5.3 Behavioral Model and Description 5.3.1 Description for software behavior 5.3.1.1 Events 5.3.1.1.1 New Game (Place Ships) A Difficulty is selected and ships are placed by the User and Computer. A Game Board is this created. 5.3.1.1.2 Perform Move The User is prompted to make a move. The move is then compared against the existing data. The computer follows in turn and the user is prompted again. 5.3.1.1.3 Game Over When the game senses that no enemy ships remain, then the game is over. The Player is then prompted to play again. Yes takes the player back to the New Game event; No takes the user back to the Main Menu. 5.3.1.2 States 5.3.1.2.1 Main Menu The user has the option to set the difficulty of the game, view high scores, and start a new game.

17

5.3.1.2.2 Playing Game The User and Computer alternate performing moves until someone wins or the game is prematurely ended. 5.3.2 State Transition Diagrams

Figure seven: Battle Ship State Diagram

6.0 Word Guesser 6.1 Data Description The word guessers utilizes a few different data objects each of which are uses for passes data around the program and keeping track of information. The data keeps track of the correct answer to the word guess as well as each individual character within the answer, each individual word also tracking each individual character within each guess, as well as the number of individual guesses. 6.1.1 Data objects The first data object is the new game. Once the word guess application is selected from the home screen a new game is initiated with an answer, a guess count, a guess array and a Boolean correctness field. Each element of the guess array is a character array so that each letter of each guess can be compared to the correct answer. There will be a button at the bottom of the UI which will allow the user at any point within the running of the program to create a new game, at which time the previous game will be overwritten.

18

The next data object is the answer. The answer will be generated at the beginning of each new game accessing a predefined list of six letter words. The answer will be stored in an array of characters. The third data object is the guess array. The guess array will consist of six elements each of which is a character array. It will be generated from an Edit Text field submitted by the user. If the guess is a valid word (I.e. has six characters, and all characters are letters) then the guess will be converted to a character array and added to the guess array. Otherwise the guess will be ignored, the user will be prompted of the mistake and will be able to submit another guess. The final data object will be the final score when the game is ended. The score is calculated by counting the number of words correctly answered before ending the game, multiplying that number by one thousand and subtracting the number of guesses taken multiplied by 50. The game will locally keep the highest score for display. 6.1.2 Relationships The relationship between the data objects above can be seen in the following figure. The user will submit data and the program will process that information accordingly. 6.1.3 Complete data model

Figure eight: Word Guesser Complete Data Model

6.1.4 Data dictionary 19

All of the data excluding the word dictionary will be stored on when the program itself is running. Once the program is stopped, or a new game is initiated, all data will be discarded. The word dictionary will be stored on the phones memory and will be accessed at each initiation of a new game, at which time a random word will be selected as the answer for that particular game. 6.2 Functional Model and Description 6.2.1 Description for Functions 6.2.1.1 Start Up This function in initiated when the word guesser game is pressed from the home screen. The function starts a new activity that shows the main game screen for the word guesser. 6.2.1.2 New Game This function in initiated once the word guesser button is pressed from the game suite home screen and when the new game button is pressed from the menu of word guesser. Once the button is pressed, a new answer is selected from the word dictionary, the guess array is reinitiated to the default values, the guess count is reset to zero and the correctness field is set to false. 6.2.1.2.1 Answer Generator When a new game is started, a random number between 0 and 600 is generated at which time the program traverses the word dictionary for the generated amount of interactions and returns that word as the correct answer for the game. 6.2.1.3 Main Game Function After a new game is started, the main game function runs functions to watch the user actions and act accordingly. 6.2.1.3.1 Submit Guess Function Each time the OK button located adjacent to the Edit Text field is selected a function is called to first check the validity of the guess (i.e. current length and correct characters). This guess is first stored as a String; however, will be passed through the split() function to create a character array of the guess for comparison. 6.2.1.3.2 Split Functional Once the guess string is retrieved from the Edit Text field, this function is called to create a character array of the guess. A string is passed to the function and a character array is returned. This function is also used for the correct answer of the game which is generated from the word dictionary. 20

6.2.1.3.3 Compare Function Once the correct answer and the individual guess are submitted, those two character arrays are passed to the compare function to determine the correctness of the guess. Each character within the guess array is first compared with the character in the corresponding position of the answer array. If those two characters are alike then the setColor() function is called and the character is printed red. If those two characters are not alike the guess array character is then compared to every other character within the answer array. If that character is found in the answer array then the setColor() function is called and the character is printed yellow signifying that the character is in the answer, but not in the correct position. If the character from the guess array is not found in the answer array then the character is left as is. 6.2.1.3.4 Set Color Function This function is called within the compare function. The guess character array, an index identifying which element of the array is being manipulated and integer value signifying which color to set the text to be passed to the function. The return value of the function is void. 6.2.1.4 Menu Functions During the game the user can press the menu button to bring up options. The menu option is used to optimize screen space, avoiding clutter. 6.2.1.4.1 Help This function displays the rules of the game. 6.2.1.4.2 New Game This function ends the current game and resets all data to default values within the word guess game screen. All previous data, other than the word dictionary, are destroyed. Selecting this option will nullify the possibility to store the game score. 6.2.1.4.3 View High Score This function displays the current high score for the word guess game as well as the score of the current game for comparison. 6.2.1.4.4 Finish Game

21

This function is very similar to the New Game function; however, rather than taking the user back to the word guess game screen, the user is returned back to the game suite home screen as well as the final score being calculated and submitted to the system. It ends the new game activity. 6.2.1.4.4.1 Calculate Score This function calculates the final score of the game. It does this by counting the total number of correct answers without ending the game multiplied by 1000 and subtracting the total number of guesses multiplied by 50. 6.2.1.4.4.2 High Score When a game is finished, either by the user incorrectly guessing six consecutive times or by selecting finish game in the menu, the score is calculated and compared to the current high score. The higher of the two scores is stored onto the phone and displayed in the high score option of the menu. 3.2.1.5 Exit Game This function exits the word guesser game screen and returns back to the game suite's main menu. 6.2.2 Software Interface Description Word guesser uses on interface that the user can see. The one that they can see is through the cell phone. The cell phone must be running the Android OS. 6.2.2.1 External machine interfaces The game will run on two different machines. One is an emulator of a cell phone running the Android OS which will be used for development and testing. The other is the user's cell phone that hosts the game. The game must be compatible with the Android OS. 6.2.2.2 External system interfaces There are no external system interfaces for the word guess game. 6.2.2.3 Human interface This is the main interface that the user will interact with. The interfaces will allow the user to use the phone's touch screen services and analog buttons. This interface is clear and easy to use. It shows buttons and text so the user can understand what is going on within the application.

22

6.2.3 Control flow description The control flow of the word guesser starts when the user starts a new game. After the new game is started there will be different states of the game. This continues till the game is finished. These individual game states are described in section 6.2.3.2 and its subsections. 6.3 Behavioral Model and Description 6.3.1 Description for software behavior 6.3.1.1 Events 6.3.1.1.1 New Game Button Presses A new game is started, answer fetched from the dictionary. 6.3.1.1.2 Menu Button Pressed When the phone's menu button is pressed a menu pops up. 6.3.1.1.3 OK Button Pressed When the OK button is pressed the text in the Edit Text field is retrieved and checked for correctness. Then the guess is compared against the answer. 6.3.1.1.4 Guess is Invalid Edit Text field is clears and the user is prompted that the previous guess was incorrect in syntax. 6.3.1.1.5 Character Not Found The specific character in guess is printed to the screen in the default grey text and the guess count is incremented. 6.3.1.1.6 Character Found in Correct Position The specific character in the guess is printed in RED to signify it is a correct letter and in the correct position. 6.3.1.1.7 Character Found in Incorrect Position The specific character in the guess is printed in YELLOW to signify it is a correct letter; however, in an incorrect position. 6.3.1.1.8 View High Score Button Pressed The high score of the game is displayed to user as well as the score of the current game (if any). 6.3.1.1.9 Help Button Pressed The rules are displayed in a dialog box. 6.3.1.1.10 New Game Button Pressed

23

The current game will be destroyed and a new game will be initiated. The score of the current game will not be calculated or compared to the high score. 6.3.1.1.11 Finish Game Button Pressed The score of the current game is calculated and displayed to the user. It is then compared to the current high score and if greater, the user is prompted that they just set a new high score. Game is then returned to the game suite's home screen. 6.3.1.1.12 No High Score Found A default zero is displayed when user selects View High Score from the menu. 6.3.1.1.13 High Score Found The highest score is splayed when the user selects View High Score from the menu. 6.3.1.2 States 6.3.1.2.1 Main Menu The main menu is displayed with the buttons for a new game and exit. 6.3.1.2.2 Enter Guess The Edit Text View is displayed where a user can input a word as a guess. The word must be six letters in length. 6.3.1.2.3 In Game Menu A menu in displayed that gives the option to view the high scores, start a new game, finish the current game, or show help. 6.3.1.2.4 Submit Guess Word Guesser checks the guess for validity then compares guess to the answer to determine which characters are correct. 6.3.1.2.5 New Game A cleared game screen is displayed and all game data is set to default. 6.3.1.2.6 Finish Game The game will end a show a dialog box with the score as well as a congratulation if a new high score was set. It will return to the game suite's main menu.

24

6.3.1.2.7 Show Help A dialog box will show the rules of the game. 6.3.1.2.8 Display Score 0 When a score is not found then a default zero is displayed when the View High Score button is pressed. 6.3.1.2.9 Display High Score Retrieves and displayed the high score from memory when the View High Score button is pressed. 6.3.1.2.10 Highlights Letter Turns character RED when the letter is in the answer and in the correct position. Turns character YELLOW when the letter is in the array but in an incorrect position. 6.3.2 State Transition Diagrams

25

Figure nine: Word Guesser State Diagram

7.0 Sudoku 7.1 Data Description The word search utilizes a couple of different data objects. These objects are used for passing data around and keeping track of information. The data keeps track of numbers, difficultly level, tiles, and hints. 7.1.1 Data objects The first data object is the user. The user will select a tile to enter a number into. The user can select any of the tiles in the 9x9 board. Once a tile is select a dialog box will with the available numbers. The user will select a number and it will be placed into the tile. The second data object is the hints. When the tile selected dialog box appears only the available numbers appear. This is helped out by the hint function, which calculated the used numbers. The hint function also colors tiles according to how many numbers can go into the tile. The last data object is the difficulty level. When a new game is started, the user selects an easy, medium, or hard level. Then a board is drawn by that difficulty. 7.1.2 Relationships The relationships between the data objects above can be seen in the figure below. The user will submit data and the program will pass around that data. 7.1.3 Complete data model

Figure ten: Sudoku Complete Data Model

7.1.4 Data dictionary All the data is stores locally and erased when a game is ended. When a game is started the game board is loaded and all the data is stored in local variables. When the game is over or ended the local data is erased. 7.2 Functional Model and Description 7.2.1 Description for Functions 7.2.1.1 Startup 26

This function is initiated when the Sudoku button is pressed from the home screen. The function starts a new activity that shows the main menu for the game. 7.2.1.2 Main Menu This function shows the main menu with buttons for a new game, one for an exit, and one for an about page. There is also a menu function to show the settings. 7.2.1.2.1 About This function initiates a dialog box that pops up. It shows information about Sudoku game and rules of the game. 7.2.1.2.2 Settings This function pops up a menu with various settings for the Sudoku game. The settings are stored locally and are erased after the game is exited. 7.2.1.2.2.1 Music This function turns the music on and off. 7.2.1.2.2.2 Hints This function turns the hints on and off. 7.2.1.2.3 Exit This function exits the main menu of the Sudoku and takes the user back to the main menu of the game suite. 7.2.1.3 New Game This function is activated when the new game button is pressed. After it is pressed a dialog box appears with the user to select the difficulty level. After the selection, this function loads the puzzle and starts the main game function. 7.2.1.3.1 Difficulty This function allows the user to select the difficulty level. The difficulty levels are easy, medium, and hard. Once the difficulty is selected it is store in the data object. Then the puzzle is retrieved based on the difficulty. 7.2.1.3.2 Load Puzzle This function takes the puzzle from the difficulty data object and passes it to the main game function to be drawn. 7.2.1.4 Main Game

27

This function loads the main game and allows the user to play the game. When a tile is selected, it shows the numbers that can be played. It calls the hints function to color squares differently. This function is run all the numbers are filled or the game is exited. 7.2.1.4.1 Draw Board Every time a number is selected then the board is redrawn to show those changes. This function draws the lines, numbers, background, and different colors for the hinted tiles. 7.2.1.4.2 Select Tile This function deals with when a user selects a tile on the board. When a tile is selected it is turned a different color. It then calls the hints function and brings up the select numbers function. 7.2.1.4.3 Select Numbers This function brings up a dialog box that shows the available numbers to select for that tile. Once the number is selected it sends it to the main game function to get drawn. 7.2.1.4.4 Hints This function goes through the board and finds the available numbers for each tile. It uses the amount of numbers available to pick a color for that tile. 7.2.1.4.5 End Game This function ends the current game and goes to the main menu of Sudoku. 7.2.2 Software Interface Description Sudoku uses one interface that the user can see. The one that they see is through the cell phone. The cell phone must be running the Android operating system. 7.2.2.1 External machine interfaces The game will run on two different machines. One is an emulator of a cell phone that is used for development and testing. The other is the users cell phone that hosts the game. The game must be compatible with the Android operating system. 7.2.2.2 External system interfaces The game does not use any external interfaces. All components of the game are internal. 7.2.2.3 Human interface 28

This is the main interface that the user will interact with. The interface will allow the user to use the phones touch screen services and analog buttons. This interface is clear and easy to use. It shows buttons and text so the user can understand what is going on. 7.2.3 Control flow description The control flow of the word search starts when the user starts a new game. After the new game is started there will be different states of the game. This continues till the game is finished. This described in section 5.0 and its subsections. 7.3 Behavioral Model and Description 7.3.1 Description for software behavior 7.3.1.1 Events 7.3.1.1.1 New Game Button Pressed A new game is started, puzzle drawn, and board is drawn. 7.3.1.1.2 About Button Pressed Shows the rules and information of the game. 7.3.1.1.3 Exit Button Pressed Exits the game to the games main menu. 7.3.1.1.4 Menu Pressed A menu pops of with the settings button. 7.3.1.1.5 Setting Button Pressed A new page is shown with settings of the game to be set. 7.3.1.1.6 Hints Option Button Pressed This event turns on and off the hints function of the game. 7.3.1.1.7 Music Option Button Pressed The event turns on and off the music of the game. 7.3.1.1.8 Difficulty Selected When the new game is selected the user is presented with an option to select the difficulty of the game. The option is then passed to the game. 7.3.1.1.9 Tile Selected When inside the main game the user will select tiles to put or change a number in. When a tile is selected it brings up a menu to pick what number goes inside the square. 7.3.1.1.10 Draw Board 29

This event is called at the beginning of the game and after a new number is selected. 7.3.1.2 States 7.3.1.2.1 Main Menu The main menu is selected when the Sudoku game is selected. It has buttons for a new game, about page, exit, and a menu. 7.3.1.2.2 About The about page is a dialog box that shows the rules of the game. 7.3.1.2.3 Exit This exits the game to the main menu of the game suite. 7.3.1.2.4 Menu This page is shown when the analog menu button is pressed on the phone. It shows a settings button. 7.3.1.2.5 Settings The settings page allows the user to change the settings for the music and hints of the game. 7.3.1.2.6 Hints This displays a button to turn on/off hints. 7.3.1.2.7 Music This displays a button to turn on/off music. 7.3.1.2.8 Difficulty Selected This displays a dialog box with the options to select the difficulty of the game. 7.3.1.2.9 Tile Select This is the main page of the game to be displayed. It shows the board drawn and allows the user to select a tile or end the game. 7.3.1.2.10 Number Select From the hints function the numbers available are retrieved. It displays the number is a dialog box with a button for each available number. 7.3.2 State Transition Diagrams

30

Figure eleven: Sudoku State Diagram

8.0 Restrictions, Limitations, and Constraints The application is being developed for the Android operating system and as such should be compatible with at least the majority of the current versions of Android which are 1.1, 1.5, 1.6, 2.0, and 2.0.1. The application must be designed to display correctly on the wide range of mobile phones which run the Android operating system. The overall application and its individual parts must be designed to run smoothly and quickly on the relatively limited processing power of mobile devises. 9.0 Validation Criteria Validation for the application will mostly be focused around the end user use case. While not all possible scenarios can be tested validation will consist of testing a reasonable number of cases to declare that all cases should work. 9.1 Classes of tests 9.1.1 Welcome Screen 31

- Move between the Welcome screen and the available games multiple times and in varying orders. 9.1.2 Word Search - Select known valid words for multiple puzzles. - Select known invalid words. - End game, exit program, and re-launch. 9.1.3 Connect Four - Run through multiple games from start to finish with varying end game scenarios. - Exit program mid game and re-launch. 9.1.4 Battleship - Run through multiple games from start to finish with varying end game scenarios. - Exit program mid game and re-launch. 9.1.5 Hangman - Run through multiple games from start to finish with varying end game scenarios. - Exit program mid game and re-launch. 9.1.6 Sudoku - Run through multiple games from start to finish with varying end game scenarios. - Exit program mid game and re-launch. 9.2 Expected software response 9.2.1 Welcome Screen - Individual should launch and close cleanly and smoothly, returning to the Welcome screen when closed. 9.2.2 Word Search - Valid words should be accepted and added to the current score. - Invalid words should be rejected. - Game should open and close cleanly and high score should be persistent when re-launching. 9.2.3 Connect Four - Individual chips should be placed properly when specific columns are selected. The game should end when four chips of the same color connect horizontally, vertically, diagonally. - Game should open and close cleanly and game state should be restored if the application was closed mid game.

32

9.2.4 Battleship - Individual 'shots' should register as hits when they occur at a location occupied by an opponents ship. The game should end when all enemy ships have been destroyed - Game should open and close cleanly and high score should be persistent when re-launching. 9.2.5 Hangman - Individual letters should register as being part of the target word if they are. Incorrect letters should result in the addition of a body part to the 'hangman'. The game should end when either the 'hangman' is complete or the target word is completed. - Game should open and close cleanly and high score should be persistent when re-launching. 9.2.6 Sudoku - Individual entries should be registered on the board and the game should end when the puzzle has been solved. - Game should open and close cleanly and high score should be persistent when re-launching. 9.3 Performance bounds All games and their individual subsystems should run smoothly and quickly. 10.0 Appendices 10.1 Product Strategies Our product will be likely submitted in the Android Market Place. It will likely be free to the user and will require no advertisement. 10.2 Supplementary information The following is a screen shot of the emulator we use to develop our program.

33

Figure twelve: Android OS Emulator

34

You might also like