DEV Community

Cover image for Building a React app to solve every Sudoku puzzle.

Building a React app to solve every Sudoku puzzle.

J.P. Solano on October 22, 2020

Introduction Peter Norvig, the legendary Google mogul and AI titan, wrote a python essay to solve every Sudoku puzzle 10 years ago. Back...
Collapse
 
andxre profile image
Andre •

Really well done! A suggestion would be to make inputting a new board easier. I feel like the current process is quite tedious. Maybe randomized boards too! Other than that, this is really great

Collapse
 
jsolano profile image
J.P. Solano •

That's correct Andre, thank you for the feedback, I'll add the randomized option soon..

Collapse
 
jsolano profile image
J.P. Solano •

Hi Andre, I just updated the repo and the online demo with your suggestion, I hope you will enjoy it. /JP

Collapse
 
andxre profile image
Andre •

I just tried it out and it's really cool! One more bug I found was when inputting a sudoku string (ex. ..6.....2.81.4293.25...34..4.8.1..76..2...8..17..6.3.9..35...94.9732.51.5.....7..) it solves it in the first column instantly rather than the second.

Thread Thread
 
jsolano profile image
J.P. Solano • • Edited

Great! Thank you for take a look. I tested your sudoku string and it's not a bug, what's happening is when you load a new puzzle, the parseGrid method apply strategy 1 and to 2 (assign(values, square, digit) Solver.js, line 148) to generate the possible values for the cell. In this case, resolve the complete puzzle. May be need a message explaining what happens.

Thread Thread
 
jsolano profile image
J.P. Solano •

Hi Andre, I updated (repo and live) with a message when the board is solved in the load state. Thank you for sharing your feedback.

Collapse
 
rubeen profile image
Ruben Vitt •

Well done! 👏 How long did you work for it?

Collapse
 
jsolano profile image
J.P. Solano •

Thank you Ruben. The initial push was like 10hours spaced in 1 week, couple hours every day.

Collapse
 
achintyam1812 profile image
acm1812 •

Extremely well written article! Well done! 👍

Collapse
 
jsolano profile image
J.P. Solano •

Thank you!