Logic Gates in Blocks in Gimkit Creative! (Difficulty 🟧) (And gate, or gate, nor gate, etc.)

:brick: Blocks Warning: This guide has excessive use of blocks.

Welcome to my latest (and first in a long time) GKC guide!

In this guide, I’ll be going through the six basic logic gates in electronics and coding, and explaining how to create each of them with block code in Gimkit Creative to compare two true/false properties.


Table of contents:


How these explanations will work


Okay, so, basically, for each gate, we’ll have three true/false properties: Input 1, Input 2, and Output. I’ll explain how to create the gate with block code, comparing the two input properties to determine the output (which, if you didn’t know, is what a logic gate does).

Now, with two inputs which can each be in two different states, there are four possible combinations the gate can recieve:
the combos.
But there are only two possible outputs, so depending on the gate, the number of possible ways the output can be 1 versus the number of possible ways it can be 0 can vary.

For each gate, I’ll give an explanation of what the gate does, I’ll show a table with the four possible input combinations, and the output that would come out of each, and I’ll then show the block code to make the gate, with a brief explanation of exactly what it does.

Anyways, let’s get started!

Important note: If I say that an input’s value is 1, or its value is true or it is set to true, or it is powered, those all mean the same thing.

AND gate


An AND gate checks if both inputs have a value of 1, or true, then the output becomes 1 as well. Therefore, as shown below, only one input combination can power the output of the gate.
Screenshot 2023-09-22 7.16.17 PM
The block code for this one is quite simple, here it is:
Screenshot 2023-09-23 at 10-06-07 Gimkit - live learning game show
Basically, it checks if the first input is powered/true, and if it isn’t, it does nothing else, but if it does, it checks if the second input is also powered. If it isn’t, once again, the script is over, but if it is, then it powers the output.

OR gate


An OR gate is pretty simple: it checks if at least one input is powered. If this is true, it powers the output. The only combination that does not power it is if neither input is powered.
Screenshot 2023-09-22 8.29.14 PM
The block code for it is also pretty simple:
Screenshot 2023-09-23 at 10-04-36 Gimkit - live learning game show
Basically, it checks if the first input is powered, and if it is, it powers the output, finishing the script. If it is not powered, it checks if the second input is, and if it is, it powers the output and finishes the script. If it isn’t, it just finishes.

XOR gate


The XOR gate works similarly to the OR gate, but unlike the OR gate, if both inputs are powered, it does not power the output. One, and only one, input must be powered.
Screenshot 2023-09-23 at 09-42-06 logic gate (AND OR XOR NOT NAND NOR and XNOR)
Surprisingly, the block code for this one is actually quite simple:
Screenshot 2023-09-23 at 10-00-59 Gimkit - live learning game show
It checks if the two inputs are the same. They could be both true or both false. If either of these are true, it does nothing. If they are not true, it means the two inputs are different, so only one is powered, therefore, the output is powered.

NAND gate


The NAND gate powers the output if less than two of the inputs are powered. As its name sort of states, the NAND gate’s output is powered when the AND gate’s output is not, and vice versa.
Screenshot 2023-09-23 at 12-57-24 logic gate (AND OR XOR NOT NAND NOR and XNOR)
Once again, not too complicated to make in block code:


It works by checking if both inputs are powered, and if they are, it does nothing, but if they are not both powered (so, if one or neither of them are), it powers the output.

NOR gate


The NOR gate is basically an OR gate with an inverted output signal. If neither input is powered, the output is. Where an OR gate’s output would be powered, a NOR gate’s output isn’t, and vice versa.
Screenshot 2023-09-23 at 13-07-30 logic gate (AND OR XOR NOT NAND NOR and XNOR)
The NOR gate’s block code is sort of similar to the NAND gate:


It checks that both inputs are false, and if this is the case, it powers the output.

XNOR gate


And now, the final logic gate of this guide, the XNOR gate.
The XNOR gate, sort of similarly to the NOR gate, checks if the inputs are the same, as in, if they are both powered or both not powered, and if either of these is true, its output is powered.
Screenshot 2023-09-23 at 13-15-01 logic gate (AND OR XOR NOT NAND NOR and XNOR)
Despite its complicated-sounding name, the XNOR gate is actually one of the simpler and easier gates to create using block code:
Screenshot 2023-09-23 at 13-16-35 Gimkit - live learning game show
It simply checks if both inputs are the same, and if they are, powers the output.

Conclusion


So there you go! The six basic logic gates, made in Gimkit Creative block code!

Yes, I know there’s also a NOT gate, but I’m only doing the ones with two inputs.

Complex operations can be performed using combinations of these logic gates. In theory, there is no limit other than memory to the number of gates that can be arrayed together in a single contraption - or a single device - a single block, for that matter. Arrays of logic gates are found in digital ICs (integrated circuits). As IC technology advances, the required physical volume for each individual logic gate decreases and digital devices of the same or smaller size become capable of performing ever-more-complicated operations at ever-increasing speeds. I suppose that probably isn’t really true for Gimkit though lol

Thanks for reading this guide, I hope you learned something, and I hope this helps you and/or improves your Gimkit Creative experience! :grin:

Resources:
https://www.techtarget.com/whatis/definition/logic-gate-AND-OR-XOR-NOT-NAND-NOR-and-XNOR

15 Likes

Nice guide! This’ll help a lot with block coding!

5 Likes

Blocks are cool, and this guide is too.

6 Likes

This is a very useful guide! Thanks!

2 Likes

@CringeKarlScott Great guide! This would be very useful!

2 Likes

What about the NOT Function? The not function inverts the output

False → True
True → False

1 Like
4 Likes

How did you make the table of contents?

2 Likes

@CringeKarlScott I want to know how too.

2 Likes

There were some stuff about this in a different guide

2 Likes
7 Likes

You could make this with numbers, too, right?
I feel like that would be easier…

2 Likes

Nice job, @CringeKarlScott! A good addition to the concepts.

3 Likes

Very useful! You should link this to the Bitwise Operations post.

2 Likes

I love this guide!

3 Likes

Same, very helpful, and nice new pfp @RandomKid!

3 Likes

Thx!

4 Likes

I would’ve used properties TBH.
AND gate=
If inputa+inputb=2
set output=1
OR gate=
if inputa+inputb>0
set output=1
XOR gate=
if inputa+inputb=1
set output=1
NAND gate=
if inputa+inputb<2
set output=1
NOR gate=
If inputa+inputb=0
set output=1
XNOR gate=
if inputa-inputb=0
set output=1

3 Likes

bump

2 Likes

hey guys

remember when we just said “bump” instead of trying to add some kind of funny joke to our bumps

those were the days

5 Likes