09-03-2019, 06:46 AM
Nimb for the 15C. The shortest version yet due to the 15C's broad suite of conditional tests.
Usage:
f PRGM R/S < 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
Usage:
f PRGM R/S < 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:
001 f FIX 0
002 1
003 5
004 STO 0
005 f LBL 0
006 RCL 0
007 R/S
008 g TEST 7 # x>y
009 GTO 0 # Move bigger than value
010 3
011 g TEST 8 # f x<y
012 GTO 0 # Move bigger than 3
013 x<->y
014 g TEST 4 # x<=0
015 GTO 0 # move LEQ 0
016 STO-0 # Player move
017 RCL 0
018 g TEST 0 # x<>0
019 GTO 1
020 5
021 5
022 1
023 7
024 8
025 g RTN # BLISS, Program wins
026 f LBL 1
027 1 # Compute program move
028 -
029 4
030 /
031 f FRAC
032 4
033 *
034 g x=0
035 1
036 STO-0 # Program move
037 f PSE
038 RCL 0
039 g TEST 0 # x<>0 ?
040 GTO 0
041 3
042 5
043 0
044 7
045 .
046 1
047 f FIX 1
048 g RTN # LOSE, Program looses