Fire, Wood, Water (Revision 1) Written by mjhayes@cse.buffalo.edu August 28, 1998 This program does not use graphics, so you can use any cartridge you want. The reason for Revision 1 was to fix a typo in the last line of code. At the title screen, use the keyboard to choose a 1-player or 2-player game. Player 1 uses the left controller to make decisions. In a 2-player game, player 2 uses the keyboard. You are then asked to enter a target number. This is the number of rounds a player must win for the match. During each round, the scores for player 1 and player 2/computer appear followed by instructions for player 1. When player 1 makes a selection, instructions for player 2 will appear. After both players have made their decisions, the results of the round will appear. Fire beats wood, water beats fire, and wood beats water. 10 FM(0)=0 ; Two numbers will be displayed on one line, in regular notation, with zero places to the right of the decimal point. 20 FM(4)=6 ; Display yellow text. 30 SET A$="PLAYER ONE WINS." 40 SET B$="PLAYER ONE LOSES." 50 SET C$="HIT EITHER TOP SIDE" 60 PRIN"FIRE, WOOD, WATER" 70 PRIN"BY MIKE HAYES" 80 PRIN"DOLM: 8/28/1998" ; Display credits. RUN 10 DATA 0 20 READ B,F,G ; Reset scores and player mode. 30 CLR 40 PRIN "1-HUMAN VS. HUMAN," 50 PRIN "2-HUMAN VS. COMPUTER" 60 INPU I 70 IF(I>1)B=1 ; Setting the value of B enters 2-player mode. 80 PRIN "ENTER TARGET NUMBER." 90 INPU I 100 CLR 110 PRIN F,G 120 IF(F=I)GOTO 550 ; Did Player 1 win? 130 IF(G=I)GOTO 600 ; Did Player 2 win? 140 PRIN "PLAYER ONE'S TURN." 150 PUT C$ 160 PRIN "BUTTON FOR FIRE, OR" 170 PRIN "THE LOWER LEFT SIDE" 180 PRIN "BUTTON FOR WOOD, OR" 190 PRIN "HIT THE LOWER RIGHT" 200 PRIN "SIDE BUTTON FOR" 210 PRIN "WATER." 220 CALL HAND ; Poll the left hand controller. 230 IF(A=0)GOTO 220 ; Wait until action button is pressed. 240 IF(B=0)GOTO 460 ; Is this 1-player mode? If it is{ 250 Q=RN(0) 260 K=1 270 IF(Q<32)K=2 280 IF(Q>65)K=3 ; Randomly choose Fire, Wood, or Water. 290 Q=A+(K-1)*3 ; Determine the outcome. 300 IF(Q=1)PRIN "TIE." 310 IF(Q=2)PUT B$ 320 IF(Q=3)PUT A$ 330 IF(Q=4)PUT A$ 340 IF(Q=5)PRIN "TIE." 350 IF(Q=6)PUT B$ 360 IF(Q=7)PUT B$ 370 IF(Q=8)PUT A$ 380 IF(Q=9)PRIN "TIE." 390 IF(Q=2)G=G+1 400 IF(Q=3)F=F+1 410 IF(Q=4)F=F+1 420 IF(Q=6)G=G+1 430 IF(Q=7)G=G+1 440 IF(Q=8)F=F+1 450 GOTO 100 ; } 460 CLR ; else{ 470 PRIN "PLAYER ONE HAS MADE" 480 PRIN "A CHOICE. NOW IT'S" 490 PRIN "PLAYER TWO'S TURN." 500 PRIN "TYPE 1 FOR FIRE, 2" 510 PRIN "FOR WOOD, OR 3 FOR" 520 PRIN "WATER." 530 INPU K ; Get selection. 540 GOTO 290 ; } 550 PRIN "PLAYER ONE WON THE" 560 PRIN "MATCH. HIT RTN TO" 570 PRIN "RESTART." 580 INPU Q 590 GOTO 10 600 PRIN "PLAYER ONE LOST THE" 610 GOTO 500