Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #88005

Re: Sudoku solver

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'yet.': 0.04; 'mentions': 0.09; 'second.': 0.09; 'python': 0.11; 'skip:= 70': 0.12; 'posted': 0.15; '0.07': 0.16; '110': 0.16; 'arbitrarily': 0.16; 'clues': 0.16; 'posted,': 0.16; 'programmatic': 0.16; 'seconds.': 0.16; 'solver': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'finished': 0.19; "hasn't": 0.19; 'typing': 0.19; '(the': 0.22; 'example': 0.22; 'case.': 0.24; 'space.': 0.24; 'values': 0.27; 'header:In- Reply-To:1': 0.27; 'tried': 0.27; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; '25,': 0.31; 'running': 0.33; 'problem': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'in.': 0.36; 'seconds': 0.37; 'minimum': 0.38; 'filled': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'expect': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'ian': 0.60; 'completed': 0.61; 'took': 0.61; 'first': 0.61; 'times': 0.62; "you'll": 0.62; 'total': 0.65; 'url:co': 0.67; 'mar': 0.68; 'million': 0.74; '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=6gR+axmOE+e9fX1CAIk5xIrOxXe3C8aF2ltRDnf7CH8=; b=SqhJxYGAVF5OU6o+dAeHuiLa6VgQCLN8pPlu6YI5C6Q/ZvXIdVpiiHjskiJFatn902 NYy8Ha+6+4mXDvO3gFAHOaBZUZLIDw+JfK4lT//dKgLKT9meFYTbeB+Cq2SoJrVjVqo2 NcyRBYKv3e5cYflPmnKSwc2ku56PmLCEx3i/Iq4K2/wUSP1HT3TC5Hds0DrROa4bvdc/ QirKjKVBMpzCKHIq6x8JP2DjxfS8rLaOFpW6cOjux857Vr2PKrJEKSL7vnFYk84ZX0xC k4sgKhbiAb1wSGc5F/3skz396SXq2MhaEojvUPCGLBFQwoQ45uTUbBqXz4f7g4JOm2f4 pP5g==
X-Received by 10.180.87.165 with SMTP id az5mr33009079wib.29.1427328484297; Wed, 25 Mar 2015 17:08:04 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <87iodoakft.fsf@elektro.pacujo.net>
References <87r3sdnw5t.fsf@elektro.pacujo.net> <4e81bdb9-52db-46e6-b449-d4241cb2a3f2@googlegroups.com> <87twx8amww.fsf@elektro.pacujo.net> <mailman.159.1427314248.10327.python-list@python.org> <87iodoakft.fsf@elektro.pacujo.net>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Wed, 25 Mar 2015 18:07:24 -0600
Subject Re: Sudoku solver
To Python <python-list@python.org>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.171.1427328485.10327.python-list@python.org> (permalink)
Lines 52
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1427328485 news.xs4all.nl 2961 [2001:888:2000:d::a6]:40233
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:88005

Show key headers only | View raw


