Think Fast I (Revision 1) Written by mjhayes@cs.buffalo.edu September 1, 1998 This program uses the Sub Hunt cartridge, but you can substitute any other cartridge that has appropriate graphics. To play the game, watch the number at the top-right corner. If the number is fifty or higher, then press and hold any side button until another number appears. If you are holding a side button when the number is fifty or higher, then the glowing piece moves to the right. If you are holding a side button when the number is less than fifty, then the glowing piece moves to the left. If the glowing piece moves past the marker on the left, then the game ends. If it passes the marker on the right, then you advance to the next level. There are ten levels. Each one moves faster than the previous one. Finish the last level to see an ending message. There are two messages, depending on whether or not you finish the last level without making a mistake. 10 D=2 ; The particular sprite used is hi-res. 20 FM(1)=0 ; One number will be displayed on a line, in regular notation, with 0 places to the right of the decimal point. 30 FM(4)=7 ; All text is displayed in white. 40 SET A$="AS A SWEET REWARD" 50 SET B$="GAME, YOU MAY TRY" 60 SET C$="THE SPECIAL DRAWING" ; Pre-define the longer text to save memory. RUN 10 CLR 20 FOR O=2 TO 4 30 CALL SHOW ; Make the sprites appear. 40 CO(O)=5 ; Make them invisible. 50 XS(O)=1 60 YS(O)=1 ; Make them large. 70 YP(O)=72 80 XP(O)=O*76-148 ; Put them into position. 90 NEXT O ; Main game loop{ 100 B=RN(0) ; Pick a number at random. 110 PRIN B ; Display the number. 120 FOR C=F TO 9 ; Smaller delays for higher levels. 130 CO(3)=CO(3)+1 ; Make the center piece glow. 140 IF(CO(3)=15)CO(3)=0 ; Cycle back to the first color if necessary. 150 NEXT C 160 CLR 170 CALL HAND ; Poll the left hand controller. 180 IF(A=0)GOTO 100 ; Was an action key pressed? 190 IF(B<50)XP(3)=XP(3)-12 ; Oops. Move the center piece to the left. 200 IF(B>49)XP(3)=XP(3)+11 ; Move the center piece to the right. The values for moving left and moving right differ to determine if the last level was finished "perfectly." 210 IF(XP(3)<6)GOTO 240 ; Did the piece move too far to the left? 220 IF(XP(3)>154)GOTO 280 ; Did the piece move too far to the right? 230 GOTO 100 ; } 240 PRIN "YOU LOSE." ; Game over{ 250 FOR F=-49 TO 0 260 NEXT F ; Time delay and reset level counter. 270 GOTO 10 ; New game} 280 IF(F=9)GOTO 340 ; Was that the last level? 290 PRIN "TRY NEXT LEVEL." 300 FOR C=0 TO 49 310 NEXT C ; Time delay 320 F=F+1 ; Increment the level counter. 330 GOTO 10 ; Next level 340 IF(XP(3)=157)GOTO 370 ; Was the last level completed perfectly? 350 PRIN "YOU WIN, BIG DEAL..." ; Not this text again! 360 GOTO 250 ; Restart. 370 VS(2)=-1 380 VS(3)=-1 390 VS(4)=-1 ; Hide all sprites. 400 PRIN "CONGRATULATIONS." 410 PUT A$ 420 PRIN "FOR BEATING THIS" 430 PUT B$ 440 PUT C$ 450 PRIN "PROGRAM. HIT RTN." ; There was plenty of room to spare so I threw in this Easter egg. In case you're wondering, this is just a wimpy program that lets the user draw pictures out of colored blocks. Not very efficient. 460 INPU A 470 CLR 480 B=189 ; B contains the number of the background card in which the piece is located. 490 CALL SHOW ; Make the piece appear. 500 CO(O)=CO(O)+1 ; Make the piece glow. 510 IF(CO(O)=15)CO(O)=0 ; Cycle through the colors. 520 CALL HAND ; Poll the left hand controller. 530 H=0-H 540 IF(H=1)XP(0)=XP(0)+8 ; Was the disc pressed right? 550 IF(H=1)B=B+1 560 IF(H=5)YP(0)=YP(0)-8 ; Was the disc pressed up? 570 IF(H=5)B=B-20 580 IF(H=9)XP(0)=XP(0)-8 ; Was the disc pressed left? 590 IF(H=9)B=B-1 600 IF(H=13)YP(0)=YP(0)+8 ; Was the disc pressed down? 610 IF(H=13)B=B+20 620 IF(A=1)BK(B)=BK(B)-1 ; Was a top action button pressed? 630 IF(A>1)BK(B)=BK(B)+1 ; Was a bottom action button pressed? 640 GOTO 500