4 comments

  • crustycoder26 days ago
    Or perhaps just use a language that&#x27;s designed to solve those sorts of problems? In 14 lines of code.<p><a href="https:&#x2F;&#x2F;www.swi-prolog.org&#x2F;pldoc&#x2F;man?section=clpfd-sudoku" rel="nofollow">https:&#x2F;&#x2F;www.swi-prolog.org&#x2F;pldoc&#x2F;man?section=clpfd-sudoku</a>
    • cenamus26 days ago
      Is there a similarly short&#x2F;simple solution not using all of the built ins? Haven&#x27;t worked with prolog in a while but should be easy enough with primitives (albeit with more duplication)?
      • crustycoder26 days ago
        Well no, not really. The whole point is to use the appropriate tool for the task at hand. In this case it&#x27;s the CLP(FD) library, <a href="https:&#x2F;&#x2F;www.swi-prolog.org&#x2F;pldoc&#x2F;man?section=clpfd" rel="nofollow">https:&#x2F;&#x2F;www.swi-prolog.org&#x2F;pldoc&#x2F;man?section=clpfd</a>
    • nurettin26 days ago
      Why not just<p><pre><code> blocks(Rows, Blocks), maplist(all_distinct, Blocks), maplist(label, Rows)</code></pre>
  • kayo_2021103026 days ago
    Peter Seibel&#x27;s original post is worth reading in its entirety.<p>It&#x27;s a decently balanced piece. It leaves room for various views, and its summation seems about right.<p><a href="https:&#x2F;&#x2F;gigamonkeys.wordpress.com&#x2F;2009&#x2F;10&#x2F;05&#x2F;coders-unit-testing&#x2F;" rel="nofollow">https:&#x2F;&#x2F;gigamonkeys.wordpress.com&#x2F;2009&#x2F;10&#x2F;05&#x2F;coders-unit-tes...</a>
  • gnabgib32 days ago
    Some comments 2 months ago (15 points, 7 comments)<p>2012 (28 points, 9 comments) <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=4434744">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=4434744</a><p>2010 (65 points, 48 comments) <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1221399">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1221399</a>
    • Jtsummers26 days ago
      The one from a couple months ago is here: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=45733410">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=45733410</a>
  • nurettin26 days ago
    I remember implementing some of these<p><a href="https:&#x2F;&#x2F;www.stolaf.edu&#x2F;people&#x2F;hansonr&#x2F;sudoku&#x2F;12rules.htm" rel="nofollow">https:&#x2F;&#x2F;www.stolaf.edu&#x2F;people&#x2F;hansonr&#x2F;sudoku&#x2F;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.