Colors

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

Colors is an esolang... Well, it's really complicated to explain within a single sentence so let me explain further!

Cursor

You control a cursor that automatically moves in the direction it's facing. Enough said, if you have heard of Befunge before it's a similar principle. However, unlike Befunge that uses an arbitrary starting position, Colors' starting position is always at the top left. The cursor is represented by a rainbow gradient in code.png.

The Three Planes Of Existence

There are three planes of existence. The first is the "text plane," which is the contents of the file. It shows text and is an abstraction for the "code plane," which uses graphics and is visible as code.png. The code plane is the same size as the text plane by default, but you can change it. The last plane is the "data plane," which is text like the text plane but normally hidden. The data plane stores what the code plane reads and writes when it reaches four colors: BLU, RED, GRN, and RED. The data plane is infinite, like the text plane.

Text Plane

The text plane has only one actual command (not counting the four UDLR directional commands and 3 comment commands).

Unique Commands
Command Header text
$[BLU, BLA, ORA, GRN, RED, YLW, PNK, WHT, GRY, MGN, CYN, ] Changes the color of the current cell the cursor is occupying on the code table
# The path that the cursor will take
% COMMENT % Starting comment. Can only be at the start or the end, can not be in the code itself.
. Represents the starting cursor. However, this can not be used to move the cursors position as if the cursor is not the very first non-comment character in the entire code an error is thrown.

Code Plane

There are 15 colors on the code plane. Each pixel is 50x50 pixels in dimensions.

Caption text
Color (text plane representation) Description
BLU Adds the current cell on the data plane by 1.
RED Subtracts the current cell on the data plane by 1.
ORA Exits the program (if ORA isn't called at least once, then the program will just loop indefinitely until you manually stop it)
GRN Takes the current cell from the data plane to the terminal as the ASCII value (i.e - prints a character)
RED Takes in a number as input and sets the current cell on the data plane to the input
WHT ~EMPTY SPACE~
GRY Code-wise the same as WHT, but readability-wise the same as # on the text plane
MGN Starts a loop
CYN Ends a loop
YEL Copy current cell to a buffer: This stores the value of the current cell into a temporary buffer for later use in operations.
BRN Add buffer to current cell: Adds the value stored in the buffer to the current cell on the data plane.
PRP Subtract buffer from current cell: Subtracts the value in the buffer from the current cell.
TUR Multiply current cell by buffer: Multiplies the value in the current cell by the value stored in the buffer.
SLV Divide current cell by buffer: Divides the current cell by the value stored in the buffer (integer division).
GLD Store result in another cell: Takes the result of the last operation and stores it in a new data plane cell. "New" meaning 5 cells away from the current data plane cell.
BLK If the current data plane cell is zero, the cursor will skip to the next BLK or a defined location.

NOTE: You can't chain multiple commands in one cell. You have to move to separate cells for each command.