So I started reading Petzold's code and got into the logic gates
which is fun when you can translate it over to Minecraft and start building
some gates and messing around with them.
So I decided to create a door in which an 8-bit passcode is needed
in order to enter I came up with this:
The world save:
Basically there's 2 control panels, one for the person(s) trying to enter
(invade ur epix basez0r) and another one inside (presumably) your base
that you use to set the passcode.
Now the logic gates take 2 inputs and provide you with 1 output, (I haven't read further than
where Petzold discusses a half-adder, so if he discusses a way to do an 8-bit logic gate
further on then this thread is essentially useless) so I did it like this:
Pair the bits from the panel outside to the panel inside the base together
then XNOR (compare) them, this leaves me with 8 XNOR'd outputs.
These are then split up into 4 pairs which each go through an AND gate
(order doesn't matter thanks to the rules of multiplication), I now have 4
AND'd bits which all go through an AND gate, now I have 2, AND those together
to get my final output, if it's 0 it will provide no power to the door
and the invaders will be left stumped on what to do next, if it's 1 the door
will open up.
So if one of those XNOR'd bits is 0, the rules of multiplication
will allow the final bit to become 0 even if the rest of the bits matched.
I'm presuming this works entirely, I haven't sat down and tried 256 seperate codes
because that would take days.
Anyway, if you downloaded and played the save you'll see that the whole contraption
is HUGE. If you were playing survival, it probably wouldn't be worth your time to go out
and collect all those materials.
I can reduce the size of it and still keep the way it works the same (I exaggerated
the spaces between each lane to make it easier to build), is there a simpler way of doing this?
Download it, make it smaller.