HP Forums

Full Version: (65) Nimb
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Nimb for the HP65. Only allows values between 1 and 3, no cheating!
Usage:

A

< initial value is 15 >

Loop:
Display remaining value
< Enter 1 2 or 3 >
R/S
If you took remaining value then display 55178 ( BLISS ) and halt
Displays program move ( 1,2 or 3). Press R/S to continue.
If program took remaining value then display 3507.1 ( I.LOSE ) and halt
Loop back to start

Code:

LBL A
DSP .0  
1
5
STO 1
LBL 0
RCL 1
R/S
g x>y 
GTO 0    #Move > counter ?
3
x<->y
g x>y
GTO 0 # Move bigger than 3
0
x<->y
g x<=y 
GTO 0    # Move less than or equal to 0
STO-1    # Player move
RCL 1
0
g x<>y
GTO 1
5
5
1
7
8
RTN  # BLISS, Program wins
LBL 1
x<->y
1    # Compute program move
-
4
/
f-1 INT
4
*
0
g x=y
1
x<->y
x<->y
STO-1   # Program move
R/S 
RCL 1
0
g x<>y 
GTO 0
3    
5
0
7
.
1
DSP  .1
RTN    # LOSE, Program looses
Reference URL's