HP Forums
(71B) Cyber Tennis for HP-71B - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (71B) Cyber Tennis for HP-71B (/thread-8976.html)



(71B) Cyber Tennis for HP-71B - Namir - 09-03-2017 06:45 PM

The game assumes you are playing a 10-point match of cyber tennis. You play as many rounds until either you or the calculator wins 10 rounds. See instructions to play the game.

Memory Map

Code:
M9 = max range
C9 = number of points to win
C1 = wining counter for player
C2 = wining counter for calculator
V1 = round value for player
V2 = round value for calculator
R = random number
V = round value

HP-71B Listing


Code:
10 REM CYBER TENNIS - 10-POINJT GAME
20 M9= 100 @ C9=10 @C1 = 0 @ C2 = 0
30 R = PI
40 INPUT "ENTER NEW SEED? ", "";A$
50 IF A$<>"" THEN R=VAL(A$)
60 GOSUB 1000 @ V1=V
70 GOSUB 1000 @ V2=V
80 IF V1>V2 THEN C1=C1+1 @ DISP "YOU=";C1 @ WAIT 2
90 IF V2>V1 THEN C2=C2+1 @ DISP "CALC=";C2 @ WAIT 2
100 IF V1=V2 THEN DISP "TIE" @ WAIT 2
110 IF C1>=C9 THEN DISP "YOU WIN" @ GOTO 200
120 IF C2>=C9 THEN DISP "YOU LOSE" @ GOTO 200
130 GOTO 40
200 END
1000 R = (PI+R)^5
1010 R = R - INT(R)
1020 V = INT(M9*R)
1030 RETURN

Instructions


1) Press the [RUN] key.
2) The calculator prompts you to enter a new seed for the random number.
3) Optionally enter a new seed and press [ENTER]. You can simply do the latter to use the current random number.
4) If you win the current round, the program displays "YOU=" followed by you current total winnings. If you lose the current round, program displays "CALC=" followed by the calculator's current total winnings. If neither wins the current round, the program displays "TIE".
5) If you reached the maximum number of points to win, the program displays "YOU WIN". If the calculator has reached the maximum number of points to win, the program displays "YOU LOSE". The program stops if there is a winner.
6) Resume at step 4.