LaserFuck

From Esolang
Jump to navigation Jump to search
LaserFuck
Designed by User:CappyIsCrappy
Appeared in 2022
Dimensions two-dimensional
Computational class Turing tarpit
Major implementations Rust interpreter
Influenced by brainfuck, AsciiDots
File extension(s) .lsrf, .lsrfk

LaserFuck is a 2d brainfuck derivative made by User:CappyIsCrappy.

Memory

In LaserFuck, there is a tape with infinite cells in both directions, and the cells store signed 32-bit integers (-2147483648-2147483647).

Commands

Laser movement

A laser's starting point is marked by a o. Note that the direction the laser goes in is randomly chosen.

Lasers can be deleted with x. Execution ends if no more lasers exist. When the program ends, the value of all used cells are printed in decimal with line breaks (if first byte is 0xFF (aka ÿ) outputs unicode with no line breaks), except those of negative numbers.

Lasers can be reflected with the mirror characters: /\_|.

There are also conditional mirrors:

( act as _ if pointed cell not 0, else skip this.
) act as | if pointed cell not 0, else skip this.

Lasers can be duplicated with the *. Direction also randomly chosen, can't duplicate backwards or forwards since that's where the original laser went from and will go to, respectively.

Their direction can also be set directly with:

{ left
} right
^ up
v down

The brackets ([]) don't make sense in 2d, so they have been replaced with the bridge: #

It just skips over the next command the laser will go to.

Notes

All brainfuck commands are preserved (except the square brackets and .) and all invalid commands are ignored.

Examples

Hello, world!

By User:Bangyen:

ÿ}>+++++++>++++++++++>++++++++++>++++++++++>+++++++++++>++++>+++>++++++++v
 ^             {  {v+++>++++++++++>++++++++++>+++++++++++>+++++++++++>+++{
                                                        x++>+>+>>++>+>+>++>++>+>++>{
 }}++++++++++v       }  }<#/)>-#/)+++v }  }>>>++>++>>+>>+++>>+>++>>+v }  }<#/)>-#/)^
|o^          }#^)#^             /    }#^)#^                                      /
 _                 }#^)#^  /                                        }#^)#^  /

Binary RNG

 }+-x
|o+x
 }+-x

50% chance of printing 0, 50% chance of printing 1.

Cat program (until NUL)

ÿ/\
|o},#/)x
 _\> /

input, if 0 then end and output everything as unicode, else go to next cell and repeat.

Implementations

A Rust interpreter by User:Bangyen.

See also