Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61471
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <antoon.pardon@rece.vub.ac.be> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'received:134': 0.05; 'binary': 0.07; 'suppose': 0.07; 'solution,': 0.09; 'tackle': 0.09; 'type,': 0.09; 'boolean': 0.16; 'digits.': 0.16; 'i1,': 0.16; 'i2,': 0.16; 'subject:Programming': 0.16; 'thought.': 0.16; 'values:': 0.16; 'bit': 0.19; 'input': 0.22; 'coding': 0.22; 'python?': 0.22; 'header:User-Agent:1': 0.23; 'guys': 0.24; 'question': 0.24; 'appreciated': 0.26; 'header :In-Reply-To:1': 0.27; "i'm": 0.30; 'code': 0.31; 'maybe': 0.34; 'problem': 0.35; 'subject:with': 0.35; 'advice': 0.35; 'but': 0.35; 'possible': 0.36; 'should': 0.36; 'two': 0.37; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'even': 0.60; 'easy': 0.60; 'most': 0.60; 'new': 0.61; 'kind': 0.63; 'group,': 0.63; 'combining': 0.68; 'circuit': 0.84; 'pardon': 0.84 |
| X-IronPort-Anti-Spam-Filtered | true |
| X-IronPort-Anti-Spam-Result | AogFAOApp1KGuA9G/2dsb2JhbABZs3uGLoMGgTODGgEFeBELIRYPCQMCAQIBRRMIAheHZ7sEhhAXjwwWhB4EmBSGLotlgyo |
| Date | Tue, 10 Dec 2013 15:25:42 +0100 |
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20131005 Icedove/17.0.9 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Programming puzzle with boolean circuits |
| References | <l84aor$3mj$1@news.albasani.net> |
| In-Reply-To | <l84aor$3mj$1@news.albasani.net> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.3830.1386687123.18130.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1386687123 news.xs4all.nl 2932 [2001:888:2000:d::a6]:41117 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:61471 |
Show key headers only | View raw
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 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 of AND/OR). > > Surprisingly, this is possible (and I even know the solution, but won't > give it away just yet). > > I found this puzzle again and was thinking about: How would I code a > brute-force approach to this problem in Python? And to my surprise, it > isn't as easy as I thought. So I'm looking for some advice from you guys > (never huts to improve ones coding skills). Well I would make some kind of connecter type, that would have a binary vector associated with it. How do we calculate bit n of a connector? Take the three input signals, i0, i1, i2, these can be seen as a binary digits. So suppose we have input 0, 1, 0 then bit 2 of the connector would be the value of that connector with these input signals. The original three connectors would have the following values: 01010101, 00110011, 00001111. What you can do now is make new connectors by combining them with an or, and or not port and search for those whose value is 10101010, 11001100 and 11110000. -- Antoon Pardon
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll 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