Saturday, May 2, 2026

🖥 Animated "100 Doors"

This program is an animated version of the "100 Doors" programming task described on the Rosetta Code website.

Other than the tackling the task and enhancing it with some simple animation (to visualize the process), I also wanted to showcase a few features of BAM's BASIC implementation:

  • Using expressions in GOSUB statements
  • Using emojis to facilitate finding/noticing program sections and identifiers/labels 
  • Using the IFF function
  • Using the BETWEEN function
  • Pausing the program with help from the _MOUSEBUTTON function
My primary interest in this exercise (other than giving the old sponge a workout) revolved around the design of this loop and setting it up for multiple purposes:

FOR y% = 0 TO 4
  FOR x% = 1 TO 20
    GOSUB (DoorAction$)
    IF _MOUSEBUTTON THEN WHILE _MOUSEBUTTON : WEND
    SLEEP IFF(BETWEEN(pass%,1,30) AND (pass% < 5 OR pass% MOD 10 = 0), 0.025, 0.001)
  NEXT x%
NEXT y%

The program:



No comments:

Post a Comment

🖥 Animated "100 Doors"

This program is an animated version of the "100 Doors" programming task described on the Rosetta Code website . Other than the tac...