Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [logic-gates]

A challenge either involving using logic-gates as the coding language or outputting logic gates.

Filter by
Sorted by
Tagged with
15 votes
25 answers
1k views

Implement the Conjunction of a Three-Valued Logic

Your task, should you choose to accept it, is to take two input values \$a\$ and \$b\$, where \$a\$ and \$b\$ are in the set \$\{T, U, F\}\$, and compute and output their logical conjunction in a ...
user avatar
  • 1,021
23 votes
5 answers
2k views

Implement a very simple ALU using only NAND gates

Note: This challenge was inspired by Joe Z's many excellent questions surrounding NAND golfing. Description Your goal in this challenge, should you choose to accept it, is to implement a very simple ...
user avatar
  • 1,021
18 votes
2 answers
594 views

Counting universal n-ary logic gates

Background A classical logic gate is an idealized electronic device implementing a Boolean function, i.e. one that takes a certain number of Boolean inputs and outputs a Boolean. We only consider two-...
user avatar
  • 62.2k
15 votes
1 answer
384 views

Build the stove controller (physically)

Challenge Build the Wheat Wizard's stove using 2-input NAND gates. The solution with the fewest NAND gates wins. Externally, it works in the following way: (the first line is added from the original ...
user avatar
  • 62.2k
14 votes
9 answers
2k views

What logic gates work given the input?

