Any Browser Campaign

MasterMind, Variant 2, for HP-41CX
deutsche Version

MasterMind - but in this variant the HP-41CX guesses the hidden code provided by the player ! The code must consist of four characters out of a range from "A" through "F" (inclusive). (Of course, it's from a programming point of view no problem to extend the number of positions, but this would last too long !) Every character is allowed to appear only once in the code. The several time appearance of characters is no real problem, but in this case the number of permutations increases very quickly and - believe me :-) - it would be no fun to wait for the next proposed code ! Therefore in this program version these features have not been implemented.

Computing time is up to 20min, if you have the TURBO alteration it's up to about 10min, until the HP-41CX proposes the next code. To prevent battery voltage from decreasing too much, flag 49, battery voltage flag, is checked during program execution. If this happens program execution is terminated and the HP-41CX powers off itself. On power on "BATTERY" is displayed to indicate the low battery voltage. Program execution can't be continued.

Course of Game :

On starting the program a seed for the random number generator has to be entered. Now the HP-41CX calculates a first guess. After the sound it is shown in the display. Pressing R/S, now "B,W :" appears in the display and the number of black and white markers, separated by decimal comma must be entered. Again pressing R/S starts the computation of the next sequence. When the correct code is determined, the HP-41CX displays the number of tries.

Program Listing :

001 LBL "GAME5b"
002  "MASTERMIND 2"
003  AVIEW
004  PSE
005  ,034
006  CLRGX
007  CLX
008  X<>F
009   E
010  " RNG-SEED :"
011  PROMPT
012  STO 00
013  ,003
014  STO 01
015  CLA
016 LBL 00
017  RCL 00
018  R-D
019  FRC
020  STO 00
021   E5
022  *
023  6
024  MOD
025  FS? IND X
026  GTO 00
027  SF IND X
028  65
029  +
030  XTOA
031  ISG 01
032  GTO 00
033  11
034  STO 04
035  ASTO IND X
036  ,005
037  STO 00
038  STO 01
039  STO 02
040  STO 03
041  XEQ 22
042  GTO 16
043 LBL 15
044  XEQ 22
045  CLX
046  X<>F
047  RCL 00
048  SF IND X
049  RCL 01
050  FS? IND X
051  GTO 17
052  SF IND X
053  RCL 02
054  FS? IND X
055  GTO 17
056  SF IND X
057  RCL 03
058  FS? IND X
059  GTO 17
060 LBL 05
061  RCL 08
062  31
063  -
064  RCL IND X
065  65
066  +
067  STO IND 08
068  ISG 08
069  GTO 05
070  RCL 04
071  11
072  -
073   E3
074  /
075  STO 05
076 LBL 18
077  FS? 49
078  GTO 23
079  RCL 05
080  21
081  +
082  RCL IND X
083  STO 06
084  CLA
085  RCL 05
086  11
087  +
088  ARCL IND X
089  XEQ 22
090 LBL 01
091  RCL IND 08
092  POSA
093  RCL 08
094  31
095  -
096  INT
097  XY?          not equal
098  GTO 02
099  ISG 07
100  ""          (NOP)
101 LBL 02
102  ISG 08
103  GTO 01
104  RCL 06
105  INT
106  RCL 07
107  XY?          not equal
108  GTO 17
109  XEQ 22
110 LBL 03
111  RCL IND 08
112  POSA
113  X<0?
114  GTO 02
115  RCL 08
116  31
117  -
118  INT
119  X=Y?
120  GTO 02
121  ISG 07
122  ""          (NOP)
123 LBL 02
124  ISG 08
125  GTO 03
126  RCL 06
127  FRC
128   E1
129  *
130  RCL 07
131  XY?          not equal
132  GTO 17
133  ISG 05
134  GTO 18
135  ISG 04
136  ""          (NOP)
137  XEQ 22
138  CLA
139 LBL 04
140  RCL IND 08
141  XTOA
142  ISG 08
143  GTO 04
144  ASTO IND 04
145  GTO 16
146 LBL 17
147  ISG 00
148  GTO 15
149  FS? 49
150  GTO 23
151  ,005
152  STO 00
153  ISG 01
154  GTO 15
155  ,005
156  STO 00
157  STO 01
158  ISG 02
159  GTO 15
160  ,005
161  STO 00
162  STO 01
163  STO 02
164  ISG 03
165  GTO 15
166 LBL 16
167  CLA
168  ARCL IND 04
169  32
170  XTOA
171  XTOA
172  XTOA
173  XTOA
174  4
175  AROT
176  BEEP
177  AVIEW
178 STOP
179 LBL 06
180  TONE 8
181  CF 22
182  " B,W :"
183  PROMPT
184  FC? 22
185  GTO 06
186  STO 06
187  FRC
188   E1
189  *
190  RCL 06
191  +
192  INT
193  2
194  X>Y?
195  GTO 07
196  4
197  RCL Z
198  X>Y?
199  GTO 07
200  RCL 06
201  4
202  X=Y?
203  GTO 19
204  RCL 04
205   E1
206  +
207  RCL Z
208  STO IND Y
209  GTO 15
210 LBL 07
211  TONE 5
212  "WRONG INPUT"
213  AVIEW
214  PSE
215  GTO 06
216 LBL 22
217  31,034
218  STO 08
219  CLX
220  STO 07
221  RTN
222 LBL 23
223  SF 11
224  OFF
225  "  BATTERY"
226  AVIEW
227  STOP
228 LBL 19
229   E
230  RCL 04
231   E1
232  -
233  CLA
234  FIX 0
235  CF 29
236  ARCL X
237  " TR"
238  X>Y?
239  GTO 08
240  "Y"
241  GTO 09
242 LBL 08
243  "IES"
244 LBL 09
245  AVIEW
246  CLA
247  FIX 4
248  SF 29
249  ,034
250  CLRGX
251  CLX
252  X<>F
253  CLST
254  END


Back to HP-41CX Selected (Game) Programs

Back to Natural Sciences and Mathematical Games

Back to the starting page

Kai Schröder, 30.5.2001