Re: Programming puzzle with boolean circuits

2013-12-11 Thread Johannes Bauer
On 09.12.2013 14:25, Chris Angelico wrote: >> I found this puzzle again and was thinking about: How would I code a >> brute-force approach to this problem in Python? > > Ooooh interesting! Ha, I thought so too :-) > Well, here's a start: There's no value in combining the same value in > an AND

Re: Programming puzzle with boolean circuits

2013-12-10 Thread Antoon Pardon
Op 09-12-13 12:49, Johannes Bauer schreef: > Hi group, > > it's somewhat OT here, but I have a puzzle to which I would like a > solution -- but I'm unsure how I should tackle the problem with Python. > But it's a fun puzzle, so maybe it'll be appreciated here. > > The question is: How do you desi

Re: Programming puzzle with boolean circuits

2013-12-10 Thread Chris Angelico
On Tue, Dec 10, 2013 at 1:21 PM, Chris Angelico wrote: > Output: (I tweaked my __repr__ functions to parenthesize for clarity) > > (((not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and not ((($1 and > $2) and $4) or (not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and > (($1 or $2) or $4

Re: Programming puzzle with boolean circuits

2013-12-09 Thread Chris Angelico
On Tue, Dec 10, 2013 at 1:03 PM, Joel Goldstick wrote: > Chris, and all.. Since you posted yours, I post this for your pleasure. I > couldn't figure out what you were doing. > [chomp Python implementation of a fairly elegant solution] That's a fairly nice piece of code that comes from a delibera

Re: Programming puzzle with boolean circuits

2013-12-09 Thread Chris Angelico
On Tue, Dec 10, 2013 at 12:25 AM, Chris Angelico 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

Re: Spoiler alert? (Re: Programming puzzle with boolean circuits)

2013-12-09 Thread Joel Goldstick
On Mon, Dec 9, 2013 at 3:39 PM, John Ladasky wrote: > It has been ages since I've thought about logic gates, but... > > My thought is that with two NOT logic gates, you can only build a > flip-flop memory circuit. That strongly suggests to me that a memory > circuit would actually be used to solv

Spoiler alert? (Re: Programming puzzle with boolean circuits)

2013-12-09 Thread John Ladasky
It has been ages since I've thought about logic gates, but... (Spoiler alert? I'm not sure...) . . . . . . . . . . . . . . . . My thought is that with two NOT logic gates, you can only build a flip-flop memory circuit. That strongly suggests to me that a memory circuit would

Re: Programming puzzle with boolean circuits

2013-12-09 Thread Joel Goldstick
On Mon, Dec 9, 2013 at 6:49 AM, Johannes Bauer wrote: > Hi group, > > it's somewhat OT here, but I have a puzzle to which I would like a > solution -- but I'm unsure how I should tackle the problem with Python. > But it's a fun puzzle, so maybe it'll be appreciated here. > > The question is: How

Re: Programming puzzle with boolean circuits

2013-12-09 Thread Chris Angelico
On Mon, Dec 9, 2013 at 10:49 PM, Johannes Bauer wrote: > The question is: How do you design a boolean circuit that contains at > most 2 NOT gates, but may contain as many AND or OR gates that inverts > three inputs? IOW: Build three inverters by using only two inverters > (and an infinite amount o