Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.032 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'differently': 0.07; 'wednesday,': 0.07; 'python': 0.11; 'bug': 0.12; 'obviously,': 0.16; 'propagation': 0.16; 'smart,': 0.16; 'solver': 0.16; 'solver.': 0.16; 'student': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'written': 0.21; 'example': 0.22; 'space.': 0.24; "haven't": 0.24; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; '25,': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'so,': 0.37; 'turn': 0.37; 'mine': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'solve': 0.60; 'march': 0.61; 'john': 0.61; 'more': 0.64; 'mar': 0.68; 'limit': 0.70; 'await': 0.74; 'strategies': 0.77; '2015': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=iUK76L9OxUlbby2tmiaJnlbYpnMGcZO60fJjyOCEolY=; b=LloOWSVK2p3t5RqgxY25xMbLv/iZpGebt9pbnE9li0R3/SG/WRQEoHEJJ4yymj0v1Z KFdmACG0ezQft/kMv020ps1uv20hipBOdLrsBzZevp7Hz8puwsPtM0Q5HB5nNUjOVo5X WB/g4ahMVO5Lv9/o6JmluaGG1C19p72V6KHCEXDd4kk9F9YjBtgq2BR4kdD7fQDv/tlv PSnxaDlrTh8fjrka5cb12xn8fIgtwZN6FLmO0yXEXgivg/ma6uW/7BRwzd/We03ZdT8y +1MKvTBmD2GhmFHl30kh89snVHe2s5fpMRCPSvAI3OwQXGLcGAo/dC1i/47JKdWxVQwZ aNIw== X-Received: by 10.68.201.227 with SMTP id kd3mr19585049pbc.95.1427310377825; Wed, 25 Mar 2015 12:06:17 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4e81bdb9-52db-46e6-b449-d4241cb2a3f2@googlegroups.com> References: <87r3sdnw5t.fsf@elektro.pacujo.net> <4e81bdb9-52db-46e6-b449-d4241cb2a3f2@googlegroups.com> From: Ian Kelly Date: Wed, 25 Mar 2015 13:05:37 -0600 Subject: Re: Sudoku solver To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427310381 news.xs4all.nl 2866 [2001:888:2000:d::a6]:41075 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:87966 On Wed, Mar 25, 2015 at 12:44 PM, John Ladasky wrote: > On Wednesday, March 25, 2015 at 4:39:40 AM UTC-7, Marko Rauhamaa wrote: > >> I post below a sudoku solver. I eagerly await neater implementations (as >> well as bug reports). > > So, it's a brute-force, recursive solver? The code is nice and short. But I bet it takes a long time to run. > > I and a student of mine are working on Sudoku solvers which solve puzzles the way that humans would. Smart, pattern-recognition strategies take less time to run... but, obviously, far more time to turn into code! I haven't written one myself, but Peter Norvig has a nice example on the web of a Python sudoku solver using constraint propagation to limit the search space. http://norvig.com/sudoku.html I don't know that I would do it much differently if I were going to write one myself.