Skip to main content

Questions tagged [atomic-code-golf]

Atomic code golf is scored by the number of operations in a specific fragment of a language you define.

Filter by
Sorted by
Tagged with
5 votes
3 answers
266 views

Fewest Instructions for Mihály Quine

https://mihaly.barasz.com/compressed-loop/game.html You have a simple, line-oriented “compression” language. The language works as follows: The document must start with the ...
programjames's user avatar
8 votes
3 answers
444 views

Stably sort N elements in this restricted "cmov" language

The following problem is taken from the real world — but indubitably code-golf! In this puzzle, the programming language is fixed, and your job is to write the most ...
Quuxplusone's user avatar
15 votes
3 answers
565 views

Count the number of disjoint 11 blocks

The task is to count the number of disjoint 11 blocks in a 64-bit word, using the minimum number of straight-line instructions. That is, how many nonoverlapping ...
Falk Hüffner's user avatar
8 votes
1 answer
522 views

Use a Finite Combo in Magic the Gathering to Produce Graham's Number

Produce Graham's Number in Magic the Gathering using the fewest number of cards and without using any infinite combos. Rules: Producing Graham's number means do anything that requires Graham's number ...
Zags's user avatar
  • 407
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 ...
Qaziquza's user avatar
  • 1,623
12 votes
2 answers
645 views

Branchless (MIPS) assembly code for median of 3

I was trying to write a short MIPS32 code for computing the median of three registers. The rules: Assume that some values are pre-loaded into $t0, ...
M A's user avatar
  • 221
15 votes
1 answer
432 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 ...
Bubbler's user avatar
  • 76.9k
12 votes
2 answers
1k views

SKI calculus golf: Hello, World!

Background SKI combinator calculus, or simply SKI calculus, is a system similar to lambda calculus, except that SKI calculus uses a small set of combinators, namely ...
Bubbler's user avatar
  • 76.9k
8 votes
3 answers
838 views

Crack the Lost Numbers

The Lost Numbers are 4, 8, 15, 16, 23, 42. Your goal is to create an expression to output them all. Your allowed characters are 0123456789, ^+-*/, (), % for modulo and n as the single variable allowed....
AndrewTheCodegolfer's user avatar
3 votes
3 answers
802 views

Programming Less-Than, Greater-Than and Equal-To functions using Restricted Source [closed]

I'm currently working with a branchless language which does not have native Less-Than, Greater-Than or Equal-To functions. I do however have min, ...
Eliseo D'Annunzio's user avatar
4 votes
1 answer
456 views

Write a fast-growing assembly function

Synopsis Your goal is to implement the (asymptotically) fastest growing function within bounded code on a fictional CPU utilizing a quite limited, yet (probably) turing-complete instruction set. ...
univalence's user avatar
  • 1,649
9 votes
3 answers
541 views

Efficient table-lookup computation

The challenge: compute the day of the week from a MM-DD representation of a day in this year (2021). However, you have to write your program in the following subset ...
DELETE_ME's user avatar
  • 17.3k
34 votes
7 answers
4k views

Shortest "arithmetic" formula to output 1000 primes

Write a formula using only the digits 0-9, +, *, -, <...
prime_directive's user avatar
16 votes
3 answers
2k views

Final tribute to John Conway: FRACTRAN self-interpreter

It's time to conclude the series of John Conway challenges of mine. Background A FRACTRAN program consists of an ordered list of fractions. The program starts by taking a single integer as input. Each ...
Bubbler's user avatar
  • 76.9k
36 votes
9 answers
5k views

Make 1s using a bunch of 1s

Your task is to form an expression equaling \$ 11111111111 \text{ (11 ones)} \$ using only the following characters: 1+(). Keep in mind that the result is in base ...
dingledooper's user avatar
  • 22.7k
35 votes
2 answers
4k views

Tribute to John Conway: Collatz in FRACTRAN

