

Supra chess engine
The first Portuguese chess engine

Introduction
Supra chess is the first Portuguese chess engine.
The source code is totally original, open, written in c ++ and is available to download at the bottom of webpage. ↓
Creator and developer: Pedro Mourão Soares Correia.
News
Supra 30.0 SMP is available for download below on the page↓
- The biggest update in Supra's history. In a test match against the previous version (Supra 29.1, 10 minutes per game, 50 openings played with both colours), Supra 30.0 scored +82 =12 -6 in 100 games (88%), about +350 Elo. (Supra 30.0 used 8 cores and Supra 29.1 used 1 core.)
-Search up to 40 plies
Supra can now search up to 40 plies. With multiprocessing and the quiescence search it reaches much deeper in the same time, and the 40 levels make it possible to take full advantage of that.
- Multiprocessing (Lazy SMP) **
Supra can use up to 8 CPU cores (Threads option; 1 by default). The threads search in parallel and share the hash table (and, as an experimental option, the alpha values at the same depth). At the end, Supra chooses the move of the thread that searched deepest, accepting incomplete cycles but discarding the move cut by the clock, and the starting depths are spread evenly over the threads. * **
In a test match (10 minutes per game), Supra with 8 cores scored +8 =6 -1 (73%) against itself with 1 core, with exactly the same thinking time.
- Faster evaluation **
Two-sided lazy evaluation and an evaluation memory: about 13% faster to the same depth, with exactly the same search.
- Quiescence search **
At the leaves of the tree, Supra searches capture and promotion sequences until the position is quiet. It no longer evaluates positions in the middle of an exchange, which removes many tactical errors.
- Adaptive quiescence window * **
In the middlegame the quiescence search uses an alpha-beta window, which makes it much faster. In endgames (less than 1/3 of the material) the window is closed and the quiescence search becomes exact, for maximum precision in technical endgames. (The author's idea, implemented with Claude's help.)
- Mop-up **
In endgames against a lone king, Supra drives the enemy king to the edge and brings its own king closer. It now mates easily with K+R vs K.
- Hash table (transpositions) **
Positions already analysed are stored and reused, and the table is shared by all threads. It is cleared at the start of each new game.
- Personalities
New "Personality" option with five styles:
custom: the individual options decide (default);
hyper-romantic: all-out attack, will sacrifice up to a queen;
romantic: attacking play, will sacrifice up to a rook;
dynamic: Supra's classic style;
positional: solid, positional play.
Each personality sets seven parameters at once (aggressiveness, king attack, mobility, positional relevance, material quotient and sacrifice limit). Inspired by Alexander Shashin's ideas.
- New romantic opening book **
Internal book with 350 positions: every line of the previous book plus classical gambits such as the King's Gambit (with the Muzio), the Evans Gambit, the Fried Liver, the Traxler Counterattack, the Marshall Attack, the Schliemann Gambit, the Latvian Gambit, the Budapest Gambit, the Albin Countergambit, the Alien Gambit, the Martian Gambit and the Portuguese Variation of the Scandinavian. The book can be edited: just place the file supra_livro.txt in the engine folder (or choose another file with the "Book file" option). Each move can have a weight, and Supra chooses among several options.
- UCI options reorganised by topic: system, time, book and memory, search, evaluation and style, interface and testing. The "OwnBook" and "Hash" options now use the standard UCI names.
- Fixes
Fixed a bug that, in some games, limited the search to low depths. Improved communication with GUIs.
Datasheet:
Type: UCI engine with no graphical interface of its own. It connects to chess programs such as Fritz, ChessBase, Arena, Hiarcs or Cute Chess.
Language: C++
Size: Supra 1.0: about 15,000 lines of code (executable of about 1.5 MB). Supra 30.0: about 539,000 lines of code (executable of about 12 MB).
Depth: up to 40 plies
Processors: up to 8 cores (Lazy SMP)
Creator: Pedro Mourão Soares Correia
Year created: 2010 (Supra 1.0)

