From Esolang
Jump to navigation Jump to search

ObjectArt is a (currently incomplete) esoteric programming language. It appears as a rectangular image, where each pixel represents one piece of code, determined by its RGB values. It is object-oriented, and based largely on Java.

This language is currently in development. Suggestions, especially about keyword colors, are welcome.

Design philosophy

ObjectArt is designed to be as human-readable as possible. Different types of keywords have very different colors, and all variables of the same type have the same shape.


There are 16,777,216 possible colors, as the Red, Green, and Blue components can each range from 0 to 255.

The color CCCCCC --- has a special function, see #Program flow.

Colors where any of the Red, Green, or Blue components is equals to 128 represent keywords .The color FFFFFF --- is also a keyword.

Colors where the Red, Green, and Blue components are all less than 128 (the darkest octant) represent numbers.

Colors where the Red, Green, and Blue components are all greater than 128 (the brightest octant) represent Array inputs.

All other colors are used for variables.


An ObjectArt program consists of at least one segment, which serve as classes. To separate segments, a complete wall of "blank" (CCCCCC ---) space is used, so each orthogonally connected group of non-blank space is a segment. Segments (or groups of segments) can also be placed in a separate file. All files used must be placed in the same folder, and must be explicitly imported.


Each class is represented by a group of pixels in a specific shape. To define a class, put it into its own segment. Note that its shape will be somewhat determined by its methods. A class with a large number of methods must be quite intricate, but even a simple class can be as complicated as you want. That is, there is a lower bound on shape complexity for a class, but no upper bound.

There are no static classes. When running the program, it creates an instance of the specified class, and runs its main method. (If the file run has multiple segments, then the one with a main method is run. There may be no more than one main method per file.)

Program flow

The program starts with the class with the main method, which touches the class on exactly one side. The program continues out the other side, always going in a straight line. If it encounters the edge of the image, or the color CCCCCC ---, it turns right.


Remember that all keyword colors have at least one component equal to 128 (#80). In general, bluish colors are used for math, greenish colors for control flow, and reddish colors for miscellaneous stuff.

Keyword Name Notes
FFFFFF --- nothing does nothing
000080 --- plus number addition
202080 --- minus binary operator
404080 --- times multiplication
606080 --- divided by 7 / 2 = 3.5. 5 / 3 = 1.666... without limit.
8080A0 --- modulus -10 mod 3 = 2. 10 mod -3 = 1. 6 mod 2.5 = 1. 8 mod 0 = 0.
002080 --- and see #Boolean below; eager evaluation
204080 --- or eager evaluation
406080 --- not
200080 --- bitwise and
402080 --- bitwise or
604080 --- bitwise xor
806080 --- bitwise not
006080 --- open-paren everything inside the parentheses is evaluated first
00A080 --- close-paren
00C080 --- start array
00E080 --- end array
608060 --- assign to assigns the calculated value / object / array to the following variable
80B080 --- if( Next argument (until close-paren) is condition. If true, turn right at close-paren; if false, turn left.
80D080 --- for next argument is the array; the next is the name of the variable; from then until end is the body
80F080 --- end
80E090 --- done with parameters used when invoking a method
808000 --- class definition
802020 --- entry point where to enter a class
802020 --- main method must adjoin the class definition; one per file
804040 --- other method must adjoin the class definition
806060 --- return Returns next argument and ends method.

If next is blank or wall, returns 0 and ends.

C06080 --- constructor must adjoin the class definition; one per class
A08080 --- class variable must adjoin the class definition
800080 --- output number
802080 --- output character UTF-8 encoding; equivalent to ASCII for 0-127.
805080 --- input number The input must be a number.

Input "100bottles" inputs 100, and leaves "bottles" for the next input.

Input "bottles" inputs 0, and leaves "bottles". Input "" tries again.

806080 --- input character Input "" tries again.

Simple example

The Hello World program enlarged for readability. The actual program is ObjectArtHelloWorld.png.

This is a simple way of defining a class which outputs "Hello, world" when run.

The dark yellow block in the upper left is the class definition. The red square (just one pixel in the original) to its right is the main method, run at execution time. Each purple square means "output the following character", the blue squares are the ASCII values for the characters. Note how the the program turns right at each wall, and at the gray square at the left. The program ends at the grayish square in the middle.

Bear in mind that the white space is never read by the program. All of the white squares (except a few near the class definition) can be changed to any color at all without problems, although using white helps for clarity, and is the standard convention.


The only literals (class-less types) are integers, which are equivalent to booleans and character values (using UTF-8).

Standard integers are represented as 16384R + 128G + B, using the two's complement system to represent negatives. The largest integer normally representable is thus 1048575, and the smallest is -1048576.

Color Decimal
000000 --- 0
000001 --- 1
000064 --- 100
004E10 --- 10000
7F7F7F --- -1
7F7F1C --- -100

Other numbers

All numbers can exist in ObjectArt, including large numbers in both positive and negative, non-integers with unlimited precision, positive and negative infinity, and NaN. (Complex numbers may be added in a later version.) Many numbers not representable using the above method can be constructed in other ways. For example, 0.5 can be written as 1 / 2, negative infinity can be produced by -1 / 0, and 0 / 0 results in NaN.

However, there is no way to represent irrational numbers. Hence, any programming requiring a square-root function or Pi will have to make do with an approximation.


Converting from numbers to Boolean, all numbers except 0 are considered true. From Boolean to numbers, true is -1 (7F7F7F ---); false is 0 (000000 ---).


The essence of ObjectArt is classes. A program needs one class to run, but will typically make use of many other classes as well.

A class is defined as a shape. The shape can not be flipped or rotated. Typically, the main method's class is a three-by-three square, but any can be used. A class is defined by making its shape out of the color 808000 ---. Adjourning it must be an entry point and almost always a constructor. It will usually have methods, variables, and possibly a main method as well. Each of these components must touch the class on exactly one side.

To create an instance of a class, have the program flow lead into the entry point, draw the class (in any of the colors allocated for variables) and out the constructor. Then place any parameters, and finish with the done-with-parameters pixel. Voila! Your object is now created. To invoke it any time, go into the entry point of the object, and out one of the methods. Draw the parameters, and exit.