[ ] Create a generator to randomly generate the puzzles (requires research)
[ ] Set a row of buttons (1-9, backspace) to fill the table
[ ] Add a button to start/reset game (reset will clear moves DB table of the current game id and basically make the current game a brand new game), disabled if no active games
[ ] Add a button to generate new game, discarding the current game
[ ] Add validation helper (can be disabled) to check if the cells are filled in correctly
[ ] Add difficulty level in settings (1-6), where the number equates to how many numbers are removed from the table to generate the puzzle (subjected to changes)
[ ] Add a counter that counts steps taken to solve the puzzle
[ ] Add timer that counts how long one takes to do the puzzle (pauses when the user leaves the app, resumes when the user resumes the app)
[ ] Save data (steps taken, number of steps per game, time taken per game, table layout) in a SQLite DB that can be exported (try Room lib)
[ ] Allow export and import of DB data
DB layout (subjected to changes)
tbl_game
id, puzzle (in CSV format from left to right, top to bottom), completed_puzzle (CSV), time taken (in millis, update when game completes/pauses), started (1-first move made,0-not started), is_active (true if currently active game), completed (true if puzzle is solved, false otherwise), game_difficuly (num of cells removed)
tbl_moves
id, game_id (linked to Id in tbl_game), slot\_id (0-80, based on cell in asc order from left to right, top to bottom), old_val (0-9, where 0 is blank), new_val (0-9, where 0 is blank)
Game flow (subjected to changes, general flow)
User generate new puzzle
On new puzzle generated first create a game record, storing the completed puzzle, then based on set difficulty remove the amount of numbers in each 3x3 table, storing that as the puzzle and saving the difficulty as well
Timer starts on first entry of value
Set started to 1, is_active to 1 in table
Every value entry (update, add or delete) will be added to the moves table
Timer will pause if activity enter pause/destroyed state
On activity pause, save the paused timer in milliseconds to DB
If activity is resumed, timer will continue
If activity is destroyed and recreated, first check for existing active game, if no existing game then go to top flow. If existing game, repopulate the puzzle and set timer based on values in DB, then recreate all steps by going through the moves in the moves DB table sequentially and updating the table accordingly, finally resume the timer
Every time the user adds a move, check if all cells are filled
If all cells has been filled, check if the puzzle is correct
If user has completed the puzzle correctly, stop timer and save the final time in the DB, updating the is_active var to 0 and completed to 1 in the DB
If user creates a new game with an active game on going, stop timer, save final time and just update is_active to 0 in the DB
DB layout (subjected to changes)
tbl_game
tbl_moves
Game flow (subjected to changes, general flow)
Sent from my Mi A1 using FastHub