Remarks: Ports to Other Platforms

From Maze

Revision as of 14:41, 12 October 2010 by MarkMarino (Talk | contribs) (moved Jeremy's intro to this section from Maze chapter)
Jump to: navigation, search

Contents

[hide]

Patterns

Variations on a Maze: 10 Print as CHR calls

[this was moved from mazes chapter needs to be modified)

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 (moved to c64 chapter)
  • 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.


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.

10 PRINT CHR$(109+RND(1)*2); : GOTO 10

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.

10 PRINT CHR$(102+RND(1)*2); : GOTO 10

(add note on 3d wicker visual interpretation)

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.

(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.)

10 PRINT " "CHR$(108+(INT(RND(1)+.5)*3)); : GOTO 10

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.

10 PRINT CHR$(181+(INT(RND(1)+.5)*3)+(INT(RND(1)+.5))); : GOTO 10

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
(...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)
10 PRINT CHR$(181+(INT(RND(1)+.5)*3)); : GOTO 10

See Also

Notes

Cross-reference the discussion of QWERTY / PETSCII with a small table of textures that indexes the variations, giving each a letter pair, index pair, a name, and a picture:

  • FG (102/103) Weave
  • JK (106/107) Waves ?
  • NM (110/109) (reversed) Maze
  • OP (111/112) Corners2 ?

How should the table be sorted? Probably by alphabetical / index, although it doesn't make sense to go through it in that order.... Table might also have two pictures -- one of the textured render, the other of the symbolic render (-32 shifted, so NM etc.) There is a hotkey in C64 BASIC to do this...?


Additional Images

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
Atari2600-Adventure-v2-(vgmaps).png
1920 × 2317 pixels
Map of Adventure for Atari 2600 (VGmaps)
10print-77,78-NM-letters.png
464 × 366 pixels
10 PRINT CHR$(77+RND(1)*2); : GOTO 10


Bibliography

Commodore 64 User's Guide. Wayne PA; Indianapolis, IN: Commodore Business Machines; Distributed by Howard W. Sams & Co., 1982. <http://www.commodore.ca/manuals/c64_users_guide/c64-users_guide.htm>.

Jerz, Dennis. "Somewhere Nearby is Colossal Cave: Examining Will Crowther's Original 'Adventure' in Code and in Kentucky." DHQ: Digital Humanities Quarterly 1.2 (2007). <http://digitalhumanities.org/dhq/vol/001/2/000009/000009.html>.

Krueger, Dan A., and Louis F. Sander. "Magic $93." Run Jul 1984. 13-14. <http://www.old-computer-mags.com/magazine/magazine_viewer_eng.php?idx=Run.htm&base=Run&num=007&page=13>.

Langway, Lynn. "Invasion of the Video Creatures." Newsweek 16 Nov 1981: 90+.

Latham, Aaron. "Video Games Star War." The New York Times 25 Oct 1981: 100+.

Map of Twisty Little Passages All Alike Maze. TEXTFILES. <http://www.textfiles.com/adventure/mazmap.adv>.

Zork 1 - Maze Map. TEXTFILES. <http://www.textfiles.com/adventure/maze.zk1>.

Personal tools