Bout

Bout is an assembly-like esolang created by User:PythonshellDebugwindow.

Syntax

Bout programs consist of lines with opcodes followed by any arguments they might take.

Bout uses a

Operations

Opcode # of Args Effect
W 2 Set MEM[arg 1] to be arg 2
A 1 Increment MEM[arg], or set it to 1 if it isn't set
D 1 Decrement MEM[arg], or set it to 0 if it isn't set (this does nothing if MEM[arg] is zero)
R 1 Print V(arg)
J 1 Jump unconditionally to 0-based line (V(arg))
N 2 Jump unconditionally to 0-based line (V(arg 1)) if arg 2 is nonzero
H 0 Halt the program

MEM[x] means MEM.getValue(V(x))

Meaning of V(x)

V(x) means that if x is a non-negative integer, return x; if x is a non-negative integer prefixed by a minus sign, return MEM[x]; if x is the dollars sign \$, return a user-input non-negative integer (which returns 0 for invalid input); otherwise, return 0.

```R \$
J 0
```

```W 0 \$
N 3 -0
H
R -0
J 0
```

```W 0 \$
N 4 -0
R 0
H
R 1
J 4
```

Computational class

Bout is Turing-complete, as a version of brainfuck with numeric I/O can be translated into it.

Translation from brainfuck

First, initialize a cell pointer:

```W 0 1
```

To increment the cell pointer:

```A 0
```

To decrement it:

```D 0
```

But the clever part is that we can access cells dynamically, by using `-0`. To increment the current cell:

```A -0
```

To decrement it:

```D -0
```

Input:

```W -0 \$
```

Output:

```R -0
```

Looping can be accomplished with jumps. Just be careful not to go below cell #1, as below that and the cell pointer will overwrite itself.