We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

^English/MORE PROGRAM

From Esolang
Jump to navigation Jump to search

Main page →→→→ ^English

Bubble sort

--- BUBBLE SORT ---

Compare each list element two by two. 
If the former is larger than the latter of the two elements, the two elements are swap, 
just like bubbles float up one by one, the bigger number will go to the end of list.

--- END ---

Define a list, and read the list from user.
Bubble sort the entire list, and output the result.

99x bottles of beers

Read a integer from user and then assign it to x, and push it into the stack.
If x is larger than 0 then do these code forever: 
Print "%1 bottles of beers on the wall, \n%1 bottles of beers.\n". All %1 here will be replaced by x.
Decreases x and then print "Take 1 down and pass it around, \n"
If x is still larger than 0 then print "%1 bottles of beers on the wall.\n\n". All %1 here will be replaced by x.
Otherwise, print "no bottles of beers on the wall.\n\n".
End loop.
Print "No more bottles of beers on the wall, \nno more bottles of beers.\n".
Pop x from stack and restore it.
Print "Go to the store and buy some more, \n%1 bottles of beers on the wall.\n\n". All %1 here will be raplaced by x.
Throw x into the trash.

Sussy language interpreter

Input a string from user and throw it into the trash, and then output a Sinhala Letter Kantaja Naasikyaya.

Nope. interpreter

Input a string from user and throw it into the trash, and then output "Nope." without newline.

Do nothing

No operation.

Cat Program

If the user don't input nothing, then print the user input, otherwise break out.

Collatz function/sequence

Input an integer from user, and then assign it to x.
Repeat these until x = 1:
For every step, if x is an even, then assign x/2 to x, otherwise, assign 3x+1 to x.
Print the value of x with a newline.
End loop.
Print "All done." without newline.
Throw x into the trash.

Befunge 93 interpreter

