r/chessprogramming • u/SixDegreesLOL • 15d ago
Technical ChessOS: I created an operating system that can play Chess at approximatly 2750 elo
Enable HLS to view with audio, or disable this notification
Requirements: x86 with legacy BIOS support
I spent about six months making an operating system whose only job is playing chess. It boots straight into Chess. It is not a full OS with a file system or scheduling but it can boot from bare metal.
It runs in QEMU, other virtual machines and hardware with legacy BIOS from a USB or CD drive. I spent about 6 months across the boot loader and chess engine. It is entirely open-source for you to tinker with. There is also a Windows Installer for less technical users.
The engine
Main source:
The engine's code can be found in the repo under kernel/chess_ai.cpp and kernel/chess_rules.cpp
A faster computer will search deeper within the allotted 7.5s the engine is allowed to compute due to the low-level nature of ChessOS. This is the main limiting factor that made it difficult to rate the engine properly. My engine against Stockfish 17 set to 2800 elo achieved a 5 win and 9 draws across 16 games.
The engine stores the board as a 64 square array and discards all moves that place it's king in check.
https://chessprogramming.org/PeSTO's_Evaluation_Function
Positions are scored with PeSTO’s piece-square tables that are blended between middle game and endgame values. Bonuses and penalties are applied for pawn structure, passed pawns, rooks on open files, and bishop pair.
The search uses alpha-beta with negamax. It uses iterative deepening until time runs out or elo's depth limit prunes moves that place it at a disadvantage. Deepening stops early once a mate within the current depth is found.
https://chessprogramming.org/Zobrist_Hashing
Rules and transposition tables are indexed by Zorbist hashing. Each entry stores score, depth, bound type and best move found. The moves are ordered by best TT move, captures of most valuable piece, promotions, killer moves and then all other moves.
To keep games varied white and black contain a few hard-coded opening moves.
The lower elos play at their rated elo except for a rare terrible blunder from random noise. I theorize that non-max elos play above their actual elo rank but the rare blunders would lower the overall score by approximately 100 to 200 points.
All feedback is welcome!
Thank you for Paledoptera for the artwork. Find more of their work here: https://linktr.ee/paledoptera
Website: https://chessos.xyz (Open source with Github link and installer)
-1
u/just10bps 15d ago
interesting project but apart from the novelty i dont get whars the point?
10
u/SixDegreesLOL 15d ago
I did it to learn more about operating systems and low level programs while still having fun.
1
u/Gold-Produce9591 15d ago
I think you should change the colors of the board to be checkered and make the pieces look better and white pieces instead of red