Game analysis: «Analyse» starts at once with the options chosen before
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run

The dialog comes the first time (no analysis started from it yet) and with
«Analyse again…». The analysis options are now saved when changed. Dev
hook CP_REVIEW=ask presses «Analyse».

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-25 22:47:39 +03:00
parent d4cccb3f68
commit 9c9f7e9178
5 changed files with 48 additions and 14 deletions

View file

@ -2,6 +2,16 @@
All notable changes are listed here. Versions follow [Semantic Versioning](https://semver.org/).
## [Unreleased]
- Play against Maia: the large model (79M parameters, 316 MB, downloaded once from the
authors' page) plays every strength; it is stronger and closer to how people play.
The slider shows her measured strength on the Lichess blitz scale (1100–2000). The
small model, when it is there, still plays up to 1800. Maia thinks on half the cores;
her clock counts the computing when it takes longer than her pause.
- Game analysis: «Analyse» starts at once with the options chosen the last time; the
options dialog comes the first time and with «Analyse again…».
## [1.4.0] — 2026-10-25
- The library's title row in three groups: databases | a game to enter | Play.

View file

@ -234,7 +234,8 @@ pub struct App {
/// Dev-only startup automation for screenshots/manual QA (see docs/dev/desktop.md):
/// `CP_OPEN=<game index>` opens a game from the first database, `CP_PLY=<n>` steps
/// along the main line, `CP_ANALYZE=1` starts the engine, `CP_SETTINGS=1` opens settings (`=board`, `=about`: that tab),
/// `CP_REVIEW=1` starts the whole-game analysis (`=dialog` only opens its dialog),
/// `CP_REVIEW=1` starts the whole-game analysis (`=dialog` only opens its dialog, `=ask`
/// presses «Analyse»: the dialog or, the options chosen before, the analysis),
/// `CP_KEYS="ArrowDown Shift+ArrowUp Ctrl+Z Escape"` presses these keys, one every half second
/// from the second second.
#[derive(Default)]
@ -619,9 +620,10 @@ impl App {
if let Some(k) = std::env::var("CP_BEST").ok().and_then(|v| v.parse().ok()) {
g.debug_best_line(k);
}
// CP_REVIEW=dialog opens the game-analysis dialog, any other value starts the analysis.
// CP_REVIEW=dialog opens the game-analysis dialog, =ask presses «Analyse», any
// other value starts the analysis.
if let Ok(v) = std::env::var("CP_REVIEW") {
g.debug_review(&self.settings, ctx, v != "dialog");
g.debug_review(&self.settings, ctx, &v);
}
}
if let Some(start) = self.debug.play_from.take() {
@ -2305,6 +2307,7 @@ impl eframe::App for App {
bytes: self.library.file_size(p),
})
.collect();
let review = self.settings.review.clone();
let actions = game.show(
ui,
&mut self.settings,
@ -2313,6 +2316,8 @@ impl eframe::App for App {
&mut self.translation,
input_enabled,
);
// The analysis options (its dialog) are kept.
self.settings_dirty |= self.settings.review != review;
self.reference_tab = game.reference_tab();
for a in actions {
match a {

View file

@ -80,6 +80,8 @@ pub struct GameView {
show_diagnostics: bool,
engine_settings_open: bool,
review: Review,
/// «Analyse» was pressed: started (or its dialog shown) where the settings are.
review_asked: bool,
side_tab: SideTab,
/// The game this one was opened from (reference tab): the title for "← back to".
pub previous: Option<String>,
@ -175,6 +177,7 @@ impl GameView {
show_diagnostics: false,
engine_settings_open: false,
review,
review_asked: false,
// Dev hook (screenshots): `CP_TAB=reference` opens that tab.
side_tab: if std::env::var("CP_TAB").as_deref() == Ok("reference") {
SideTab::Reference
@ -749,8 +752,19 @@ impl GameView {
});
self.sync_analysis(analysis);
// «Analyse»: at once with the options chosen before, else the dialog first.
if std::mem::take(&mut self.review_asked) {
if settings.review.chosen {
self.start_review(settings, true, ui.ctx(), &mut actions);
} else {
self.review.dialog_open = true;
}
}
match self.review.dialog(ui.ctx(), settings) {
Some(DialogAction::Start) => self.start_review(settings, true, ui.ctx(), &mut actions),
Some(DialogAction::Start) => {
settings.review.chosen = true;
self.start_review(settings, true, ui.ctx(), &mut actions);
}
Some(DialogAction::EngineSwitch) => actions.push(GameAction::EngineSwitch),
Some(DialogAction::OpenEngines) => actions.push(GameAction::OpenEngineSettings),
None => {}
@ -859,7 +873,7 @@ impl GameView {
))
.clicked()
{
self.review.dialog_open = true;
self.review_asked = true;
}
}
@ -1998,11 +2012,12 @@ impl GameView {
}
}
pub fn debug_review(&mut self, settings: &Settings, ctx: &egui::Context, start: bool) {
if start {
self.start_review(settings, false, ctx, &mut Vec::new());
} else {
self.review.dialog_open = true;
/// `how`: "dialog" opens the dialog, "ask" presses «Analyse», else the analysis starts.
pub fn debug_review(&mut self, settings: &Settings, ctx: &egui::Context, how: &str) {
match how {
"dialog" => self.review.dialog_open = true,
"ask" => self.review_asked = true,
_ => self.start_review(settings, false, ctx, &mut Vec::new()),
}
}
@ -3213,7 +3228,7 @@ impl GameView {
button(ui, 3, full);
}
if clicked[0] {
self.review.dialog_open = true;
self.review_asked = true;
}
if clicked[1] {
actions.push(GameAction::Rematch);
@ -4306,7 +4321,7 @@ impl GameView {
if self.review.has_data() || self.review.running() {
self.review.visible = !self.review.visible;
} else {
self.review.dialog_open = true;
self.review_asked = true;
}
}
// Escape cancels what is going on first (a preview of an engine line, a

View file

@ -148,13 +148,16 @@ pub struct Settings {
}
/// Options of the whole-game analysis (the engine is the active one).
#[derive(Clone, Debug, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(default)]
pub struct ReviewSettings {
/// Index into [`REVIEW_QUALITY`].
pub quality: usize,
pub threads: u32,
pub hash_mb: u32,
/// An analysis was started from the dialog once: «Analyse» starts the next one with
/// these options at once (the dialog stays for «Analyse again…»).
pub chosen: bool,
}
impl Default for ReviewSettings {
@ -163,6 +166,7 @@ impl Default for ReviewSettings {
quality: 1,
threads: default_threads(),
hash_mb: default_hash(),
chosen: false,
}
}
}

File diff suppressed because one or more lines are too long