Post Reply 
Cyber Tennis Game for HP-67
09-02-2017, 07:56 PM
Post: #1
Cyber Tennis Game for HP-67
The game assumes you are playing a 10-point match of cyber tennis. You play as many rounds until either you or the claculator wins 10 rounds. See instructions to play the game.

Memory Map


Code:
R0 = random number
R1 = counter for player
R2 = counter for calculat0r
R3 = win count
R4 = max range

HP-67 Listing

Code:
LBL a
0
STO 1
STO 2
10        # number of points to win. Can be edited
STO 3
X^2
STO 4

LBL A    # main game routine
RCL 1        
RCL 3
X=Y?        # did the player win the game?
GTO B
RCL 2
X=Y?        # did the calculator win the game?
GTO C
RCL 0
R/S        # prompt for next seed (optional)
STO 0
GSB 1        # get random integer for player
GSB 1        # get random integer for calculator
X>Y?        # did the calculator win current round?
GTO 2
X<>Y
X>Y?        # did the player win the current round?
GTO 3
0
PSE        # no one won the current round
GTO A

LBL 2        # increment calculator wins
1
STO+ 2
RCL 2
CHS
PSE        # display as negative number!
GTO A

LBL 3        # increment player's wins
1
STO+ 1
RCL 1
PSE        # display as positive number
GTO A

LBL B    # Player wins the game
RCL 1
GTO 4

LBL C    # Calculator wins the game
RCL 2
CHS

LBL 4
PSE
PSE
0
/        # displa message "Error" to announce end of game.
RTN

LBL 1        # get random integer
GSB E
RCL 4
*
INT
RTN

LBL E        # PRNG function
RCL 0
PI
+
5
Y^X
FRC
STO 0
RTN

Games Instructions

1) Press [gold][A] to initialize the game.
2) The program stops to display current seed. You can alter this value or enter a new one. The new "seed" can be an integer, a fraction, or a number contains both.
3) Press [R/s]. The program determines who wins the current round:
A) If the player wins, the program pauses and displays a positive number of current total wins for the player.
B) If the calculator wins, the program pauses and displays a negative number of current total wins for the calculator.
C) If no one wins the current round, the program pauses and displays 0.

4) Repeat steps 2 and 3. If the player wins, the program displays the player's total wins and then divides by 0 to display the message Error. If the calculator wins, the program displays the calculator's total wins (as a negative number) and then divides by 0 to display the message Error. This error message signals the end of the program.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)