Outakes from Maze Chapter
From Maze
(Difference between revisions)
| Line 1: | Line 1: | ||
| + | ===Moving to a different chapter:=== | ||
| + | |||
| + | Before viewing 10 PRINT as producing a sort of dance, it's worthwhile to note that there are BASIC programs for the Commodore 64 that are explicitly said to dance, or to produce dancing output. One example is "Michael's Dancing Mouse," a 30-line BASIC program included on page 167 of the Programmer's Reference Guide and which is completely explicated, statement by statement, on the pages that follow. This program "uses three different sprites in a cute animation with sound effects" (PRM p. 166). By considering how this dancing program works, and how exactly it can be said to dance, we will be able to see in what ways 10 PRINT produces dancing output. | ||
| + | |||
| + | One significant difference between "Michael's Dancing Mouse" and 10 PRINT is the longer program's use of sprites. Sprites are graphical facilities provided by the VIC-II chip. They allow a rectangular image to be drawn on the screen, in any graphics mode, based on a range of values in memory. They are easy to move around and can be drawn over a background image without upsetting the underlying image - when a sprite is moved, whatever was "underneath" it is drawn once again. If elements of the screen that are larger than a textual character but still relatively small (for instance, a human or a ship or other vehicle) needs to be moved about, sprites provide the obvious means to accomplish this. The sprite is a sort of object, and is sometimes called a "character," although it is not part of the typographical system of numbers, letters, punctuation marks, and character graphics that is the basis for 10 PRINT's output. The VIC-II offers eight sprites that are 24 pixels high and 21 pixels wide and are represented in 63 bytes. Near the end of "Michael's Dancing Mouse" are 10 lines of DATA statements that contain a total of 189 numbers: These define the three sprites that represent the mouse in three frames of animation. | ||
| + | What makes the mouse in this program dance? The mouse in this program may be dancing because it has recently escaped from a maze. Even if that is the case, John Watson's scientific technique of systematically disabling rodents can be applied (more humanely) to this simulated creature and to this program. By making the program simpler and simpler, by making it do fewer and fewer things, and then judging the result, it is possible to see which of its effects are essential to producing a dance and which are not. So, changing the assertion "I AM THE DANCING MOUSE!" to the question "AM I DANCING?", the process of simplifying the program begins. | ||
| + | |||
| + | First to go are the sound effects. Removing lines 70 and 75 (and, optionally, lines 200 and 300, which will no longer be used) means that the two different notes are no longer produced. The mouse dances on in silence. | ||
| + | |||
| + | The next thing that can be dropped is a frame of the animation. In line 85, the test "P>194" can be changed to "P>193" so that the value of P becomes 192, 193, 192, 193, and so on. Although the mouse's motion is less elaborate, the creature still appears to dance. | ||
| + | |||
| + | However, if another frame is removed (for instance, by changing the condition to "P>192") the mouse no longer seems to dance, even though it glides to the right. A static image being translated across the screen does not constitute dancing. This suggests a different way to simplify the program: remove the left-to-right motion of the mouse. This can be done by modifying line 65 so that instead of putting a changing horizontal coordinate into the appropriate memory location, the same value is always stored there. "65 POKE V, 50 : POKE V + 16, 0" will do the trick. Now two different sprites are displayed alternately at the same point on the screen. The mouse stays in one place and is animated by only two frames, but still appears to dance. | ||
| + | |||
| + | One final modification: The mouse dances very regularly at this point. What if the mouse changes its posture at random instead? Changing line 85 to read: | ||
| + | |||
| + | 85 P=P+RND(1) : IF P >= 194 THEN P=192 | ||
| + | Is one way to accomplish this. Perhaps surprisingly, given the rhythmic associations we have with dance, the irregularity of movement that results makes the mouse seem to be more alive and makes the motion seem more like dance, or at least more like an interesting dance, than when the mouse was moving in an unnatural lockstep. | ||
| + | |||
| + | It's possible to take this experiment further by changing the sprite data itself, but two things are made clear by what has been done so far. First, two different images replacing one another at the same point on the screen are sufficient to produce the effect of a dance. And further, if the motion is irregular, the suggestion of dance is not erased and may even be enhanced. Since the reduced version of "Michael's Dancing Mouse" can do this with the "characters" of two sprites, there is at least the strong suggestion that another program can do it using the "\" and "/" character graphics, having them replace one another irregularly at the same point on the screen. | ||
| + | |||
| + | |||
| + | ________________________- | ||
| + | |||
| + | Scrap: | ||
| + | On Easter Sunday another maze dance took to the labyrinth in the cathedrals of Auxerre and Sens. In these rites, dancers ringed round the perimeter while the bishop or dean moved along the path of the labyrinth into the center and back out. In his hand, he held a ball that he would throw out to the dancers. The presence of that ball and the human-ring of the dancers once again materialized the walls of the labyrinth depicted on the floor. The dean became the means by which the ball traversed the maze. If architectural mazes create passageways through material constraints over a given space, labyrinth dances create boundaries by materializing the inner passageways over a given time. | ||
| + | |||
| + | ____________________ | ||
| + | |||
| + | |||
== Mazes in Puzzlebooks == | == Mazes in Puzzlebooks == | ||
