How to make a Sudoku (Only javascript used)
on Friday, January 9th, 2009 at 2:03 am10 days ago, a good friend of mine asked me to write a sudoku online game for him.
He is always bored at work and wanted to lose some time, so… here it is ![]()
PLAY
Rules of sudoku
- Each row should contains all numbers from 1 to 9 (no repetition)
- Each column should contains all numbers from 1 to 9 (no repetition)
- Each 3×3 table should contains all numbers from 1 to 9 (no repetition)
Logic used
- Start by generating each number in a cell at a time by choosing randomly from 1 to 9
- If the number is ok and do not conflict with the other cells —> Continue to next one
- Else —> go back one cell and choose another number
10 Comments »
Good job! I would like to see the source code too. Can you please publish the source?
Thanks
@pinjala
Post updated ![]()
you can get the code from here: http://joeabiraad.com/demos/sudoku/sudoku.rar
Your post reminded me of my own attempt at this. I wasn’t exactly trying to program Sudoku. Rather, I was just checking out how to program using the Canvas tag.
Do take a look http://abhijeetmaharana.com/blog/2007/11/24/browser-2d-canvas-and-sudoku/
Regards,
Abhijeet.
[...] How to make a Sudoku (Only javascript used) [...]
Hi,
My friend is trying to build a Sudoku game using javascript he is new javascript. Do you have any advice for him?
I’m building soduku Mini-box with 9 boxes or cells in a square. In addition, have two input boxes: one to accept a value and one to tell the cell number to put the value in. It will have two buttons: one that when clicked will put a specified value in the appropriate cell. and one to reset all the boxes to blank but tt only lets me put one number in the first box only. Here is the code:
Chapter 14-Jessica H.
function displayNums(d)
{
d.boxForm.elements[0].value =
d.sudukoForm.elements[0].value
}
Please enter a value to put in a box:
Please indicate which box you want to put it in:
Hey there,
I wrote a sudoku-solver and it showed up that your sudoku-generator doesn’t provide explicitly solvable sudokus.
if the difficulty is under 30 they are mostly solvable.
greetings!
RSS feed for comments on this post. TrackBack URL