Skip to content

Solutions and Descriptions of each circuit and advanced docs on each circuit created for NandGame

Notifications You must be signed in to change notification settings

StevenReynoso/NandGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 

Repository files navigation

NandGame

Solutions for The Nand Game, a game that teaches the fundamentals of computing by building a computer from scratch. Each level is accompanied by images of the logic gates used to build the components.

📘 Table of Contents

🔩 Hardware Implementation

🔌 Logic Gates

➗ Arithmetic

🔀 Switching

🧮 Arithmetic Logic Unit

💾 Memory

🧠 Processor


Levels

🔌 Logic Gates

NAND Gate

This NAND gate is built using two SPDT (Single Pole Double Throw) relays. Each input (A and B) controls one relay's coil. The relays are wired so that only when both inputs are HIGH do the coils switch their contacts and disconnect the output from voltage — making the output LOW. In all other cases, the output remains HIGH, satisfying the NAND truth table. While modern systems use transistors for speed and efficiency, this relay-based implementation demonstrates the fundamental logic at a hardware level.

📖 Full Explanation →

Invert

Builds a NOT gate using a NAND gate by tying both inputs together. This creates an inverter — a fundamental building block in digital logic.

📖 Full Explanation →

AND Gate

This builds the AND Gate, which takes two inputs and will tell you if they are both on, this is created by inverting the output of a NAND gate.

📖 Full Explanation →

OR Gate

Builds an OR gate using only NAND gates by applying De Morgan’s Law. Inverts both inputs, then NANDs the results — producing a circuit that’s true when either (or both) inputs are HIGH.

📖 Full Explanation →

XOR Gate

Implements exclusive logic using only NAND gates — true when inputs differ, false when they’re the same.

📖 Full Explanation →

➗ Arithmetic

Half Adder

This is the adder which allows us to add binary numbers from 0 to 2 (1 0) in binary

📖 Full Explanation →

Full Adder

The Full Adder allows us to add up 3 1-bit binary numbers to add from 0 to 3 (1 1 in binary)

📖 Full Explanation →

Multi-bit Adder

We made the Full Adder,and now we can chain multiple Full Adders to perform binary addition on multi-bit numbers.

📖 Full Explanation →

Increment

Increases a binary number by one — useful for counters and loops.

📖 Full Explanation →

Subtraction

Performs binary subtraction using adders and two’s complement logic.

📖 Full Explanation →

Equal to Zero

Checks if a binary value is zero — essential for condition checking and branching.

📖 Full Explanation →

Less than Zero

Detects negative values in signed binary numbers — useful in arithmetic logic decisions.

📖 Full Explanation →

🔀 Switching

Selector

Routes one of two inputs to the output based on a control signal — a 2:1 multiplexer.

Switch

Acts like a controlled gate — opens or closes the path between input and output.

🧮 Arithmetic Logic Unit

Logic Unit

Performs bitwise operations (AND, OR, NOT) between binary inputs.

Arithmetic Unit

Handles binary addition and subtraction operations.

ALU

Combines logic and arithmetic functions into one unit — the brain of binary computation.

Condition

Evaluates flags or result bits from the ALU to guide decision making.

📎 Memory

SR Latch

Basic memory cell that stores 1 bit using feedback between NAND gates.

D Latch

Stores data based on a clock or enable signal — an improvement over the SR Latch.

Data Flip-Flop

Edge-triggered version of the D Latch — useful for precise timing.

Register

Stores multiple bits together — like a row of flip-flops.

Counter

A sequential circuit that counts up (or down) with each clock pulse

RAM

Random Access Memory — stores and retrieves binary values at addressed locations.

🧠 Processor

Combined Memory

Unifies program and data memory for compact system design.

ALU Instruction

Encodes control bits to instruct the ALU on which operation to perform.

Control Selector

Selects control paths to guide instruction flow.

Control Unit

Directs the execution of instructions based on inputs and current state.

Computer

Combines the control unit, the storage memory (RAM and Registers), program memory(Rom), A counter, and a clock unit to create a working programmable microprocessor.

Input and Output

Interfaces the computer with the outside world through signals and devices, in this case a button and a light.

Author

👤 Steven Reynoso

Releases

No releases published

Packages

No packages published