On Wed, Mar 25, 2015 at 2:31 PM, Marko Rauhamaa <marko@pacujo.net> wrote:
> Ian Kelly <ian.g.kelly@gmail.com>:
>
>> The test puzzle that you posted has 23 values already filled in. How
>> does it perform on harder puzzles with only 17 clues (the proven
>> minimum)? One would expect it to be around a million times slower.
>
> Just try it. The example had a minimum of clues (drop one clue and
> you'll get multiple solutions).
>
> <URL: http://www.telegraph.co.uk/news/science/science-news/9359579/W
> orlds-hardest-sudoku-can-you-crack-it.html> mentions this puzzle:
>
> ========================================================================
> 8 . . . . . . . .
> . . 3 6 . . . . .
> . 7 . . 9 . 2 . .
> . 5 . . . 7 . . .
> . . . . 4 5 7 . .
> . . . 1 . . . 3 .
> . . 1 . . . . 6 8
> . . 8 5 . . . 1 .
> . 9 . . . . 4 . .
> ========================================================================
>
> It takes about 2 seconds for my Python program to find the answer but it
> spends a total of 110 seconds to exhaust the problem space.
>
> The analogous C program finished the whole thing in 200 milliseconds.

"Hard" for a human doesn't necessarily mean "hard" for a programmatic
solver in this case. Try your solver on this one:

$ cat sudoku2.dat
. . . 7 . . . . .
1 . . . . . . . .
. . . 4 3 . 2 . .
. . . . . . . . 6
. . . 5 . 9 . . .
. . . . . . 4 1 8
. . . . 8 1 . . .
. . 2 . . . . 5 .
. 4 . . . . 3 . .

I tried the first puzzle you posted, and it took about a second. I
then started running it on this one before I started typing up this
post, and it hasn't finished yet. While that was running, I then tried
running Norvig's solver on this puzzle, and it completed in about 0.07
seconds.

For the curious, this puzzle was arbitrarily collected from
http://theconversation.com/good-at-sudoku-heres-some-youll-never-complete-5234

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-25 13:39 +0200
  Re: Sudoku solver John Ladasky <john_ladasky@sbcglobal.net> - 2015-03-25 11:44 -0700
    Re: Sudoku solver Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-25 13:05 -0600
    Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-25 21:37 +0200
      Re: Sudoku solver Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-25 14:09 -0600
        Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-25 22:31 +0200
          Re: Sudoku solver Chris Angelico <rosuav@gmail.com> - 2015-03-26 09:40 +1100
          Re: Sudoku solver Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-25 18:07 -0600
            Re: Sudoku solver BartC <bc@freeuk.com> - 2015-03-27 20:04 +0000
          Re: Sudoku solver Abhiram R <abhi.darkness@gmail.com> - 2015-03-26 08:26 +0530
          Re: Sudoku solver Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-25 21:24 -0600
          Re: Sudoku solver Abhiram R <abhi.darkness@gmail.com> - 2015-03-26 08:58 +0530
            Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-26 14:13 +0200
              Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-26 16:15 +0200
          Re: Sudoku solver albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-04-10 23:10 +0000
      Re: Sudoku solver Sayth <flebber.crue@gmail.com> - 2015-03-27 20:39 -0700
        Re: Sudoku solver BartC <bc@freeuk.com> - 2015-03-28 23:50 +0000
          Re: Sudoku solver Chris Angelico <rosuav@gmail.com> - 2015-03-29 11:12 +1100
            Re: Sudoku solver BartC <bc@freeuk.com> - 2015-03-29 21:59 +0100
              Re: Sudoku solver Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-29 22:19 +0100
                Re: Sudoku solver BartC <bc@freeuk.com> - 2015-03-29 22:59 +0100
          Re: Sudoku solver Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-29 14:06 +1100
            Re: Sudoku solver Chris Angelico <rosuav@gmail.com> - 2015-03-29 15:10 +1100
              Re: Sudoku solver Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-29 21:35 +1100
                Re: Sudoku solver Chris Angelico <rosuav@gmail.com> - 2015-03-29 21:54 +1100
                Re: Sudoku solver BartC <bc@freeuk.com> - 2015-03-29 13:01 +0100
                Re: Sudoku solver BartC <bc@freeuk.com> - 2015-03-29 16:23 +0100
            Re: Sudoku solver Christian Gollwitzer <auriocus@gmx.de> - 2015-03-29 09:57 +0200
              Re: Sudoku solver BartC <bc@freeuk.com> - 2015-03-30 11:54 +0100
            Re: Sudoku solver BartC <bc@freeuk.com> - 2015-03-29 12:25 +0100
              Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-29 21:03 +0300
                Re: Sudoku solver Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-29 19:26 +0100
                Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-29 21:33 +0300
                Re: Sudoku solver BartC <bc@freeuk.com> - 2015-03-29 22:11 +0100
                Re: Sudoku solver Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-30 00:50 -0600
                Re: Sudoku solver Christian Gollwitzer <auriocus@gmx.de> - 2015-03-30 09:13 +0200
                Re: Sudoku solver Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-30 01:29 -0600
                Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-30 12:16 +0300
                Re: Sudoku solver Dave Angel <davea@davea.name> - 2015-03-30 04:16 -0400
                Re: Sudoku solver Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-30 02:57 -0600
                Re: Sudoku solver Chris Angelico <rosuav@gmail.com> - 2015-03-30 20:13 +1100
          Re: Sudoku solver Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-29 22:21 +0100
            Re: Sudoku solver BartC <bc@freeuk.com> - 2015-03-29 23:17 +0100
              Re: Sudoku solver Seymore4Head <Seymore4Head@Hotmail.invalid> - 2015-03-29 21:40 -0400
  Re: Sudoku solver Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-26 09:50 +1100
    Re: Sudoku solver Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-25 23:04 +0000
      Re: Sudoku solver Christian Gollwitzer <auriocus@gmx.de> - 2015-03-27 07:40 +0100
  Re: Sudoku solver "Frank Millman" <frank@chagford.com> - 2015-03-26 10:19 +0200
    Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-26 14:26 +0200
      Re: Sudoku solver Chris Angelico <rosuav@gmail.com> - 2015-03-26 23:37 +1100
      Re: Sudoku solver Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-26 07:15 -0600
        Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-26 16:23 +0200
          Re: Sudoku solver Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-26 09:06 -0600
            Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-26 17:48 +0200
              Re: Sudoku solver Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-26 10:20 -0600
                Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-26 18:47 +0200
      Re: Sudoku solver Dave Angel <davea@davea.name> - 2015-03-26 10:14 -0400
      Re: Sudoku solver Chris Angelico <rosuav@gmail.com> - 2015-03-27 01:41 +1100
      Re: Sudoku solver Dave Angel <davea@davea.name> - 2015-03-26 11:03 -0400
        Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-26 17:42 +0200
          Re: Sudoku solver Pete Forman <petef4+usenet@gmail.com> - 2015-03-26 22:24 +0000
      Re: Sudoku solver Chris Angelico <rosuav@gmail.com> - 2015-03-27 02:21 +1100
      Re: Sudoku solver Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-03-26 20:42 -0400
      Re: Sudoku solver Dave Angel <davea@davea.name> - 2015-03-27 09:14 -0400
      Re: Sudoku solver Chris Angelico <rosuav@gmail.com> - 2015-03-28 00:25 +1100
      Re: Sudoku solver "Frank Millman" <frank@chagford.com> - 2015-03-27 15:35 +0200
        Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-27 15:56 +0200
          Re: Sudoku solver Dave Angel <davea@davea.name> - 2015-03-27 10:09 -0400
            Re: Sudoku solver sohcahtoa82@gmail.com - 2015-03-27 11:18 -0700
              Re: Sudoku solver Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-28 12:46 +1100
            Re: Sudoku solver Larry Hudson <orgnut@yahoo.com> - 2015-03-27 16:48 -0700
          Re: Sudoku solver Chris Angelico <rosuav@gmail.com> - 2015-03-28 01:07 +1100
          Re: Sudoku solver Chris Angelico <rosuav@gmail.com> - 2015-03-28 01:19 +1100
            Re: Sudoku solver Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-03-28 14:13 +1300
            Re: Sudoku solver Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-28 12:40 +1100
              Re: Sudoku solver Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-28 02:24 -0600
          Re: Sudoku solver Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-27 16:03 +0000
          Re: Sudoku solver Virgil Stokes <vs@it.uu.se> - 2015-03-28 19:36 +0100
      Re: Sudoku solver Dave Angel <davea@davea.name> - 2015-03-27 09:48 -0400
      Re: Sudoku solver Dave Angel <davea@davea.name> - 2015-03-27 09:52 -0400
      Re: Sudoku solver Chris Angelico <rosuav@gmail.com> - 2015-03-28 00:58 +1100
  Re: Sudoku solver mr.smittye@gmail.com - 2015-03-29 16:39 -0700
    Re: Sudoku solver Marko Rauhamaa <marko@pacujo.net> - 2015-03-30 12:24 +0300

csiph-web