LOLGraphics
A downloadable programming language for Windows, macOS, and Linux
This is an esoteric programming language based on lolcode only with graphics. All codes must begin with the line HAI <version> to specify which version of lolgraphics you are running. Then you need to write "IM IN UR CODE EXECUTIN UR KOMANDZ". At the end of the code, you need to write "IM OUTTA UR CODE".
If you find any bugs, please report them in the comments below (if possible, with a detailed explanation on how to recreate the bug).
List of commands:
1. PLZ TYPE TEXT <TEXT> types the text written after the word text to the console. There's no need to add quotation marks, and if added will be typed as well.
2. PLZ TYPE ONE BYTE <index/variable> - types the value of the one-byte value in the specified location to the console. (For more information: LOLGraphics memory)
3. PLZ TYPE TWO BYTE <index/variable> - types the value of the two-byte value in the specified location to the console. (For more information: LOLGraphics memory)
4. PLZ TYPE FOUR BYTE <index/variable> - types the value of the four-byte value in the specified location to the console. (For more information: LOLGraphics memory)
5. PLZ TYPE EIGHT BYTE <index/variable> - types the value of the eight-byte value in the specified location to the console. (For more information: LOLGraphics memory)
6. PLZ PRINT TEXT <TEXT> - the same that PLZ TYPE TEXT only goes to the next line.
7. PLZ PRINT ONE BYTE <index/variable> - the same that PLZ TYPE ONE BYTE <index>, only goes to the next line.
8. PLZ PRINT TWO BYTE <index/variable> - the same that PLZ TYPE TWO BYTE <index>, only goes to the next line.
9. PLZ PRINT FOUR BYTE <index/variable> - the same that PLZ TYPE FOUR BYTE <index>, only goes to the next line.
10. PLZ PRINT EIGHT BYTE <index/variable> - the same that PLZ TYPE EIGHT BYTE <index>, only goes to the next line.
11. PLZ ADD A SPACE - adds a space to the terminal. This is necessary because LOLGraphics deletes any spaces written at the beginning or end of any line.
12. I CAN HAS A CHEEZBURGER? - draws a cheeseburger to the top left of the screen. (version 0.1). Starting from version 0.2, you can draw it on any place on the screen you want. (see PLZ DELIVR MAH CHEEZBURGERS 2). Please note that in version 0.2 when a cheeseburger is drawn, it will clear any previous cheeseburgers. Starting from version 0.3, every time when a cheeseburger is drawn, it will keep the previous cheeseburgers, with the most top left drawn on the bottom layer. Starting from version 1.5, the cheeseburger drawn first will appear on the bottom, and the one drawn last will appear on the top.
13. PLZ DELIVR MAH CHEEZBURGERS 2 <x> <y> - any cheeseburgers drawn after this command will be drawn on the specified position. (version 0.2 and above). The values given in x and y can be numbers or the name of a one-byte variable. (Version 1.2 and above). two byte variable (version 2.4 and above).
14. PLZ WAIT 4 DA USR 2 REACT - enables the input button, and does nothing until it's pressed, then it continues the program. Any text in the input field will be ignored. (version 0.2 and above).
15. PLZ CLEAR TEH SCREEN - clears the graphics panel. If no commands that use the graphics panel were ran, it will be gray, and typing this command at the beginning of the code will fix this. (version 0.2 and above).
16. PLZ CLEAR TEH CONSOLE - clears the console. (Version 0.2 and above).
17. I HAS A ONE BYTE DAT IZ CALLED <name> - defined a one byte variable with the specified name. (version 1.1 and above).
18. I HAS A TWO BYTE DAT IZ CALLED <name> - defined a two bytes variable with the specified name. (version 1.1 and above).
19. I HAS A FOUR BYTE DAT IZ CALLED <name> - defined a four bytes variable with the specified name. (version 1.1 and above).
20. I HAS A EIGHT BYTE DAT IZ CALLED <name> - defined an eight bytes variable with the specified name. (version 1.1 and above).
21. PLZ SET ONE/TWO/FOUR/EIGHT BYTE <address/variable> <number> - sets the value of the specified address to the specified number. Currently you can only type a numeric value as the second parameter, not a variable. (version 1.4 and above).
22. PLZ GIMME A RANDOM ONE/TWO/FOUR/EIGHT BYTE <address/variable> - sets the specified variable to a random number. (version 1.4 and above).
23. PLZ ASK TEH USR 2 GIMME A ONE/TWO/FOUR/EIGHT BYTE <address/variable> - waits till the user types a number in the specified field, and then puts it's value in the specified variable or address. (version 1.4 and above).
24. PLZ CLEAR ALL TEH SEGMENTS - sets the values of all the addresses in all four segments to random numbers. (version 1.4 and above).
25. PLZ RUN SUBPROGRAM <name> - runs the specified subprogram. (version 2.0 and above).
26. IM IN UR SUBPROGRAM DAT IZ KALLED <name> - write this line at the beginning of every subprogram. (version 2.0 and above).
27. IM OUTTA UR SUBPROGRAM - write this at the end of every subprogram. (version 2.0 and above).
28. PLZ ASK CEILIN KAT 2 CHEK IZ <condition> - checks is the condition true. If it is it saves the value true in the flag, else it saves false. Currently the only conditions are == that check if the two variables are equal to each other, > that checks if the first one is greater that the second, and < that checks if the first one is smaller than the second. Supports both numeric values and variables. Type [varname] for one byte variables, [[varname]] for two bytes, [[[varname]]] for four bytes, and [[[[varname]]]] for eight bytes. (version 2.1 and above).
29. IF CEILIN KAT IZ NODDING PLZ RUN <subprogram> - if the value of the flag is true, this command runs the specified subprogram. (version 2.1 and above).
30. ELSE PLZ RUN <program> - if the value of flag is false, this command runs the specified subprogram. In LOLGraphics, else doesn't have to come after if as it runs as an independent command. (version 2.2 and above).
31. PLZ ASK CEILIN CAT 2 NOD - sets the value of the flag to true. While it is possible to type a condition that is always true like 5<7, this command runs much more efficiently. (version 2.2 and above).
32. PLZ ASK CEILIN CAT 2 STOP NODING - sets the value of the flag to false. While it is possible to type a condition that is always false like 5>7, this command runs much more efficiently. (version 2.2 and above).
33. WHILE CEILIN CAT IZ NODDIN PLZ RUN <subprogram> - a while loop. Runs while the value of the flag is true. It is important you always remember to type the condition at the end of the subprogram this loop is running. Otherwise, the loop will be an infinite loop. (version 2.2 and above).
34. PLZ SET DELAY <number> - changes the amount of time that passes in between every 2 commands. All numbers in milliseconds. (Version 2.3 and above).
35. FOREVER RUN <subprogram> - runs the specified subprogram in an infinite loop. (version 2.4 and above).
36. PLZ READ ONE/TWO/FOUR/EIGHT BYTE <address/variable> - reads the value in the input field and saves in the specified variable or address. The difference between this command and PLZ ASK TEH USR 2 GIMME A ONE/TWO/FOUR/EIGHT BYTE is that PLZ ASK.... waits for the user to enter a number while PLZ READ just reads whatever is in there. If the input field is empty, this command doesn't do anything and the value of the variable stays the same. (version 2.4 and above).
37. SWITCH <variable/address> - copies the value of the variable or address to an 8 bit variable in the memory. This variable can't be accessed using commands and is only used in this command, and in the CASE command (below). The default value of this variable is 0. (version 2.5 and above) (For more information: SWITCH CASE).
38. CASE <number/a list of numbers separated by commas without spaces> <subprogram> - checks if the value of the variable used in switch is equal to the value or one of the values listed. If yes, it will run the specified subprogram For example: CASE 5 FIVE or CASE 5,6,2,27,99 SUBPROGRAM. (version 2.5 and above) (For more information: SWITCH CASE).
39. PLZ CHANGE TEXT COLOR <color> - changes the color of the text in the console to the specified color. It can be one of the following: black, blue, cyan, dark gray, gray, green, light gray, magenta, orange, pink, red, white, and yellow. Java programmers will recognize this as a list of colors from java.awt.Color class. In a future version, I plan to add support of RGB colors. You can look in the example code "Changing colors" for reference. (version 2.5 and above) Also rgb values (for example 180, 150, 100) or the word RANDOM for an entirely random color. (Version 3.4)
40. PLZ LOAD IMAGE <image name in the code> <file name> - Loads an image from a specified file. The name of the image in the code can't contain spaces but the file name can. For example, if your write PLZ LOAD IMAGE EXAMPLE EXAMPLE.PNG, then if you want to draw this image, you will refer to it as EXAMPLE. (Version 3.0 and above).
41. PLZ DRAW IMAGE <image name> - draws the specified image on the screen. It will be drawn on the same coordinates that you have chosen for drawing cheeseburgers. You can change it using the command "PLZ DELIVR MAH CHEEZBURGERS 2 <x> <y>" and type the name of a two bytes variable or a number. (Version 3.0 and above).
42. PLZ DRAW LINE <x1> <y1> <x2> <y2> - draws a line from point (x1,y1) to (x2,y2). x1, y1, x2, and y2 can be numbers or two byte variables. (version 3.1 and above).
43. PLZ CHANGE PAINT BRUSH <color> - changes the color that lines will be drawn. This doesn't influence existing lines and only lines drawn after this command is run will be in the specified color. List of supported colors: black, blue, cyan, dark gray, gray, green, light gray, magenta, orange, pink, red, white, and yellow. (version 3.1 and above). Also rgb values (for example 180, 150, 100) or the word RANDOM for an entirely random color. (Version 3.4)
44. PLZ GIMME A RANDOM ONE/TWO/FOUR/EIGHT BYTE IN RANGE <address/variable> <min> <max> - generates a random number in the given range and saves it in the specified address or variable. min and max can be just numbers, not variables. (version 3.1 and above).
45. PLZ DRAW RECT <x1> <y1> <width> <height> - draws the outline of a rectangle with the top left corner in the specified coordinates (x1,y1) and with the specified width and height. You can enter as parameters numbers or two byte variables. (version 3.2 and above).
46. PLZ FILL RECT <x1> <y1> <width> <height> - draws and fills a rectangle with the top left corner in the specified coordinates (x1,y1) and with the specified width and height. You can enter as parameters numbers or two byte variables. If you want to draw a rectangle with an outline in another color, first write PLZ FILL RECT, and only then PLZ DRAW RECT (version 3.2 and above).
47. PLZ DRAW ELLIPSE <x1> <y1> <width> <height> - draws the outline of an ellipse with the top left corner in the specified coordinates (x1,y1) and with the specified width and height. You can enter as parameters numbers or two byte variables. (version 3.2 and above).
48. PLZ FILL ELLIPSE <x1> <y1> <width> <height> - draws and fills a ellipse with the top left corner in the specified coordinates (x1,y1) and with the specified width and height. You can enter as parameters numbers or two byte variables. If you want to draw a ellipse with an outline in another color, first write PLZ FILL RECT, and only then PLZ DRAW RECT (version 3.2 and above).
49. PLZ FILL TEH SCREEN - colors the entire screen with the color of the paint brush. Can be changed using the command PLZ CHANGE PAINT BRUSH. (version 3.2 and above).
50. PLZ DRAW POLY <points> - draws a polygon through the specified points. Must be at least 3 points (6 numbers) and an even number of numbers (x,y coordinates). PLZ DRAW POLY 10 10 150 200 100 20 is a valid command while PLZ DRAW POLY 10 10 150 200 100 20 5 and PLZ DRAW POLY 10 10 150 200 are not. (version 3.2 and above).
51. DIS IZ MY LABEL! IT IZ KALLED <name> - a label. Can be jumped to. (version 3.2 and above).
52. PLZ GOTO LABEL <label> - jumps to the specified label. (version 3.2 and above).
53. PLZ READ CHAR <address/variable> - reads the character that was entered and saves it's unicode value in the specified two bytes variable, or the specified address in the two bytes segment. Only supports two bytes values. If more than one character is provided, it will only put attention to the first character. (version 3.3 and above)
54. LABELCASSE <number/numbers seperated by commas without spaces> <label> works more or less the same as CASE only that instead of running a subprogram, it jumps to a label. The only difference that if you run a subprogram, it remembers from what line you called the subprogram and when the subprogram is over, it returns to this line, but if you jump to a label it doesn't remember. (version 3.3 and above).
55. PLZ DRAW BACKGROUND - draws an image drawn in MS-Paint called background. It is used in the scrolling background demo. (version 3.3 and above).
LOLGraphics memory (starting from version 1.0):
The LOLGraphcis Interpreter gives you access to 4 arrays (called segments) called the one-byte segment, the two-bytes segment, the four-bytes segment, and the eight-bytes segment. Each segment has 65536 items (2^16). In the one byte segment each item takes one byte (8 bits), in the two byte segment each item takes two bytes (16 bit), in the four byte segment each item takes 4 bytes (32 bits), and in the eight bytes segment each item takes 8 bytes (64 bits).
It's possible to print the values of variables using the PRINT and TYPE commands, for example PLZ PRINT FOUR BYTES 100 prints the value in index 100 in the four-bytes segment. At the beginning of the code, all 4 segments are all filled with random numbers that starting from version 1.3 can be changed using the command PLZ SET VALUE.
Starting from version 1.4, it's possible to set set the values to random numbers using PLZ GIMME A RANDOM <size> BYTE, to ask the user to enter numbers using PLZ ASK TEH USR 2 GIMME A <size> BYTE, and also to set all the values in all the segments to random numbers using PLZ CLEAR ALL TEH SEGMENTS.
Also it's possible to define variables by using the command "I HAS A ONE/TWO/FOUR/EIGHT BYTE DAT IZ CALLED X". What this command basically does is it takes the first unnamed address in the specified segment, and names it however you want to name it. At the beginning of the code, all addresses will be unnamed. It's possible to give to variables in the same segment the same name but this name will always refer to the first one.
Example:
HAI 1.2
...
I HAS A ONE BYTE DAT IZ CALLED X
I HAS A ONE BYTE DAT IZ CALLED X
PLZ PRINT ONE BYTE X
...
This code will run properly without any errors, however the print command will refer to the first variable, and the second one will be inaccessible, unless you use use it's address which in this case is 1, but will be different if you defined several variables before that.
SWITCH CASE:
In some cases, you will want to run a different subprogram based on the value of a specific variable. For example in 8462 demo (if you download version 2.4), you will see the way I did it is by using 4 conditions like following:
PLZ ASK CEILIN KAT 2 CHEK IZ [BUTTON]==8
IF CEILIN KAT IZ NODDING PLZ RUN UP
PLZ ASK CEILIN KAT 2 CHEK IZ [BUTTON]==2
IF CEILIN KAT IZ NODDING PLZ RUN DOWN
PLZ ASK CEILIN KAT 2 CHEK IZ [BUTTON]==4
IF CEILIN KAT IZ NODDING PLZ RUN LEFT
PLZ ASK CEILIN KAT 2 CHEK IZ [BUTTON]==6
IF CEILIN KAT IZ NODDING PLZ RUN RIGHT
However, this is very time consuming because LOLGraphics Interpreter has to figure out each time what the condition means, where the variable button is stored, and so on. Starting from version 2.5, there's a new way to do this: by using switch case. In the switch, you can type any variable or address you want, just remember that this command requires [] for one byte variables, [[]] for two byte variables, [[[]]] for four byte variables, and [[[[]]]] for eight byte variables. In the case, you can type a number or few numbers separated by commas without spaces. Here's an example:
SWITCH [BUTTON]
CASE 8 UP
CASE 2 DOWN
CASE 4 LEFT
CASE 6 RIGHT
CASE 86,68,9 UP_RIGHT
CASE 48,84,7 UP_LEFT
CASE 42,24,1 DOWN_LEFT
CASE 62,26,3 DOWN_RIGHT
As you see much more elegant, and also more flexible. The words you see after the numbers are the subprograms that should be run if the variable is equal to the specified value or one of the specified values. If you don't write the switch line, the default value will be 0. This theoretically could have been even more efficient, but since in LOLGraphics every line is a command, it's impossible to make it not run on the other numbers after it found a match without changing this, and besides the point of an esoteric programming language is to test the boundaries of programming language design.
Subprograms (Starting from version 2.0):
A subprogram works sort of like a function in python or a method in java. They are written at the end of the code (after the line IM OUTTA UR CODE). Theoretically, they can be written anywhere in the code, but it's highly recommended to write them at the end of the code. At the beginning of a subprogram, write IM IN UR SUBPROGRAM DAT IZ KALLED <name>, and at the end, write IM OUTTA UR SUBPROGRAM. You can call a subprogram by typing PLZ RUN SUBPROGRAM <name>. It's possible to have few subprograms with the same name, however it will always run just the last one. Subprograms can also be used for if statements (see commands 28 and 29)
Comments and case sensitivity:
To write comments, type BTW at the beginning of a line. Multiple line comments start with OBTW and end with TLDR. Unlike most programming languages, you can't start comments in the middle of a line so the line PLZ TYPE TEXT HELLO WORLD BTW THIS IS A COMMENT will print the text HELLO WORLD BTW THIS IS A COMMENT. Also the words OBTW and TLDR must be at the beginning of the line in order for the LOLGraphics interpreter to consider it as a comment. If you want to continue the comment after TLDR on the same line, you can. Also lolgraphics is not case sensitive, so you can type the code in lowercase letters, however lolgraphics automaticity turns everything to upper case.
Version history:
Version 0.1 (09.12.2020): In this version there are just 4 commands: PLZ TYPE TEXT - types the text written after that to the console, PLZ PRINT TEXT - like type text only that it goes to the next line after that, PLZ ADD A SPACE - types a space, and I CAN HAS A CHEEZBURGER? - draws a cheeseburger on the top left corner of the screen.
Version 0.2 (16.12.2020): Added 4 new commands: PLZ DELIVR MAH CHEEZBURGERS 2 <x> <y> - can be used to specify where on the screen you want the cheeseburgers to be drawn (however in version 0.2 you can only have one cheeseburger on the screen in a given moment), PLZ WAIT 4 DA USR 2 REACT - enables the input button and halts the code until the user press it, PLZ CLEAR TEH SCREEN - clears the screen, PLZ CHEAR TEH CONSOLE - clears the console.
Version 0.3 (30.12.2020): Starting from this version, more than one cheeseburger can be displayed on the screen at any given time, however the ones on the top left will be drawn on the bottom layer with the ones on the bottom right being drawn on the top layer.
Version 1.0 (30.12.2020): Added the LOLGraphics memory - 4 arrays called "segments" each with 65536 items (the one bytes segment, the two bytes segment, the four bytes segment, and the eight bytes segment). Currently they can only be accessed using PRINT and TYPE commands. At the beginning of the code, they are all filled with random numbers that as of now can't be changed.
Version 1.1 (31.12.2020): Added a new command - I HAS A ONE/TWO/FOUR/EIGHT BYTE DAT IZ CALLED <name> that defines a variable with the given name in the specified segment. Also it's possible to print the values of those variables! Happy New Year! More features to come next decade!
Version 1.2 (07.01.2021): Now the command PLZ DELIVR MAH CHEEZBURGERS 2 accepts one byte variables as parameters.
Version 1.3 (07.01.2021): Now you can change the values of variables using the command PLZ SET ONE/TWO/FOUR/EIGHT BYTE.
Version 1.4 (29.01.2021): Now you can set the values of variables to random numbers, get numbers from the user, and set the values of all the addresses to random numbers.
Version 1.5 (05.02.2021): Changed it so that the first cheeseburger drawn will always be shown on the bottom and the last cheeseburger drawn will always be shown on the top.
Version 2.0 (05.02.2021): Added subprograms to LOLGraphics.
Version 2.1 (24.02.2021): Added conditions and if statements to LOLGraphics. currently the only conditions are ==,<,>. More to come soon!
Version 2.2 (14.03.2021): Added an else statement, now it's possible to set the value of the flag to true or false directly without needing to type a condition, and also added while loops. Changed it so that now 10 commands run every second. In a future version I will make it so that you can toggle the frequency using a command.
Version 2.3 (18.03.2021): Made it so that you can toggle the amount of time that passes in between every 2 commands. Notice how starting from this version, it's written HAI 2.3 0 100 instead of just HAI 2.3. The zero stands for the amount of time in milliseconds that passes before the first command starts running, and the 100 stands for the amount of time (also in milliseconds) that passes in between every 2 commands. If you write just one number, it will be the amount of time in between every 2 commands, and if you don't type any numbers it will just keep the default values. Also added the command PLZ SET DELAY <number> that changes the amount of time that passes in between every 2 commands. Also added support for simple arithmetic operations.
Version 2.4 (05.04.2021): Added infinite loops (FOREVER RUN) and the option to read what is in the input field without freezing the program using PLZ READ. Also added an example program "8462 demo" where you can move a cheeseburger around the screen using the 8462 buttons. (If you use the numpad. it's convenient).
Version 2.5 (15.04.2021): Added switch case statements, and also a command that change the text color in the console. Upgraded the "8462 demo" to now support diagonal movement. Also added to new example codes: "Fibonacci" that asks the user to enter a number and then prints that amount of numbers from Fibonacci sequence, and "Changing colors" that prints text and the color of this text changes twice every second.
Version 3.0 (23.04.2021): Added two new commands: PLZ LOAD IMAGE that loads an image from a file and PLZ DRAW IMAGE that draws an image. Also fixed the flickering in "8462 demo" by moving the command "PLZ CLEAR TEH SCREEN". Now, instead of clearing the screen, calculating the new position, and then drawing, the program calculates the new position, clears the screen and draws it.
Version 3.1 (28.04.2021): Added the option to draw lines using the command PLZ DRAW LINE <x1> <y1> <x2> <y2>. You can give it as parameters numbers and two byte variables. It's also possible to change the color of the paintbrush by using PLZ CHANGE PAINT BRUSH <color>. List of supported colors above. Also added the option to generate random numbers in a given range using PLZ GIMME A RANDOM ONE/TWO/FOUR/EIGHT BYTE IN RANGE. More about this command above.
Version 3.2 (02.05.2021): Added the option to draw and fill rectangles and ellipses. Also added the option to draw custom polygons and to fill the entire screen in one color. Also added labels. You can define a label using DIS IZ A LABEL! IT IZ KALLED <name>. You can also jump to a label using PLZ GOTO LABEL <label>.
Version 3.3 (18.05.2021): Added three new commands: PLZ READ CHAR that reads the character that was entered and saves it's unicode value in the specified two bytes variable, or the specified address in the two bytes segment (if more than one character is provided, it will only read the first one), LABELCASE that works like CASE only jumps to a label instead of runnin ga subprogram, and PLZ DRAW BACKGROUND that draws a huge image in the coordinates using the command PLZ DELIVR MAH CHEEZBURGERS 2 <x> <y>. This image is so big that it can't fit the screen so you will only see a part of it. Also added a new example code - a scrolling screen demo that uses this image. I didn't want to include an example code that relies on external images not included in LOLGraphics so I included this image and added this command.
Version 3.4 (01.06.2021): Added the ability to change the text color to any color you want - not just a list of predefined colors. You can still use the predefined ones if you want to but you can also write RGB values (for example 200, 100, 0) or the word RANDOM for a random color. Also added a new example code that draws many random lines in random colors.
Entry in esolangs.org: https://esolangs.org/wiki/LOLGraphics
Tutorial book: https://en.m.wikibooks.org/wiki/Programming_in_LOLGraphics_3.4
Download
Install instructions
Just download the version that you want and open the jar file.
No extracting necessary. : )
Development log
- LOLGraphics Version 3.4Jun 01, 2021
- LOLGraphics Version 3.3May 18, 2021
- LOLGraphics Version 3.2May 02, 2021
- LOLGraphics Version 3.1Apr 28, 2021
- LOLGraphics Version 3.0Apr 22, 2021
- LOLGraphics Version 2.5Apr 15, 2021
- LOLGraphics Version 2.4Apr 05, 2021
- LOLGraphics Version 2.3Mar 18, 2021
Comments
Log in with itch.io to leave a comment.
Im a computer sience teacher in Eritrea an here we teach this wonderful lang as part if our curriculum. I think that it is very good because it helps my students understand the basics of computer science. A+ for the creator.
Congratelations people