Stoopid Chess
C#
An engine and a board to play it on, first written in 2009 and rebuilt in 2026 for .NET 10, with a GUI for Linux, macOS and Windows that will also play any other UCI engine. Its source is written to be read: simple and canonical, for anyone learning chess programming, with strength second.
- Licence
- GPLv3
- Source
- GitHub
README.md · on GitHub
A chess engine and a cross-platform chess GUI in C#. The engine speaks UCI, so it can be used from any chess GUI and tested against other engines; the GUI can play against any UCI engine, with the built-in one as the default. Originally written in 2009 as a Windows Forms program, ported to .NET 10 and restructured in 2026. The source is meant to be read: it aims to be as simple, clean and canonical as it can be, so that it is useful to someone learning chess programming, and strength comes second.
The engine
- Bitboard board representation (a set of squares per piece type and per color, plus a square
array), magic bitboards for the sliding pieces, their magic numbers found by a seeded search at
start-up, and a fully legal move generator that resolves pins, checks, en passant and castling
during generation rather than by make/test/unmake. Modelled on pawnstar; the design and
measurements are in
docs/BITBOARDS.md. - Squares, bitboards and move lists are small structs (
Square,Bitboard,MoveList) rather than raw integers and arrays, at no run-time cost: the bench signature and speed are unchanged by them. - Zobrist keys for the position and for the pawn structure, generated from fixed seeds so every run is reproducible; 16-byte transposition entries verified by the full 64-bit key.
- Search: negamax alpha-beta (principal variation search) with iterative deepening, aspiration
windows, and time management that gives a move half as much time again when its score drops or
its best move changes; a two-tier transposition table (depth-preferred and always-replace), probed
in the quiescence search too; mate distance pruning, internal iterative reduction, reverse
futility pruning, razoring, null-move pruning, late move pruning and late move reductions; moves
ordered by the table move, MVV/LVA for captures, two killer moves, a countermove, and history and
one-ply continuation history for quiet moves; a check extension at the horizon; and a quiescence
search with stand-pat that skips captures losing material by static exchange evaluation.
Engine/Searcher.csopens with a numbered map of these in the order it applies them, anddocs/SEARCH.mdrecords what each one measured in self-play, with the ones that were tried and dropped. - Evaluation: the Simplified Evaluation Function (material and piece-square tables, with a separate
king table in the endgame) as a baseline, plus whatever terms self-play has since justified;
docs/EVALUATION.mdis the log of every term tried, kept or not. - UCI:
uci,isready,setoption(see UCI options below),ucinewgame,position,go(depth, nodes, movetime, wtime/btime/winc/binc/movestogo, infinite),stop,quit; plusd,eval,perft Nandbench [depth].
The search is deterministic, so the bench node count is a signature of the search and evaluation.
Current values: depth 5 = 42,533 nodes, depth 6 = 79,688 nodes. A test asserts the depth-5
figure; update it (and CLAUDE.md) whenever a change to search or evaluation is intended.
UCI options
The engine advertises one option in answer to uci. A value outside its range is clamped to it, and
an unknown option is ignored.
| Option | Default | Min | Max | What it does |
|---|---|---|---|---|
Hash |
64 | 1 | 1024 | Transposition table size in megabytes |
The evaluation's weights are constants in Evaluator.cs, not options; docs/EVALUATION.md describes every
term and how its value was found.
The GUI
The board with the captured pieces under it, the move list (SAN) with Move now! under it at the right, the drawn menu bar across the top and the status bar along the foot; the Analysis window (View > Analysis window) is a window of its own. It is drawn in the Reckless series' look, as Reckless Amphitheater wears it: charcoal, cream ink and an amber accent, the light and dark squares of its board, the toolkit's legend plates for buttons and choices, Noto Serif for the interface and Monaspace Xenon for the moves, the engine's lines and the clocks, and every dialog drawn in the window over a veil.
You play White or Black against the engine (Game > New Game), can take a move back or switch sides, set up a position by right-clicking a square, copy and paste FEN, save and load games, and import and export PGN. Every game is played on countdown clocks, shown in the status bar, and a side whose clock reaches zero loses on time. Game > Time control offers eight: 40/5 and 40/40 (40 moves in 5 or 40 minutes, the period repeating), 1+0, 3+2, 5+3, 10+0, 15+10 and 30+0, in minutes and seconds of increment; a game starts at 10+0. Game > Set level handicaps the engine's thinking, not the clocks: both clocks run in real time, but the engine plans each move as though it had only part of its clock - a hundredth at Easy, a tenth at Medium, a third at Hard and all of it at Best. Easy, where a game starts, also searches no more than three plies deep.
-
Views (
Views/,Look/, andMainView,BoardView,Dialogs/beside them) draw on anySKCanvasand take the app's own pointer, wheel, key and text events, so the suite runs them with no window. The look is a C# translation of reckless-toolkit's drawing (look/LookDrawing.cpp,app/MenuBarView.h,view/Menu.h,view/Dialog.h; GPLv3, as this repository is), in Amphitheater's colours (src/app/Theme.h). The menu bar is drawn on every OS; its shortcuts use the platform's command key, Cmd on macOS and Ctrl elsewhere. -
The SDL host (
Sdl/) opens the windows, pumps SDL's events into the views, and presents each frame: Skia draws into a raster bitmap at the window's physical pixels, which an SDL streaming texture shows - no GL context of the app's own, so the GUI runs on any display, a CI runner's included. It also does the native file dialogs (on Linux through the desktop portal, or zenity), the clipboard and the UI thread's synchronization context, which engine replies continue on.
Playing against other engines
The engine executable works in any UCI GUI (Arena, Cute Chess, Banksia), and
Reckless Amphitheater carries it as one of its bundled
engines. It also works with tournament tools such as cutechess-cli or fastchess, which is how it can be measured
against pawnstar or trebuchet.
In the Stoopid Chess GUI, Engine > Open UCI engine... plays an external engine in place of the built-in one, and Engine > Use built-in engine goes back. The GUI plays one engine at a time: matches between engines, a list of engines and their options are Amphitheater's job, and were taken out of this GUI in 5.0.
Saved games
*.chess files are JSON: the starting position as FEN, the moves in UCI notation, the side you play,
the level and whether the board is flipped; the time control is not saved. A file saved at the Beginner level,
which 5.0 removed, loads at Easy. Files from before September 2026 used .NET binary serialisation and cannot be
loaded.
History
This project lived in the StoopidChess directory of the reckless-technology/software repository
until September 2026, when it was split out with its history. docs/history/ keeps the review that preceded the
restructuring and the proposals that followed it; the names in them are out of date.
License
Stoopid Chess is free software, licensed under the GNU General Public License, version 3 (GPLv3). You may redistribute and/or modify it under the terms of that license; it comes with no warranty. See the LICENSE file for the full text, or https://www.gnu.org/licenses/gpl-3.0.html.
The GUI's fonts are embedded in it with their licences (src/StoopidChess.Desktop/Assets/Fonts/): Noto Serif,
Copyright 2022 The Noto Project Authors, and Monaspace Xenon, Copyright 2023 GitHub, both under the SIL Open Font
License, version 1.1, as reckless-toolkit carries them. It is built on SkiaSharp 4 (MIT; Skia itself under the BSD
licence) and on SDL3 (the zlib licence) through the ppy.SDL3-CS binding (MIT), whose native libraries ship inside it.
The chess piece images, in the GUI and in the application icon, are the "cburnett" set by
Colin M.L. Burnett, used under the GNU General Public
License, version 2 or later. They were rendered to 64 px PNGs from the SVGs that
Lichess
ships. The application icon is the black queen, packaging/icon/BlackQueen.svg (that SVG, unchanged), on a rounded
square of the Lichess board's light square colour, laid out on Apple's icon grid; tools/make-icons.py renders it to
the Windows .ico (16 to 256 px), the window's PNG and the macOS app's .icns (16 to 1024 px).