List of Listings

 

Chapter 3. Conditionals and Boolean logic

Listing 3.1. The THENEND program, demonstrating If/Then/End conditional blocks

Listing 3.2. Testing the truth values of the four Boolean logical operators

Listing 3.3. MIRROR2, demonstrating bounds checking added to THENEND

Chapter 4. Control structures

Listing 4.1. GUESSLBL, the GUESS program with Lbl/Goto instead of Repeat/End

Listing 4.2. GUESSMNU, the GUESS game with a main menu and Lbl/Goto

Listing 4.3. Calculating Fibonacci numbers with a For loop

Listing 4.4. The ISPRIME program for checking if a number is prime

Listing 4.5. The AVERAGE program that demonstrates a Repeat loop

Chapter 5. Theory interlude: problem solving and debugging

Listing 5.1. Preliminary PYTHPREL program

Listing 5.2. Final PYTHTRIP program

Listing 5.3. A faster PYTHTRIP program, called PYTHFAST

Chapter 6. Advanced input and events

Listing 6.1. Four-directional movement of an M around the homescreen

Listing 6.2. One possible 8-directional movement solution

Listing 6.3. MOVE8D2, another possible eight-directional movement solution

Listing 6.4. The Mouse and Cheese game

Listing 6.5. The Mouse and Cheese game with randomly moving cheese

Listing 6.6. getKey example for modifier keys

Chapter 7. Pixels and the graphscreen

Listing 7.1. MOVETEXT, a modified MOVECHAR on the graphscreen

Listing 7.2. Two versions of a cursor-drawing subprogram, ZCURSORA/ZCURSORB

Listing 7.3. The moveable cursor program, CURSOR