John Horton Conway was a brilliant mathematician. Among his contributions were three Turing-complete esolangs: Game of Life (esolangs wiki), FRACTRAN (esolangs wiki), and Collatz function (esolangs ...
Bubbler's user avatar
  • 76.9k
7 votes
1 answer
424 views

The shortest way of getting rid of these numbers

This is a simple game of getting rid of those damn numbers. You start with the numbers from 1 to 19, written in a grid of 9 by 3: 1 2 3 4 5 6 7 8 9 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 You may ...
ThE_-_BliZZarD's user avatar
20 votes
4 answers
2k views

SKI calculus golf: Half of a Church numeral

Background SKI combinator calculus, or simply SKI calculus, is a system similar to lambda calculus, except that SKI calculus uses a small set of combinators, namely ...
Bubbler's user avatar
  • 76.9k
47 votes
3 answers
4k views

Construct a pentagon avoiding compass use

Rules You will start with only two elements: Points \$A\$ and \$B\$ such that \$A \neq B\$. These points occupy a plane that is infinite in all directions. At any step in the process you may do any ...
Wheat Wizard's user avatar
  • 98.8k
74 votes
5 answers
9k views

Machine Learning Golf: Multiplication

I'd like to propose a different kind of golfing challenge to this community: (Artificial) Neural Networks are very popular machine learning models that can be designed and trained to approximate any ...
Stefan Mesken's user avatar
14 votes
2 answers
843 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 ...
Bubbler's user avatar
  • 76.9k
8 votes
1 answer
449 views

Generate an expression yielding near-equidistributed result

Create a program (any language) which, given positive integer m, outputs a valid C expression that: Uses a single variable x ...
fgrieu's user avatar
  • 615
11 votes
2 answers
553 views

Egg hunting in Collatz style

Inspired by The Great API Easter Egg Hunt! Summary Your task is to search for a predetermined integer in the "Collatz space" (to be explained later) using the fewest step possible. ...
Weijun Zhou's user avatar
  • 3,647
12 votes
5 answers
581 views

Get Two from One

As we saw in this question complex logical statements can be expressed in terms of the simple connectives of generalized Minesweeper. However Generalized minesweeper still has redundancies. In order ...
Wheat Wizard's user avatar
  • 98.8k
13 votes
3 answers
2k views

Hexcellent Minesweeping

Hexcells is a game based off of Minesweeper played on hexagons. (Full disclosure: I have nothing to do with Hexcells. In fact I don't really like the game.) Most of Hexcells rules can be pretty ...
Wheat Wizard's user avatar
  • 98.8k
22 votes
2 answers
869 views

Write it into number theory style

Write a mathematical statement, using the symbols: There exists at least one non-negative integer (written as E, existential ...
l4m2's user avatar
  • 24.5k
17 votes
1 answer
2k views

Google's Hopping Bunny

On December 4, 2017, the Google Doodle was a graphical programming game featuring a bunny. The later levels were nicely non-trivial and they seemed like a great candidate for an atomic-golf challenge. ...
El'endia Starman's user avatar
33 votes
3 answers
30k views

Google's doodle on kids coding: shortest program solving all the levels

Today's Google doodle is about Celebrating 50 years of Kids Coding: The goal is program the path of a little bunny so that it can eat all the carrots. There are 4 types of blocks (see pictures below): ...
Surb's user avatar
  • 441
12 votes
4 answers
938 views

Find the password

An ordinary N-digit combination lock consists of N rotating discs. Each disc has digits 0-9 inscribed in order, and you need to turn them to the correct password to open it. Obviously, if you don't ...
Colera Su's user avatar
  • 2,421
136 votes
11 answers
14k views

(-a) × (-a) = a × a

We all know that \$(-a) \times (-a) = a \times a\$ (hopefully), but can you prove it? Your task is to prove this fact using the ring axioms. What are the ring axioms? The ring axioms are a list of ...
Wheat Wizard's user avatar
  • 98.8k
10 votes
3 answers
983 views

Blind binary adder

Imagine you have two boxes B(x) and B(y), each containing an unknown bit - 0 or 1, and a machine ...
ngn's user avatar
  • 15.3k
8 votes
1 answer
2k views

Regular expression parser

This task is a classic programming task: Implement a regular expression parser. That is, write a program or function which takes a string describing a regular expression and a candidate string, and ...
celtschk's user avatar
  • 4,680
8 votes
1 answer
441 views

Solve this uHerbert challenge

TL;DR: Solve this particular challenge, a robot simulation, by stepping on all of the white pads, and avoiding the gray pads. You can step on a white pad any number of times, as long as you step on ...
Tim's user avatar
  • 183
1 vote
0 answers
158 views

Rewrite the Tiny BASIC IL program to support 7 changes to BASIC [closed]

Circa 1976. With the success of the Tiny BASIC Design Note, a variety of Tiny BASIC IL implementations now span a range of microcomputers. The time has come to expand the Tiny BASIC standard. Grammar ...
Jeffrey Henning's user avatar
0 votes
2 answers
624 views

Tetration: (Very) Hard Mode [closed]

This question is inspired by this one Your task Make a program or function that calculates the Tetration of 2 numbers. Tetration is what "comes next after addition, multiplication, and exponents". ...
user avatar
27 votes
11 answers
5k views

Is this number an exact power of -2: (Very) Hard Mode

This is a version of the recent challenge Is this number an integer power of -2? with a different set of criteria designed to highlight the interesting nature of the problem and make the challenge ...
Jason C's user avatar
  • 6,482
1 vote
1 answer
327 views

Converting rational numbers to an “alien” data format

For a story I'm writing, I needed to convert 101⅐ (101 + 1/7 if that doesn’t show up for you) into base 47. Expressing an integer in some base brings back memories of first learning how to program ...
JDługosz's user avatar
  • 119
2 votes
3 answers
369 views

Your very own "for" instruction, redux [closed]

Inspired by Sygmei's question, I'm interested in finding out what languages can "do this properly". Your task is to write a "for loop" function / macro / instruction. The arguments should be: an ...
Hugh Allen's user avatar
16 votes
5 answers
2k views

Abstract Syntax Tree Golfing: FizzBuzz, Python

Summary Implement FizzBuzz in Python, with the fewest possible tokens. Challenge Write a program that prints the decimal numbers from 1 to 100 inclusive. But for multiples of three print “Fizz” ...
isaacg's user avatar
  • 42k
22 votes
3 answers
970 views

Prove DeMorgan's laws

Using the the ten inferences of the Natural Deduction System prove DeMorgan's laws. The Rules of Natural Deduction Negation Introduction: {(P → Q), (P → ¬Q)} ⊢ ¬P ...
Wheat Wizard's user avatar
  • 98.8k
6 votes
4 answers
1k 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 the ...
Baldrick's user avatar
  • 261
13 votes
4 answers
672 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
-4 votes
1 answer
311 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 ...
Lew Baxter's user avatar
2 votes
0 answers
323 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, ...
Filip Haglund's user avatar
1 vote
3 answers
169 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 ...
Caridorc's user avatar
  • 2,338
10 votes
3 answers
1k 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 ...
MaiaVictor's user avatar
3 votes
5 answers
1k 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 ...
a62's user avatar
  • 69
5 votes
1 answer
328 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....
Brett's user avatar
  • 73
-5 votes
7 answers
406 views

Determine length of bitstring

Optimize the following function for number of tokens: ...
fredoverflow's user avatar
  • 2,709
9 votes
4 answers
458 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 ...
Marzio De Biasi's user avatar