We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Littleman

From Esolang
Jump to navigation Jump to search
For educational machine, see Little Man Computer.

Littleman is an esoteric programming language defined for the ICFP contest 2026. The contestants have to write programs in this language.

The code of a Littleman program is a two-dimensional array of ASCII characters, similar to Fungoids. Instruction pointers, called little men, run on this two-dimensional code space. Each little man also has a direction that is one of the four cardinal directions. In every tick, each little man reads the instruction from the cell that it's standing on, executes it, then steps forward in its direction. Multiple little men can act in parallel.

Littleman has no Befunge-like stack. Besides its position and direction, each little man only has two general-purpose registers and a counter register, each storing a 64-bit integer. Because of this, each little man can only do very limited computations, and the little men have to work together in useful programs.

Rooms and pipes

The program space is partitioned to rooms, which are rectangular boxes with a one character thick border on each side. Little men can only be positioned strictly inside a box, and it is an error if they step onto the border of a box. In the first version of the language, each room could have at most one little man. The twist, revealed one day after the start of the contest, allows little men to fork into two little men, so that each room could have multiple little men acting simultaneously, although each room still starts with at most one little man. When little men collide, the annihilate. There are also special rooms that represent the input and output of the program, these don't have instructions or little men in them.

Connecting the rooms are pipes, which are queues that carry numbers. The little men can send a number into a pipe that starts from its room, or receive a number from a pipe that ends in its room. Pipes are directed polygonal paths that start from just outside the border of a room and end just outside the border of another room. Each cell of a pipe is at a cardinal direction from the previous cell, so pipes can take turns, except that the second cell of a pipe must be in the direction from the first cell that is away from the source room of the pipe. Pipes cannot cross. They can merge, but this feature is hard to use.

Numbers take up a cell on the pipe. They try to move forward on the pipe by one cell between each program tick, but they block each other so only one number can occupy each cell of a pipe. A train of numbers that is one number per cell dense can move together. The ordinary send and receive instructions use the pipe closest to the instruction in Manhattan distance. These instructions are blocking: the receive instruction waits until a number is available on the last cell of a pipe, while a send instruction waits until there is no number in the first cell of a pipe. There are a few less common instructions that interact with pipes: two receive any instructions that receives from any pipe where a number has arrived, a broadcast send instruction that sends to all pipes that start in the room, and a non-blocking instruction that counts the number of numbers in a pipe.

Instruction set

A decimal digit as an instruction loads a constant to the A register. There are nine two-operand arithmetic instructions that all use the A and B registers as input and the A register as output. The receive from pipe instructions also output into the A register. This register usage makes programs more verbose than Befunge programs, or even programs on a stack machine with the stack limited to depth 2, because you need to insert register transfer instructions often. There are three register transfer instructions: copy A to B, swap A with B, and copy A to counter. The two-argument arithmetic instructions are: add (64-bit wrapping), subtract (wrapping, A minus B), multiply, modulus (signed, A modulo B), bitwise and, bitwise or, bitwise xor, left shift, signed right shift. There is also a unary negate instruction and a signed divide instruction that outputs two results, one to A and one to B.

For control, you have the nop and four absolute cardinal direction instructions (<^v>) from Befunge, as well as a three-way branch that turns the direction relative to the current direction left/forward/right if the A register is negative/zero/positive respectively. At the start of the program, all little men face to the east. There is also a halt instruction that stops only the little man that is executing it.

There are three branch instructions that use the the counter register. The first two do nothing if the counter is not positive but do a relative turn left or right compared to the current direction respectively if the counter is strictly positive. The third does a relative turn left/right if the counter is even/odd respectively. Complementing these instructions there is an instruction that decreases the counter by 1 (64-bit wrapping), and one that signed shifts the counter right by 1. You cannot examine the counter register other than with these three conditional branches, in particular there is no instruction that transfers the counter to the A register, only one that transfers from the A register to the counter.

On program syntax

Littleman is not self-modifying. The location of rooms and pipes is immutable, and so is the instruction on each cell.

It is easy to add comments to a Littleman program or write polyglots, because most characters are ignored if you never try to execute them as an instruction. Outside of rooms, anything that doesn't look like a complete border for a room or a prefix of a pipe is ignored. Pipe prefixes are recognized if an arrow (one of the characters <v^>) is next to a room border and is facing away from it – each pipe prefix must be a complete pipe that ends in another room or else the program is invalid. Within a normal room, any printable ASCII character other than @ or ` is valid, and is ignored until a little man tries to execute it. @ marks the starting position of a little man, there can be no more than one of these in a room. ` is a way to write multi-digit numeric constants – this has rather inconvenient and unintuitive syntax, which at least one organizer claims was a mistake.

Problems and scoring

There are 16 problems on the contest, of which the last 4 were revealed as part of the twist a day after the start of the start of the contest. The contestants have to write Littleman programs that try to solve each problem. These programs are then tested on testcases that the organizers have prepared in advance. Some of the testcases are secret, but the website tells how many testcases your program has passed, and you get extract information about the secret testcases using that.

Contestant teams can get up to 2 points for each problem: up to 1 for solving all testcases, with partial score for solving just some of the testcases, then up to 1 more point for a more optimized program among those that solve all testcases. Submitted programs that solve all testcases a problem are ranked according to the product of their area and execution time. The area is measured as the area of the smallest square that the program's code space fits into; execution time is measured until the program writes the last output for the testcase, and is added up among testcases. One problem is an exception and is ranked by area only, regardless execution time. The programs ranked for each problem then receive their score according to their place in this ranking.

Subsets

The contest defines two heavily restricted subsets of the Littleman language: Little little littleman (LLLM) and Little littleman (LLM). The contestants don't write programs in these; instead the last two contests problems ask the contestants to write a Littleman program that simulates these languages.

Links