Gerbil

From Esolang
Jump to navigation Jump to search

Gerbil is a forgotten and abandoned esolang idea by User:Madk which shares some similarities with Hunter.

Concept

A Gerbil program consists of several types of data, arranged in a 2D grid. There are gerbils, which function similarly to instruction pointers. There are kittens, which will chase gerbils and eat them if they catch up, and there are cats, which will hunt gerbils down much more intently. There are obstacles, which help to regulate program flow; there are walls that block all movement, obstacles which will block only kittens, obstacles which will block only cats, and obstacles that will block only gerbils. There is feed, which attracts hungry gerbils. When a pile of feed has been consumed, a gerbil will often immediately search for the next. When a gerbil moves over a command, it's executed. When a cat moves over a command, it's removed from the field. A kitten does not affect commands.

Also significant, when two mature gerbils of opposite genders meet, they will move together along the field for a length of time, and after a while will bear two child gerbils, one male and one female. Child gerbils will grow to adult ones after an amount of feed has been consumed. Cats and kittens do not reproduce or grow, but a cat that goes too long without eating a gerbil will die. Only cloning devices can spawn new cats or kittens. Additionally, no two creature may occupy the exact same space.

The commands executed by gerbils are similar, though not identical, to brainfuck's command set.

Commands

The creatures to be defined at the start of a program

M - defines a grown male gerbil at program start
F - defines a grown female gerbil
m - defines a newborn male gerbil
f - defines a newborn female gerbil
k - defines a kitten
c - defines a cat

Commands that gerbils execute and cats destroy

] - moves the memory cell pointer left
[ - moves the memory cell pointer right
+ - increments the memory cell under the pointer by 1
- - decrements the memory cell under the pointer by 1
" - doubles the value in the current memory cell
= - halves the value in the current memory cell
0 - returns the memory cell pointer to 0
! - if the cell under the pointer is =0 it becomes 1 and if it's >0 it becomes 0 (logical not operation)
~ - performs a bitwise not on the current memory cell
? - if the cell under the pointer is >0 the memory pointer is moved right once
. - outputs the cell under the pointer as an ASCII character
, - gets input to assign the cell under the pointer to an ASCII value
: - outputs the cell value as a number
; - inputs the cell value as a number
\ - prints a newline to the console

Commands that change the way the field works and how creatures behave

* - feed, attracts gerbils and is expended.
& - dispenser, creates a new unit of feed in an empty tile around it every so often
% - poison, destroys any creature that moves over it
G - an obstacle which blocks only gerbils
J - blocks only mature gerbils
j - blocks only young gerbils
K - an obstacle which blocks only kittens
C - an obstacle which blocks only cats
# - an impassable wall
X - repellent, deters creatures from coming near
y - yarn, attracts cats and kittens but not gerbils
> - copies the tile from two tiles to the left to two tiles to the right when a gerbil or kitten moves over it
< - copies the tile from two to the right to two to the left
^ - copies the tile from 2 below to 2 above
v - copies the tile from 2 above to 2 below
( - clones the occupying creature (gerbil, cat, or kitten) and places the new creature two tiles to the left
) - clones a creature and places it two tiles to the right
n - clones and places two above
u - clones and places two below
I - bridge, allows creatures to cross above-to-below or left-to-right (and visa-versa) but not in a perpendicular direction.
/ - changes the gender of a gerbil that passes over it
@ - toggles a kitten to a cat and a cat to a kitten
Q - instantly matures a young gerbil to an adult
} - only allows passage over the tile from the left
{ - only allows passage from the right
A - only allows passage from below
V - only allows passage from above
_ - (and whitespace, a tab counts as 8 spaces) blank space
S - confuses and resets any creature's pathfinding