Quantcast
Viewing all articles
Browse latest Browse all 14

JavaScript Sudoku, now with even more JavaScript

I’ve made a few revisions to my JavaScript version of Sudoku (which you can play here).  Changes include:

  • As soon as you press a number key, it is checked (instead of waiting for you to leave the cell).
  • You can use h, j, k, and l to move around the puzzle (a la vim), in addition to the arrow and tab keys.
  • If you press the letter q, the current cell is toggled “questionable”.  The provided stylesheet colors questionable cells with a yellow background.  This can help you backtrack on your guesses.
  • When a new game is presented, the first empty cell is now focused (previously, nothing was focused).
  • I added a “Help” button that pops up a floating help window.  You can click and drag this window anywhere, and you can close it by pressing ESC or by clicking on the “x” button in the title bar.  Three new style classes were added for this window (see readme.txt and sudoku.css).
  • When you successfully solve a puzzle, an alert pops up that says “Solved!”  Waiting for that to happen will prevent you from thinking that you’re done when there are still some empty cells left.
  • I separated the styling for cells that are corrected by a Solve (class sudokuCorrected) and those that were still empty when Solve was pressed (sudokuSolvedEmpty).  The provided stylesheet colors the text for these red and blue, respectively.  This helps you better determine where you went wrong.
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 14

Trending Articles