News for hackers. Stuff that matters.
Re:Sudoku Solver in Common Lisp (2009) by nickcw on Thursday May 23, 2019 @01:24PM (#19993792)
I had a go at solving sudokos, but I found the experience tedious, mechanical and far too easy to make a mistake.

In fact just the frustration inducing thing to tickle the first of the virtues of a programmer: "Laziness". I then wrote a solver in Python which was far more fun than solving sudokus by hand and has the advantage that I never need to solve one of the dratted puzzles again ;-)

I recommend it as an exercise for all programmers!

I didn't document that process, but I did for solving a different puzzle which you may enjoy if you need inspiration: https://www.craig-wood.com/nick/articles/snake-puzzle/

Re:Sudoku Solver in Common Lisp (2009) by eralps on Thursday May 23, 2019 @02:23PM (#19994433)
I enjoy solving Sudoku puzzles. I had a puzzle book that I solve everyday on commute to school.

Then I created a solver in Python as well, it uses backtracking. It can solve the puzzle instantly. Never solved another sudoku puzzle ever since.

Re:Sudoku Solver in Common Lisp (2009) by vyuh on Thursday May 23, 2019 @02:35PM (#19994535)
I wrote a program that generates all sudokus that satisfy constraints given in a partially filled grid. I thought it might be feasible to find out the distribution of 81 digit numbers that are valid Sudokus by such brute force. Since there are so many sudokus, I made the program capable of resuming an interrupted computation using a dump file. All this I did in C. It was quite a learning experience. Here goes: (https://github.com/vyuh/sud.c)

For some fun I also translated the algorithm to Javascript (https://github.com/vyuh/sud.js) and Java (https://github.com/vyuh/sudoku-lister/blob/master/java/sudok...). The javascript code is used in a toy browser application i made (https://su-do-ku.herokuapp.com/).

Some day I might generalize the program to larger Latin Squares (https://en.wikipedia.org/wiki/Latin_square).

Re:Sudoku Solver in Common Lisp (2009) by goric on Thursday May 23, 2019 @12:39PM (#19993289)
If you found this interesting, see also Norvig's Sudoku Solver [1], with an implementation in Python.

[1] http://norvig.com/sudoku.html

Re:Sudoku Solver in Common Lisp (2009) by notyourwork on Thursday May 23, 2019 @11:39AM (#19992722)
I enjoy these puzzles a lot in my commute time. Recently on a flight to Germany I built a solver in python. It was a pretty great way to consume a portion of the long flight from US.

I’ve recently started reading up on optimization strategies, my first attempt was pretty straightforward. It’s a fun exercise I recommend for anyone who likes solving these puzzles manually.

Re:Sudoku Solver in Common Lisp (2009) by pge on Thursday May 23, 2019 @11:41AM (#19992741)
If you haven't already seen it, check out Donald Knuth's Dancing Links algorithm for solving sudoku. Here's a good overview and intro (that includes a link to the paper).

https://www.kevinhooke.com/2019/01/22/revisiting-donald-knut...

Re:Sudoku Solver in Common Lisp (2009) by doc_gunthrop on Thursday May 23, 2019 @12:11PM (#19993006)
If anyone is interested in these kind of coding challenges, there are a few Sudoku solver puzzles on Codewars: https://www.codewars.com/kata/search/?q=sudoku
Re:Sudoku Solver in Common Lisp (2009) by chaoticmass on Thursday May 23, 2019 @12:30PM (#19993202)
I wrote a sudoku solver in Visual Basic 5 many years ago. I've lost the source code to it but I remember the algorithm mostly. I've been meaning to re-implement it in a new language as a learning/practice exercise.
Re:Sudoku Solver in Common Lisp (2009) by gnuvince on Thursday May 23, 2019 @10:56AM (#19992327)
Damn near impossible to read the code in those blockquote blocks :(
Re:Sudoku Solver in Common Lisp (2009) by deepaksurti on Thursday May 23, 2019 @11:03AM (#19992399)
A more readable version on github. [1]

[1] https://github.com/dmsurti/sudoku

Re:Sudoku Solver in Common Lisp (2009) by goldfishparty on Thursday May 23, 2019 @05:50PM (#19996369)
The author doesn't understand what blockquotes are for I think.
Re:Sudoku Solver in Common Lisp (2009) by pretty_dumm_guy on Thursday May 23, 2019 @02:32PM (#19994509)
One could also write a sudoku solver in z3. I did this for an assignment and it was fun. I have never programmed in Lisp before but there seems to be some similarity between them.