Javascript plugin that generates random sudoku grid.
https://denissdubinin.github.io/javascript-sudoku/
Add a sudoku script to your page:
<script src="https://cdn.jsdelivr.net/gh/denissdubinin/javascript-sudoku@latest/dist/sudoku.min.js"></script>
Add a sudoku stylesheet to your page:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/denissdubinin/javascript-sudoku@latest/dist/sudoku.min.css">
Add a sudoku script to your page:
<script src="PATH_TO_DIR/sudoku.min.js"></script>
Add a sudoku stylesheet to your page:
<link rel="stylesheet" href="PATH_TO_DIR/sudoku.min.css">
Create div
element on your page:
<div></div>
Initialise Sudoku plugin:
$(element).Sudoku();
Custom control buttons
You can use custom buttons for sudoku. To disable default buttons, set options useCustomButtons
to true
.
For custom buttons use ID
selector:
start-sudoku
for start buttonr-sudoku
for reset buttongn-sudoku
for generate buttonExample:
<div class="button" id="start-sudoku">START</div>
<div class="button" id="r-sudoku">RESET</div>
<div class="button" id="gn-sudoku">GENERATE NEW SUDOKU</div>
$(element).Sudoku({
dropTimerOnReset: true,
markWrongCellsOnFly: false,
useTimer: true,
timerOnly: true,
});
squareSize
Size of small squre. Default 3
dropTimerOnReset
Reset timer on sudoku reset. Default true
markWrongCellsOnFly
: false,
Mark cell with red if it has wrong value right after number is entered. Default false
markWrongCellsOnFinish
Mark cell with wrong value with red when all cells are filled. Default true
useTimer
Enable timer. Default true
timerOnly
Game can be started only with activated timer. Works only with options.useTimer === true
. Default true
useCustomButtons
If you want to use own control buttons, enable this options. Default false
sudokuMixIterations
Iterations count for mixing random rows and columns between themselfs The larger number, the more mixed sudoku becomes and the more time script initialisation takes. Default 500
jQuery 1.7
Copyright © 2018 Deniss Dubinin
Licensed under the MIT license.