Algorithms used:
Main Algorithm:
- - Base algorithm *
A recursive algorithm, equivalent to minimax, that chooses at each node the strongest child for the side to move. It was designed by the author in 2011 (Supra 2.0); later the author found out it had been discovered long before.
RELATED TO THE BASE ALGORITHM
- - Alpha-beta
Stops searching a node when beta <= alpha, because that node can no longer beat the best option already found.
- - Wormhole *
Applies the alpha-beta cutoff condition against ALL previous levels, not only against the level immediately above. The gain was overwhelming.
MOVE ORDERING (TO SPEED UP CUTOFFS)
- - Internal Iterative Deepening
Successive full searches with increasing depth, which improve move ordering and time management.
- - Killer moves
Searches first the move that caused a cutoff at the same depth in another part of the tree.
- - Hash table (transpositions) **
Stores the best move and the value of each analysed position. When the same position appears again (through another move order), Supra reuses the work already done.
FILTERING BY CONDITION
- - Vertical filter *
Discards clearly bad variations from level 3 onwards.
- - Turbo filter *
A faster search that moves alpha forward in steps.
FILTERING WITH A PRELIMINARY SEARCH AT LOWER DEPTH
- - Null move pruning
The side to move "passes" and checks whether the opponent is still doing well at a lower depth. If not, the node is cut.
- - Late Move Reductions
The first children (about five) are searched at full depth and the rest at reduced depth. A new full-depth search is only made when the reduced search causes a cutoff. A more radical version than the usual one.
- - Principal Variation Search
Each node starts with a very narrow window; the full-window search is only made when needed.
SEARCH AT THE LEAVES
- - Quiescence search **
At the leaves, Supra keeps searching only captures and promotions until the position is quiet, with "stand pat" (the side to move may decline to capture), MVV-LVA ordering (most valuable victim, least valuable attacker) and a material-only evaluation, which makes it very fast.
- - Adaptive quiescence window * **
Alpha-beta window in the middlegame (faster) and exact quiescence in the endgame (more precise).
ENDGAMES
- - Mop-up **
Against a lone king: the enemy king is driven to the edge and the attacking king comes closer.
MULTIPROCESSING
- - Lazy SMP **
Several threads search the same position in parallel, at staggered depths, sharing the hash table and the alpha values. Each one benefits from the work of the others.
- - Best thread by depth * **
The chosen move is the one of the thread with the deepest valid search. An incomplete cycle counts as soon as the first root move is finished; the move cut by the clock is discarded; on a tie, the thread that finished more root moves wins.
- - Shared alpha by depth (experimental option, off by default) * **
Threads at the same depth share their alpha values and cut earlier.
- - Balanced depth spread * **
With 4 threads, two start at the first thread's level and two one cycle ahead; with 8, three at the same level, four one cycle ahead and one two cycles ahead.
EVALUATION SPEED
- - Two-sided lazy evaluation **
If the material alone already guarantees the cutoff or the irrelevance of the leaf, the full evaluation is skipped.
- - Evaluation memory **
Evaluations repeated within the same search (about 17%) are stored and reused, with exactly the same result.
EVALUATION AND STYLE
- - Shashin algorithm
Classifies positions into attacking (Tal), balanced (Capablanca) and defensive (Petrosian) zones, and adjusts the positional criteria to each zone.
- - Material quotient *
The material advantage is evaluated through the logarithm of the ratio between both sides' material, not only through the difference. So one extra pawn is worth more in an endgame than in the middlegame, and Supra looks for exchanges when ahead and avoids them when behind.
- - Personalities
Five playing styles (custom, hyper-romantic, romantic, dynamic and positional) that set at once the aggressiveness, king attack, mobility, positional relevance, material quotient and sacrifice limit.
* Algorithms discovered by the author, or independently rediscovered.
** Algorithms implemented in Supra 30.0 with the precious and indispensable help of Claude, an artificial intelligence by Anthropic.
