BOUNCE

From Esolang
Jump to navigation Jump to search

BOUNCE is an two-dimensional esoteric programming language created by User:QuantumV where the Instruction Pointer is always moving diagonally and can bounce off "#" characters and the boundaries of the program similiarly to a DVD logo.

Instructions

+,-,*,/,% - Arithmetic operations. First argument is the second to last element on the stack and the second argument is the last element on the stack.

Stack ops:
: - Duplicate the top of the stack.
~ - Swap two top elements on the stack.
. - Pop and print as number.
, - Pop and print as a character.
$ - Pop.
& - Input integer.
@ - Rotate three top elements on the stack (abc) -> (cab).
^ - Rotate the entire stack (abcdef) -> (fabcde).
v - Push the stack length onto the stack.

Walls:
# - Wall. The IP bounces off.
= - Becomes a wall when touched by the IP.
" - Becomes a wall when the IP attempts to bounce on it.
? - Acts like a wall if the top of the stack is not 0.

Other:
! - End the program.

Example Programs

Hello World

9     +     ,     ,     +     *     *     +     +     ,     -     *
 8   1 :   : 7   : 3   2 4   4 ,   8 1   1 :   1 :   + 3   8 ,   3 ,
  * 9   * +   + ,   + 9   * 8   9 +   - 9   : +   : 3   - ,   9 +    
   ,     1     :     ,     ,     2     ,     *     ,     :     2     !
   #     #     #######     #     #     #     #     #######     #     #
   #######     ####        #           #           #     #     |     |
   #     #     #######     #######     #######     #######     *     *

Factorial

&    #    `   `     !
 `   `   ` ` ` `   .
  ` ` ` $  "*   $ $
  ":   `?    v   `?
    1 `       1 ` 
     -         -   

Truth machine

&   +
 1 1 .
  -   !
  ?1  #
    + `
    ": `#
      .

Interpreters

There is currently only one interpreter: https://github.com/QuantumV2/BOUNCE