ZYXBasic
ZYXBasic is an esoteric language made by User:Marcel364. Its name comes from the user's Scratch username (ZYX987WVU654) because the interpreter was made in Scratch.
Overview
The screen is made up of an 80x45 text grid. There are 99 variables, each labeled 01 to 99. Programs can have up to 200000 lines of code (due to the interpreter's limitations) which is a lot of working space.
History
ZYXBasic was originally made for simple text-based games, but has become broader in terms of what it can do.
Commands
ZYXBasic has 20 three-letter commands. AA
and BB
are placeholders for variables, TEXT
is a placeholder for text, and NUM
is a placeholder for a number.
Command | What it does |
---|---|
prtTEXT |
Prints text |
prvAA |
Prints a variable |
inpAATEXT |
Inputs user's text to a variable |
movAABB |
Moves the text cursor to a set location* |
mvvAABB |
Moves the text cursor according to variables |
strAATEXT |
Stores text to a variable |
gtoNUM |
Goes to a line in code |
ifeAATEXT |
If a variable is equal to text, execute the next action, otherwise skip it |
iveAABB |
If the two variables are equal, execute the next action, otherwise skip it |
ifnAATEXT |
If a variable is not equal to text, execute the next action, otherwise skip it |
ivnAABB |
If the two variables are not equal, execute the next action, otherwise skip it |
ifmAANUM |
If a variable is more than a number, execute the next action, otherwise skip it |
ivmAABB |
If variable AA is more than variable BB, execute the next action, otherwise skip it |
iflAANUM |
If a variable is less than a number, execute the next action, otherwise skip it |
ivlAABB |
If variable AA is less than variable BB, execute the next action, otherwise skip it |
ifkTEXT |
If a key is pressed, execute the next action, otherwise skip it** |
cngAANUM |
Changes a variable by a number |
cgvAABB |
Changes variable AA by variable BB |
ers |
Erases the screen |
slpNUM |
Sleeps for an amount of seconds |
*In this case, AA and BB are not variables, but rather two-digit numbers. AA goes from 00 to 79, while BB goes from 00 to 44.
**The keys are space, up arrow, down arrow, right arrow, left arrow, any, a - z, and 0 - 9.
Example programs
These programs are sorted from least to most complicated.
xkcd random number
prt4
Hello, world!
prtHello, world!
Cat program
inp01Enter text: prv01
Truth machine
inp01Choose 0 or 1: prv01 ifn010 gto2
A+B problem
inp01Enter a number: inp02Enter another number: cgv0102 prv01
Pseudo-random number
prtPress space to generate a number mov0001 str011 cng011 ifm01100 str011 ifkspace gto10 gto4 prv01
Looping counter
cng011 prt* cng021 ivn0102 gto2 str020 cng031 ifm0344 str030 ife030 ers mvv0203 gto1
Bouncing square
str011 str021 mvv0304 prt█ cgv0301 cgv0402 ifm0378 str01-1 ifm0443 str02-1 ifl031 str011 ifl041 str021 ers gto3
FizzBuzz
str010 str020 str030 cng011 cng021 cng031 ife023 prtFizz ife023 str020 ife035 prtBuzz ife035 str030 ife020 prt ife020 gto4 ifn030 prv01 prt gto4
99 bottles of beer
str0199 prv01 prt bottles of beer on the wall. cng021 mvv0302 prv01 prt bottles of beer. cng021 mvv0302 prtTake one down, cng021 mvv0302 pass it around, cng01-1 prv01 prt bottles of beer on the wall! cng022 mvv0302 ifm0244 ers ifm0244 mov0000 ifm0244 str020 ifn010 gto2
Five-function calculator
inp01Enter an operation (+, -, *, /, %): ife01+ gto12 ife01- gto22 ife01* gto35 ife01/ gto47 ife01% gto65 inp02Enter first number: inp03Enter second number: cgv0402 cgv0403 prv02 prt+ prv03 prt= prv04 gto999 inp02Enter first number: inp03Enter second number: cgv0402 cng051 cng04-1 ivn0305 gto25 prv02 prt- prv03 prt= prv04 gto999 inp02Enter first number: inp03Enter second number: cgv0403 cng051 ivn0205 gto37 prv02 prt× prv03 prt= prv04 gto999 inp02Enter first number: inp03Enter second number: cng051 cng061 ive0305 cng041 ive0305 str050 ivn0206 gto49 prv02 prt÷ prv03 prt= prv04 prtr prv05 gto999 inp02Enter first number: inp03Enter second number: cng041 cng051 ive0304 str040 ivn0205 gto67 prv02 prt% prv03 prt= prv04
Turing-completeness
ZYXBasic can simulate brainf**k, albeit with some major formatting changes, and since brainf**k is Turing-complete, then that means that ZYXBasic is Turing-complete as well.
External references
Scratch interpreter — To make your own code, click "See inside", delete everything in the "code" list, and insert your own code here, manually or via a .txt file.