...
/Initialize the Sudoku Board and Set its Properties
Initialize the Sudoku Board and Set its Properties
Create the utility functions to initialize the Sudoku board.
We'll cover the following...
Introduction
Let's start by developing the building blocks of our Sudoku game. We'll be using a third-party API that will provide us with a matrix prefilled with the numbers. We will then need to fill the empty cells of the matrix using recursion and backtracking. But before that, we will be performing the following steps to render the Sudoku board on the web page:
Create the HTML
div
elements for each cell of the Sudoku board.Write a utility function to load all the
div
elements for each cell and store them in a 2D array, so that eachdiv
element in the2D array corresponds to a cell of the Sudoku board on the HTML page. For example, a div
element at position (0, 3) indicates the fourth element in the first row of the Sudoku board. Recall that the indexing of arrays starts from 0. ...