Brainyay

From Esolang
Jump to navigation Jump to search

BrainYay is a version of Brainf*ck that adds many features, including a stack, and graphics created by user(PhiphiPHIpHi), Phoenix Irwin. (Note the user phiPhiPHipHi2.0 is the same as PhiphiPHIpHi)

All the original commands from brainf*ck are the same in brainYay except for the [] which are replaced with () respectively PS-sorry about this I just think it looks nicer. Also there are many added commands related to graphics, the stack and variables

For graphics, it uses a 50*50-pixel grid in the form of a 250 long unsigned byte array.


  1. as of 6/11/2025, the entire programming language has been completely redone.

Commands

The valid commands are:

command list
command effect
> move the pointer forward
< move the pointer backwards
+ increment the cell at the pointer
- decrement the cell at the pointer
( jump to the next matching ) if the current cell is 0
) jump to the last matching ( if the current cell is 1
[a] append the string a onto the stack
l set the current cell to the length of the element on the top of the stack
! pop the top item from the stack
c clear the stack
# prints the top element of the stack to the console
^ appends the value of the current cell to the top of the stack
v sets the current cell to the value at the top of the stack
? performs the comparison operator in the next character (>=<) on the top two items of the stack, and appends either a 1 or 0 as a result
& performs a mathematical operation (+-*/^%) (the next command) on the top two elements of the stack with the top of the stack going first in the operation.
. outputs the current cell as an ascii value
, sets the current cell to input as an ascii value
: outputs the current cell as an integer
; accepts input into the current cell as an integer
d duplicates the top item of the stack
r sets the pointers position to 0
~ sets the current cell to a random integer from 0 to the current cell's value
t waits the current cell's value seconds
i appends input onto the stack as a string
f sets the current cell to a 1 if it positive, otherwise set it to a 0
$ set the pointer to the value held in the current cell
` set the current cell to a 0 if it is 1, or a 1 if it is 0
G set up a display
g update the display
q quit the display
C clear the graphics buffer
@ pops the top three items of the stack (value, y, x) and sets the pixel at the coordinate to the value
%a (Not implemented, idea) defines a function called a and sets it to the top item of the stack, and also pops the stack.
_a (not implemented) performs the action on the stack
s pops the top item of the stack, sets the current cell to the index in the stack of the value popped from the stack (see below)
_ sets the current cell to the length of the stack

explanation of s function:

if the stack is [5, 6, 7, 8] and the cells are [0,0,0,0,0] to set the first cell in the tape to the value at index 1 of the stack (the second value, 6) == [1]s

Functions can take arguments on the stack like this f(a, b, c) == [c][b][a]f //in brainyay

example (addition function) f(a, b) = a+b BRAINYAY

[&+!]%f

Inspiration: Truttle1: Very good content about esolangs, got me into them in the first place (that feels kinda cheesy to say sorry) JuneBug: Youtuber who created an impressive ghost evade game in brainfuck with ascii text graphics, inspired me to add graphics to brainfuck. Silver Takana: has done something similar with adding graphics to brainfuck, but not with a stack and other features.

Implementation

https://docs.google.com/document/d/1i5ThlRet7k1pbgHUlhQBIvSKpeUoCAA4vpLNb2CCq0g

Examples

Hello World | [Hello, World!]#

Add two inputs | ii&+#

cat program (most golfed) | i#

program to print the length of an inputted string (strings parsed as integers use their length) iv: