Jumpy

From Esolang
Jump to navigation Jump to search

Jumpy is an esoteric programming language.

Syntax

A Jumpy program consists of a series of lines of code, and on each line there is a single number.

Execution

Conceptually, the lines are numbered from 0 upwards. Execution starts at 0, and proceeds in a series of steps. At each step, the interpreter finds the line of code that matches the number, and transitions to the number found on that line. The interpreter outputs to the console the beginning and ending numbers for that transition, separated by '->'. If the ending line number does not exist, then the program terminates.

Example Program

Program

   1
   3
   2
   4

Output

   0 -> 1
   1 -> 3
   3 -> 4

Program Size

In a Jumpy program, the number of lines of code, and the size of the integers represented on each line are both theoretically infinite. In practise, a program running on a computer will limit both of these due to limits in available memory and integer representation.

Turing Completeness

Jumpy is Turing Complete. To see why, consider its relationship to Game of Life. Game of Life has been proven Turing Complete. We can construct a mapping from a Game of Life program to a Jumpy program as follows. First we develop an encoding for the cells of empty the Game of Life board. We can number these by following a spiral path from the origin in ever increasing squares, until a square bounding box of any size is reached. We assign a single bit to each of these cell-numbers. Let's say this gives us N bits. The binary numbers up to 2^N can be mapped to the Game of Life configurations where each bit represents a cell (0 if dead, and 1 if alive). Next we identify the transition state for each of these states, forming a transition table, and this forms the main part of our Jumpy program. Lastly, we identify the beginning state of our Game of Life program, and place that as line 0 in our Jumpy program.