At some land
A Befunge-like grid without wrap around. Step off the edge and the program is over.
ChuckEsoteric08 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
ChuckEsoteric08 made At some land, ATSML for short, as a fungeoid. Its memory is one stack and one accumulator, and it has 31 commands. Unlike Befunge the grid does not wrap; when the pointer goes out of bounds the program halts, so the edge works as a second @.
Read the story
The accumulator can only count up and down, and , is the only command that reads it. That makes it a loop counter.
The machine
| Command | Does |
|---|---|
> < v ^ | Point the pointer |
/ \ | Mirror it |
0 to 9 | Push the digit |
+ - * ! | Pop a, then b, and push b + a, b - a, b * a or b / a |
i d | Add 1 to the accumulator; take 1 from it |
: % | Duplicate the top; swap the top two |
; , | Skip the next cell if the top is 0; if the accumulator is 0 |
' ` | Move the top to the bottom; the bottom to the top | |
? . | Push an input character; print the top as a character |
@ | Halt |
The specification says pop only for the four arithmetic commands, so in this implementation . and ; leave the top where it is.
Example
The accumulator as a loop counter.
The accumulator as a loop counter. Three i set it to 3, 88*1+ makes 65, and each round prints A and counts down. When the count is 0 the , jumps over the v onto @.
The truth machine. On 0 the ; skips the v and the top row prints 0. On 1 the pointer goes down into a loop that makes 49 from 6, 8 and 1 and prints it forever.
The Hello, World! program builds each letter out of nines, so o is twelve 9s and a 3, and zigzags down with one row for each letter and one row back between them.
Patterns it teaches
- Two-dimensional control flow: arrows and mirrors, with the edge of the grid as the end of the program.
- Stack machines: every value is built on the stack from single digits.
Further
See also
Two-dimensional languages
Stack-based
Write your own in Run Convert a program from At some land
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: at-some-land.
Command line
shib run at-some-land -e '?68*-;v68*.@
>v
6
8
*
1
+
.
^<' --input '0'shib manual at-some-landSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/at-some-land.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org