Bagels/Mastermind for the HP-65

Back to main page | Email me at: Gene!


The program presented below will play the game of bagels (sometimes known as Mastermind) on the HP-65. It was written by John Rausch and appeared in the V2N3P35 issue of PPC Journal (March 1975). Thanks to John wherever he is today!

Try to guess the three digit number generated by the HP-65. All three digits are different. After the guess, you will be given a clue as to how well you've done in the form of A.B, where A is the number of digits you have guessed correctly in their correct position and B is the number of digits you have guessed but in the wrong position. When you guess the number, the display will show the number of guesses you took as a negative number.

If you get the number in 1-3 guesses, count yourself lucky. 4-5 guesses is excellent. 6-9 guesses is average. 10-14 guesses means you aren't trying. 15 and above means you should try another game!

Instructions:
1) Load the program into the calculator and change back to RUN mode.
2) Enter the initial decimal seed and press STO 6.
3) Start the game by pressing A.
4) Enter your guess and press B. The display will show a clue as described above.
5) For a new game, go to step 3.


Program Listing: Email if you have any questions. Note: This program pointed out something about HP-65 programming that I didn't realize until I was typing it in. There is a GTO A instruction in the program but no LBL A. The instructions also tell you to press A to start the game. How does this work? Apparently, the HP-65 starts program execution at the start of the program when you press LBL A if there is no LBL A in program memory. Very handy or else this program would not have fit into the memory as written.
Line      Instruction  Keycode
01         DSP          21
02         .            83
03         1            01
04         .            83
05         1            01
06         STO 7        33 07
07         E            15
08         STO 1        33 01
09         E            15
10         STO 2        33 02
11         E            15
12         STO 3        33 03
13         RCL 1        34 01
14         g X = Y      35 23
15         GTO          22
16         A            11
17         0            00
18         STO 8        33 08
19         RTN          24
20         LBL          23
21         B            12
22         STO 4        33 04
23         g            35
24         DSZ          83
25         0            00
26         STO 5        33 05
27         C            13
28         C            13
29         C            13
30         3            03
31         g X NE Y     35 21
32         g X <> Y     35 07
33         RTN          24
34         DSP          21
35         .            83
36         0            00
37         RCL 8        34 08
38         RTN          24
39         LBL          23
40         C            13
41         RCL 1        34 01
42         RCL 2        34 02
43         RCL 3        34 03
44         STO 1        33 01
45         g RDN        35 08
46         STO 3        33 03
47         g RDN        35 08
48         STO 2        33 02
49         RCL 4        34 04
50         1            01
51         0            00
52         /            81
53         ENTER        41
54         f            31
55         INT          83
56         STO 4        33 04
57         -            51
58         1            01
59         0            00
60         *            71
61         RCL 1        34 01
62         g X = Y      35 23
63         1            01
64         D            14
65         CLX          44
66         RCL 2        34 02
67         g X NE Y     35 21
68         CLX          44
69         RCL 3        34 03
70         g X = Y      35 23
71         RCL 7        34 07
72         D            14
73         0            00
74         LBL          23
75         D            14
76         RCL 5        34 05
77         +            61
78         STO 5        33 05
79         RTN          24
80         LBL          23
81         E            15
82         RCL 6        34 06
83         g            35
84         PI           02
85         +            61
86         f-1          32
87         SQRT         09
88         f-1          32
89         INT          83
90         STO 6        33 06
91         1            01
92         0            00
93         *            71
94         f            31
95         INT          83
96         g X = Y      35 23
97         GTO          22
98         E            15
99         RTN          24

That's it!
Visitors since 8/4/97