PlainCore

From Esolang
Jump to navigation Jump to search

PlainCore is an esolang by User:yoyolin0409 and ChatGPT. Its aim is to solve as many problems as possible with as few instructions and golf as possible. There are only 12 instructions in total.

Instructions

set <name> <value>

Create a variable named 'name' with the content 'value'. 'value' can be any text or number; text should be enclosed in quotation marks.

add <name> <value>

As long as `name` is a numeric variable, plus the number represented by `value`, subtraction can be achieved by setting `value` to a negative number. It can also be used to connect text.

mul <name> <value>

If `name` is a numeric variable, multiply it by the number represented by `value`.

div <name> <value>

If `name` is a numeric variable, divide by the number represented by `value`.

cmp <name1><Conditional expression><name2> [is False]

Comparing name1 and name2 to see if they meet the condition "is False" is unnecessary and will reverse the result. The condition can be = (equal), < (less than), > (greater than), <= (less than or equal to), or >= (greater than or equal to).

jmp <label or label_name>

Annoying, infamous "GOTO"

jnz <label or label_name> <Conditional expression>

GOTO with condition

in <name>

Input a string of characters and store it in a variable. The variable must be created first. If the variable is a literal variable, it will be stored directly as literal. If it is a numeric variable, it will only be entered if the input is a number; otherwise, an error will occur.

out <name>

Output variable content

nop

This is equivalent to a comment; all characters following it will be ignored.

label <label_name>

Set the current row number to <label_name>, then simply jmp to the reference to directly replace the row number.

trans <name1> <dict> <name2>

At this point, the dictionary is defined on the fly. The contents of `name1` are replaced with the contents of the dictionary and then output to `name2`. It's important to note that the order follows the order within the dictionary. For example:

set var1 "hi"
set var2 ""
trans var1 [hi:?,hi:!] var2
out var2

It will output "?"

\n

Like python, This shouldn't be considered a instructions, right?

Example

Hello, world!

set a "Hello, world!"
out a

99 bottles of beer

set num 99
set thing1 " bottles of beer on the wall,\n"
set thing2 " bottles of beer.\n"
set thing3 "Take one down, pass it around,\n"
set thing4 "Go to the store, buy some more,\n"
set thing5 "99 bottles of beer on the wall."
set no "No"
label a
set memory num
add memory thing1
out memory
add memory thing2
out memory
out thing3
add num -1
set memory num 
add memory thing1
out memory
jnz a num=1 is False
set memory num
add memory thing1
out memory
add memory thing2
out memory
out thing3
set memory no
add memory thing1
out memory
set memory no
add memory thing1
out memory
set memory no
add memory thing2
out memory
out thing4
out thing5

Quine

Explain the previous example

nothing in code will input nothing so it is quine