Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [atomic-code-golf]

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

13
votes
1answer
216 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 ...
5
votes
1answer
321 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 ...
12
votes
2answers
402 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. Introduction ...
13
votes
3answers
1k 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 ...
11
votes
1answer
448 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 ...
15
votes
1answer
510 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. ...
20
votes
3answers
8k 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): ...
12
votes
4answers
807 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 ...
108
votes
11answers
11k views

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

We all know that (-a) × (-a) = a × 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 rules that two ...
10
votes
3answers
855 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 ...
5
votes
1answer
873 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 ...
9
votes
1answer
331 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 ...
1
vote
0answers
93 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 ...
0
votes
2answers
377 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". ...
26
votes
11answers
4k 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 ...
1
vote
1answer
257 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 ...
2
votes
3answers
348 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 ...
21
votes
3answers
673 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 ...
5
votes
4answers
690 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 ...
12
votes
4answers
458 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 ...
-3
votes
1answer
294 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 ...
3
votes
0answers
207 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, ...
0
votes
3answers
151 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 ...
5
votes
2answers
660 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 ...
2
votes
5answers
826 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 ...
4
votes
1answer
263 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....
-4
votes
7answers
201 views

Determine length of bitstring

Optimize the following function for number of tokens: ...
8
votes
4answers
377 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 ...
-3
votes
1answer
445 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: ...
4
votes
2answers
478 views

draw ASCII function plots

Consider a function plot like this: ...
7
votes
2answers
884 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 ...
0
votes
2answers
273 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 ...
9
votes
3answers
868 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:...
11
votes
0answers
299 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 ...
8
votes
4answers
3k 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 ...
40
votes
4answers
2k 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 <...
13
votes
6answers
3k 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 ...
-5
votes
4answers
858 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 ...
6
votes
6answers
4k 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 ...
-3
votes
2answers
298 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 ...
22
votes
5answers
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 = ...
17
votes
15answers
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/Equality ...
19
votes
16answers
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 ...
3
votes
5answers
486 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 ...
26
votes
11answers
3k views

Calculate n % 12

Calculate n modulo 12 for an unsigned 32 bit integer. The Rules: Must work for all n ...
9
votes
2answers
884 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 ...
13
votes
1answer
559 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, ...
11
votes
2answers
1k 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 ...
8
votes
3answers
745 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 ...
8
votes
1answer
296 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: ...