Post Reply 
Cyber Tennis Game for HP-41C
09-02-2017, 08:01 PM (This post was last modified: 09-05-2017 11:40 PM by Namir.)
Post: #1
Cyber Tennis Game for HP-41C
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:
R00 = random number
R01 = counter for player
R02 = counter for calculat0r
R03 = win count
R04 = max range

HP-41C Listing

Code:
LBL "TENNIS"
LBL a
0
STO 01
STO 02
10
STO 03
X^2
STO 04

LBL A        # main game routine
RCL 01        
RCL 03
X=Y?        # did the player win the game?
GTO B
RCL 02
X=Y?        # did the calculator win the game?
GTO C
RCL 00
"SEED?"
FC? 00        # check flag 00 for no-prompt mode
PROMPT        # prompt for next seed (optional)
STO 00
XEQ 01        # get random integer for player
XEQ 01        # get random integer for calculator
X>Y?        # did the calculator win current round?
GTO 02
X<>Y
X>Y?        # did the player win the current round?
GTO 03
"TIE"
AVIEW        
PSE        # no one won the current round
GTO A

LBL 02        # increment calculator wins
1
STO+ 02
"CALC:"
ARCL 02
AVIEW
PSE        # display calculator's winning
GTO A

LBL 03        # increment player's wins
1
STO+ 01
"YOU:"
ARCL 01
AVIEW
PSE        # display as player's number
GTO A

LBL B        # Player wins the game
"YOU WIN"
GTO 04

LBL C        # Calculator wins the game
"YOU LOSE"

LBL 04
BEEP
PROMPT
RTN

LBL 01        # get random integer
XEQ E
RCL 04
*
INT
RTN

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

Games Instructions

1) Press [XEQ]"TENNIS or [shift][A] (in User Mode) 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 "YOU:" followed by current total wins for the player.
B) If the calculator wins, the program pauses and displays "CALC:" followed by the current total wins for the calculator.
C) If no one wins the current round, the program pauses and displays "TIE".

4) Repeat steps 2 and 3. If the player wins, the program displays "YOU WIN". If the calculator wins, the program displays "YOU LOSE".

Note: You can set flag 00 to skip the "SEED?" prompt.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Cyber Tennis Game for HP-41C - Namir - 09-02-2017 08:01 PM
RE: Cyber Tennis Game for HP-41C - Dieter - 09-03-2017, 05:25 PM
RE: Cyber Tennis Game for HP-41C - Namir - 09-05-2017, 02:59 PM
RE: Cyber Tennis Game for HP-41C - Namir - 09-05-2017, 11:41 PM
RE: Cyber Tennis Game for HP-41C - Dieter - 09-06-2017, 11:26 AM
RE: Cyber Tennis Game for HP-41C - Dieter - 09-05-2017, 08:32 PM



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