User:FireFly/Enterbrainfuck

From Esolang
Jump to navigation Jump to search

Enterbrainfuck (EBF) is a brainfuck implementation written in the RMXP event system. It stores the instruction pointer, memory pointer, loop counter, memory and code in an RMXP game, which when run is executed. It isn't fully completed; the latest version is 0.6.

Features

Multiplication program being run in EBF.
  • Implements < > - + [ ] correctly.
  • Output is always the ASCII value of the actual value (eg. "56" is outputted instead of "8").
  • Input is not yet supported. (Maybe more of an anti-feature.)
  • Unsigned memory values; 0-255. '-' when at 0 or '+' when at 255 does nothing (will wrap in future version).

Changelog

  • 0.6
Corrected loops, with loop counter for keeping track of depth.
. implemented (kind of).
  • 0.5
< and > implemented.
- and + implemented.
Bogus loops implemented (max depth: 1).

How it works

Part of the IP source code of EBF.

There exists an event for the instruction pointer (IP), and one for the memory pointer (MP). The instructions are stored as tiles, judged by their Terrain Tag (which, handily enough, may be anywhere between 0 and 7, inclusive).

The IP passes over the code row, by being an event set as being a parallel process (as most parts are).

  • If the Terrain Tag (TT) is 4 or 5, the MP event will move left or right once, respectively.
  • If TT is 2 or 3, it'll increase or decrease the current memory, respectively. I thought a bit on how to store the memory, since arrays aren't available, and ended up with a semi-dynamic solution. Every memory is its own parallel process event (represented as a rabbit), whose Y position represents its value. Actually, the increasing/decreasing is done within the rabbit event, by checking if the MP is at its position, and if any memory manip instruction should be executed.
  • TT set to 6 or 7 controls looping. 6 actually does nothing at all. When 7 is executed, it checks current cell value, and if not 0, it increases the loop counter (by moving it to the right), and then keeps going left, increasing LC for each ']', and decreasing for '[', until a match has been found.
  • If TT is 1, show text box with current memory cell value.