esolang

MineFriff

Befunge and ><> brought into Minecraft. Each command is a block, and a program can be built in a world as well as typed.

2018 · Turing complete: unknown · ●●○ moderate · esolangs.org

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

Run it

Expected: Hello, World!

The idea

MineFriff is a fungeoid. The program is a grid, an instruction pointer walks across it, and arrows turn it. What it adds is Minecraft. In its strict form the code is a 100 by 100 field of blocks in a game world, where oak planks turn the pointer left and a sponge prints. The textual form uses a character for each block.

Read the story

Numbers are not written out. They are built in a temporary register from the digits 0 to f, which are added, so ffe makes 44. An operator in between changes how the next digit joins in, so a*b4 is ten times eleven, plus four, which is 114. A comma pushes the result and clears the register.

The machine

CodeDoes
0…fAdd a digit to the register; after * / % - it multiplies, divides and so on instead
, .Push the register (as I int, C character or F float); pop into it
+ - * / %With the register at 0, work on the top two of the stack
= ( )Push 1 or 0: equal, top is less, top is greater
: $ ! r l [ ]Duplicate, swap, drop, reverse, length, rotate either way
o pPrint the top; print the whole stack of characters with a newline
iRead a line, pushing each character
< > ^ vTurn
# ?Skip the next cell; pop and skip it if 0
~ ` | Back to the start of this row; on to the start of the next
{ } ;A comment; the end

This implementation follows main.py, the Python interpreter Try It Online runs, quirks included. Rows are not padded, and the pointer reads them with Python's indexes, so it can go left past the first column and come out at the end of the row once. Off the right edge or the bottom it never finds another cell and the program hangs.

Example

The first program pushes the letters of !dlroW ,olleH in that order, so H ends on top.
Expected: Hello, World!
Expected: 7
Expected: 0.75

The first program pushes the letters of !dlroW ,olleH in that order, so H ends on top. The second row loops. l pushes the stack's length, ? ends the program when it is 0, and otherwise o prints the top letter and ~ starts the row again. The second program pushes the letters the other way round and lets p print them all at once. The third reads 34 as the digits 3 and 4 and adds them. Division always gives a float, as in Python.

Patterns it teaches

Try this

  1. Print the digits 9 down to 0.
  2. Read a line of digits and print their sum.
  3. Hard: print the input number in binary.

Further

Non-textual

Two-dimensional languages

Write your own in Run Convert a program from MineFriff

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run minefriff -e 'i+o;' --input '34
'
shib manual minefriff

Source

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

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

Source esolangs.org (CC0) · Edit on esolangs.org