Movesum

Movesum is an esolang by User:PythonshellDebugwindow where the only instructions are move and sum.

Syntax and Semantics

First line

The first line of a Movesum program is a series of space-separated `Key=Value` pairs. There can be as many or as few of these pairs as you like. They represent the initial values of the array, the Keys being indexes and the Values being values. Keys and Values are normally numbers, but if either one is `42`, it will be replaced with a user input number (0 on EOF). So this:

```0=4 3=-8 19=3 15=12345
```

would set the array to

```4, 0, 0, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12345, 0, 0, 0, 3, 0, 0, 0, ...
```

where `...` is an infinite amount of zeros. This line can't be empty, but something like `0=0` is fine.

Rest of the program

The rest of a Movesum program is a series of instructions, one per line. These instructions are move and sum. To execute an instruction, type its name followed by any arguments it might take (two arguments for move, no arguments for sum). The move instruction sets the second argumentth item of the array to the first argumentth item of the array (the first argumentth item stays the same), and the sum instruction sets the 0th item of the array to the sum of the 1st, 2nd, 3rd, and 4th items of the array. The instructions in the program are executed cyclically until the program halts (see #Halting). Executing move with a negative first argument sets the second argumentth item of the array to a number input by the user (0 on EOF), and a negative second argument outputs the first argumentth item in the Array, but if both arguments are negative, then nothing happens.

Halting

A Movesum program will halt if the array doesn't change after two commands are executed (including move with two negative arguments). Programs can be forcibly halted by typing the following:

```move 0 0
move 0 0
```

Examples

Hello World ASCII values

```0=72 1=101 2=108 3=111 4=32 5=87 6=114 7=100
move 0 -1
move 1 -1
move 2 -1
move 2 -1
move 3 -1
move 4 -1
move 5 -1
move 3 -1
move 6 -1
move 2 -1
move 7 -1
```

Infinite numeric cat

```1=2 2=1
move -1 0
move 1 2
move 0 -1
move 2 1
```

Cat until EOF (0)

```1=1 2=1 3=2
move -1 0
move 2 3
move 3 2
move 0 -1
move 0 1
move 1 0
```

```1=42 2=42
sum
move 0 -1
move 0 0
```

```0=42
move 0 -1
move 0 1
move 2 1
```