Numberlist

From Esolang
Jump to navigation Jump to search

Numberlist is an esoteric programming language created by User:A casual user. The program and memory is a list of numbers, which can be positive or negative.

It also has a pointer, which points to a number in the list.

Commands

Every cycle, the pointer moves n numbers down, with n being the number it is pointing to. Every 3 cycles, the interpreter sees the numbers the pointer has pointed the last 3 cycles.

Depending on which ones were odd and even, a different command is performed.


Command Outcome
odd - odd - odd Prints the number the pointer is pointing to as a number.
odd - odd - even Adds the number the pointer is pointing to by the number next to the pointer and replaces the number the pointer is pointing to with the result.
odd - even - odd Subtracts the number the pointer is pointing to by the number next to the right of the pointer and replaces the number the pointer is pointing to with the result.
odd - even - even Asks for a number from the user and puts it in the number the pointer is pointing to.
Anything else Does nothing.

If the pointer is pointing to a 0, the program ends.

Notes (IMPORTANT)

When, for example, input is put in a number, the pointer doesn't go input numbers to the right. The input is put in the number, but the pointer remembers what that number was before user input was put there, and goes that many numbers to the right. This works for all the other commands.

Also, the only way to end a program is by making the pointer point to a 0. However, it can be hard (or even impossible) to make programs end this way. A interpreter could have a limit, perhaps specified by the user, to how many jumps the pointer can make before the program stops.

Examples

Adding program

This program takes 2 inputs, a and b, adds them, and puts the result in input b.

1
2
0
2
5           <---- Input b
1           <---- Input a
2
0
-4
1
-6

Cat program

Gets user input, stores it, then outputs it.

1
2
3
2
0
-3

Interpreter

An interpreter has been created by User:Dtp09 and has been uploaded here.