Variations on a maze

From Maze

Revision as of 18:28, 29 July 2010 by JeremyDouglass (Talk | contribs) (→Context: Computer Graphics and Games)
Jump to: navigation, search

Variations on a Maze: 10 Print as CHR calls

This section examines a set of simple variations in the 10 Print one-liner, each drawing on different graphic characters from the PETSCII table. Although each change is small, every variation has a significant impact on the perceived maze-like qualities of the visual output. The output of 10 Print has a unique visual appeal, which we can understand in terms of design and composition (diagonal vs orthogonal), and in terms of how it plays against the contextual expectations of the historical period when it emerged (graphical software -- particularly video games of the era).

When we attempt to change even the smallest element of 10 Print, we make an interesting discovery -- 10 Print is a kind of optimal solution that is uniquely elegant in its design space (a c64 BASIC one-line maze generator). Any similar attempt is both less concise (requires more code) and less expressive (resembles a maze less). 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:

  • the keyboard layout of the PET / C64
  • the sequence of adjacent characters in the PETSCII table
  • graphic design and topology
  • a design goal to make the one-liner short and simple

Because the original program is a concise randomized offset to a region of the PETCSII character table, our variations are limited to other such lookups. The code is limited by the characters available in PETSCII, and the concision or elegance of the code is affected by the adjacency of characters, which must otherwise be randomized in a more complex way than an offset.

Contents

[hide]

Context: Computer Graphics and Games

The representation of mazes in computer graphics was already a staple during the period that finds the 10 Print BASIC one-liner appearing in C64 manuals and journals -- in fact, the use of computers to represent mazes conceptually was common before computer graphics.

(Sidebar? Summary IF and the tradition of box diagram maps, the importance of mazes in Adventure / Zork / Acheton, and the contextual relationship to home computing and dominance of early PC video game industry)

Game-Gotcha-arcade-(1973).jpg
320 × 240 pixels
Gotcha (1973 arcade) a game of tag between two players in a maze-like field of partitions
Game-Amazing_Maze-arcade-(1976).png
225 × 197 pixels
The Amazing Maze Game (1976 arcade) -- a classic maze
Game-Maze_Craze-Atari2600-(1978).png
640 × 350 pixels
Maze Craze (1978 Atari VCS) -- a large set of games -- complete, race-to-complete, tag, etc. -- all played within classic mazes.

In graphical games, one common feature of the many different 2D maze games from the period is orientation: all are rectilinear and aligned to the Cartesian axes. This similarity, it turns out, is even more important than the extent to which given games were maze-like, and different games have different maze aesthetics. The arcade game Gotcha (1973) staged a game of tag between two players in a maze-like field of disconnected partitions which served as an obstacle course. Conversly, the arcade game The Amazing Maze Game (1976) implemented a race (two-player or against a computer) to solve a classic continuous closed maze. A similar implementation on the home Atari VCS, Maze Craze (1978) added to a two-player playable random maze generator a large number of games, including racing, tag, and a mode with invisible walls.

Game-Pac-Man-arcade-(1980).png
224 × 288 pixels
Pac-Man (1980 arcade) -- a maze-like field of partitions must be run while being chased by ghosts

Pac-Man (1980) is perhaps the classic maze-like arcade game, although, like Gotcha, it uses partitioning walls as a free-form obstacle course rather than a way of obfuscating the path to escape. When it was reimplemented for the Atari VCS in

vertical field was redesigned in horizontal format for a


-- Pac Man partitions the screen space into an open field of indirect routes, Maze Craze creates a traditional full-screen overview with a single solution, while Adventure produces a claustrophobic view in which only part of the impossibly wrapping maze topology is visible at any time -- usually nearby but inaccessible paths. What all have in common is that they are constructed of horizontal/vertical walls that are orthogonal to the edges of the screen and the scan line of the display.

Diagonal orientation did have its place in the early maze-like games, but not in simple 2D -- the emergence of isometric games like Ant Attack, Marble Madness.


To what extent



(of maze video games)


Pac-Man (1980 arcade) -- a maze-like field of partitions must be run while being chased by ghosts

Pac-Man (1982 Atari VCS)


(presence of the diagonal line at all -- isometric projection itself not unheard of, but far from the norm -- Marble Madness not until 1984)

Patterns

Diagonals

10print-diagonal.png
464 × 366 pixels
10 PRINT CHR$(109+RND(1)*2); : GOTO 10

By contrast, the maze output of 10 PRINT is oriented diagonally, giving it a distinctive visual look.

Several things about this visual orientation are surprising. First, when we visually trace the maze the long runs or paths that lead through the maze do not follow the lines along which the algorithm constructs the maze (which remains left-right, top-bottom). Second, this feature of being diagnol is not an elaboration in the code, but instead an elegant simplification that is part of the essence of the succinct one-liner.

Orthogonal Weave

10print-orthogonal-weave.png
464 × 366 pixels
10 PRINT CHR$(102+RND(1)*2); : GOTO 10

There are no other two characters in the PETSCII data set that, when substituted for our "\" 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.

Corners

10print-elbows.png
464 × 366 pixels
10 PRINT CHR$(108+(INT(RND(1)+.5)*3)); : GOTO 10

Randomly selecting corner pieces such as "L", on the other hand, simply turn the image into a honeycomb.

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.

Four Walls

10print-orthogonal-rough.png
464 × 366 pixels
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 can, of course, construct an orthogonal maze instead in a variety of other ways. One way is to address a set of four or more horizontal character elements a l. There are two styles of these characters (thick and thin) available in the Commodore 64 ASCII character set. However, these four character types never appear continuously in the table, so the elegant method of using a simple RND offset must be made a bit more verbose -- for example, selecting between 181, 182, 184 and 185 using two random offsets.

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.

Two Walls

10print-orthogonal.png
464 × 366 pixels
10 PRINT CHR$(181+(INT(RND(1)+.5)*3)); : GOTO 10


See Also

Notes

Atari2600-Adventure-v2-(vgmaps).png
1920 × 2317 pixels
Map of Adventure for Atari 2600 (VGmaps)
Personal tools