{"id":85,"date":"2005-12-07T15:14:05","date_gmt":"2005-12-07T20:14:05","guid":{"rendered":"http:\/\/stein.everybody.org\/journal\/?p=85"},"modified":"2013-04-27T14:18:59","modified_gmt":"2013-04-27T18:18:59","slug":"sudoku-solver-in-python","status":"publish","type":"post","link":"https:\/\/jeremystein.com\/journal\/sudoku-solver-in-python\/","title":{"rendered":"Sudoku solver in Python"},"content":{"rendered":"<p>I recently learned about <a href=\"http:\/\/www.puzzlechoice.com\/pc\/Sudoku_Puzzlex.html\">Sudoku puzzles<\/a>.  I solved one, but after that it seemed a more interesting problem would be to write a computer program to solve them.<\/p>\n<p><!--more-->I&#8217;ve also long wanted to play with <a href=\"http:\/\/en.wikipedia.org\/wiki\/Python_programming_language\">Python<\/a>.  So, here is my first Python program:  <a href=\"http:\/\/stein.everybody.org\/journal\/wp-content\/sudoku.py.txt\">an inefficient Sudoku solver<br \/>\n<\/a><\/p>\n<p>(Sudoku is a well-researched problem and there are already <a href=\"http:\/\/www.setbb.com\/phpbb\/viewtopic.php?t=227&#038;mforum=sudoku\">open-source implementations<\/a> using <a href=\"http:\/\/www-cs-faculty.stanford.edu\/~knuth\/faq.html\">Donald Knuth<\/a>&#8216;s lightning-fast dancing links algorithm.  In contrast, this code maps to the way my brain solves these puzzles.)<\/p>\n<p>If you have any Python experience, I&#8217;d appreciate any feedback.  In particular, I couldn&#8217;t figure out how to get the sole member of a set.  I created a method (singleValue) to do it for me because I needed it in several places.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently learned about Sudoku puzzles. I solved one, but after that it seemed a more interesting problem would be to write a computer program to solve them.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-85","post","type-post","status-publish","format-standard","hentry","category-geek"],"_links":{"self":[{"href":"https:\/\/jeremystein.com\/journal\/wp-json\/wp\/v2\/posts\/85","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jeremystein.com\/journal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jeremystein.com\/journal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jeremystein.com\/journal\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jeremystein.com\/journal\/wp-json\/wp\/v2\/comments?post=85"}],"version-history":[{"count":1,"href":"https:\/\/jeremystein.com\/journal\/wp-json\/wp\/v2\/posts\/85\/revisions"}],"predecessor-version":[{"id":300,"href":"https:\/\/jeremystein.com\/journal\/wp-json\/wp\/v2\/posts\/85\/revisions\/300"}],"wp:attachment":[{"href":"https:\/\/jeremystein.com\/journal\/wp-json\/wp\/v2\/media?parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jeremystein.com\/journal\/wp-json\/wp\/v2\/categories?post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jeremystein.com\/journal\/wp-json\/wp\/v2\/tags?post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}