Equalizing chess allows you to play against stockfish in such a way that it does not try to beat you with all its strength, but rather balance the game with each move to try to keep the evaluation as balanced as possible.
The webapp uses a selection function to choose the move among the candidates provided by stockfish. It supports externalized functions (i.e. hosted in a gist), so that YOU can write your own selection function:
export function selectCandidate(candidates) {
// TO DO: select and return a candidate from the list
}
"candidates" is an array containing the moves provided by stockfish, i.e.: [{"type":"cp","score":689,"pv":"h7h5"},{"type":"cp","score":-703,"pv":"h8g7"}, {"type":"mate","score":14,"pv":"a2d2"},{"type":"mate","score":16,"pv":"a2a4"},...]
When type=cp, the higher the score, the stronger the movement. When type=mate, the score is the distance to mate.
There are already these functions available:
-
Original "equalizing" function: https://gist.githubusercontent.com/supertorpe/c18a5f320db997e52f25aecac5f9ceb1/raw/e9c5985630c0da60aa0e7fa07b85f5c7c8d28a57/equalizing-chess-selection.js
-
Half the highest score value: https://gist.githubusercontent.com/supertorpe/1ec6275e1f8ac6de55d3da754f3a1f9f/raw/c9a655e1c5dcf3dbb0061622623cee7f26f5f7b8/equalizing-chess-mean-move.js
The webapp dynamically loads the function from the URL and uses it to choose the movement of the engine.
You can write your own function and set its URL in the settings screen.
It's possible to set an initial FEN: https://supertorpe.github.io/equalizing-chess/#/equalizing-chess/fen/7k/7p/8/8/8/8/P7/K7 w - - 0 1
Following software and resources has been used:
- chess.js: A Javascript chess library for chess move generation/validation, piece placement/movement, and check/checkmate/draw detection
- chessground: A Javascript chess board
- stockfish.js WASM implementation of Stockfish chess engine by Nathan Rugg (nmrugg)
- TypeScript: JavaScript with syntax for types
- Ionic Framework: the mobile sdk for the web
- Alpine.js: lightweight JavaScript framework
- Alpine i18n: Internationalization (i18n) support for Alpine.js
- Navigo: a simple vanilla JavaScript router
- howler.js: javascript audio library for the modern web
- enable-threads: creates a service worker that cross-origin-isolates the page
- Vite: fast build tool
- Logo: designed by Inipagi from Iconfinder
- Chess pieces sets: alpha (Eric Bentzen), california (Jerry S), cburnett (Colin M.L. Burnett), chess7 (Alexander Sizenko), chessnut (Alexis Luengas), chicago (Benjamin Friedrich), companion (David L. Brown), fantasy (Maurizio Monge), iowa (Benjamin Friedrich), kosal (philatype), leipzig (Armando Hernández Marroquin), letter (???), merida (Armando Hernández Marroquin), mono (???), oslo (Benjamin Friedrich), pirouetti, pixel (therealqtpi), reilly (Reilly Craig), riohacha (???), shapes (Jimmie Elvenmark), spatial (Maurizio Monge), symmetric (Arcticpenguins)
- Russo One: text font by Jovanny Lemonad
- Move sound: from lichess static resources
- Capture sound: from lichess static resources
- Success sound: shinephoenixstormcrow from freesound.org
- Fail sound: Bertrof from freesound.org