# Tagged Questions

Atomic code golf is scored by the number of tokens of your program, excluding any syntactical separators (`()[]{}. ;` is a general rule).

538 views

### Box-256 Assembly - BIG SQUARE II

I'd like to start a series of challenges for http://box-256.com/ starting with the first challenge, “BIG SQUARE II”. After this one I'll add another for "CHECKERBOARD" and so on. Rules: Complete ...
205 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 ...
222 views

### What is the shortest LOOP program that outputs 2016? [closed]

LOOP This challenge is based around a modified version of the programming language LOOP. A program may be of any of the following forms: P;Q, where P and Q are subprograms Subprogram P is ...
95 views

### Robot optimization

Your task is to program a robot so that it reaches the hole in the ground on each of the maps within reasonable time. If the robot reaches the hole, it falls down into it and thus victory is assured, ...
132 views

### Define map in the fewest tokens [closed]

map is a very basic yet important function in functional programming. All FP programming languages have it built-in but it is always fun to see how shortly you can define it yourself. This will be ...
460 views

### Sort a list of numbers on the λ-calculus

Write a term on the pure untyped lambda calculus that, when applied to a church-encoded list of numbers, returns it with its numbers sorted in ascending or descending order. Church lists and numbers ...
578 views

### Brainf*** code golf challenge - write a Brainf*** program that searches for the first non-zero cell

The challenge is to write a brainf*** program that searches sequentially through memory for the first NON-zero cell. The program should start somewhere in fairly low memory (there will probably be ...
219 views

### Copy Memory Only Using Store And Subtraction

A peer of mine approached me with this challenge and I wasn't able to come up with an elegant solution. After discussing my approach, we began to wonder what the people at Code Golf would come up with....
177 views

### Determine length of bitstring

Optimize the following function for number of tokens: int length(int x) { switch (x) { case 1: return 1; case 3: return 2; case 7: return 3; case 15: return 4; case 31: ...
348 views

### Collatz sequence on a two counter machine

The Collatz sequence starting from a positive integer n is defined in this way: if n is even then divide it by 2 (n' = n / 2) if n is odd then multiply it by 3 and add 1 (n' = 3n + 1) Repeat the ...
298 views

### Find the inverse of a matrix

Write a full program to calculate the inverse of a 4-by-4 matrix. Rules The sixteen values of the initial matrix must be hard-coded to variables, as follows: _ _ |a b c d| |e f g h| |i j k l| ...
414 views

### draw ASCII function plots

Consider a function plot like this: ########### ################# ...
445 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 ...
229 views

### Meta-atomic code golf

In this meta-challenge, you will score your own atomic-code-golf submissions. More precisely, you will need to write a program P in language L such that the atomic-score of P is produced by P. Score ...
792 views

### “Atomic” code golf - determine the number of neutrons in an isotope

Your task is to take an string containing an isotope of an element as input, encoded like the following example with the atomic number followed by a space and the IUPAC chemical symbol for the element:...
211 views

### How to golf string output in Chef

I'm attempting to solve a programming golf style programming puzzle. I need to write an 18 character phrase in Chef in less than 32 "lines" of code. In this case, a line counts as an ingredient or an ...
2k 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 ...
1k views

### Multiply with restricted operations

Goal Your goal is to multiply two numbers using only a very limited set of arithmetic operations and variable assignment. Addition x,y -> x+y Reciprocal x -> 1/x (not division x,y -> x/y)...
1k views

### Implement an 8 bit adder

The Challenge Implement a function which accepts two integers whose values range from 0 - 255 and returns the sum of those integers mod 256. You may only use bitwise negation (~), bitwise or (|), bit ...
505 views

### Convert to uppercase and lowercase without branching and comparisons

Write two functions/programs which take an ASCII code of character (8-bit unsigned integer) and one of them converts char to uppercase and other to lowercase. That is, they must be equivalent to ...
2k views

### Solve quadratic equation using only 3 variables and arithmetic

Write function which solves equation of degree less than or equal to 2 (ax^2 + bx + c = 0). Input Function should get 3 parameters - floating point numbers which are coefficients of this equation. ...
273 views

### Shortest test for primality for byte [duplicate]

Write a function which gets as input a number (0 <= n <= 255) stored in 32-bit variable and returns non-zero integer if n is prime number and 0 otherwise. Considern = 0 and n = 1 as non-primes. ...
4k views

### Shortest expression for {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}

Given list of integers {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}. For those who interested these numbers are used in weekday calculation. Weekday = (m[n] + d + y + y>>2 + y/400 - y/100) % 7;, where ...
4k views

### Find the maximum of 3 numbers without branching

This time around your goal is to find the maximum of 3 integers (from -(2^31) to 2^31 - 1 in binary 2's complement) without using branching or loops. You are only allowed to use Inequality/...
4k views

### Determine if an integer is divisible by 3

Your goal is to determine if a number is divisible by 3 without using conditionals. The input will be an unsigned 8 bit number from 0 to 255. Creativity encouraged! You are ONLY allowed to use ...
427 views

### Increment Bitwise

Make a function that increments a number using only bitwise, loops, and conditions. Rules: All entries must be as per the language spec defined below. Scoring is not of code length, but of the ...
3k views

### Calculate `n % 12`

Calculate n modulo 12 for an unsigned 32 bit integer. The Rules: Must work for all n between 0 and 23. Other numbers optional. Must only use any of the operators +-*, ~&^| or <<, >>...
525 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 A1, A2, A4, ..., A128 ...
423 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, which has the following representation: ...
958 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 B1, B2, B4, B8, ... representing a number. It then returns 1 if the ...
631 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 inputs L_, L_a, L_b, and L_ab, and produces a single output L(a, b) using ...
252 views

### Turtle Graphics Version 2

Most of you have probably heard of the famous Turtle Graphics program, initially made popular by Logo. This challenge is to implement a Turtle Graphics program in your language of choice. Rules: ...
249 views

### tree from string

A string like this one: "a, 4.25, ((true, 5), 3, (false, false, false)), abc" Describes a tree with 13 nodes, 9 of which are leaf nodes. In C# the leaf nodes in this example would be of types string,...
920 views

### Write a hash function for Morse Code

Your goal is to write a hash function, that accepts morse code character and returns a hash code that you get to define. You can be sure, passed string will be: One of the Latin characters (A-Z) ...
724 views

### Turtle Graphics Program

Most of you have probably heard of the famous Turtle Graphics program, initially made popular by Logo. This challenge is to implement a Turtle Graphics program in your language of choice. Rules: ...
4k 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 ...
388 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 A and B and ...
908 views

### Encode a program with the fewest distinct characters possible,

The goal is to write a program that encodes an other program (input) with the fewest character possible. Scoring The score is equal to the different number of characters needed for the output. ...
2k 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, A2, A4, A8, B1, B2, B4, B8, representing two binary numbers A to B ...