2026-10-18 01:54:06 +03:00
|
|
|
// No console window for release builds on Windows.
|
|
|
|
|
#![cfg_attr(all(windows, not(debug_assertions)), windows_subsystem = "windows")]
|
|
|
|
|
|
2026-10-26 23:57:45 +03:00
|
|
|
mod adjourned;
|
2026-10-18 01:54:06 +03:00
|
|
|
mod analysis;
|
|
|
|
|
mod app;
|
|
|
|
|
mod assets;
|
|
|
|
|
mod board;
|
ChessPenguin 0.5.0: find games by position on a board
The "Board" pane next to the game list (Ctrl+B): moves played on it filter
the list to the games that reach the position by any move order, together
with the filters; the moves played next are listed with games, a results
bar, average rating and last year. Games reached by another order are
marked and "only this order" narrows the list; strongest games first.
A game opens at the found position; "Find in database" (Ctrl+Shift+F)
searches the position of the game on screen.
Large ChessBase databases: a fast main-line walk (moves built from the
board), pruning by material and pawns, the .cbb search booster when valid;
Mega Database: 0.4 s for the starting position, under 0.1 s deeper.
PGN databases and books: positions of all games, variations included,
kept in memory once built.
Also: × to clear filter and search fields; "Open as a new game" opens at
the last move; the "Moves" column is now "Length".
Docs: decision 13, design (docs/design/board-search.md), research
(position-search, position-index), dev notes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 08:42:08 +03:00
|
|
|
mod board_search;
|
Translation of game comments
When a game's comments are in another language, ChessPenguin offers to translate
them into the reader's: with the ChatGPT Plus/Pro subscription (Sign in with
ChatGPT: OAuth with PKCE in the browser, a loopback callback, tokens refreshed
one at a time), or an OpenAI-compatible API key (DeepSeek, OpenAI, Gemini, a
model on this computer with Ollama or LM Studio, another address). After the
first consent, games in other languages are translated as they are opened;
[Original | Translation] (Ctrl+Shift+T) switches back.
Only comment text is sent; the model gets strict instructions and a glossary,
and every answer must keep the moves and squares of the original, or the
comment stays in the original with a mark. Translations are never written to
the PGN; a cache keeps them per language. Keys and tokens live in a 0600 file
apart from the settings. Settings › Translation holds the target language,
when to translate, the connection, permissions and the cache.
Also: the monospace font and three glyphs of Noto Sans Math are text fallbacks,
so arrows and the evaluation signs ⩲ ⩱ ⌓ no longer show as boxes.
Reviewed by the designer and the tester agents (two rounds).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:03:03 +03:00
|
|
|
mod chatgpt;
|
2026-10-27 23:00:29 +03:00
|
|
|
mod db_counts;
|
2026-10-19 09:33:37 +03:00
|
|
|
mod engine_download;
|
|
|
|
|
mod engine_offer;
|
2026-10-18 11:53:30 +03:00
|
|
|
mod engines;
|
2026-10-19 12:21:09 +03:00
|
|
|
mod examples;
|
2026-10-26 22:51:48 +03:00
|
|
|
mod file_state;
|
2026-10-18 01:54:06 +03:00
|
|
|
mod game_view;
|
2026-10-21 19:15:21 +03:00
|
|
|
mod graphics;
|
2026-10-18 01:54:06 +03:00
|
|
|
mod i18n;
|
ChessPenguin 0.4.0: large ChessBase databases with a filter panel
Mega Database (11.7 million games) opens in under a second: a .cbh with
20,000 records or more is read in place, a game is converted to PGN when
opened. Filter panel on the right (player with suggestions, colour,
opponent, tournament, annotator, years, Elo rule, result, ECO, moves,
comments, variations), applied live in the background with cancellation.
Fixes: a ChessBase game unreadable from its first move (Chess960) crashed
the import; databases mixing UTF-8 and single-byte texts were decoded as
Cyrillic.
Docs: decision 12, design (docs/design/large-databases.md), format research
and acceptance criteria, QA report 2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 01:02:36 +03:00
|
|
|
mod large_db;
|
2026-10-18 01:54:06 +03:00
|
|
|
mod library;
|
Play against Maia: dialog, clocks, game screen, result strip
«⚔ Play» (Ctrl+G) opens «Play against the computer»: name and rating
(optional), strength 600–2600 (or weaker/as me/stronger), colour, Lichess time
controls, custom, no clock. The game screen in play mode: clock cards above
and below the notation (read-only), take back, resign (abort before the first
moves); no engine, analysis or editing. Maia answers in a background thread
with a human-like pause bounded so she never loses on time; stale answers are
dropped. Endings: mate, stalemate, no material, threefold, fifty moves, time
(draw when the other side cannot mate), resignation; then the result strip
(Analyse, Rematch, New game, Save to a database) and an ordinary game with the
tags of a played game and [%clk]. Leaving during a game asks (resign and add /
resign and leave / keep playing), the clocks wait meanwhile. maia reads the
published PyTorch checkpoint directly (zip + a small pickle reader that refuses
everything but tensors); maia_download fetches it on request (pinned revision,
SHA-256). Dev hooks CP_PLAY, CP_PLAY_AUTO, CP_MAIA. Russian texts; the other
languages follow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 04:10:02 +03:00
|
|
|
mod maia_download;
|
2026-10-18 01:54:06 +03:00
|
|
|
mod notation;
|
2026-10-19 21:10:22 +03:00
|
|
|
mod online;
|
|
|
|
|
mod online_ui;
|
Own databases: create PGN bases, add, save, delete games; library logging
Desktop: «✚ New database» on the shelf (Ctrl+Shift+N), «Add to database…»
(Ctrl+Shift+S, 💾, ☰) for any game — new, pasted, from a ChessBase, online or
legacy-encoded database — into a PGN of the user's choice; Ctrl+S saves the
changes back into the game's own PGN (its record is replaced) or adds the game
when the source is read-only; the game data editor (F2, the title, ☰) asked once
when a new game is first added; duplicate check (same players, date, moves →
replace / add as new, no Enter); delete from the table with a question and Undo
(Ctrl+Z, 6 s, waits under the mouse); UTF-8 copy for legacy-encoded files with
the restored letters; online and ChessBase stay read-only. Writes are explicit:
append, or an atomic rewrite through a temporary file and a rename (through a
symlink, keeping the mode, syncing the folder), refused when the file changed on
the disk. chess_core::pgn::store: append/replace/remove/restore/write_utf8_copy,
find_same_game, pgn_date; Game::remove_tag and order_roster. Settings: your
name (annotator), the folder for new databases, the last target. Nine languages.
Also: library warnings (wgpu, winit) go to chesspenguin.log, CP_LOG_FRAMES=1
traces egui_wgpu frames (the GNOME hang hunt); dev hooks CP_OWN, CP_PASTE,
CP_COMMENT, CP_KEYS with Ctrl+, CP_SETTINGS=interface.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 00:46:47 +03:00
|
|
|
mod own_db;
|
Play against Maia: dialog, clocks, game screen, result strip
«⚔ Play» (Ctrl+G) opens «Play against the computer»: name and rating
(optional), strength 600–2600 (or weaker/as me/stronger), colour, Lichess time
controls, custom, no clock. The game screen in play mode: clock cards above
and below the notation (read-only), take back, resign (abort before the first
moves); no engine, analysis or editing. Maia answers in a background thread
with a human-like pause bounded so she never loses on time; stale answers are
dropped. Endings: mate, stalemate, no material, threefold, fifty moves, time
(draw when the other side cannot mate), resignation; then the result strip
(Analyse, Rematch, New game, Save to a database) and an ordinary game with the
tags of a played game and [%clk]. Leaving during a game asks (resign and add /
resign and leave / keep playing), the clocks wait meanwhile. maia reads the
published PyTorch checkpoint directly (zip + a small pickle reader that refuses
everything but tensors); maia_download fetches it on request (pinned revision,
SHA-256). Dev hooks CP_PLAY, CP_PLAY_AUTO, CP_MAIA. Russian texts; the other
languages follow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 04:10:02 +03:00
|
|
|
mod play;
|
Play: games against the computer go by themselves into the player's database
docs/research/player-games-db.md, docs/design/player-games.md, decisions
«Партии игрока записываются сами» (desktop; Android next):
- «Roman — games against the computer» (without a name, «Games against the
computer»), made at the first game in the folder of new databases; only
new records are appended.
- During a game a journal after every move (a lock held while the program
runs); a crash leaves it to the next start, which writes the game once,
unfinished. A failed write keeps the journal until the game is saved
elsewhere or left.
- The play dialog says where the games go (wraps under the name), a ▾ list of
the computer's players with their ratings (↓/↑ in the field); a toast when
the database is made; the result strip «Written to the database, No. n ·
Open» instead of «Save to a database…»; the leave question names it.
- ♞ on the player's card and in the folded shelf; a checkbox in Settings →
Interface → Your databases (on).
Checked by the tester (crash, failed write, two instances, names, files of
the same name) and the designer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 15:33:35 +03:00
|
|
|
mod player_games;
|
Opponent prep: the desktop screen (dialog, report, engine run)
The «Prepare against…» entry points in the library (the filter panel's button
when a player is set, the game row's context menu, Ctrl+Shift+P), the dialog
(database, the player's spellings with the similar names apart, colour, book)
and the report screen in the stack between the library and the game: the
repertoire tree with transpositions, opening names, scores and the book
column, the openings table by family and variation, the errors tab (repeated
errors and by opening), the board of the chosen position with the line under
it, and the games of the selection, which open in the game screen at that move
with «⬅ Back to preparation».
The engine run reuses the game analysis job over the distinct opening
positions of the chosen colour: the launch dialog shares the engine picker and
the quality/threads/memory grid with review.rs (quality «Fast» by default, its
own setting), marks appear as positions are evaluated, «Stop» keeps what was
done, the evaluations and the report are cached under <cache>/prep. One engine
job per program: game analysis and the live engine are blocked meanwhile.
Core: targets and counts by colour (`targets_for`, `missing_for`), the book
step keeps its per-position counts (`book_counts`) for the tree column.
Narrow windows: the board stacks over the lists under 804 px and folds into a
button under 720 px of height; the right column is split explicitly (a nested
bottom panel is not reserved from the content above it in egui).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-28 15:43:15 +03:00
|
|
|
mod prep_ui;
|
2026-10-19 23:20:37 +03:00
|
|
|
mod reference;
|
Game analysis: whole-game engine review with graph, report and notation marks
- Separate background engine job over the main line (go nodes N), live engine
paused meanwhile; header button with progress/cancel, Shift+A.
- Lichess-method metrics: win %, move/game accuracy, inaccuracy/mistake/blunder,
ACPL, accuracy per game phase.
- Evaluation graph under the board, Report tab, engine badges and better lines
in the notation (preview on click), launch dialog with quality/threads/memory
and time estimate.
- Results cached in ~/.cache/chesspenguin/analysis; [%eval] read from PGN.
- Write analysis to the game as one undo step (chess-core: Game::annotate,
Game::edit_group).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 11:03:23 +03:00
|
|
|
mod review;
|
2026-10-26 20:53:49 +03:00
|
|
|
mod rodent4_download;
|
Play: Rodent V as an opponent (desktop): downloaded on request, strength and style
The dialog (docs/design/rodent-opponent.md): «Maia · Rodent V» tiles, one
strength slider for both (Maia's zone marked; past it Rodent is chosen at
once), Rodent's style (Balanced, Attacking, Chaotic, Restricting, Classical,
Tal, Tal (network)) always in its place, greyed for Maia. Rodent V 1.2 (the
authors' release, pinned SHA-256) is downloaded and unpacked with its
personalities, nets and books; it plays through UCI at UCI_Elo from the
measured table (provisional until the measurement ends), with its book,
after Maia's human pause. Its own texts where Russian makes Maia «she» and
Rodent «he». The download helper is shared with Stockfish's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 03:02:55 +03:00
|
|
|
mod rodent_download;
|
Move notation: Latin letters, figurines or the interface language's letters
Settings › Board & pieces: Nf3, ♘f3 as on Lichess, or Кр Ф Л С К (German
K D T L S, French R D T F C, Spanish and Italian R D T A C; in English the
Latin letters), with a sample per option and a line of a game. Only the shown
label changes (san::show): the game, PGN, copied games, the analysis written
into a game, the reference cache and every comparison stay Latin SAN. Applied
in the move list, engine lines, the reference tab, board search and the
analysis report. The figurines are egui's chess glyphs cut out to a 4.7 KB
font, a little smaller and on the baseline. Latin remains the default.
Reviewed by the designer and the tester agents.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:18:53 +03:00
|
|
|
mod san;
|
2026-10-18 01:54:06 +03:00
|
|
|
mod settings;
|
|
|
|
|
mod settings_ui;
|
|
|
|
|
mod sound;
|
Translation of game comments
When a game's comments are in another language, ChessPenguin offers to translate
them into the reader's: with the ChatGPT Plus/Pro subscription (Sign in with
ChatGPT: OAuth with PKCE in the browser, a loopback callback, tokens refreshed
one at a time), or an OpenAI-compatible API key (DeepSeek, OpenAI, Gemini, a
model on this computer with Ollama or LM Studio, another address). After the
first consent, games in other languages are translated as they are opened;
[Original | Translation] (Ctrl+Shift+T) switches back.
Only comment text is sent; the model gets strict instructions and a glossary,
and every answer must keep the moves and squares of the original, or the
comment stays in the original with a mark. Translations are never written to
the PGN; a cache keeps them per language. Keys and tokens live in a 0600 file
apart from the settings. Settings › Translation holds the target language,
when to translate, the connection, permissions and the cache.
Also: the monospace font and three glyphs of Noto Sans Math are text fallbacks,
so arrows and the evaluation signs ⩲ ⩱ ⌓ no longer show as boxes.
Reviewed by the designer and the tester agents (two rounds).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:03:03 +03:00
|
|
|
mod translate;
|
|
|
|
|
mod translate_ui;
|
2026-10-20 07:55:59 +03:00
|
|
|
mod update;
|
|
|
|
|
mod update_ui;
|
2026-10-18 14:00:19 +03:00
|
|
|
mod viewed;
|
2026-10-18 01:54:06 +03:00
|
|
|
mod widgets;
|
|
|
|
|
|
2026-10-26 01:00:11 +03:00
|
|
|
/// Learning an opening: shared with the Android app.
|
|
|
|
|
use trainer as train;
|
|
|
|
|
|
2026-10-18 01:54:06 +03:00
|
|
|
fn main() -> eframe::Result {
|
2026-10-19 19:07:47 +03:00
|
|
|
// `chesspenguin --bench <database> [report.txt]`: timings instead of the window
|
|
|
|
|
// (`docs/dev/import.md`, "Замер на другой машине").
|
|
|
|
|
let args: Vec<std::ffi::OsString> = std::env::args_os().skip(1).collect();
|
|
|
|
|
if args.first().is_some_and(|a| a == "--bench") {
|
|
|
|
|
let Some(db) = args.get(1) else {
|
|
|
|
|
eprintln!("usage: chesspenguin --bench <database> [report.txt]");
|
|
|
|
|
std::process::exit(2);
|
|
|
|
|
};
|
|
|
|
|
let cache = settings::Settings::cache_dir().map(|d| d.join("boosters"));
|
|
|
|
|
let result = match args.get(2) {
|
|
|
|
|
Some(file) => std::fs::File::create(file)
|
|
|
|
|
.and_then(|mut f| chess_import::bench::run(db.as_ref(), cache.as_deref(), &mut f)),
|
|
|
|
|
None => chess_import::bench::run(db.as_ref(), cache.as_deref(), &mut std::io::stdout()),
|
|
|
|
|
};
|
|
|
|
|
if let Err(e) = result {
|
|
|
|
|
eprintln!("bench: {e}");
|
|
|
|
|
std::process::exit(1);
|
|
|
|
|
}
|
|
|
|
|
return Ok(());
|
|
|
|
|
}
|
2026-10-21 19:15:21 +03:00
|
|
|
crate::i18n::set_lang(settings::Settings::load().language);
|
2026-10-26 01:00:11 +03:00
|
|
|
// The runs of the opening trainer (`CP_TRAINING_FILE` elsewhere: development).
|
|
|
|
|
if let Some(file) = std::env::var_os("CP_TRAINING_FILE")
|
|
|
|
|
.map(std::path::PathBuf::from)
|
|
|
|
|
.or_else(|| {
|
|
|
|
|
directories::ProjectDirs::from("io.github", "vrubelroman", "ChessPenguin")
|
|
|
|
|
.map(|d| d.data_local_dir().join("training.json"))
|
|
|
|
|
})
|
|
|
|
|
{
|
|
|
|
|
train::set_file(file);
|
|
|
|
|
}
|
2026-10-21 19:15:21 +03:00
|
|
|
graphics::install_panic_hook();
|
Own databases: create PGN bases, add, save, delete games; library logging
Desktop: «✚ New database» on the shelf (Ctrl+Shift+N), «Add to database…»
(Ctrl+Shift+S, 💾, ☰) for any game — new, pasted, from a ChessBase, online or
legacy-encoded database — into a PGN of the user's choice; Ctrl+S saves the
changes back into the game's own PGN (its record is replaced) or adds the game
when the source is read-only; the game data editor (F2, the title, ☰) asked once
when a new game is first added; duplicate check (same players, date, moves →
replace / add as new, no Enter); delete from the table with a question and Undo
(Ctrl+Z, 6 s, waits under the mouse); UTF-8 copy for legacy-encoded files with
the restored letters; online and ChessBase stay read-only. Writes are explicit:
append, or an atomic rewrite through a temporary file and a rename (through a
symlink, keeping the mode, syncing the folder), refused when the file changed on
the disk. chess_core::pgn::store: append/replace/remove/restore/write_utf8_copy,
find_same_game, pgn_date; Game::remove_tag and order_roster. Settings: your
name (annotator), the folder for new databases, the last target. Nine languages.
Also: library warnings (wgpu, winit) go to chesspenguin.log, CP_LOG_FRAMES=1
traces egui_wgpu frames (the GNOME hang hunt); dev hooks CP_OWN, CP_PASTE,
CP_COMMENT, CP_KEYS with Ctrl+, CP_SETTINGS=interface.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 00:46:47 +03:00
|
|
|
graphics::init_library_log();
|
2026-10-21 19:15:21 +03:00
|
|
|
let mode = graphics::choose();
|
2026-10-18 01:54:06 +03:00
|
|
|
let options = eframe::NativeOptions {
|
|
|
|
|
viewport: egui::ViewportBuilder::default()
|
|
|
|
|
.with_app_id("io.github.vrubelroman.chessPenguin")
|
|
|
|
|
.with_title("ChessPenguin")
|
|
|
|
|
.with_inner_size([1400.0, 900.0])
|
2026-10-24 10:14:10 +03:00
|
|
|
.with_min_inner_size([640.0, 480.0])
|
2026-10-18 01:54:06 +03:00
|
|
|
// X11 uses this; on Wayland the icon comes from the .desktop entry matching the app id.
|
|
|
|
|
.with_icon(
|
|
|
|
|
eframe::icon_data::from_png_bytes(include_bytes!("../assets/icon-256.png"))
|
|
|
|
|
.unwrap_or_default(),
|
|
|
|
|
),
|
2026-10-21 19:15:21 +03:00
|
|
|
wgpu_options: graphics::options(mode),
|
2026-10-18 01:54:06 +03:00
|
|
|
..Default::default()
|
|
|
|
|
};
|
2026-10-21 19:15:21 +03:00
|
|
|
let result = eframe::run_native(
|
2026-10-18 01:54:06 +03:00
|
|
|
"ChessPenguin",
|
|
|
|
|
options,
|
|
|
|
|
Box::new(|cc| {
|
|
|
|
|
assets::install(&cc.egui_ctx);
|
|
|
|
|
Ok(Box::new(app::App::new(&cc.egui_ctx)))
|
|
|
|
|
}),
|
2026-10-21 19:15:21 +03:00
|
|
|
);
|
|
|
|
|
if let Err(e) = &result {
|
|
|
|
|
if graphics::retry(&e.to_string()) {
|
|
|
|
|
return Ok(());
|
|
|
|
|
}
|
|
|
|
|
graphics::fatal(&e.to_string());
|
|
|
|
|
}
|
|
|
|
|
result
|
2026-10-18 01:54:06 +03:00
|
|
|
}
|