Remarks: Processing Mazes
From Maze
[Comments/context moved to the Discussion, except this: I'm having trouble keep straight past and present tense in this today]
The algorithm that defines the 10 PRINT maze exists independently from the Commodore 64 (C64) platform. In fact, the algorithm can be simply executed with a sheet of graph paper, a pen, and a coin to toss. The act of running the algorithm on a number of different platforms reveals what is essential to the algorithm from the specific constraints and affordances of the C64. The concision of 10 PRINT originates from its clever exploitation of the C64, as explained in section ??. For example, the code need not instruct the lines to wrap to the next line when they reach the edge of the screen because it's built into the system; lines don't need explicit x- and y-coordinates because characters 205 and 206 define them. When 10 PRINT is ported to other platform, as demonstrated in section ??, these features of the C64 need to be defined within the new platform. The primary constrains of 10 PRINT are C64 default blue on blue color palette and the 40 x 25 character screen.
When the C64 was launched in 1982, it was a powerful home computer for creating computers graphics. In the thirty years since the introduction, computers have changed substantially. Contemporary hardware is an interesting place to re-imagine the 10 PRINT algorithm. For this exploration, we used Processing, a programming system first designed in 2001. It's built on top of Java, one of the dominant modern programming languages, but Processing is specialized for making graphics and simplifies some of the native Java syntax. Java was first introduced in 1995 and is most similar to C++ (1983)[1], which is an object-oriented language that grew from C (1973).
The first Processing version of 10 PRINT was written for the increased resolution of contemporary screens. It did this by making the thickness and ends of the lines into variables that can be changed while the program runs. The lines of the maze can range from 0.5 to 10 pixels wide and the lines can terminate with a rounded or square end. Like 10 PRINT, it maintained the grid of lines at 40 x 25 units, but unlike 10 PRINT it didn't add each grid unit in sequence, left to right and top to bottom, the entire grid was refreshed in unison. The color of the lines was set to white and the background to black, which gave the program a distinctly different feel from the original lower-contrast blues. The result is shown in figures ?? to ??.
The line endings are a subtle, but crucial change within this program. In the original 10 PRINT image (see fig ??), notice how each line terminates into a point. This is required because each of the 40 x 25 tiles that comprise the image are constrained to its 8 x 8 pixels area. This is is created by tiling these lines, fixed into their 64 pixels boxes. In the Processing program, each line is free to extend beyond and into the other lines area. This is because the lines are defined by x- and y-coordinates (precise locations on screen) rather than tile positions. Any number of shapes and colors can appear at any given pixel on screen.
[MORE: Add text about the use of \ and / characters and how they make it work.]
The second Processing version of 10 PRINT took more liberties with 10 PRINT. Most importantly, the number of rows and columns in the grid were variable, the direction of the line defined its color (black or white), each line was defined as a quadrilateral to give more flexibility of the shape, and a third color was used for the background. Each time the code is run, the size of the grid unit is defined at random as a power of 2 (2, 4, 8, 16, or 32) and the thickness of each line is set by a random number. Figures ?? to ?? show some of the varied results. With the ability to further define the graphics, the code became longer than the C64 one-liner 10 PRINT with the enhanced precision and variability:
size(1020, 680);
noStroke();
background(0, 0, 255);
int rows = int(pow(2, int(random(1, 6)))); // 2, 4, 8, 16, 32
int thickness = int(pow(2, int(random(1, 4)))); // 2, 4, 8
int unit = height / (rows + 4);
int uthick = unit / thickness;
int uthicker = unit + uthick;
for (int x = int(-unit * 0.75); x < width+unit; x += unit) {
for (int y = height/2 - rows/2 * unit; y < height/2 + rows/2 * unit; y += unit) {
if (random(1) > 0.5) {
fill(255);
quad(x, y, x + unit, y + unit, x + uthicker, y + unit, x + uthick, y);
}
else {
fill(0);
quad(x, y + unit, x + unit, y, x + uthicker, y, x + uthick, y + unit);
}
}
}
The decision to display one direction of lines as white and the other as black triggers our evolved perception to create depth within this two-dimensional image. Our eyes inform us that there is a light source that is reflecting off one directional edge and creating a shadow on the other. The angle at which the lines terminate in this program enhance the affect by occlusion and terminating at the edge. This creates an isometric perspective which further enhances the perceived dimensionality in the image. These effects work better in some configurations and are subverted by others.
[1] In the C language two plus symbols "++" is a shortcut for adding one. For example x++ adds the value 1 to the variable x. The "++" in C++ is a reference to this operator.
