Remarks: Variations in BASIC
From Maze
(Difference between revisions)
(Created page with 'Even small changes to the 10 PRINT code can have a significant impact on the visual output and the pattern produced. The output of 10 PRINT has a unique visual appeal which can b…') | (Full revision) | ||
| Line 1: | Line 1: | ||
| − | Even small changes to the 10 PRINT code can have a significant impact on the visual output and the pattern produced. The output of 10 PRINT has a unique visual appeal which can be understood in terms of design and composition (diagonal vs. orthogonal, for instance), and in terms of how it plays against the contextual expectations of the historical period when it emerged (all-text BASIC programs on the one hand and graphical software, particularly videogames, on the other). | + | Even small changes to the 10 PRINT code can have a significant impact on the visual output and the pattern produced. The output of 10 PRINT has a unique visual appeal which can be understood in terms of design and composition (diagonal vs. orthogonal, for instance), and in terms of how it plays against the contextual expectations of the historical period when it emerged (all-text BASIC programs on the one hand and graphical software, particularly videogames, on the other). To understand this, we can take the ''Commodore 64 User's Guide'' and ''RUN'' magazine up on their invitations to modify the program and see what happens. |
| − | As tweaking the program slightly will show, 10 PRINT is a kind of optimal solution that is uniquely elegant in its design space, that of the Commodore 64 BASIC one-line maze generator. Any similar attempt is both less concise (it requires more code) and less expressive (it resembles a maze less or produces a less interesting visual pattern). In fact, the concision of the code and the expressiveness of the image are tightly related, and arise out of a unique set of constraints and interactions, particularly the interaction between the desire to constrain the program code to a single line and the sequence of adjacent characters in the PETSCII table. | + | As tweaking the program will show, 10 PRINT is a kind of optimal solution that is uniquely elegant in its design space, that of the Commodore 64 BASIC one-line maze generator. Any similar attempt is both less concise (it requires more code) and less expressive (it resembles a maze less or produces a less interesting visual pattern). In fact, the concision of the code and the expressiveness of the image are tightly related, and arise out of a unique set of constraints and interactions, particularly the interaction between the desire to constrain the program code to a single line and the sequence of adjacent characters in the PETSCII table. |
The following variations, like the original program, begin by referring to adjacent PETCSII characters. | The following variations, like the original program, begin by referring to adjacent PETCSII characters. | ||
| − | ==== Orthogonal Weave ==== | + | = Weave = |
| − | [[Image:10print-orthogonal-weave.png|160px|thumb|10 PRINT CHR$(102+RND(1)*2); : GOTO 10]] | + | [[Image:weave.png|||10 PRINT CHR$(198.5+RND(1)); : GOTO 10]] |
| − | There are no other two characters in the [http://en.wikipedia.org/wiki/PETSCII PETSCII] data set that, when substituted for "\" and "/", will result in the construction of a traditional orthogonal maze. Vertical and horizontal bars, for example, result in a disconnected weave, while solid and empty squares result in rough static. | + | There are no other two characters in the PETSCII data set that, when substituted for the diagonal "\" and "/", will result in the construction of a traditional orthogonal maze, one that is aligned to the vertical and horizontal axes of the screen screen. Using vertical and horizontal bars, for example, results in a disconnected weave, while solid and empty squares result in rough static. |
| − | <blockquote>10 PRINT CHR$(102+RND(1)*2); : GOTO 10</blockquote> | + | <blockquote>10 PRINT CHR$(198.5+RND(1)); : GOTO 10</blockquote> |
| − | Though it's certainly not a maze, this version of the program imparts a three-dimensional impression, as if someone had woven bands of material over and under one another. | + | Though the result is certainly not a maze, this version of the program is not without visual interest. The output imparts a three-dimensional impression, as if someone had woven bands of material over and under one another. |
| − | ==== Corners ==== | + | = Corners = |
| − | [[Image:10print-elbows.png|160px|thumb|10 PRINT CHR$(108+(INT(RND(1)+.5)*3)); : GOTO 10]] | + | [[Image:corners.png|||10 PRINT CHR$(204+(INT(RND(1)+.5)*3)); : GOTO 10]] |
| − | Randomly selecting corner pieces such as "L", by contrast, turns the image into a honeycomb. | + | Randomly selecting either a bottom-left or top-left corner piece, by contrast, turns the image into a honeycomb. Diagonal mazes are symbolically efficient on a Cartesian grid due to the fact that four characters meet at the corners, whereas only two meet along an edge. Thus, intersections of up to four lines (the building blocks of a rectilinear maze) can be created at corners if we use diagonal lines. |
| − | As it turns out, diagonal mazes are symbolically efficient on a Cartesian grid due to the fact that four characters meet at the corners, whereas only two meet along an edge. Thus, intersections of up to four lines (the building blocks of a rectilinear maze) can be created at corners if we use diagonal lines. | + | = Corners and Diagonals = |
| − | (Add note on including 1,2,3,4,5 etc. spaces in order to try to create a spaced offset -- note similarity to Gotcha etc.) | + | [[Image:corners_and_diagonals.png|||10 PRINT CHR$(204+(RND(1)+.5)*3); : GOTO 10]] |
| − | 10 PRINT " "CHR$(108+(INT(RND(1)+.5)*3)); : GOTO 10 | + | A simplification of the program above involves dropping the "INT" function, so that the program chooses at random not only between characters 204 and 207, the two corners; it can also choose the two characters in between. These characters happen to be 205 and 206, the ╲ and ╱ characters which are invoked by 10 PRINT. The result does not have the clear structure of the 10 PRINT maze, but is compelling in its confusion of elements. |
| − | ==== Four Walls ==== | + | = Four Walls = |
| − | [[Image:10print-orthogonal-rough.png|160px|thumb|10 PRINT CHR$(181+(INT(RND(1)+.5)*3)+(INT(RND(1)+.5))); : GOTO 10]] | + | [[Image:10print-orthogonal-rough.png|||10 PRINT CHR$(181+(INT(RND(1)+.5)*3)+(INT(RND(1)+.5))); : GOTO 10]] |
One of the most intuitive methods of constructing a maze-grid is to take an approach like graph paper, using four characters to signify either a top-wall, bottom-wall, left-wall or right-wall for each cell on the grid. Such characters exist in PETSCII in both "thick" and "thin" variants. Such a process is unfortunately less elegant, as these characters are never placed continuously in the PETSCII character set, and so cannot be addressed with a simple offset. | One of the most intuitive methods of constructing a maze-grid is to take an approach like graph paper, using four characters to signify either a top-wall, bottom-wall, left-wall or right-wall for each cell on the grid. Such characters exist in PETSCII in both "thick" and "thin" variants. Such a process is unfortunately less elegant, as these characters are never placed continuously in the PETSCII character set, and so cannot be addressed with a simple offset. | ||
| Line 37: | Line 37: | ||
<blockquote>10 PRINT CHR$(181+(INT(RND(1)+.5)*3)+(INT(RND(1)+.5))); : GOTO 10</blockquote> | <blockquote>10 PRINT CHR$(181+(INT(RND(1)+.5)*3)+(INT(RND(1)+.5))); : GOTO 10</blockquote> | ||
| − | The image that emerges is indeed mazelike, but (like the code) lacks simplicity and elegance. potential redundancy between the top / bottom and left / right elements creates apparent variation in the thickness of the walls -- an interesting but potentially distracting implication of messiness and texture. | + | The image that emerges is indeed mazelike, but this image, like the underlying code, lacks simplicity and elegance. Since top and bottom and left and right lines can be printed up against each other, a variation in the thickness of the walls appears -- an interesting but potentially distracting implication of messiness and texture. |
==== Two Walls ==== | ==== Two Walls ==== | ||
| − | [[Image:10print-orthogonal.png|160px|thumb|10 PRINT CHR$(181+(INT(RND(1)+.5)*3)); : GOTO 10]] | + | [[Image:10print-orthogonal.png|||10 PRINT CHR$(181+(INT(RND(1)+.5)*3)); : GOTO 10]] |
| − | <blockquote>(...discuss how 181/184 is the best approximation of the classic orthogonal game aesthetic, but it is still less elegant than 109/110 -- we have to carefully force the random result to an INT before introducing an offset multiplier, which adds length to the line, conceptual complexity to the demo, AND as a result we get a less visually interesting output -- that is, it is both less formally dynamic as a design and less contextually unexpected)</blockquote> | + | The selection of characters 181 and 184, a thick left line and thick top line, is the best approximation of the classic orthogonal maze aesthetic seen in computer and videogames. It is still less elegant than using 205 and 206 as PETSCII values. The characters are not adjacent, so some trick, such as this one involving the use of INT, must be used to select one of the two at random. The result is less visually interesting output. It is a maze, but is both less formally dynamic (being aligned to the screen) and less contextually unexpected (being typical of computer mazes). |
<blockquote>10 PRINT CHR$(181+(INT(RND(1)+.5)*3)); : GOTO 10</blockquote> | <blockquote>10 PRINT CHR$(181+(INT(RND(1)+.5)*3)); : GOTO 10</blockquote> | ||
