This program is Copyright © 1976 by HewlettPackard and is used here by permission. This program was originally published in the HP67 Games Pac 1.
This program is supplied without representation or warranty of any kind. HewlettPackard Company and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.
SuperBagels 

Shift 





Label 
Seed 
# Digits 
Max Dig 
(> # Guess) 
Guess> 
Key 
A 
B 
C 
D 
E 
The object of the game of Super Bagels is for the player to guess an integer number which the calculator has chosen. Clues are given after each guess to tell the player how close his guess is to the hidden number. To make the game more interesting, the hidden number can be specified by the user to be from 1 to 8 digits, where each digit can range from zero to a maximum specified by the user. When the proper number is finally entered, the number of guesses required to discover the hidden number is displayed.
Play begins by first keying in a seed (any number) and pressing A. The display will return with a 2digit code as shown: 4.5. This output shows the type of number which the machine will pick for the player to guess unless requested otherwise. The 4.5 game is a game of moderate difficulty where the number is a 4 digit number with each digit having any value from 0 to 5. Thus the minimum possible number is 0000, and the maximum 5555.
After the game has been started by pressing A, the number to be guessed can be changed by pressing B or C. To change the number of digits in the hidden number, key in the number of digits and press B. The number of digits must be at least 1 and not greater than 8. To change the maximum digit found in the hidden number, the maximum digit is keyed in and C is pressed. The range of legal maximum digits is from 0 to 9. After B or C is pressed, the display returns with a display in the same format as after pressing A. This makes sure the user knows the type of number he is trying to guess.
Once the hidden number has been specified, the game begins with the player entering his first guess and pressing E. The returned output is of the form CW.Guess where C is the number of digits of the guess that exactly match digits in the hidden number both in value and location. W is the number of digits of the guess that match digits of the hidden number in value, but not in location. Digits are not counted twice; that is, digits counted as C digits are not counted again as W digits. If C is 0 there will be a blank in place of C.
For example, if the hidden number is 12251, a guess of 12345 would yield 21.12345, meaning that 2 numbers (the 1 and 2) match exactly the hidden number, but that 1 number (5) is out of place.
A guess of 21125 would give 5.21125 meaning all of the digits of the guess are in the hidden number, but none of them are in the right place.
When the guess finally matches the hidden number, the number of guesses used is output. At any time during the game, the current number of guesses taken can be displayed by pressing D.
To play again, enter a new seed and press A. Super Bagels is written to run as fast as possible, but when numbers with many digits are selected, the time to analyze a guess will be significantly slower than with a simpler number. For those who want to discover the hidden number in some manner other than by using the clues given, you are invited to try. Super Bagels has been written to hide the number as much as possible. Good Luck.
This game was inspired by the popular game Mastermind.
Step 
Instructions 
Input Data/Units 
Keys 
Output Data/Units 
1 
Load side 1 and side 2. 

2 
To start game, key in a seed (any number); output is in the form D.M.* 
Seed 
A 
4.5 
3 
To change number of digits to be guessed in the number, key in the number (1 <= D <= 8). 
D 
B 
D.M* 
4 
To change the maximum digit found in the number to be guessed, key in the number (0 <= M <= 9). 
M 
C 
D.M* 
5 
To display current number of guesses already taken 

D 
Guesses 
6 
Guess a number containing D digits with the maximum digit <= M. The output returns the guess and also codes C and W which signify the number of digits of the guess correct and in the right location (C), and the number of other digits of the guess correct but, in the wrong location (W). 
Guess 
E 
CW.Guess 
7 
Repeat step 6 until a match is made between the guess and the number stored in the machine. The output shows the number of guesses required to make the match. 

no. of guesses 

8 
8 To play again return to 2.  

*D = number of digits in hidden number. 




M = maximum allowed value of any digit in hidden number. 



Play a game with 4 digits, each in the range 05.
Load sides 1 and 2.
Keystrokes Outputs 1.23456987 EEX CHS 12 A 4.5 3214 E 11.3214 *** (1 right, 1 in right place) 3015 E 2.3015 *** (2 right) 5234 E 21.5234 *** (1 right, 2 in right place) 5203 A 30.5203 *** (3 in right place) 5223 E 30.5223 *** 5253 E 40.5253 *** (Correct)! 6. *** (6 guesses)
The original game of Bagels uses a hidden number of 3 digits, each in the range of 09. Play a game of Bagels.
Keystrokes Outputs 1.23456987 A 4.5 3 B 3.5 9 C 3.9 512 E 1.512 *** 702 E 1.702 *** 217 E 10.217 *** 236 E 20.236 *** 235 E 20.235 *** 239 E 20.239 *** 238 E 30.238 *** 7. *** (Number of guesses)
***Shown by PRINT on HP97 and by PAUSE on HP67.
LINE KEYS 001 *LBL B Number of digits. 002 INT 003 X=0? 004 GTO b 005 8 006 X<>Y 007 X>Y? 008 GTO b 009 RCL B 010 FRAC 011 + 012 GTO 0 013 *LBL C Maximum digits. 014 INT 015 9 016 X<>Y 017 X>Y? 018 GTO b 019 RCL A 020 ÷ 021 RCL B 022 INT 023 + 024 GTO 0 025 *LBL D Number of guesses. 026 RCL C 027 RTN 028 *LBL A Input seed. 029 PRT SPC 030 CF 0 031 CL REG 032 X=0? 033 pi 034 STO E 035 1 036 0 037 STO A 038 4 039 . 040 5 041 *LBL 0 042 STO B 043 FIX 044 DSP 1 045 RTN 046 *LBL E Input guess. 047 CF 2 048 F0? 049 GTO a 050 ENTER 051 SF 0 052 RCL E 053 RCL B 054 x 055 x 056 X=0? 057 LST X 058 LN 059 EEX 060 7 061 x 062 ABS 063 D>R 064 1/X 065 STO E 066 roll dn 067 *LBL a 068 INT 069 STO D 070 RCL E 071 1/X 072 R>D 073 SF 1 074 GSB 1 075 CLX 076 STO 9 077 STO 0 078 P<>S 079 RCL D 080 CF 1 081 GSB 1 082 RCL B 083 STO I 084 *LBL 3 Compare for equality. 085 RCL (i) 086 P<>S 087 RCL (i) 088 X!=Y? 089 GTO 0 090 CHS 091 X<>Y 092 CHS 093 X<>Y 094 RCL A 095 STO + 9 096 roll dn 097 *LBL 0 098 STO (i) 099 X<>Y 100 P<>S 101 STO (i) 102 DSZ I 103 GTO 3 104 RCL B 105 STO 0 106 *LBL 9 Check for digits out of position. 107 RCL 0 108 STO I 109 RCL (i) 110 P<>S 111 X<0? 112 GTO 5 113 SF 2 114 RCL B 115 STO I 116 *LBL 6 117 CLX 118 RCL (i) 119 X=Y? 120 GTO 0 121 DSZ I 122 GTO 7 123 GTO 5 124 *LBL 7 125 CLX 126 RCL (i) 127 X=Y? 128 GTO 0 129 DSZ I 130 GTO 8 131 GTO 5 132 *LBL 8 133 CLX 134 RCL (i) 135 X=Y? 136 GTO 0 137 DSZ I 138 GTO 6 139 GTO 5 140 *LBL 0 Mark digits used. 141 CHS 142 STO (i) 143 RCL A 144 STO + 0 145 *LBL 5 146 P<>S 147 CLX 148 STO I 149 DSZ (i) 150 GTO 9 151 P<>S 152 RCL D Prepare output for used. 153 RCL B 154 INT 155 10^{X} 156 ÷ 157 FRAC 158 RCL 0 159 RCL A 160 ÷ 161 + 162 RCL 9 163 + 164 RCL B 165 STO I 166 CLX 167 GSB e 168 CLX 169 RCL C 170 1 171 + 172 STO C 173 DSP (i) 174 X<>Y 175 PRTX 176 F2? Win? 177 RTN 178 X<>Y 179 DSP 0 180 PRTX Output guesses to win. 181 RTN 182 *LBL 1 Decompose number. 183 RCL B 184 FRAC 185 RCL A 186 1/X 187 + 188 STO 0 189 CLX 190 RCL B 191 STO I 192 INT 193 10^{X} 194 ÷ 195 ABS 196 STO 9 197 *LBL 2 198 RCL 9 199 FRAC 200 RCL A 201 x 202 STO 9 203 RCL 0 204 X<>Y 205 F1? 206 x 207 1 208 + 209 INT 210 STO (i) 211 DSZ I 212 GTO 2 213 RTN 214 *LBL e Clear registers for next guess. 215 STO 1 216 STO 2 217 STO 3 218 STO 4 219 STO 5 220 STO 6 221 STO 7 222 STO 8 223 RTN
R1 Used R2 Used R3 Used R4 Used R5 Used R6 Used R7 Used R8 Used S0 Used S1 Used S2 Used S3 Used S4 Used S5 Used S6 Used S7 Used S8 Used S9 Used A Used B Used C Used D Used E Used I Used
Go back to the software library
Go back to the main exhibit hall