AEAV

From Esolang
Jump to navigation Jump to search

AEAV(An Esolang About Variables) is an esolang designed by User:Infinitehexagon that uses variables to store values.

Inputting

Inputting uses the tag _input_.

test = _input_

Variables

To create a variable start the name of the variable followed by the keyword "is" and the value or string. If you want to concatenate a non-keyword value into a variable add a $$ before the value.

test = "Hello, "
test = $$ "World!"

Setting a variable to itself will concatenate the current value of the variable twice. This program will assume that test equals Hello, from before and join the string 2 times. Repeating this will cause the variable to exponentially join forever.

loop 1
test = [test]
;loop

Returns "Hello, Hello, Hello..."

;(Semicolon)

The semicolon is used at the start of instructions to end tags like HTML tags, although they are only used for some instructions.

loopi               (loops infinitely)
out test
;loopi

Random

To set a variable to a random value, use a hyphen and input 2 numbers in this format: a-b

test = 1-3
out test

Functions

Making a function is quite easy. All you have to do is use "new" followed by the name of the function. After that, define the function and use the Semicolon tag followed by the name of the function. If you want arguments in your function add a letter eg. "(a)" to the name of the function.

new negate (a)
(a) = (a) mul -1
;negate

Variable Built-In Functions

Instruction / Function Example / Keyword Description
mod test = 9 mod 3 (Returns 0) Get the modulo of 2 arguments a and b and return it into to the variable.
sub test = 9 sub 3 (Returns 6) Get the difference between 2 arguments a and b and return it into the variable.
add test = 9 add 3 (Returns 12) Add 2 arguments a and b and return it into the variable.
div test = 9 add 3 (Returns 3) Get the quotient of 2 arguments a and b and return it into the variable.
pow test = 9 pow 3 (Returns 729) Raise argument a to the power of argument b and return it into the variable.
mul test = 9 mul 3 (Returns 27) Get the product of argument a and argument b and return it into the variable.
> if test > a Return a true value if the variable is greater than argument a.
< if test < a Return a true value if the variable is less than argument a.
= if test = a Return a true value if the variable equal to argument a. Else, skip the next line.
! if test ! a Return a true value if the variable is not a nonzero value.
& if test & a Return a true value if the variable and argument a are a nonzero value.

Instructions

Instruction Example Description
rev rev test Reverse the order of variable a eg. "Hello, " -> " ,olleH"
len len test Return the length of argument a
out out a Output argument a
loop loop 2(n) loop n times
loopi - loop infinitely

Program Examples

Hello World Program

helloworld = "Hello, "
helloworld = $$ "World!"
out helloworld

Counter

counter = 1
loopi
counterc = [counter]
counterc = $$ ", "
out counterc
counter = 1 + [counter]
;loopi

Outputs 1, 2, 3.....,

Truth Machine

truthmachine = _input_
if truthmachine = 1
loopi
out truthmachine
if truthmachine = 1
;loopi

Cat Program

input = _input_
out input

Rock Paper Scissors Game

computer = 1-3
cpuchoice = none
new rps
rock = 1
paper = 2
scissors = 3
;rps
loopi
message1 = "Input 1, 2, or 3."
out message1
choice = _input_
if choice = 1
cpuandplayerchoice = "You chose "
if choice = 1
cpuandplayerchoice = $$ "rock! The computer chose "
if computer = 1
cpuchoice = "rock"
if choice = 1
cpuandplayerchoice = "You chose "
cpuandplayerchoice = $$ "rock! The computer chose "
if computer = 2
cpuchoice = "paper"
if choice = 1
cpuandplayerchoice = "You chose "
if choice = 1
cpuandplayerchoice = $$ "rock! The computer chose "
if computer = 3
cpuchoice = "scissors"
if choice = 2
cpuandplayerchoice = "You chose "
if choice = 2
cpuandplayerchoice = $$ "paper! The computer chose "
if computer = 1
cpuchoice = "rock"
if choice = 2
cpuandplayerchoice = "You chose "
if choice = 2
cpuandplayerchoice = $$ "paper! The computer chose "
if computer = 2
cpuchoice = "rock"
if choice = 2
cpuandplayerchoice = "You chose "
if choice = 2
cpuandplayerchoice = $$ "paper! The computer chose "
if computer = 3
cpuchoice = "scissors"
if choice = 3
cpuandplayerchoice = "You chose "
if choice = 3
cpuandplayerchoice = $$ "scissors! The computer chose "
if computer = 1
cpuchoice = "rock"
if choice = 3
cpuandplayerchoice = "You chose "
if choice = 3
cpuandplayerchoice = $$ "scissors! The computer chose "
if computer = 2
cpuchoice = "paper"
if choice = 3
cpuandplayerchoice = "You chose "
if choice = 3
cpuandplayerchoice = $$ "scissors! The computer chose "
if computer = 3
cpuchoice = "scissors"
cpuandplayerchoice = $$ "[cpuchoice]."
out cupandplayerchoice
;loopi

XKCD Random Number

xkcd = 4         (Non-random version)
out xkcd





xkcd = 1-4            (Random version)
out xkcd

n^2

squared = _input_
squared = [squared] pow 2
out squared

Output to AEAV translation

Output AEAV
Input input = _input_
Output "a" output = _input_ \n out output
Output the input input = _input_ \n out input