This is the first problem in a series about Digital Logic Circuits.
Modern electronics depend on circuit boards, feeding them lots of input information and quickly receiving back outputs in order to perform whatever function is desired. But how do circuit boards work, exactly? Fundamentally, circuit boards consist of chips and wires.
Chips are self-contained blocks with input pins, output pins, and some internal logic. Every pin may be either
powered (1) or unpowered (0). The chip will read its input pins, and then perform some internal logic to determine
the resulant states of the output pins.
Wires connect two pins together, effectively fusing them and causing them to have the same state. Input pins must be connect to output pins, and vice versa - it is not allowed to connect two input pins together nor two output pins together.
Each circuit board will have signal(s) being generated by an INPUT source pre-built into the board,
and also an OUTPUT able to read a signal.
───────┐ ┌────────
├─● OUT[0] │
INPUT │ IN ●─┤ OUTPUT
├─● OUT[1] │
───────┘ └────────
See how the INPUT chip has a 2 pins named OUT, and the OUTPUT chip has 1 pin named IN.
While this might appear confusing at first, understand from each chip's perspective:
the INPUT chip sends signals OUT, whereas the OUTPUT chip reads signals IN.
Any unconnected IN pin will remain in an unpowered state.
However if we place a wire connecting an OUT pin to an IN pin, then the state of the IN pin will match the connected OUT pin.
───────┐ ┌────────
├─● OUT[0] -----------------┐ │
INPUT │ └----------------- IN ●─┤ OUTPUT
├─● OUT[1] │
───────┘ └────────
But this is hardly a useful circuit board - there's no real "logic" happening.
Luckily, we've been given a single pre-built chip called a NAND chip.
It has 2 IN pins and 1 OUT pin. Like all chips, the state of the OUT pin is determined by the signals read by the IN pins.
┌───────────┐
IN[0] ●─┤ │
│ NAND ├─● OUT
IN[1] ●─┤ │
└───────────┘
Below is a table (referred to as a Truth Table) which describes the determination of the OUT pin on a NAND chip.
NAND.IN ║ NAND.OUT
─────────║──────────
00 ║ 1
01 ║ 1
10 ║ 1
11 ║ 0
So the NAND chip will only output 0 when both inputs are powered, and will output 1 otherwise.
Plainly speaking, let's place a NAND chip onto the circuit board,
then wire it to the INPUT and OUTPUT pins so that the entire board has the same logic as a NAND chip.
Digital Logic Circuit Interface
For these Digital Logic Circuits tasks, you will not be providing an answer string you would for other tasks.
Instead, your Solution Code will be interpreted directly to place chips onto the circuitboard and connect them with wires.
Click here to learn the Digital Logic Circuit Syntax used on this site.
After the chips have been placed and connected, the server will run a series of tests, randomly assigning values to the input pin(s) and checking to see if the output pins read the corresponding expected values. If all tests produce the expected outputs, then the circuitboard is considered a success.
Even though we won't be using the "Your answer" box, you'll still need to put something in that box to submit your solution. Just put anything - it will not be passed to the interpreter.
Truth Table
Design a circuit board which satisfies the following Truth Table:
INPUT.OUT ║ OUTPUT.IN
───────────║───────────
00 ║ 1
01 ║ 1
10 ║ 1
11 ║ 0