The Sudoku Game I created follows the basic rules of a traditional Sudoku puzzle. A player must fill in the remaining numbers using logic and the numbers given in the starting puzzle.
The following is a breakdown of the features of the game, and how they meet the project requirements:
❱ The key function used for generating the grid is renderGame(gameInfo,x,y), which takes 3 parameters: an object containing the game data, and the height and width of the generated grid.
❱ The number buttons are key, as the user is required to select one of the numbers, (1-9) before they can begin completing the puzzle. Selecting a number will highlight the matching numbers on the puzzle grid, (to aid the user in locating them), and subsequently allow the user to place the selected number in blank spaces on the grid.
❱ Other user input options are located in the Settings menu, which is accessible by clicking on the small "settings-cog" icon in the bottom left of the game. The user inputs include:
❱ Event handlers are added to each of the cells and the buttons in their respective rendering functions. In addition, there is a somewhat hidden 'cheat' for the game. By right clicking an empty cell, the correct number is placed in the cell.
❱ highlightSameNums(myElem): Is an example of DOM manipulation via innerText, as it is the function that changes the inner html of the table cell
❱ For detailed documentation on how this was implemented read the separate readme.txt file dedicated to the implementation of this, (located in the base folder of the project).
❱ The majority of the game logic code is contained in the /Model/AssignmentScript.js file. Here are some example functions that handle base functionality:
❱ Additional logic for other features of the game, (that haven't been mentioned yet), include the animation logic in the /View/Animation.js file, the timer logic in the /Model/stopwatch.js file, and some experimental random puzzle generation logic in the /Model/RandomPuzzle.js file.
❱ When losing the game, a canvas animation is triggered, which duplicates all of the numbers on the board, and turns them into canvas objects, and animates them dropping from the board. The canvas animation code can be found in the /View/Canvas.js file
❱ An unrequired feature that is in the project is linking to the Yahoo Weather API, which parses a JSON response from Yahoo containing weather information, (this feature can be seen by enabling the Yahoo API setting from the game grid 'Settings' menu).