Armok
Dwarves in a cave mine rock, build workshops and trade the rocks for characters.
2016 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 5 known programs · Test method
Run it
The idea
Armok was made in 2016 and is inspired by the video game Dwarf Fortress. A program gives orders to dwarves. Each dwarf has his own list of tasks, and all of them work in turns, one task each per turn.
Read the story
The cave is a row of tiles. Tile 0 is magma, the dwarves start on tile 1, tiles 2 and 3 are open and everything after that is rock. Mining a wall gives a pile of 64 rocks, and rocks are the only data. A dwarf builds a workshop from the rocks he carries, and what he gets depends on how many he has.
Dwarves die when they walk into a wall or into the magma, build without the right rocks, ask a trader for input that is not there or run out of work. The program ends when all of them are dead.
The machine
| Char | Does |
|---|---|
+ | Start a new dwarf; the tasks after it are his |
- | Start a new subroutine |
> < | Move right or left |
m | Turn the wall on the right into 64 rocks, and take one rock from the tile on the right |
d | Drop a rock on the tile on the left |
w | Build a workshop, or work at the one that is here |
| Rocks to build | Workshop | Working there |
|---|---|---|
| 1 | Trader | Print the rocks as one character, or take the next input character as rocks |
| 2 | Manager | Run the subroutine that the rocks on the tile count, or tear it down when it has none |
| 3 | Appraiser | Drop a rock to the left when carrying more than lie here |
Dwarves and subroutines are numbered together from 1, in the order of the source. After a subroutine the dwarf goes on where he was.
Example
The copycat.
The copycat. The dwarf walks to tile 3, mines one rock and builds a trader with it. Each pair of work orders after that reads a character and prints it.
The manager loop copies any input. The dwarf builds a trader on tile 3 and a manager on tile 2, drops 2 rocks on the manager and works there. That runs set 2, >ww<w, which copies one character and comes back to the manager. It goes on until the input runs out and the traders kill him.
The true Hello World. Three subroutines mine about 1,200 rocks and pile them on tile 2, and a fourth picks up 32 of them at a time. The dwarf then swaps the manager for a trader and counts out each letter. It takes 4,600 turns, the number the specification gives.
The specification also kills five dwarves in five ways with ++<+w+>>>+>>mww. It prints nothing.
Further
See also
Also in Jokes
Write your own in Run Convert a program from Armok
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: armok.
Command line
shib run armok -e '++<+w+>>>+>>mww'shib manual armokSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/armok.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org