Fungus

An ASCII art drawing of a mushroom. It splits the name, fungus, of the language in half. fun is to the left, gus is to the right.

The Fungus Logo

Fungus is a toy Fungeoid. Fungeoids are 2D programming languages where the instruction pointer navigates the code moving north, east, south, and west. This fiamily of programming langauges traces its origin to Befunge.

The world editor for Fungus. It features the play area (where instructions are placed on a grid) and the two data stacks called left hand and right hand.

The fungus play area.

Fungus features a 2D playing field which the programmer can navigate using the arrow keys. Additionally, Fungus has a pair of data stacks that can hold any Lua value type (except nil, nil sucks). At any moment, the player can press F1 to begin/end execution and F2 to execute the opcode at the current position.

Factorial in Fungus.

The speed of the interpreter can be changed with Page Up and Page Down.

Unlike Befunge, a Fungus program starts wherever you are standing in the direction you are facing. Thus, you can have many small programs spread about in Fungus. This is useful for testing and exploring ideas.

Saving and Loading

Fungus has a simple command line that can preform two actions: save a project to a file, and load a project from a file. The command line can be accessed with F3.

A sorting algorithm in Fungus. Dunno if it is bubble sort, insertion sort, or selection sort tbh. One of the slow ones.

save some/path/to/a/project.fungi
load some/path/to/a/project.fungi

All project files are relative to the current working directory of Fungus. If you started Fungus in ~/Documents, then all paths would be relative to that.

Inspirations for Fungus

I've always love the feeling of "you are an entity in the world, building it". Especially for programs. I've long been enamoured with Paradise and Kooltool. To a lesser degree, Io and Factor gave me similiar feelings through their REPL experience.

I personally think there should be more tools that give you the feeling of actively existing in your program as you build it. Especially for visual applications. Games rely heavily on art, but it is so often secondary. Some enviroments integrat art tools directly, but they still feel like software-oriented IDEs.

Much to my surprise, there seems to be very little w/r/t Befunge editors. The most advanced editor is BefungeSharp.

Ideas for Fungus

  • Self-modification
  • Dropping values to the playing field
  • Multiple Rooms
  • Cell colors
  • Random number operator
  • Jump operator
  • Speed controls
  • Saving and loading programs
  • Basic I/O to a in-editor CLI
  • More stack operators

Current Instruction Set

NGo north
EGo east
SGo south
WGo west
0-9Push 0-9 to the stack as a number
a-fPush hex digits 10-15 (subject to removal, these letters could be more useful as opcodes).
\Transfer to off hand
%Switch hands
~Swap top two items in main hand
:Duplicate top item in main hand
^Pop top item in main hand
oCopy 2nd item over 1st item in main hand
-Subtract top two values in main hand.
+Add top two values in main hand.
*Multiply top two values in main hand.
/Divide top two values in main hand.
MModulo top two values in main hand.
|North-South conditional junction. Pop value, if true go North else go South.
_East-West conditional junction. Pop value, if true go East else go West.
>Greater than
<Less than
=Equals
!Boolean not
.Halt and return to editing
?Pop top two values on stack, pick a random number between them.
ALogical and
VLogical or
$Push stack height