Mastermind for HP42s Message #1 Posted by Tom Grydeland on 30 Aug 2013, 3:27 a.m.
Created in fits of boredom in school ~25 years ago, printed on thermal paper, lost and forgotten. Now recreated from memory, probably only similar to the original in functionality. Since the display has limited colour capabilities, the integers 17 are used instead.
Issues:
1) Your first guess is always '1234'. It would be easy to change, but it is the way I play, so I don't bother
2) I am sure there are superfluous redundancies in there, feel free to suggest improvements.
Issues for users of the '42s' iOS emulator in particular:
1) Assumes 4level stack. (Disable dynamic stack)
2) Uses flags 14, switch off flag indicators or have the game spoiled.
00 { 289Byte Prgm }
01>LBL "MIND"
02 MVAR " "
03 MVAR "P1"
04 MVAR "P2"
05 MVAR "P3"
06 MVAR "P4"
07 7
08 STO "N"
09 4
10 STO "P4"
11 STO 00
12 3
13 STO "P3"
14 2
15 STO "P2"
16 1
17 STO "P1"
18>LBL 00
19 XEQ 42
20 DSE 00
21 GTO 00
22 0
23 STO 09
24>LBL 01
25 1
26 RCL+ 09
27 STO 09
28 "Guess #"
29 AIP
30 "("
31 XEQ 02
32 RCL 05
33 AIP
34 RCL 06
35 AIP
36 RCL 07
37 AIP
38 RCL 08
39 AIP
40 "): "
41 4
42 RCL 11
43 X=Y?
44 GTO 41
45 AIP
46 "B/"
47 RCL 12
48 AIP
49 "W"
50 VARMENU "MIND"
51 AVIEW
52 STOP
53 GTO 01
54>LBL 02
55 8
56>LBL 03
57 CF IND ST X
58 DSE ST X
59 GTO 03
60 0
61 STO 11
62 STO 12
63 RCL "P1"
64 STO 05
65 RCL "P2"
66 STO 06
67 RCL "P3"
68 STO 07
69 RCL "P4"
70 STO 08
71 4
72>LBL 04
73 XEQ 11
74 Rv
75 Rv
76 DSE ST X
77 GTO 04
78 8.004
79>LBL 05
80 4
81>LBL 06
82 XEQ 12
83 DSE ST X
84 GTO 06
85 Rv
86 DSE ST X
87 GTO 05
88 RTN
89>LBL 11
90 4
91 RCL+ ST Y
92 RCL IND ST Y
93 RCL IND ST Y
94 X!=0?
95 RTN
96 SF IND ST Y
97 Rv
98 SF IND ST Y
99 1
100 STO+ 11
101 RTN
102>LBL 12
103 FS? IND ST X
104 RTN
105 FS? IND ST Y
106 RTN
107 RCL IND ST Y
108 RCL IND ST Y
109 X!=0?
110 GTO 20
111 Rv
112 SF IND ST X
113 SF IND ST Y
114 1
115 STO+ 12
116>LBL 20
117 Rv
118 RTN
119>LBL 41
120 "Right!"
121 AVIEW
122 STOP
123 GTO "MIND"
124>LBL 42
125 RAN
126 RCL* "N"
127 IP
128 1
129 +
130 STO IND 00
131 .END.
Enjoy!
