Hacker News new | ask | show | jobs
by c2the3rd 4277 days ago
Has anyone managed to implement an and gate out of this? {xor, or, true} is a universal logic set, so it it theoretically possible. A not gate is easy, but the positioning of the inputs and outputs makes and gates tricky.

For those who are rusty on boolean algebra or just curious:

not A = A xor true

A and B = ((A xor true) or (B xor true)) xor 1

1 comments

Here's my attempt using the "ring of xor" technique posted elsewhere: https://imgur.com/xGHmN9c

It follows the hex structure of the other gates (inputs down and diagonally up, outputs up and diagonally down). It's got a radius 4 (the 5th blocks being the example inputs and outputs) but I think you could probably do better with some judicious bit trickery in the middle.

Edit: Radius 3: https://i.imgur.com/BaI6YLj - I wonder if 2 is possible?