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


Groups > comp.lang.python > #61427

Re: Programming puzzle with boolean circuits

References <l84aor$3mj$1@news.albasani.net> <CAPTjJmo7+x68de6NR97E7jWRcez6bdy4Z-gZAuXekK=AoNgZXw@mail.gmail.com>
Date 2013-12-10 12:41 +1100
Subject Re: Programming puzzle with boolean circuits
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3804.1386639709.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Dec 10, 2013 at 12:25 AM, Chris Angelico <rosuav@gmail.com> wrote:
> Unfortunately I haven't been able to prove that the code works,
> because even with some changes it's taking way too long. But hey, it's
> a crazy fun piece to work with!

Well... it eventually solved the problem. I don't know how many CPU
hours it took but it threw a SolutionFound exception eventually.

Unfortunately I didn't parenthesize the display. The solution seems to
involve using a NOT gate and then splitting its output, so you'll see
more than two instances of 'not' in the output. This is definitely not
an optimal solution, but hey, you asked for a brute-force solver!

~$1 = $4 or not $1 and $2 or $4 and $1 or $2 and $4 and not $1 and $2
or $4 and $1 or $2 or $2 or not $1 and $2 or $4 and $1 or $2 and $2
and not $1 and $2 or $4 and $1 or $2 or not $2 or $1 or $4 and $2 and
$1 and $4 or not $1 and $2 or $4 and $1 or $2
~$2 = $4 or not $1 and $2 or $4 and $1 or $2 and $4 and not $1 and $2
or $4 and $1 or $2 or $1 or not $1 and $2 or $4 and $1 or $2 and $1
and not $1 and $2 or $4 and $1 or $2 or not $2 or $1 or $4 and $2 and
$1 and $4 or not $1 and $2 or $4 and $1 or $2
~$4 = $2 or not $1 and $2 or $4 and $1 or $2 and $2 and not $1 and $2
or $4 and $1 or $2 or $1 or not $1 and $2 or $4 and $1 or $2 and $1
and not $1 and $2 or $4 and $1 or $2 or not $2 or $1 or $4 and $2 and
$1 and $4 or not $1 and $2 or $4 and $1 or $2

ChrisA

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


Thread

Programming puzzle with boolean circuits Johannes Bauer <dfnsonfsduifb@gmx.de> - 2013-12-09 12:49 +0100
  Re: Programming puzzle with boolean circuits Chris Angelico <rosuav@gmail.com> - 2013-12-10 00:25 +1100
    Re: Programming puzzle with boolean circuits Johannes Bauer <dfnsonfsduifb@gmx.de> - 2013-12-11 14:52 +0100
  Re: Programming puzzle with boolean circuits Joel Goldstick <joel.goldstick@gmail.com> - 2013-12-09 15:19 -0500
  Spoiler alert? (Re: Programming puzzle with boolean circuits) John Ladasky <john_ladasky@sbcglobal.net> - 2013-12-09 12:39 -0800
    Re: Spoiler alert? (Re: Programming puzzle with boolean circuits) Joel Goldstick <joel.goldstick@gmail.com> - 2013-12-09 15:45 -0500
  Re: Programming puzzle with boolean circuits Chris Angelico <rosuav@gmail.com> - 2013-12-10 12:41 +1100
  Fwd: Programming puzzle with boolean circuits Joel Goldstick <joel.goldstick@gmail.com> - 2013-12-09 21:03 -0500
  Re: Programming puzzle with boolean circuits Chris Angelico <rosuav@gmail.com> - 2013-12-10 13:21 +1100
  Re: Programming puzzle with boolean circuits Chris Angelico <rosuav@gmail.com> - 2013-12-10 19:50 +1100
  Re: Programming puzzle with boolean circuits Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-12-10 15:25 +0100

csiph-web