Variations on a maze
From Maze
(Difference between revisions)
| Line 10: | Line 10: | ||
By contrast, the maze output of 10 PRINT is oriented diagonally, giving it a distinctive visual look. | By contrast, the maze output of 10 PRINT is oriented diagonally, giving it a distinctive visual look. | ||
| − | [[Image:10print-diagonal.png|thumb|left|200px|10 PRINT CHR$(109+RND(1)*2); : GOTO 10]] | + | [[Image:10print-diagonal.png|200px|10 PRINT CHR$(109+RND(1)*2); : GOTO 10]] |
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. | 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. | ||
| Line 16: | Line 16: | ||
There are no other two characters in the <a href="http://en.wikipedia.org/wiki/PETSCII">PETSCII</a> 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. | There are no other two characters in the <a href="http://en.wikipedia.org/wiki/PETSCII">PETSCII</a> 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 | + | [[Image:10print-orthogonal-weave.png|200px|10 PRINT CHR$(102+RND(1)*2); : GOTO 10]] |
| − | |||
| − | [[Image:10print-orthogonal-weave.png|200px]] | ||
Randomly selecting corner pieces such as "L", on the other hand, simply turn the image into a honeycomb. | Randomly selecting corner pieces such as "L", on the other hand, simply turn the image into a honeycomb. | ||
| − | 10 PRINT CHR$(108+(INT(RND(1)+.5)*3)); : GOTO 10 | + | [[Image:10print-elbows.png|200px|10 PRINT CHR$(108+(INT(RND(1)+.5)*3)); : GOTO 10]] |
| − | |||
| − | [[Image:10print-elbows.png|200px]] | ||
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. | 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. | ||
