We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

MFJZ

From Esolang
Jump to navigation Jump to search

MFJZ (Move pointer and Flip, Jump if Zero) is an OISC created by User:ChuckEsoteric08 in 2026 and based on a Smallfuck-like language with if statements created in 2022

Description

It operates on a binary tape infinite to the right, initialized as zeroes. It's command is of the form:

a b;

Where a is a signer integer, and b is unsigned integer. It executes as follows:

  1. Move tape pointer to the right by a, with negative values moving it to the left
  2. Flip bit that tape pointer is now pointing to
  3. Check resulting value, if it is zero increase instruction pointer by b. If it would get past boundaries of the program then it is unidentified behaviour

Program is in an implicit infinite loop.

Computational class

Any Turing machine with right-infinite binary tape could be translated to it. In TM with states each cell is represented as follows:

[x][B][s0][s1]...[sn-1][sn]

x is 1 if it is current cell (except on uninitialized tape) and 0 if it isn't, and B is value of a cell. Here commands of the form a 1; (which regardless of the value jumps to the next instruction) are represented as a; and if b is a string then it is considered as a jump forward to label b. Program starts with initialization, which would be skipped if x is 1 (which is true for all cases when it jumps to the start except when program is just started):

0;
0 endinit;
init;
label endinit;

Each cell is initialized with B being the value and x and s0-sn being 0, except for the first cell, which has x as 1. Then it is followed by an instruction to move tape pointer back to the first cell, with label endinit being after it. Then each state for cell with the value 0 is translated as follows (with tape pointer starting at x):

1 nz;
state check;
0;
label nz;
0;
-1;
0;

And for cell with value 1:

1;
0 zero;
state check;
label zero;
-1;
0;

And each state check would move m cells to the right (tape pointer by now starts at <codeB) until it gets to the state needed:

m;
0;
0 notstate;
state transition;
moving cell back to cell representing this state (even if it was changed or tape pointer was moved);
label notstate;
-m;

State transitions are then formed easily, with flipping cell which represents this state, then proceding to do an instruction, flipping B if needed and if pointer should be moved it would set x to zero, move pointer to x of the cell either to the left or to the right and then flipping x there. Then it would move right to the cell representing next state, flip cell there and move back to the cell representing the state.