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
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,502
12 votes
14 answers
8k views

Print NxN spiral of ascending numbers [closed]

The numbers should be printed with leading zeroes in a field with length = (number of digits of N^2). Input (N): 4 Output: ...
Hristo Hristov's user avatar
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, ...
Joe Z.'s user avatar
  • 34.9k
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
  • 76k
23 votes
2 answers
13k 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 ...
Joe Z.'s user avatar
  • 34.9k
16 votes
1 answer
868 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, ...
Joe Z.'s user avatar
  • 34.9k
6 votes
5 answers
1k 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: ...
user avatar
135 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.5k
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
50 votes
5 answers
3k views

Multiply with restricted operations

There's a 500 rep unofficial bounty for beating the current best answer. Goal Your goal is to multiply two numbers using only a very limited set of arithmetic operations and variable assignment. ...
xnor's user avatar
  • 145k
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
28 votes
11 answers
4k views

Calculate n % 12 [closed]

Calculate n modulo 12 for an unsigned 32 bit integer. The Rules: Must work for all n ...
Nathaniel Bubis's user avatar
25 votes
5 answers
5k 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 = ...
Somnium's user avatar
  • 2,669
20 votes
4 answers
1k 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
  • 76k
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
  • 76k
15 votes
4 answers
1k views

No branching please

Anyone who is moderately into low level code optimization know about the perils of branching, be it implemented as if-statements, loops or select-statements the possibility of a branch misprediction ...
aaaaaaaaaaaa's user avatar
  • 4,405
14 votes
2 answers
832 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
  • 76k
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.5k
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 ...
Joe Z.'s user avatar
  • 34.9k
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 ...
Joe Z.'s user avatar
  • 34.9k
10 votes
3 answers
1k 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 ...
Joe Z.'s user avatar
  • 34.9k
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 ...
Joe Z.'s user avatar
  • 34.9k
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
7 votes
10 answers
2k views

Write a hash function for Morse Code [closed]

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) ...
awesoon's user avatar
  • 189
-4 votes
1 answer
544 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: ...
Ypnypn's user avatar
  • 10.9k