Electric BitFunk

From Esolang
Jump to navigation Jump to search

Electric BitFunk is a two-dimensional esoteric programming language created by User:Koen on 2012, september 9. It was inspired mainly by Electric Go, an "esoteric" variant of the game of go (see External resources below). Electric BitFunk operates on a tape of bits, using instructions borrowed from BitChanger. However, those instructions affect the playfield as well, making programming in Electric BitFunk a challenge somewhat similar to Half-Broken Car in Heavy Traffic.

Language overview

A program in Electric BitFunk consists of a two-dimensional grid, each cell in the grid being initially Blank, Positive, or Negative. In addition, one cell is the 'start' cell. The start cell cannot be Blank. There is an instruction pointer, initially pointing to the start cell. The instruction pointer never points to Blank cells.

The execution of an Electric BitFunk program consists in a loop:

Execute the current cell as a BitChanger instruction
If the current cell is Negative, move the bit pointer one space to the right, then flip the pointed bit
If the current cell is Positive, move the bit pointer one space to the left
Apply the current cell's electric field to neighbouring cells
In every cardinal direction, move the nearest non-Blank cell one space nearer if its polarity is opposite to that of the current cell, one space away otherwise
When moving a cell:
If the target cell is Blank, switch the two cells (that is, the target cell becomes either Positive or Negative, and the moved cell becomes Blank
If the target cell is non-Blank, the "move" operation is a no-op; however the "moved" cell is considered as having been moved nonetheless
Move the instruction pointer to a new cell
Up to four cells have been moved when applying the current cell's electric field
Select the nearest of those 0-to-4 cells
In case of a tie, ignore the tying cells for the purpose of computing the nearest cell
Move the instruction pointer to the selected cell, then continue to the next iteration of the loop
If no cell has been selected, either because no cell was moved or because of ties between the moved cell, execution halts.


External resources

A brief description of Electric Go, the game which inspired Electric BitFunk