sse657.project1.Inception

=Inception=

Vision
The Sudoku Game is a one player game that allows player to play, solve, receive hints, and saved current Sudoku puzzles. A player must created an account in order to save a game. Any user can be able to start with a blank puzzle and after inserting values may get a hint or have the puzzle solved by the system.

**System Actors**

 * Guest User - Can use solver and get hints on an inputted Sudoku. Can also play a manually entered Suduko.
 * Player - Registered user that has logged on. Can play, save in-progress games, use solver, and get hints.

**Use Cases**
b. Hints button is pressed c. Solve button is pressed d. Player enters invalid value.
 * UC1: Play a generated Sudoku**
 * //Primary Actor// || Player ||
 * //Preconditions// || Valid Login for the Player ||
 * //Main Success Scenario// || # Player selects to Play New Sudoku
 * 1) The system generates a random Sudoku.
 * 2) The Sudoku is saved under the Player's account.
 * 3) Player begins inserting numbers into blank cells.
 * 4) The system validates the Player's inputs for rules violations.
 * 5) The system removes entered value from associated cells available values.
 * 6) The system saves grid layout after each valid input.
 * 7) When all cells are entered, the system tells Player of success. ||
 * //Alternative Scenario Extensions// || a. Player can leave game at anytime and the grid is saved for later playing.
 * 1) Player presses Hint button.
 * 2) System determines one valid move.
 * 3) System inserts solution into grid.
 * 4) Control is given back to Player.
 * 1) Player presses Solve button.
 * 2) System generates a grid solution for the current grid.
 * 3) System inserts solution into grid
 * 4) Control is given back to Player.
 * 1) Player enters a value that is fails the rules validation.
 * 2) System prompts Player of invalid entry.
 * 3) Value is not removed from associated cells available values. ||

**UC2: Play a saved Sudoku**
 * //Primary Actor// || Player ||
 * //Preconditions// || * Valid Login for the Player
 * Previous game was saved ||
 * //Main Success Scenario// || # Player selects to Play Saved Sudoku.
 * 1) The system fills in grid with saved information.
 * 2) Player begins inserting numbers into blank cells.
 * 3) The system validates the Player's inputs for rules violations.
 * 4) The system removes entered value from associated cells available values.
 * 5) The system saves grid layout after each valid input.
 * 6) When all cells are entered, the system tells Player of success. ||
 * //Alternative Scenario Extensions// || a. Player can leave game at anytime and the grid is saved for later playing.

b. Hints button is pressed c. Solve button is pressed
 * 1) Player presses Hint button.
 * 2) System determines one valid move.
 * 3) System inserts solution into grid.
 * 4) Control is given back to Player.
 * 1) Player presses Solve button.
 * 2) System generates a grid solution for the current grid.
 * 3) System inserts solution into grid
 * 4) Control is given back to Player.

d. Player enters invalid value.
 * 1) Player enters a value that is fails the rules validation.
 * 2) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System prompts Player of invalid entry.
 * 3) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">Value is not removed from associated cells available values. ||

**UC3: Play a blank Sudoku** > || b. Hints button is pressed c. Solve button is pressed
 * //Primary Actor// || Player or Guest User //(Both refereed to as **User** in this UC)// ||
 * //Preconditions// || None ||
 * //Main Success Scenario// || # <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">User selects to use a blank grid.
 * 1) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System provides a blank grid.
 * 2) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">User inputs values anywhere on the grid.
 * 3) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System will validate values inputted by user.
 * 4) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">The system removes entered value from associated cells available values.
 * 5) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">No gird information will be saved.
 * 6) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">When all cells are entered, the system tells Player of success.
 * //Alternative Scenario Extension// || a. User leaves game
 * 1) User quits game.
 * 2) Grid is discarded and not saved by system.
 * 1) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">User presses Hint button.
 * 2) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System determines one valid move.
 * 3) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System inserts solution into grid.
 * 4) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">Control is given back to User.
 * 1) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">User presses Solve button.
 * 2) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System generates a grid solution for the current grid.
 * 3) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System inserts solution into grid
 * 4) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">Control is given back to User.

d. Player enters invalid value.
 * 1) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">Player enters a value that is fails the rules validation.
 * 2) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System prompts Player of invalid entry.
 * 3) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">Value is not removed from associated cells available values. ||

**UC4: Generate a Hint** >
 * //Primary Actor// || System ||
 * //Preconditions// || Player or Guest User pressed Hint button. ||
 * //Main Success Scenario// || # <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System iterates through each cell with an inputted value.
 * 1) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System removes inputted value from each cell's available values in that row.
 * 2) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System removes inputted value from each cell's available values in that column.
 * 3) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System removes inputted value from each cell's available values in the sub-square.
 * 1) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System iterates through every cell's available values search for a cardinality of one.
 * 2) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">If a cardinality of one is found, the system inserts the value into the grid. ||
 * //Alternative Scenario Extension// || a. No available cell has a cardinality of one.
 * 1) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">To prevent an infinite loop the system will clone the current grid and make an random selection of one cell's available values and try to solve the grid.
 * 2) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">If solution found, the randomly selected value will be inserted into the grid.
 * 3) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">If no solution found with the copy, the system will randomly select another value from the available values and repeat steps 1-2 until a solution is found. ||

**UC5: Generate a Solution** >
 * //Primary Actor// || System ||
 * //Preconditions// || Player or Guest User pressed Solve button. ||
 * //Main Success Scenario// || # <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System iterates through each cell with an inputted value.
 * 1) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System removes inputted value from each cell's available values in that row.
 * 2) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System removes inputted value from each cell's available values in that column.
 * 3) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System removes inputted value from each cell's available values in the sub-square.
 * 1) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">System iterates through every cell's available values search for a cardinality of one.
 * 2) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">If a cardinality of one is found, the system inserts the value into the grid.
 * 3) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">Repeat steps 1-6 until all grid cells have a value. ||
 * //Alternative Scenario Extension// || a. No available cell has a cardinality of one.
 * 1) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">To prevent an infinite loop the system will clone the current grid and make an random selection of one cell's available values and try to solve the grid.
 * 2) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">If solution found, the copied grid's values will be inserted into the main grid.
 * 3) <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 3em; padding-right: 0px; padding-top: 0px;">If no solution found with the copy, the system will randomly select another value from the available values and repeat steps 1-2 until a solution is found. ||