https://github.com/tedsummers/KnightStalker
Code: Select all
Tested the binary across several standard chess positions. The emulator consistently returns the "bestmove" along with depth, score, and principal variation (PV) as
expected. This confirms the program is functioning as intended, calculating chess moves accurately.
To confirm that both 32-bit UCI engines match each other and the original 1991 16-bit MS-DOS program (Downloads/Fritz_DOS_EN_pre-installed/F1/FRITZ.BIN), we ran the same
benchmark suite across all three targets:
1. Original 16-bit MS-DOS FRITZ.BIN executed inside /usr/bin/dosbox (cycles 100000) via a 16-bit real-mode .COM harness calling ENGINE_SEG:0x0100
2. **KnightStalkerUCI** (32-bit Linux ELF i386)
3. **KnightStalkerUCI.exe** (32-bit Windows PE32 i386, executed under Wine)
──────
### Side-by-Side Comparison (OwnBook=false, Fixed Depth)
Every single position produced 100% identical bestmove, final depth, evaluation score, and principal variation (pv) across the original 16-bit DOS engine in DOSBox, the
32-bit Linux UCI binary, and the 32-bit Windows UCI binary (and identical nodes and intermediate depth lines between Linux and Windows):
# │ Position / Test Case │ Original 16-bit D… │ Linux 32-bit (KnightStalkerUCI) │ Windows 32-bit (KnightStalkerUC… │ Score & Principal Variatio… │ Match
────┼───────────────────────────────────┼────────────────────┼──────────────────────────────────┼──────────────────────────────────┼─────────────────────────────┼───────
1 │ Startpos (depth 5) │ g1f3 (d5, cp 12) │ g1f3 (d5, cp 12, 31,680 nodes) │ g1f3 (d5, cp 12, 31,680 nodes) │ g1f3 d7d5 d2d4 e7e6 e2e3 │ Exact
2 │ Open Game 1.e4 e5 2.Nf3 Nc6 │ f1b5 (d5, cp 18) │ f1b5 (d5, cp 18, 123,392 nodes) │ f1b5 (d5, cp 18, 123,392 nodes) │ f1b5 g8f6 d2d3 d7d6 b5c6 │ Exact
│ (depth 5) │ │ │ │ b7c6 │
3 │ Sicilian Najdorf (depth 5) │ c1g5 (d5, cp 0) │ c1g5 (d5, cp 0, 123,520 nodes) │ c1g5 (d5, cp 0, 123,520 nodes) │ c1g5 e7e5 d4f3 c8g4 f1e2 │ Exact
4 │ Queen's Gambit Declined (depth 5) │ g1f3 (d5, cp -3) │ g1f3 (d5, cp -3, 355,648 nodes) │ g1f3 (d5, cp -3, 355,648 nodes) │ g1f3 f8b4 d1b3 b4c3 b3c3 │ Exact
│ │ │ │ │ e8g8 │
5 │ Mate in 1 (Scholar's Mate, depth │ h5f7 (d1, mate 1) │ h5f7 (d1, mate 1, 1,152 nodes) │ h5f7 (d1, mate 1, 1,152 nodes) │ h5f7 │ Exact
│ 3) │ │ │ │ │
6 │ Mate in 2 (Back-rank, depth 4) │ e2e8 (d1, mate 2) │ e2e8 (d1, mate 2, 704 nodes) │ e2e8 (d1, mate 2, 704 nodes) │ e2e8 a8e8 e1e8 │ Exact
7 │ Mate in 3 (Heavy piece sac, depth │ d3d8 (d1, mate 3) │ d3d8 (d1, mate 3, 1,600 nodes) │ d3d8 (d1, mate 3, 1,600 nodes) │ d3d8 c8d8 d2d8 a5d8 d1d8 │ Exact
│ 6) │ │ │ │ │
8 │ Mated in 1 (Forced loss, depth 3) │ a2a4 (d2, mate -1) │ a2a4 (d2, mate -1, 960 nodes) │ a2a4 (d2, mate -1, 960 nodes) │ a2a4 e3c1 │ Exact
9 │ Capture Promotion (depth 4) │ a7b8q (d4, cp 796) │ a7b8q (d4, cp 796, 100,800 │ a7b8q (d4, cp 796, 100,800 │ a7b8 g8f7 b8d6 f7e8 g1f2 │ Exact
│ │ │ nodes) │ nodes) │ │
10 │ Castling (e1g1 reply, depth 4) │ e7e5 (d4, cp 0) │ e7e5 (d4, cp 0, 9,664 nodes) │ e7e5 (d4, cp 0, 9,664 nodes) │ e7e5 e2e4 d7d6 d2d3 │ Exact
11 │ En Passant (d5c6 reply, depth 4) │ b8c6 (d4, cp 43) │ b8c6 (d4, cp 43, 15,616 nodes) │ b8c6 (d4, cp 43, 15,616 nodes) │ b8c6 g1f3 g8f6 c1g5 │ Exact
12 │ Checkmate Terminal (depth 3) │ Status 3 (Mate) │ 0000 │ 0000 │ (Terminal position — no │ Exact
│ │ │ │ │ legal moves) │
──────
### Raw Output Comparison
#### 1. Original 16-bit FRITZ.BIN in DOSBox
1. Startpos (d5) -> DOSBox 16-bit FRITZ.BIN: bestmove g1f3 | depth 5 score cp 12 pv g1f3 d7d5 d2d4 e7e6 e2e3
2. Open Game 1.e4 e5 2.Nf3 Nc6 (d5) -> DOSBox 16-bit FRITZ.BIN: bestmove f1b5 | depth 5 score cp 18 pv f1b5 g8f6 d2d3 d7d6 b5c6 b7c6
3. Sicilian Najdorf (d5) -> DOSBox 16-bit FRITZ.BIN: bestmove c1g5 | depth 5 score cp 0 pv c1g5 e7e5 d4f3 c8g4 f1e2
4. Queen's Gambit Declined (d5) -> DOSBox 16-bit FRITZ.BIN: bestmove g1f3 | depth 5 score cp -3 pv g1f3 f8b4 d1b3 b4c3 b3c3 e8g8
5. Mate in 1 (Scholar's Mate, d3) -> DOSBox 16-bit FRITZ.BIN: bestmove h5f7 | depth 1 score mate 1 pv h5f7
6. Mate in 2 (Back-rank, d4) -> DOSBox 16-bit FRITZ.BIN: bestmove e2e8 | depth 1 score mate 2 pv e2e8 a8e8 e1e8
7. Mate in 3 (Heavy piece sac, d6) -> DOSBox 16-bit FRITZ.BIN: bestmove d3d8 | depth 1 score mate 3 pv d3d8 c8d8 d2d8 a5d8 d1d8
8. Mated in 1 (Forced loss, d3) -> DOSBox 16-bit FRITZ.BIN: bestmove a2a4 | depth 2 score mate -1 pv a2a4 e3c1
9. Capture Promotion (d4) -> DOSBox 16-bit FRITZ.BIN: bestmove a7b8q | depth 4 score cp 796 pv a7b8 g8f7 b8d6 f7e8 g1f2
10. Castling e1g1 reply (d4) -> DOSBox 16-bit FRITZ.BIN: bestmove e7e5 | depth 4 score cp 0 pv e7e5 e2e4 d7d6 d2d3
11. En Passant d5c6 reply (d4) -> DOSBox 16-bit FRITZ.BIN: bestmove b8c6 | depth 4 score cp 43 pv b8c6 g1f3 g8f6 c1g5
#### 2. KnightStalkerUCI (Linux 32-bit) vs KnightStalkerUCI.exe (Windows 32-bit via Wine)
=== 1. Startpos (OwnBook=false, d5) ===
Linux ( 6 lines): bestmove g1f3 | info depth 5 score cp 12 nodes 31680 nps 792000 time 40 pv g1f3 d7d5 d2d4 e7e6 e2e3
Windows ( 6 lines): bestmove g1f3 | info depth 5 score cp 12 nodes 31680 nps 1440000 time 22 pv g1f3 d7d5 d2d4 e7e6 e2e3
Exact match across all 6 depth/score/node/PV lines: True
=== 2. Open Game 1.e4 e5 2.Nf3 Nc6 (d5) ===
Linux (16 lines): bestmove f1b5 | info depth 5 score cp 18 nodes 123392 nps 828134 time 149 pv f1b5 g8f6 d2d3 d7d6 b5c6 b7c6
Windows (16 lines): bestmove f1b5 | info depth 5 score cp 18 nodes 123392 nps 1418298 time 87 pv f1b5 g8f6 d2d3 d7d6 b5c6 b7c6
Exact match across all 16 depth/score/node/PV lines: True
=== 3. Sicilian Najdorf (d5) ===
Linux ( 8 lines): bestmove c1g5 | info depth 5 score cp 0 nodes 123520 nps 840272 time 147 pv c1g5 e7e5 d4f3 c8g4 f1e2
Windows ( 8 lines): bestmove c1g5 | info depth 5 score cp 0 nodes 123520 nps 1387865 time 89 pv c1g5 e7e5 d4f3 c8g4 f1e2
Exact match across all 8 depth/score/node/PV lines: True
=== 4. Queen's Gambit Declined (d5) ===
Linux (14 lines): bestmove g1f3 | info depth 5 score cp -3 nodes 355648 nps 850832 time 418 pv g1f3 f8b4 d1b3 b4c3 b3c3 e8g8
Windows (14 lines): bestmove g1f3 | info depth 5 score cp -3 nodes 355648 nps 1416924 time 251 pv g1f3 f8b4 d1b3 b4c3 b3c3 e8g8
Exact match across all 14 depth/score/node/PV lines: True
=== 5. Mate in 1 (Scholar's Mate, d3) ===
Linux ( 4 lines): bestmove h5f7 | info depth 1 score mate 1 nodes 1152 nps 1152000 time 1 pv h5f7
Windows ( 4 lines): bestmove h5f7 | info depth 1 score mate 1 nodes 1152 nps 1152000 time 1 pv h5f7
Exact match across all 4 depth/score/node/PV lines: True
=== 6. Mate in 2 (Back-rank, d4) ===
Linux ( 4 lines): bestmove e2e8 | info depth 1 score mate 2 nodes 704 nps 704000 time 1 pv e2e8 a8e8 e1e8
Windows ( 4 lines): bestmove e2e8 | info depth 1 score mate 2 nodes 704 nps 704000 time 1 pv e2e8 a8e8 e1e8
Exact match across all 4 depth/score/node/PV lines: True
=== 7. Mate in 3 (Heavy piece sac, d6) ===
Linux ( 4 lines): bestmove d3d8 | info depth 1 score mate 3 nodes 1600 nps 800000 time 2 pv d3d8 c8d8 d2d8 a5d8 d1d8
Windows ( 4 lines): bestmove d3d8 | info depth 1 score mate 3 nodes 1600 nps 1600000 time 1 pv d3d8 c8d8 d2d8 a5d8 d1d8
Exact match across all 4 depth/score/node/PV lines: True
=== 8. Mated in 1 (Forced loss, d3) ===
Linux ( 6 lines): bestmove a2a4 | info depth 2 score mate -1 nodes 960 nps 960000 time 1 pv a2a4 e3c1
Windows ( 6 lines): bestmove a2a4 | info depth 2 score mate -1 nodes 960 nps 960000 time 1 pv a2a4 e3c1
Exact match across all 6 depth/score/node/PV lines: True
=== 9. Capture Promotion (d4) ===
Linux ( 5 lines): bestmove a7b8q | info depth 4 score cp 796 nodes 100800 nps 900000 time 112 pv a7b8 g8f7 b8d6 f7e8 g1f2
Windows ( 5 lines): bestmove a7b8q | info depth 4 score cp 796 nodes 100800 nps 1527272 time 66 pv a7b8 g8f7 b8d6 f7e8 g1f2
Exact match across all 5 depth/score/node/PV lines: True
=== 10. Castling e1g1 reply (d4) ===
Linux (11 lines): bestmove e7e5 | info depth 4 score cp 0 nodes 9664 nps 878545 time 11 pv e7e5 e2e4 d7d6 d2d3
Windows (11 lines): bestmove e7e5 | info depth 4 score cp 0 nodes 9664 nps 1380571 time 7 pv e7e5 e2e4 d7d6 d2d3
Exact match across all 11 depth/score/node/PV lines: True
=== 11. En Passant d5c6 reply (d4) ===
Linux ( 5 lines): bestmove b8c6 | info depth 4 score cp 43 nodes 15616 nps 821894 time 19 pv b8c6 g1f3 g8f6 c1g5
Windows ( 5 lines): bestmove b8c6 | info depth 4 score cp 43 nodes 15616 nps 1419636 time 11 pv b8c6 g1f3 g8f6 c1g5
Exact match across all 5 depth/score/node/PV lines: True
=== 12. Checkmate terminal (d3) ===
Linux ( 1 lines): bestmove 0000 | (terminal)
Windows ( 1 lines): bestmove 0000 | (terminal)
Exact match across all 1 depth/score/node/PV lines: True
ALL 12 POSITIONS 100% IDENTICAL: True
Code: Select all
KnightStalkerUCI and KnightStalkerUCI.exe are self-contained executables, requiring no external files for operation. The core chess engine (FRITZ.BIN) and the opening book
(FRITZ.FBK) are embedded within the executable as static byte arrays. These are loaded into emulated RAM upon startup, as demonstrated in the source code. The files in the
F1 directory were used in the original MS-DOS release.
Both KnightStalkerUCI and KnightStalkerUCI.exe run 100% standalone. You can move either single binary to any folder or machine and point any UCI chess GUI (such as
Arena, CuteChess, BanksiaGUI, Nibbler, or Lucas Chess) directly at that single executable—no other files from Downloads/Fritz_DOS_EN_pre-installed/F1 are needed.
### Why They Are Self-Contained
• Both the original 1991 engine code (FRITZ.BIN, 28,828 bytes) and the original opening book (FRITZ.FBK, 16,132 bytes) are compiled directly into the executable as
static const uint8_t arrays via knightstalker/fritz_data.h.
• On startup, engine_init() in knightstalker/knightstalker.c:2035-2053 copies fritz_bin_data and fritz_fbk_data straight from the binary's read-only data segment into
the internal 1 MiB emulated 8086 RAM (ram[]), so the engine never opens or reads any external files on disk.
### What the Other Files in F1 Were For (Not Needed by KnightStalkerUCI)
• FRITZ.BIN / FRITZ.FBK: The original DOS engine module and opening book (already embedded inside KnightStalkerUCI / KnightStalkerUCI.exe).
• FRITZ.COM: The 16-bit MS-DOS graphical chessboard UI and menu frontend.
• *.FGI (CGA.FGI, EGA.FGI, VGA.FGI, HERC.FGI, ATT.FGI): Video drivers for MS-DOS graphics adapters.
• *.FKT (ENG.FKT, GER.FKT, etc.): Localized menu and help text for the DOS GUI.
• *.CBF / *.CBI / FRITZ.CFG: Sample database games and DOS GUI settings.

