Repository navigation
Shashin Framework
The framework developed by physicist and chess theorist Alexander Shashin in his book "Best Play: A New Method for Discovering the Strongest Move" is not merely a collection of chess principles, but an attempt to apply physical and thermodynamic laws to the chessboard.

The central concept is that a chess game is a dynamic system oscillating between states of equilibrium and chaos. The goal of the engine is not to find the "best" move in an abstract sense, but to identify which algorithm to apply based on the current state of the system.
Shashin identifies three fundamental algorithms, personified by three World Champions with archetypal styles:
- Tal (Attack / Expansion / Entropy)
- Capablanca (Strategy / Equilibrium / Conservation)
- Petrosian (Defense / Contraction / Density)
Shashin decomposes the position into mathematical ratios based on fundamental factors: Material, Mobility, Safety, and Space.

- Physical Principle: Increase in entropy, expansion, release of kinetic energy.
-
Condition: When the system presents a significant dynamic advantage (
$\Delta K > 0$ ). - Goal: Checkmate or decisive material gain.
-
Engine Behavior: Search for forcing lines, sacrifices (
$m > 1$ to gain$t > 1$ ), and disable pruning filters to avoid discarding "absurd" but winning moves. This is the core of the Gold Digger mode.

- Physical Principle: Conservation of energy, dynamic equilibrium, principle of least action.
-
Condition: When the position is balanced (
$\Delta K = 0$ ). - Goal: Improve piece placement (Makogonov Principle), accumulate small advantages.
- Engine Behavior: "Safety First". Prophylaxis, centralization, solid pawn structures. Aggressive pruning is allowed here to calculate main lines deeper.

- Physical Principle: Contraction, density, increase in stability to resist external pressure.
-
Condition: When under attack or at a disadvantage (
$\Delta K < 0$ ). - Goal: Neutralize the opponent's initiative, build "fortresses".
- Engine Behavior: Over-protection, restriction of opponent's mobility. The engine accepts passive positions if they are solid.
The mathematical heart of the system is the Drift Chart, which maps every position onto a continuous spectrum.

-
Conceptual Formula:
$K = \frac{Attack + Maneuver}{Defense}$ -
$\Delta K$ (Delta Kappa): Represents the deviation from equilibrium.
| Zone | Value | State | Required Action |
|---|---|---|---|
| Tal Zone | Chaos / Dynamic | Violent Attack | |
| Capablanca Zone | Stable / Static | Strategic Maneuver | |
| Petrosian Zone | Critical | Immediate Defense |
ShashChess translates these philosophical labels into C++ code by modifying the behavior of the Stockfish architecture.
Instead of manually calculating physical parameters, ShashChess uses the NNUE Win/Draw/Loss (WDL) probabilities to approximate the state of the system.
| Win Probability | Shashin Zone | Engine Behavior |
|---|---|---|
| 96-100% | High Tal | Total Attack, Pruning disabled |
| 88-95% | High-Middle Tal | Dominance, search for decisive blow |
| 51-75% | Chaos: Capa-Tal | Initiative, transition to attack |
| 50% | Capablanca | Pure strategy, aggressive pruning |
| 25-49% | Chaos: Capa-Petrosian | Opponent pressure, prudence |
| 0-15% | High Petrosian | Desperate defense, fortress building |
The engine dynamically alters search parameters based on the detected zone:
- Aspiration Window: Widened in Tal zones (expecting large score swings/sacrifices); reduced in Capablanca zones (expecting stability).
-
LMR (Late Move Reductions):
- Tal: Lower reduction. The engine "trusts less" the static ordering and searches deeper for potential tactical brilliancies.
- Capablanca: Higher reduction. Moves that look bad are discarded quickly to save time.
- Null Move Pruning (NMP): In Gold Digger mode, NMP is disabled if the position is "NodeHot" (danger of mate or hanging pieces), preventing the engine from missing tactical shots due to pruning.
- Capablanca Zone: Bonus (+30) for bringing pieces to safe squares.
- Tactical Zone: Bonus (+25) for evasion or creating direct threats.
ShashChess 41 is not simply a stronger clone of Stockfish. It is an engine that changes personality dynamically:
- It becomes a Tactical Monster (Tal) when it smells blood.
- It becomes a Boa Constrictor (Petrosian) when it is on the ropes.
- It becomes a Positional Grandmaster (Capablanca) when the position is calm.