Remarks: Maze Walker
From Maze
(Difference between revisions)
| Line 56: | Line 56: | ||
</pre> | </pre> | ||
| − | now generates a rectangular maze, 10 lines high, with the READY prompt appearing below the maze. The semicolon on the first line tells the PRINT statement not to start a new line after printing the CLR character. Without the semicolon, there would be one blank line above the maze, resulting from the PRINT on line 1 starting a new line. The READY prompt is generated by BASIC when a program terminates. In our case, after the FOR and NEXT statements increment X to 401, program execution continues past line 15, terminating the program and returning control of the C64 to the BASIC operating environment. In order to prevent the READY prompt from being printed, control must not return to BASIC; the maze program must execute forever. The original 10-print program already demonstrated how to use a GOTO statement to make a program loop forever. Now, however, we don't want the maze program to keep on printing forever, but rather to do nothing forever, so as not to return control to the BASIC operating environment and the resulting printing of the READY prompt. This is accomplished by including a line at the end of the program with a GOTO statement that loops to itself. | + | now generates a rectangular maze, 10 lines high, with the READY prompt appearing below the maze. The semicolon on the first line tells the PRINT statement not to start a new line after printing the CLR character. Without the semicolon, there would be one blank line above the maze, resulting from the PRINT on line 1 starting a new line. The READY prompt is generated by BASIC when a program terminates. In our case, after the FOR and NEXT statements increment X to 401, program execution continues past line 15, terminating the program and returning control of the C64 to the BASIC operating environment. In order to prevent the READY prompt from being printed, control must not return to BASIC; the maze program must execute forever. The original 10 PRINT program already demonstrated how to use a GOTO statement to make a program loop forever. Now, however, we don't want the maze program to keep on printing forever, but rather to do nothing forever, so as not to return control to the BASIC operating environment and the resulting printing of the READY prompt. This is accomplished by including a line at the end of the program with a GOTO statement that loops to itself. |
<pre> | <pre> | ||