Introduction Logic gates! Everyone knows them, everyone loves them (unless you're starting to learn them). Take two booleans, compare them, get a single boolean in return. ...
user avatar
23 votes
22 answers
2k views

Evaluating Logic Gates

Logic gates are functions which perform basic logic operations. In this problem, we will account for the following 6 logic gates: AND, ...
user avatar
35 votes
19 answers
7k views

Church Booleans

Church booleans A Church boolean is a function that returns x for true and y for false where ...
user avatar
14 votes
2 answers
722 views

Densely packed decimal (DPD) to decimal, with logic gates

Inspired by recent popularity of nandgame on TNB, and my own previous challenge. Background Densely packed decimal (DPD) is a way to efficiently store decimal digits in binary. It stores three ...
user avatar
  • 62.2k
13 votes
15 answers
2k views

Logic Gates Manually

Make a program that simulates the basic logic gates. Input: An all-caps word followed by 2 1 digit binary numbers, separated by spaces, such as OR 1 0. The gates <...
user avatar
  • 1,184
7 votes
0 answers
337 views

What is the simplest reversible circuit that computes conjugacy of transpositions?

Reversible computation refers to computation in which little or no information is deleted. Reversible computation a major component of quantum computation, and reversible computation is potentially ...
user avatar
1 vote
0 answers
190 views

3-inverter with two NOT gates [closed]

Introduction I recently came across an oral exam where the candidates were asked to find a logical circuit than can negate 3 inputs A,B,C using only two NOT gates. ...
user avatar
  • 111
17 votes
2 answers
1k views

Gerrymandering with Logic Gates

The majority function is a boolean function which takes three boolean inputs and returns the most common. For instance if maj(x,y,z) is the majority function and <...
user avatar
  • 2,075
13 votes
7 answers
2k views

Draw the XNOR digital timing diagram

Below is a (schematic) Digital timing diagram, for the XNOR logic gate. ...
user avatar
  • 8,386
9 votes
2 answers
578 views

The logical quine

The challenge Simply write a program that outputs its own source code. Nothing more than a regular quine. The problem We don't have a computer so we have to run the program on a programmable logic ...
user avatar
17 votes
2 answers
370 views

Given a truth table, output a Stackylogic program that satisfies it

Stackylogic is a programming language I made up in a previous challenge: Run Stackylogic. Read that post for full details and examples, but here is how it works paraphrased: Stackylogic takes ...
user avatar
46 votes
11 answers
2k views

Run Stackylogic

Stackylogic is a logic-based programming language I made up that take in 0's and 1's for input and outputs a single ...
user avatar
72 votes
86 answers
15k views

Golf all the 16 logic gates with 2 inputs and 1 output!

For example, the gate A and B is a logic gate with 2 inputs and 1 output. There are exactly 16 of them, because: each logic gate takes two inputs, which can be ...
user avatar
  • 48.2k
9 votes
9 answers
519 views

Create a Boolean parser (continued)

Continuation of this challenge because the author is gone and the question is closed. What you need to do is create a Boolean parser. Boolean expressions, in case you haven't heard of them yet, have ...
user avatar
  • 48.2k
13 votes
4 answers
627 views

Build a 4-vertex Connectedness Tester using NAND gates

A connected graph is a graph that contains a path between any two vertices. Challenge Build a [2-input NAND-gate] circuit that determines whether a 4-vertex graph is connected. (A gate's 2 inputs can ...
user avatar
14 votes
9 answers
1k views

Truth Tables: Your great-grandfather's computer

If you remember back to your schooling years, you might remember learning about Truth Tables. They seemed boring, but they are basis for logic and (some would argue) all computing... Problem Your ...
user avatar
  • 808
16 votes
5 answers
2k views

Express all 16 boolean functions with the less than operator

There are 16 distinct boolean functions for two binary variables, A and B: ...
user avatar
33 votes
6 answers
1k views

Grid Based Digital Logic (Duodyadic Tiles)

Duodyadic tiles are kinds of square function blocks that take two inputs, one from their top side and one from their left side, and have two outputs, one on their right side and one on their bottom ...
user avatar
9 votes
2 answers
1k views

Create a universal two-dimensional cellular automaton cell using two-way universal logic processors

In Conway's Game of Life, a cell is in a state of either on or off, depending on the on-and-off state of the eight cells surrounding it. We can simulate this using a logic gate network with some sort ...
user avatar
  • 33.7k
14 votes
4 answers
5k views

Drive a hexadecimal 7-segment display using NAND logic gates

The ubiquitous 7-segment numerical display can unambiguously display all 16 hexadecimal digits as show in this wikipedia .gif Entries for this challenge will create a circuit diagram using NAND logic ...
user avatar
36 votes
1 answer
2k views

Domino Circuits

Scoreboard Here are the raw scores (i.e. domino counts) for VisualMelon's submission. I'll turn these into the normalised scores described below, when more answers come in. The existing solution can ...
user avatar
10 votes
2 answers
1k views

Build an EBCDIC converter using NAND logic gates

In this question, a mapping is defined between EBCDIC and a superset of ISO-8859-1. Your task is to build a network of two-input NAND gates that will take eight inputs ...
user avatar
  • 33.7k
16 votes
1 answer
813 views

Build a minifloat adding machine using NAND logic gates

A minifloat is a binary representation of a floating-point number that has very few bits. The minifloat in this question will be defined as an 6-bit number m, ...
user avatar
  • 33.7k
12 votes
2 answers
2k views

Build a bit-counting comparator using NAND logic gates

A bit-counting comparator (BCC) is a logic circuit that takes some number of counting inputs A1, A2, A3, ..., An as well as inputs ...
user avatar
  • 33.7k
9 votes
3 answers
938 views

Build a 2-way universal logic processor using NAND logic gates

A 2-way universal logic processor (2ULP) is a network of logic gates that takes two input wires A and B, as well as four other ...
user avatar
  • 33.7k
14 votes
3 answers
5k views

building circuit for divisibility by 3

A boolean circuit in TCS is basically a DAG consisting of And, Or, Not gates, and by what is known is "functional completeness" they can compute all possible functions. eg this is the basic principle ...
user avatar
  • 379
9 votes
8 answers
4k views

A simple logic gate calculator

Your mission, if you choose to accept it, is to construct a simple truth evaluator for the following logical operators: ...
user avatar
  • 874
10 votes
2 answers
1k views

Implement superoptimizer for addition

The task is to write code that can find small logical formulae for sums of bits. The overall challenge is for your code to find the smallest possible propositional logical formula to check if the sum ...
user avatar
3 votes
1 answer
506 views

More fun with gates: Karnaugh simplification

Take a classic Boolean function with 4 variables, and perform a Karnaugh simplification (you can use any other method of Boolean algebra to arrive to the simplest form). The catch is: the result has ...
user avatar
  • 8,114
23 votes
2 answers
12k views

Build a multiplying machine using NAND logic gates

Based on my previous question of the same type, Build an adding machine using NAND logic gates, this time you're being asked to multiply instead of add. Build a diagram of (two-wire) NAND logic gates ...
user avatar
  • 33.7k
5 votes
3 answers
910 views

Build a NAND gate using multiple NAND gates

A question that had popped up in my head once - how many NAND gates would it take to build a larger, "meta-NAND" gate? Your task is to build a black-box circuit that takes two input wires ...
user avatar
  • 33.7k
8 votes
1 answer
3k views

Build an adding machine using NAND logic gates

This is "programming" at its most fundamental. Build a diagram of (two-wire) NAND logic gates that will take the input wires A1, ...
user avatar
  • 33.7k