From Esolang
Jump to navigation Jump to search

(alternatively v^3) is a two-dimensional esoteric programming language created by User:Bo Tie. v³ takes inspiration from MarioLANG and Cubix.

The IP (instruction pointer) starts in the upper-left corner of the top square. The IP starts facing right and the gravity direction starts facing down

Every turn, the IP "falls" if possible (moves in gravity's direction). If the IP would intersect with ground or is being "carried" by '^', '>', 'v', or '<', it does not fall and instead moves in its set direction. If the IP leaves an area, it goes to a corresponding cell, as if the code were mapped onto the faces of a cube. It also rotates the gravity and the IP's direction appropriately, as if the code is wrapped on a cube:

      D > A
      . . .
      F < E
D . F . . . E . A . . .
^ . v . . . ^ . v . . .
C . G . . . H . B . . .
      G > H
      . . .
      C < B
      . . B
      . . v
      . . v
. . . . . v . . . B . .
C > > > > v > > > ^ > C
. . . . . v . . . A . .
      . . v
      . . v
      . . A

If anyone understands this, please edit this if you can give a better explanation than I can.

Any program that is not in the cube net format will automatically be put in the correct format on the smallest cube possible and padded with no-ops:

abcdefghijklmno

becomes

    a b
    c d
e f g h i j k l
m n o . . . . .
    . .
    . .

Commands

  • # : ground, IP cannot move to a cell with this character. Does not count as a command.
  • . : no-op
  • ^ : if gravity is left or right, the IP points up; if gravity is down the IP does not fall next turn, do nothing otherwise
  • > : if gravity is up or down, the IP points right; if gravity is left the IP does not fall next turn, do nothing otherwise
  • v : if gravity is left or right, the IP points down; if gravity is up the IP does not fall next turn, do nothing otherwise
  • < : if gravity is up or down, the IP points left; if gravity is right the IP does not fall next turn, do nothing otherwise
  • ? : the IP points randomly up or down if gravity is left or right, otherwise the IP points randomly left or right
  • ! : ignore next command if current memory cell is zero (next command does not have to be directly after this command)
  • $ : ignore next command if current memory cell is NOT zero
  • ( : move memory pointer left
  • ) : move memory pointer right
  • + : add one to the memory cell under the pointer
  • - : subtract one from the memory cell under the pointer
  • * : output ASCII character from memory cell
  • = : output numeric value character from memory cell
  • , : input ASCII character to current memory cell
  • ; : input numeric value to current memory cell
  • @ : terminate program

Any other characters are treated as a comment and do nothing.

Turing-completeness

v³ is Turing complete because any brainfuck program can be translated into a v³ program.

Examples

Cat program:

  .
* , $ @
  #

Truth-machine:

    ; !
    # #
. . . @ = > . .
. . . . . = . .
    . .
    . .

Fibonacci sequence:

        = + = )
        # # # +
        . - ( <
        # # # #
- v ) ) ) + ( ( ( $ < . . . . .
< . . . . . . . . . ) < . . . .
< ( + ( + ( $ < . . . - ) ) ) !
< . . . . . . ) = ^ . . . . . .
        . . . .
        . . . .
        . . . .
        . . . .

External links

Repl inperpreter

Github interpreter (delete Repl link if I set this one up correctly!)