Graverage

From Esolang
Jump to navigation Jump to search

Graverage is an automaton/esolang designed by User:Challenger5.

Program Structure

A Graverage program consists of:

  • A set of one or more objects, called points.
  • A mapping from each point to a pair of rational numbers, called its initial coordinates.
  • A mapping from each point to a bag of one or more points (including itself), called its neighbors.
  • A sequence of points (the instruction list), which is assumed to repeat infinitely.

Execution

Points from the instruction list are executed by updating their position to the average position of their neighbors. Neighbors are weighted by how many times they appear in the bag.

Syntax

Interpreters can use any syntax, but the reference interpreter (were one to exist) works by getting all numbers from the digit string and interpreting them as follows:

  • The first number, which we’ll call N, defines the number of points (which are identified by integers from 0 to N-1).
  • Define the initial coordinate and neighbor arrays by repeating the following N times:
    • Read four integers. The first two are treated as the numerator and denominator of the initial x-coordinate, and the last two are treated as that of the initial y-coordinate.
    • Read a nonnegative integer M. The next M integers (which must be between 0 and N-1) are interpreted as identifiers for the point’s neighbors.
  • The remaining integers (which must be between 0 and N-1) comprise the instruction list.

Computational Class

No clue.

Examples

PyGraverage
3 1 1 0 1 3 1 2 2 -1 1 0 1 3 2 3 3 0 1 1 1 3 3 1 1 1 2 3

Exec depth 1- 1:(-0.33, 0.0), 2: (-0.33, 0.66), 3: (-0.22, 0.33)
Exec depth 2- 1: (-0.33, 0.44), 2: (-0.2594, 0.444), 3: (-0.296, 0.407)
4 curving, converging lines meet roughly at a point, slightly left of center
Trajectories of Example 2
4 1 1 1 2 4 0 1 3 2 1 1 0 1 3 0 2 1 -1 1 0 1 3 1 2 2 0 1 1 1 3 2 0 0 0 1 2 3

Exec depth: 3


Interpreter

A python-based interpreter: [1]

  • This particular interpreter uses the reference syntax, with the exception that points are numbered in the instruction list starting from 1 instead of 0. It also has a finite execution depth, that is, it only runs the instruction list for a finite, specifiable number of times.
  • It expects the program to be a single line of integers. Any other lines will be ignored

A slightly better interpreter, with graphical output and a nicer user experience: [2]

  • This version can show the trajectories of the points aver multiple iterations.