Skip to content
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
..
Failed to load latest commit information.
README.md
run.js

README.md

Solve Sample

Solve puzzle.

Usage

Run with:

node run <position string>

In the string, 0 or . represent an empty position. It prints the initial position and the final solution.

Examples

From http://mypuzzle.org/sudoku

node run 210340905300000204070008010060072009500806001800410050020700090703000008905031027

Output

2 1 . 3 4 . 9 . 5
3 . . . . . 2 . 4
. 7 . . . 8 . 1 .
. 6 . . 7 2 . . 9
5 . . 8 . 6 . . 1
8 . . 4 1 . . 5 .
. 2 . 7 . . . 9 .
7 . 3 . . . . . 8
9 . 5 . 3 1 . 2 7

2 1 6 3 4 7 9 8 5
3 5 8 1 6 9 2 7 4
4 7 9 2 5 8 3 1 6
1 6 4 5 7 2 8 3 9
5 3 2 8 9 6 7 4 1
8 9 7 4 1 3 6 5 2
6 2 1 7 8 4 5 9 3
7 4 3 9 2 5 1 6 8
9 8 5 6 3 1 4 2 7

Other examples

node run 047109508100000003000570014000600300600050007003004000810097000900000005706805490
node run 100030007300108009080090010200000005540000092060080070601903708000000000095070320
node run 107200059200009006000400700000010090800000003090050000001003000900800005680002401
node run 000200309000006070009130800270040000300000002000010043002084900040600000806009000
node run 000204000208103607060070020300607005600020004090000060703000209900030006020050030
node run 108000209060040010200196008000070000400060001690000072020904050000000000850701094
Something went wrong with that request. Please try again.