Input a string from user, and assign it to SRC.
For each character in SRC, there are:
> → Move the pointer to right.
< → Move the pointer to left.
^ → Move the pointer to up.
v → Move the pointer to down.
? → Move the pointer randomly.
_ → Pop a value; set direction to right if value=0, set to left otherwise.
| → Pop a value; set direction to down if value=0, set to up otherwise.
" → Read all character as this direction until next quote.
: → Copy the top element from stack and throw it into the stack.
\ → Swap the two top element of stack.
$ → Pop the top element from stack and then throw it into the trash.
+ → Pop a and b, and then push a+b.
- → Pop a and b, and then push b-a.
* → Pop a and b, and then push a×b.
/ → Pop a and b, and then push b÷a. Partially, if a is 0, then raise an error: "What the f*ck did you let me do?!"
% → Pop a and b, and then push mod(b, a).
! → Pop a, push 1 if a=0, push 0 otherwise.
` → Pop a and b, push 1 if b>a, push 0 otherwise.
. → Pop a, and output a as an integer.
, → Pop a, and output a as a Unicode Character.
& → Input an integer from user and push it into stack.
~ → Innput an Unicode Character from user and push its Unicode into stack. (For example, an exclamation mark pushes 33.)
0123456789 → Push the value into the stack.
# or a space mark → A placeholder.
@ → End the program.
p → A "put" call (a way to store a value for later use). Pop three values y, x and v, then change the character at the position (x,y) in the program to the character with ASCII value v.
g → A "get" call (a way to retrieve data in storage). Pop two values y and x, then push the ASCII value of the character at that position in the program. If (x,y) is out of bounds, push 0.

Insertion sort


--- INSERTION SORT ---

The process of direct insertion sorting is 
to insert each element into an ordered sequence in turn.
All elements are divided into ordered and unordered areas, 
each time take the first element from the unordered area, 
compare it with each element in the ordered area from back to front, 
find the correct position, 
and insert the element into the correct position. 
The initial ordered area has only one element.
Recall the situation of playing cards, 
when the cards are dealt according to the number of points and suits. 
This is how the insertion sort is used.

--- END ---

Define a list, and read the list from user.
Insertion sort the entire list, and output the result.

Other

Coming soon, please come later.

\\\

BrainFuck Interpretor

it's not that accurate, feel free to delete it

Get an Input String from the user, assign it to variable CD
Create a new Int variable named I, this is the memory pointer.
Create a new Array with 30,000 bytes in it, assign all the bytes to 0x00

For each character in CD:
+     increments the value at I by 1
-     decrements the value at I by 1
>     increments the memory pointer I by 1
<     decrements the memory pointer I by 1
.     outputs the array at value I
,     get input from the user, and store it in the array at I
[     if the value I is zero, skip to the corresponding ] symbol.
]     if the value I is non-zero, loop back to the corresponding [ symbol.

Deadfish interpreter

Get an input string from user, assign it to variable CD
Create a new variable named N.
For each character in CD:
i   Increments the value at I by 1.
d   Decrements the value at I by 1.
s   Squares the value at I.
o   Outputs the value at I.
h   Halts the string.

Simpl interpreter

Get an input string from user, assign it to the variable CD
For each character in CD:
+	Adds two numbers
-	Subtracts two numbers
*	Multiplies two numbers
/	Divides two numbers
^	Exponentiation
=	Equals
>	Greater than
<	Less than
!	Factorial (if right after a variable) or exclamation mark (in printed text)
sqrt()	Sqrt of a number
sin()	Sine of a number
cos()	Cosine of a number
tan()	Tan of a number
asin()	Arcsin of a number
acos()	Arccos of a number
atan()	Arctan of a number
hyp(a, n, b)	Succession if n = 0, a + b if n = 1, a * b if n = 2, a ^ b if n = 3, a tetrated to b if n = 4, so on...
log(a, b)	Outputs a number n where a ^ n = b
print()	Prints the output
def f(x)=[blah blah blah]	Sets f(x) to [blah blah blah]
assign var a = [blah blah blah]	Sets variable a to [blah blah blah]
print (A) n times	Prints a chain of n As. The "A" can be altered to be any text.
print (n cars)	Prints the given text, but if n is a variable, replace n with its value. The "cars" text can be changed into any text.
[new line]	Makes a new line in a “print” command.
end program	Ends the program.
ask (Input?)	Asks "Input?". The question can be changed at will.
assign var a = ans	Sets variable a to the answer of an "ask" command.
check if [desired condition] yes: no:	If desired condition is met, the code continues in the yes section. Otherwise continue code in the no section.
check if [desired condition]:	If the desired condition is met, continue the code.
add n to list ([list name])	Adds variable n as an element to the end of list [list name].
print list ([list name])	Prints list [list name].
repeat n	Repeats n times.
repeat until [desired condition]	Repeats until desired condition is met.
list add ([list name])	Sum of all the elements in list [list name], if all of them are numbers.
list multiply ([list name])	Product of all the elements in list [list name], if all of them are numbers.
assign numbase (n)	Sets the number system to base n.
list union ([2, 3, 4], [1, 3, 5])	Treats the lists as sets and unifies them, numbers in both of the original lists only appear once in the new list. In this case, the output is [1, 2, 3, 4, 5].
list intersect ([1, 2, 4], [2, 4, 5])	Treats the lists as sets and outputs their intersection. In this case, the output is [2, 4].
list xor ([3, 4, 5, 7], [2, 3, 4])	Treats the lists as sets and outputs the XOR of both of them. In this case, the output is [2, 5, 7].
element (n) of ([listname])	Nth element of list [listname].
add (a) to list ([listname]) (n) times	Adds n elements to the end of the list, where all of them are of the variable "a". The variable can be changed to be any variable.
rand integer (a) to (b)	Picks random integer in range from a to b.
rand integer between (a) (b)	Picks random integer between a and b
change pointer (n)	Moves pointer left or right by n cells (if n < 0, then left, if n > 0, then right, if n = 0, then it stays still)
assign memcell pointer (n)	Assigns the ASCII number of the character in the memorycell at the pointer to n.
carry memcell of pointer to s(b)	Carries the ASCII character in the memory cell at the pointer to replace the ASCII character in the memory cell of s(b), dragging the pointer along.
print memcell pointer	Prints the ASCII character in the memory cell at the pointer.
[smooth]	Connects two printed texts "smoothly", that is, without gaps.
f(x, y)	Function with two inputs. Functions can be made with any number of inputs.
while 1:	Repeat forever.
while 0:	Avoids loop completely.
def func (bac) = (assign numbase (2))	Defines the string "bac" with the functionality of "assign numbase (2)". Any command can work.
while [desired condition]	Loops while condition is true.
=/=	Not equal to

Python But Bad interpreter

This program takes a file (or reads code from standard input if no file is given) and interprets it as Python.
If an error occurs, it immediately deletes the source code file.

Conway's Game of Life

This program first reads a string (consisting only of o, b, dollar signs, and exclamation marks, where o represents a cell, b represents empty space, a dollar sign represents a newline, and an exclamation mark represents the end), interprets it as RLE, and then evolves it according to the following rules:

If an empty space is surrounded by three cells, it becomes a cell. If a cell is surrounded by two to three cells, it stays alive. In all other cases, the cell stays dead or becomes empty.

Categories