ASCII Code
Jump to navigation
Jump to search
ASCII Code is a esolang made by Mihai Popa. The goal is to fit a program in a ASCII square or rectangle.
Command list
Command | Meaning |
---|---|
s | Sets the current variable. Variable can be any of the 26 letters. |
p | Pushes the character next to it to the variable specified by the s command.
|
j | Pushes the number next to it to the variable specified by the s command.
|
w | Writes the contents of the variable specified by the s command as a ASCII character.
|
n | Writes the contents of the variable specified by the s command as a number.
|
c | Clears the variable specified by the s command.
|
h | Halts execution. |
i | Stores user input to the variable specified by the s command.
|
g | Prints the variable specified by the s command as a string (use with user input).
|
l | Adds 2 variables and stores in the variable specified. |
m | Subtracts 2 variables and stores in the variable specified. |
q | Multiples 2 variables and stores in the variable specified. |
d | Divides 2 variables and stores in the variable specified. |
f | If statement, 2 variables (letters) or 2 numbers or a mix in between, execute code in the brackets. |
y | While loop, 2 variables (letters) or 2 numbers or a mix in between, execute code in the brackets. |
a | Start of forever loop. |
o | End of forever loop. |
x | For loop, start, end, step size (optional), execute code in the brackets. |
Comments can be done with a percent sign, %, then end with a semicolon ;
Commands are separated by a semicolon.
Values are separated by a space.
It executes from left to right, top to bottom. Also, it's 2D, like in Befunge or Fish.
Detailed description of the if statement
Example:
|---------------------------------| | % If statement example ; | | f 3 5 n [s t ; p H ; w ; p i ; | | w ; p ! ; w ;] ; | |---------------------------------|
Means if 3 and 5 are not equal, then print "Hi!"
The third value can be one of the following:
e = equal to
n = not equal to
g = greater than
l = less than
q = greater or equal to
s = less or equal to
Examples
Hello, world!
|---------------------------------| | % Hello, world! ; | | % in ASCII Code ; | | % "p ;" means a space ; | | | | s t ; p H ; w ; p e ; w ; p l ; | | w ; w ; p o ; w ; p , ; w ; | | p ; w ; p w ; w ; p o ; w ; | | p r ; w ; p l ; w ; p d ; w ; | | p ! ; w ; | | | | % End of program! ; | |---------------------------------|
Cat
|-----------------------| | % Cat in ASCII Code ; | | | | s i ; i ; g ; | |-----------------------|
XKCD Random Number
|------------------------| | % XKCD in ASCII Code ; | | | | s n ; p 4 ; w ; | |------------------------|
Truth Machine
|------------------------| | % Truth Machine in ; | | % ASCII Code ; | | | | s t ; i ; f t 0 e [ | | p 0 ; w ;] ; w t 1 e [ | | a ; p 1 ; w ; o ;] ; | |------------------------|