Remarks: Processing Mazes
From Maze
(Difference between revisions)
| Line 13: | Line 13: | ||
10 PRINT CHR$(205.2+RND(1)); : GOTO 10 | 10 PRINT CHR$(205.2+RND(1)); : GOTO 10 | ||
| − | The 10 PRINT variation to show white and black squares in place of diagonal lines also changes the value 205.5 to the number between the symbols for a white box, , and black box, number ?: | + | The 10 PRINT variation to show spaces and circles in place of diagonal lines also changes the value 205.5 to the number of the space character, 32, and to calculate the value of the circle, 113: |
| − | 10 print | + | 10 PRINT CHR$(32+(INT(RND(1)+.5)*81)); : GOTO 10 |
| − | After writing this first variable program to focus entirely on the image of the maze, it became clear that watching the maze build one unit at a time on the C64 is a major component of the program. This behavior doesn't naturally work with Processing because the entire screen updates as a whole, rather than character by character. Processing uses a technique called double-buffering. This means the graphics are drawn to an off-screen image buffer stored in RAM. When the image is finished, it's pushed to the computer's screen. For programs that feature animation or interaction, the result is a new image being written and drawn to the screen about sixty times a second. Unlike in BASIC, the lines of Processing program aren't assigned numbers; each line is run in order from top to bottom and according to some higher level rules. This becomes more clear when we look at this program written in Processing by Ben Fry to approximate the behavior of our 10 PRINT program on the C64: | + | After writing this first variable program in Processing to focus entirely on the image of the maze, it became clear that watching the maze build one unit at a time on the C64 is a major component of the program. This behavior doesn't naturally work with Processing because the entire screen updates as a whole, rather than character by character. Processing uses a technique called double-buffering. This means the graphics are drawn to an off-screen image buffer stored in RAM. When the image is finished, it's pushed to the computer's screen. For programs that feature animation or interaction, the result is a new image being written and drawn to the screen about sixty times a second. Unlike in BASIC, the lines of Processing program aren't assigned numbers; each line is run in order from top to bottom and according to some higher level rules. This becomes more clear when we look at this program written in Processing by Ben Fry to approximate the behavior of our 10 PRINT program on the C64: |
int w = 16; | int w = 16; | ||
