User:kiken/Construction Site/Descriptions/grub

From Esolang
Jump to navigation Jump to search

This page is a draft for my esolang, grub.

grub is a self-modifying two-dimensional esoteric programming language created by User:kiken, based around the sticky slimes which are hard to get off your hands.

Overview

Entities

Entities in grub are like objects, with their own behaviour and properties, and are updated in order from top to bottom, left to right.

Note:

  • Entity names are capitalized, e.g. "slime" would be a trail of slime, but "Slime" would be an entity.
  • touching and contact in the following sections refer to when entities overlap, not when they are adjacent to each other.

Grub

The Grub is an entity that spreads around the unbounded grid of commands in grub. It is represented with a hashtag (#). By default, the Grub is facing right and will move straight, leaving a trail of grub (represented with *). If it comes into contact with other entities, then the following events may happen:

If the Grub is adjacent to an arrow (one of: >, <, ^ and v) then its direction will be modified accordingly.

Note: The Grub and grub mustn't be confused. The Grub is an entity, and grub is the trail that the Grub produces. Likewise, The Slime and slime in the below section also mustn't be confused.

Slime

The Slime is an entity that is still, however will create a small square of slime (3x3), and that will grow in size until it is a 7x7 square (if there isn't enough space, it will stop growing). The Slime is represented with @ and slime is represented with %. If it comes into contact with other entities, the following events may happen:

  • If slime touches grub, it will create a single glue.
  • If slime touches Glue, it will disappear.
  • If slime touches an Activator, the Activator will disappear and the touched slime will become a Slime (the entity).
  • If slime is adjacent to a Fire, it will burn.

For example, if the code was:







      @

then on iteration 1, it would turn into:







     %%%
     %@%
     %%%

then on iteration 4, it would be:




  %%%%%%%%%
  %%%%%%%%%
  %%%%%%%%%
  %%%%%%%%%
  %%%%@%%%%
  %%%%%%%%%
  %%%%%%%%%
  %%%%%%%%%
  %%%%%%%%%

and so on until iteration 7.

Glue

The Glue is an entity that moves in a single direction which is either left, right, up, down, it is random from the start of its creation. It is represented with a _. If it comes into contact with other entities, the following events may happen:

  • If it touches a Grub, the Grub will be stuck.
  • If it touches slime, both the slime and the Glue will disappear.
  • If it touches an Activator, then the Glue will continue on its way and the Activator will disappear.
  • If it touches a Fire, the Glue will burn.

Activator

The Activator is an entity that is similar to the Glue, represented with a -, however with the following interactions:

  • If it touches a Grub, then the Grub will be stuck and the Activator will disappear.
  • If it touches a slime, the slime will become a Slime.
  • If it touches a Glue, the Activator will disappear.
  • If it touches a Fire, it will burn.

Fire

The Fire is an entity that causes the burning of the other entities, represented with a ~. It is still and unmoving until it is adjacent to another entity/entities, in that case, all the surrounding entities will turn into a Fire and the original Fire will disappear.

Halt

The Halt is an entity that is still and unmoving, represented with a !. Upon contact with other entities, it will halt the entire program.

States

Grow

Grow is a state which only applies to the Grub. It increases the range in which it spreads grub.

Stuck

Stuck is a state where the entity is unable to move and if in this state, will be stuck like this until the halting of the program.

Burn

Burn is a state where the entity turns into a Fire. In this state, after 5 iterations, the new entity will disappear.

List of commands (to summarize)

Command Represented entity
# Grub
@ Slime
_ Glue
- Activator
~ Fire
! Halt
>, <, ^ and v Arrows

Anything other than these is outputted to the console and deleted. If the code is empty (excluding characters other than the above), then program immediately halts.

Examples

Hello, world!

A hello, world! and quine:

Hello, world¡

The exclamation mark is substituted for an upside-down one, for an exclamation mark is an entity.

Quine

A quine in grub can be anything other than the commands listed in the List of commands (to summarize) section.

Infinite loop

#

Since the program does not meet the halting criteria, the program never halts.

Computational class

grub may be a bounded-storage machine, though I have yet to prove it.

Implementations

Unimplemented.