Android: the game analysis in the fixed search; decision and docs
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run

- mobile-api GameReview.start(path, eval_file, full): the fixed search in
  one engine process per core (at most 4, by free memory), nice 10;
  ReviewState.stale, nps_per_process; review_estimate_secs().
- The start sheet keeps the description, the time and one button; quality,
  «Start over» and «Analyse again» are gone; a stale analysis offers
  «Update», evaluations of the PGN «Analyse with the engine».
- docs/decisions.md: the owner's decision with the numbers (search, memory,
  times, the first chess.com check); android-ui.md §21.2; chess.com README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-28 19:23:46 +03:00
parent 96e3bcd13f
commit 63a764bd16
17 changed files with 112 additions and 144 deletions

View file

@ -124,8 +124,6 @@ pub struct ReviewState {
pub searches: u32,
/// The speed of one engine process in the last run (0 when unknown).
pub nps_per_process: u64,
/// Engine processes a run uses on this phone (for the time estimate).
pub processes: u32,
/// The start position and the position after every main-line move.
pub points: Vec<ReviewPoint>,
/// Where the middlegame and the endgame begin, as indices of `points`.
@ -268,18 +266,6 @@ impl GameReview {
analysis.refresh(game);
snapshot(&st)
}
/// Seconds a full analysis takes at `nps_per_process` nodes per second of one
/// engine process (measured before, or a guess), in this phone's processes.
pub fn estimate_secs(&self, nps_per_process: u64) -> u32 {
let st = lock(&self.inner);
game_review::estimate_secs(
st.analysis.searches(),
nps_per_process as f64,
phone_processes(),
)
.ceil() as u32
}
}
impl Drop for GameReview {
@ -330,6 +316,15 @@ fn drain(st: &mut Inner) {
}
}
/// Seconds `searches` engine searches of the game analysis take at `nps_per_process`
/// nodes per second of one engine process (measured before, or a guess), in this
/// phone's engine processes.
#[uniffi::export]
pub fn review_estimate_secs(searches: u32, nps_per_process: u64) -> u32 {
game_review::estimate_secs(searches as usize, nps_per_process as f64, phone_processes()).ceil()
as u32
}
/// Engine processes of a game analysis on a phone: one per core, at most
/// [`game_review::PHONE_PROCESSES`] and what the free memory holds; all below the app
/// (nice 10).
@ -444,7 +439,6 @@ fn snapshot(st: &Inner) -> ReviewState {
positions: a.positions() as u32,
searches: a.searches() as u32,
nps_per_process: st.nps_per_process,
processes: phone_processes() as u32,
points,
middlegame: a.report.phases.middlegame.map(|i| i as u32),
endgame: a.report.phases.endgame.map(|i| i as u32),