Or perhaps just use a language that's designed to solve those sorts of problems? In 14 lines of code.<p><a href="https://www.swi-prolog.org/pldoc/man?section=clpfd-sudoku" rel="nofollow">https://www.swi-prolog.org/pldoc/man?section=clpfd-sudoku</a>
Is there a similarly short/simple solution not using all of the built ins? Haven't worked with prolog in a while but should be easy enough with primitives (albeit with more duplication)?
Why not just<p><pre><code> blocks(Rows, Blocks), maplist(all_distinct, Blocks), maplist(label, Rows)</code></pre>
Peter Seibel's original post is worth reading in its entirety.<p>It's a decently balanced piece. It leaves room for various views, and its summation seems about right.<p><a href="https://gigamonkeys.wordpress.com/2009/10/05/coders-unit-testing/" rel="nofollow">https://gigamonkeys.wordpress.com/2009/10/05/coders-unit-tes...</a>
Some comments 2 months ago (15 points, 7 comments)<p>2012 (28 points, 9 comments) <a href="https://news.ycombinator.com/item?id=4434744">https://news.ycombinator.com/item?id=4434744</a><p>2010 (65 points, 48 comments) <a href="https://news.ycombinator.com/item?id=1221399">https://news.ycombinator.com/item?id=1221399</a>
I remember implementing some of these<p><a href="https://www.stolaf.edu/people/hansonr/sudoku/12rules.htm" rel="nofollow">https://www.stolaf.edu/people/hansonr/sudoku/12rules.htm</a><p>With a simple array of unsigned int and bit operations like 20 years ago. It could solve a lot of puzzles within microseconds. Later I realized rules 1, 2, 5, 6 are pretty much the same.