esolang

Runic Enchantments

A 2D language where every pointer carries mana. Pointers merge, split, and fade out when the mana runs dry.

Draco18s · Turing complete: unknown · ●●● hard

Tested with 10 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: Hello, World!

The idea

Runic Enchantments is a grid language by Draco18s, written in C# for a Unity game and as a console program. Its pointers are spells. Each entry rune < > ^ v starts one, with 10 mana and a stack of its own, and every tick each pointer runs the rune under it and moves one cell. The grid wraps at every edge.

Read the story

Mana is the twist. A pointer whose stack holds more than its mana plus 10 values loses a point of mana per tick, and one with 100 mana or more burns the rune it stands on to a blank. Two pointers on one cell facing the same way merge into one, which keeps the older stack and adds up the mana. Popping an empty stack kills the pointer, and the program ends when no pointer is left.

The machine

The values are those of C#, so , divides two ints into a float, and doubles print with 15 digits.

CharDoes
< > ^ vEntry points, blank once the run has started
0-9 a-f "..." 'cPush 0 to 15, a string, a character
+ - * , % pArithmetic and power; strings join, lose characters, repeat
= ( ) Z X C YCompare, negate, times 10, 100, 1000
: ~ S r l { } sDup, drop, swap, reverse, length, rotate
$ @Print the top, or print the whole stack and end the pointer
; F mEnd the pointer, spend 1 mana, push the mana
L R U D \| _ / \ #Turn and reflect
! ?Skip one cell, or pop n and skip n cells
k n q iTo a character, to a number, join as text, read a word
H I J KPop n and split off a pointer with n mana

Example

The Hello World from Try It Online.

The Hello World from Try It Online. The entry rune starts a pointer moving east, the string goes on the stack as one value, $ prints it and ; ends the pointer.

The README's quine reads itself as a string in one go, since the pointer wraps round to the opening quote. 3X4+ makes 34, k turns it into a quote character, and Sq puts it in front.

Expected: "3X4+kSq$;
Expected: 12

Two pointers run side by side in the last one. In every tick the older pointer acts first.

Patterns it teaches

Further

Also in Spatial (2D and up)

Write your own in Run Convert a program from Runic Enchantments

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: runic.

Command line

shib run runic -e '12+$;'
shib manual runic

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/runic.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language