HP Forums

Full Version: (32S) Nimb
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Nimb for the HP 32S. No cheating allowed!

Usage:

XEQ N

< 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 briefly ( 1,2 or 3)
If program took remaining value then display 3507.1 ( I.LOSE ) and halt
Loop back to start
Code:

N01    LBL N
N02    15
N03    FIX 0
N03    STO A
A01    LBL A
A02    RCL A
A03    STOP
A04    4
A05    X<>Y
A06    X<Y ?
A07    GTO B
A08    GT0 A    # Input greater than 3
B01    LBL B
B02    X>0 ?
B03    GTO C
B04    GTO A    # Input less than 0
C01    LBL C
C02    RCL A
C03    X<Y?
C04    GTO A    # Input more than remaining value
C05    X<>Y
C06    STO-A    # Player move
C07    RCL A
C08    X<>0 ?
C09    GTO D
C10    55178    # Bliss, program wins
C11    FIX 0
C12    RTN
D01    LBL D
D02    1
D03    -
D04    4
D05    /
D06    FP
D07    4
D08    *
D09    IP
D10    X=0 ?
D11    1
D12    STO-A    # Program move
D13    PSE 
D14    RCL A
D15    X<>0 ?
D16    GTO A
D17    3507.1        # I lose
D18    FIX 1
D19    RTN
Reference URL's