Ant Hill

From Esolang
Jump to navigation Jump to search

Ant Hill is a 2D esoteric programming language. It was heavily inspired by a game called Cell Machine.

Syntax

The program is an infinitely repeated 2D grid of cells. All cells except NOP are soild. There are multiple types of cells:

Ants

Ants are cells that move in a direction. They are represented as >, <, ^, or v depending on their direction. They are capable of pushing other cells.

Values

Values are cells that represent hexadecimal values that range from 0 to F.

Walls

Walls are immobile cells. They are represented as #.

Cloners

Cloners take a value from one side and clone it to the other side. They are represented as %.

Deleters

Deleters take a cell from one side and just delete it. They are represented as X.

Conditional deleters

Conditional deleters take a cell from one side and delete it if it equals to 0. They are represented as !.

Rotators

Rotators clockwise rotate an ant. They are represented as C.

Incrementers

Incrementers take a value from one side, increment it, and teleport it to the other side. They are represented as +.

Halters

Halters halt the program when approached by a cell. They are represented as ;.

NOPs

NOPs do nothing. They are represented as a space.
Everything else is an invalid cell and raises a syntax error.

Physics

The language has some rules for edge cases (if more clarifications are needed, please ask questions in the talk page):

Forces

Each ant contributes a force to their direction. If multiple ants are pushing the same cell, the direction with more force will win, which means that:

>0<

will not move

>>0<

will move right

>0<<

will move left

Priority

Cells that are the closest to the top-left corner get processed first. The farther it is from top left corner, the later they move.

Teleportation

Cells can not teleport if the destination is not a NOP. For example:

>0%#

will not work because the destination is a # cell.

Grid interactions

A change in one grid does not affect other grids unless the cells in the grids interacted with each other. Cells can also wander off into neighbouring grids.

Ants pushing ants

If an ant pushes an another ant, the pushed ant will not move again in the same tick.

Examples

Infinite loop

>

Any program without a halter will run infinitely.

XKCD Random Number

4>;

(NOTE: does not output anything)