Elara S. Novikova
Iskra-226

BAGELS

Багель

David Ahl, 1973

Three digits, all different, and three words to tell you how close you are. ФЕРМИ for a digit in the right place, ПИКО for a digit in the wrong place, БАГЕЛЬ for nothing at all. Twelve guesses. The whole game is the gap between what those words tell you and what you need to know.

sectors
20-24
source lines
82
guesses
12
Three guesses at a three digit number, and all three kinds of answer the program has: bagel for a guess with nothing in it, the fermi and pico counts, and the line that ends it.
Three guesses at a three digit number, and all three kinds of answer the program has: bagel for a guess with nothing in it, the fermi and pico counts, and the line that ends it.

Run this disk · The image, 256,256 bytes

Why this one matters

BAGELS reached everyone through David Ahl's 1973 collection of BASIC games, and it stayed in the listing books afterward because it needs so little: no board, no pieces, no picture on the screen. A player, a secret, and three words. It is the deduction game that Mastermind sells in a box, without the box. What made it worth typing in was that it hands you less information than the problem looks like it requires, and turns out to be solvable anyway. That is a lesson about search rather than luck, and a lot of people met it here first.

Why it is worth having here

Everything I know about this dialect I learned from a payroll program and a database suite out of a planning institute. The tokens were shaped to add up wages and print a column of roubles. BAGELS asks the same instrument to keep a secret and answer questions about it in single words, in uppercase Cyrillic, on a terminal with no lowercase and no graphics at all. ФЕРМИ and ПИКО are the physicists' names the American original used, carried across untranslated, and they sit in Cyrillic exactly as strangely as they sat in English.

What it cost the interpreter

BAGELS runs on counters, and counters end their statements with a subtraction. That is where my old rule broke. I had been reading the minus token with a lookahead that turned V01 = V01 - 1 at the end of a payload into V01 plus a stray literal of minus one. The correct rule is shorter and duller: after an operand the token is binary minus, otherwise it opens a negative literal. The payroll software never made that difference visible. Rerunning it against the printed sheet at 212.30 roubles afterward confirmed the correction cost the corpus nothing.

What this disk is not

This disk is not a find. I wrote it in 2026, along with the assembler that builds it. No Soviet games disk was ever recovered, and nothing here reprints anyone's listing. What is old is the mechanic, common property since the early seventies. What is new is every byte of the Russian code and every decision inside it. If that sentence goes missing, somebody later holds up an invention as evidence, and at that point the whole project deserves to fall over. So it goes on every page, including this one.

What I checked

BAGELS, guess 1-2-3 against secret 9-0-7 returns "БАГЕЛЬ" correctly, then a hit.

What this does not show

The seed is fixed at 37, because no clock or timer atom is attested, so the same secret comes up on every run. Historically that is authentic, which is why so many early BASIC games asked you to type a number first, but it does mean the disk plays itself out the same way twice. What is tested is the emulator, not the hardware; whether a surviving Iskra-226 accepts these bytes is still open.

Where to read more

The source

BAGELS.bas, 82 lines, assembled onto the image with iskra_asm.py

82 lines of BASIC
10 REM BAGELS
20 PRINT "*** БАГЕЛЬ ***"
30 PRINT "Я ЗАГАДАЛ 3 РАЗНЫЕ ЦИФРЫ."
40 PRINT "ФЕРМИ - ЦИФРА НА СВОЕМ МЕСТЕ."
50 PRINT "ПИКО - ЦИФРА ЕСТЬ, НО НЕ ТАМ."
60 PRINT "БАГЕЛЬ - НЕТ НИ ОДНОЙ."
70 V50 = 37
80 GOSUB 900
81 V01 = V50 / 10
82 GOSUB 950
83 V07 = V60
84 GOSUB 900
85 V01 = V50 / 10
86 GOSUB 950
87 V08 = V60
88 IF V08 = V07 GOTO 84
89 GOSUB 900
90 V01 = V50 / 10
91 GOSUB 950
92 V09 = V60
93 IF V09 = V07 GOTO 89
94 IF V09 = V08 GOTO 89
100 V10 = 0
110 V10 = V10 + 1
120 PRINT "--- ПОПЫТКА";V10
130 PRINT "ТРИ ЦИФРЫ ПО ОДНОЙ"
140 INPUT V04
141 INPUT V05
142 INPUT V06
150 V11 = 0
160 V12 = 0
170 IF V04 = V07 GOTO 175
171 GOTO 180
175 V11 = V11 + 1
180 IF V05 = V08 GOTO 185
181 GOTO 190
185 V11 = V11 + 1
190 IF V06 = V09 GOTO 195
191 GOTO 200
195 V11 = V11 + 1
200 IF V04 = V08 GOTO 205
201 GOTO 210
205 V12 = V12 + 1
210 IF V04 = V09 GOTO 215
211 GOTO 220
215 V12 = V12 + 1
220 IF V05 = V07 GOTO 225
221 GOTO 230
225 V12 = V12 + 1
230 IF V05 = V09 GOTO 235
231 GOTO 240
235 V12 = V12 + 1
240 IF V06 = V07 GOTO 245
241 GOTO 250
245 V12 = V12 + 1
250 IF V06 = V08 GOTO 255
251 GOTO 260
255 V12 = V12 + 1
260 IF V11 = 3 GOTO 400
270 IF V11 > 0 GOTO 280
271 IF V12 > 0 GOTO 280
272 PRINT "БАГЕЛЬ"
273 GOTO 300
280 PRINT "ФЕРМИ";V11;" ПИКО";V12
300 IF V10 < 12 GOTO 110
310 PRINT "*** ПОПЫТКИ КОНЧИЛИСЬ ***"
320 PRINT "ЧИСЛО БЫЛО";V07;V08;V09
330 END
400 PRINT "*** УГАДАЛИ ЗА";V10;" ПОПЫТОК! ***"
410 END
900 V50 = V50 * 21
910 V50 = V50 + 13
920 IF V50 < 100 GOTO 940
930 V50 = V50 - 100
935 GOTO 920
940 RETURN
950 V60 = 0
960 IF V01 < 1 GOTO 990
970 V60 = V60 + 1
980 V01 = V01 - 1
985 GOTO 960
990 RETURN

Back to Iskra-226