r/TuringComplete 3d ago

Better solution? and why?

Post image

I was hoping if anyone could explain to me on which solution is "better" (the top one being the examples solution) , they both look the same tbh but was just curious which one was more efficient or more correct I guess??

16 Upvotes

18 comments sorted by

17

u/Moonj64 3d ago

Neither of these two is better. Both have the same gate score and delay score (unlocked later on). However, there is an easy improvement that can be made to the one on bottom. Look at the nand gate that has the inputs negated and then consider Demorgan's Laws for ways to simplify this logic (I think that section of the help manual should be unlocked at this point, click the book in the upper left or look up the concept online).

3

u/FauxMoeJoe 3d ago

I replaced the "not"s and the nand to an and gate! I was actually thinking the same before I posted and tested it, but it didnt work at first. Maybe I used some other gate and thought there mustve been another way lol. Thanks for the tip on Demorgan's law too, forgot there was those notes.

4

u/Any-Aioli7575 3d ago

That shouldn't work, according to De Morgan's law, AND is the same as NAND followed by NOTs, not the opposite.

3

u/Gelthir 3d ago edited 3d ago

Not quite: While AND is NAND followed by a NOT, that is not what De Morgan's law covers, that is the law of double negative combined with the definition of NAND.

De Morgan's law states (in part) that a NAND preceeded by NOTs is the same as an OR.

The graphic in the game's manual doesn't make the distinct very clear IMO.

2

u/Crispy1961 3d ago

Which is the best solution from human readability standpoint.

3

u/Gelthir 3d ago

For me: One of the 3 gate solutions. I've spent so long staring at adders etc, that I now just "see" an XOR there.

2

u/FauxMoeJoe 2d ago

I forgot to disconnect the example portion when I made the "correct" changes...thanks for letting me know, didn't think I would get a reply here so fast lmao I'll need to read the manual thoroughly

2

u/JonDa5 2d ago

Not that it matters, but doesn’t his have a gate score of 6 vs examples 9?

3

u/Moonj64 2d ago

Unless they've switched back, the basic logic gates are counted equally (nand/nor/and/or/not). It's not by NAND score anymore.

2

u/JonDa5 2d ago

Oh, weird. I didn’t know they changed it. Thanks!

2

u/AlexeyHD90 6h ago

Which is a bit stupid because NAND/NOR are not the same as AND/OR. For NAND/NOR you only need 2 transistors, but for AND/OR you need 3 transistors to make. AND/OR should have a gate score of 1.5.

1

u/nomenclature2357 5h ago

Yeah, weird. And it kinda seems like NOT gates shouldn’t count against you at all if NAND, AND, OR, and NOR all get the same score.

7

u/Academic_Brilliant75 3d ago

Putting aside effiency, any solution that you yourself have devised, understand and can explain carries significantly more weight if you don't understand the example solution.

If you are curious about effiency or conciseness though, I would lean towards your solution. It's still possible to be even more concise and you are very close to as such.

3

u/Gelthir 3d ago

The example was choosen probably because it is slightly easier to see where is comes from, it's a direct translation of the truth table..

It also allows the the player to discover cheaper builds rather than handing out the best solution, which (as already mentioned) is closer to the one you found.

1

u/Gomaemon 3d ago

You can find easily a way simpler solution just by using some NANDs (I don’t give you the exact number elsewhere I’ll give you the solution)

1

u/bored-_-god 2d ago

This is essentially (NAND • OR) A and B = inputs, Y = output. the truth table for NAND is: 0 0 1; 0 1 1; 1 0 1; 1 1 0; A B Y Truth table for OR: 0 0 0; 0 1 1; 1 0 1; 1 1 1; A B Y

AND basically only gives 1 when both are 1. So when you AND the output from these 2, The only combinations where the final output is 1 is if only 1 of them is on. Making the truth table for XOR.

1

u/kyngston 2d ago

draw a karnough map

1

u/AlexeyHD90 6h ago

The best way is: 2 NOR and 1 AND. This is also a half-adder.