Hacker News new | past | comments | ask | show | jobs | submit login

Hi! I'm the author, didn't expect this to be posted here yet. I was still somewhat working on it, so please bear with me when you find anything weird. You can give me any feedback here.



Such a beautifully written blog! I have no comments so far, but I will read it through tonight again.

I wrote a Sudoku solver using a SAT solver compiled to wasm (it is just a simple exercise TBH):

https://www.nhatcher.com/hats/sudoku.html https://www.nhatcher.com/post/on-hats-and-sats/


Thank you and all the others here for the kind words, means a lot:)

And the WASM solver is super cool, definitely useful for generating them as you have to do quite a lot of iterations!


I'll second that: great article and description of the problem space. Love it.

Once upon a time I programmed a solution finder for the game https://en.wikipedia.org/wiki/Ricochet_Robots because a gaming magazine had monthly problems to solve. But I wasn't allowed to run my program until my wife found a solution manually first ;-)


Your article is fantastic. I really like the way you present information, especially with the interactive examples.

I've been playing a lot with the logic programming language, Prolog. Sudoku is a popular "hello world" for it.

If you haven't used Prolog before, here's an example of a Sudoku solver. It uses Prolog's Constraint Logic Programming over Finite Domains library -- CLP(FD) -- a form of CSP.

https://swish.swi-prolog.org/example/clpfd_sudoku.pl

The relation on line 8 basically encodes the rules of Sudoku verbatim. Logic programming is cool (at least to me) because relations can be run in any direction with any number of variables.

I wonder how writing a Sudoku puzzle generator would differ in a language that had first-class support for CSP.


Great article, no comments. I know the angry/dissatisfied people tend to give lots of feedback, but I really enjoyed your article and playing around with it.


Is there a way to download the problems via an API, or have them available in a file like https://norvig.com/top95.txt?

It would make a great dataset for benchmarking different solver approaches.


Thanks for asking, I made the data that I used for the analysis available as JSON here: https://github.com/TN1ck/tn1ck.com/tree/main/lib/sudoku.


Hey well if you insist, I did find something weird: numpad number entry doesn't work.


Thanks! That's what happens if you only use keyboards without a proper numpad, will fix soon.

Edit: Should be fixed now.


TIL the G915 doesn't have a proper numpad. Maybe it's some hack to reduce dimensionality for wireless transmission over that proprietary lightspeed protocol thing.

Seems like it's fixed now though, thanks :)


Really love the UI!

Though the color of the inserted numbers and the highlight color of the current selected number are nearly the same, would be great if they were much more distinct.


Thanks for the feedback, changed the color to orange for the highlight.


Thanks for the quick fix!

Another thing I noticed is that the wrong entry highlight sometimes highlights multiple correct numbers as incorrect and some static numbers will vanish.

Before:

https://ibb.co/Dtk3YXT

After:

https://ibb.co/mvJWC1f

(Also now red and orange are a bit too similar ^^, maybe introduce the color blue?)


Fantastic work. You have many other hidden gems on your site I'd recommend people read too.


This should be an academic paper, great writing.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: