Android: game report — mistakes, blunders and accuracy, as on the desktop

The game analysis of the desktop (evaluations of the main line, judgements, accuracy,
cache and the engine job) moves into a shared crate, game-review, so both apps give the
same numbers. The desktop uses it unchanged in behaviour.

On Android, ⋮ → «Game analysis» runs Stockfish over the main line in its own process
(the live engine waits): an evaluation graph and a status row between the board and the
notation, marks in the notation, the better line of an error on the board, a report sheet
with both players side by side. Games with [%eval] and games analysed before show their
report at once. The analysis stops with the screen and goes on after it, also after the
phone is turned, and is cached as it goes.

Reviewed by an independent tester and designer (docs/design/android-ui.md §21, §22).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-23 14:10:58 +03:00
parent 7fcc75c7af
commit 1661e238d8
31 changed files with 3016 additions and 567 deletions

View file

@ -286,17 +286,30 @@ fn engine_line(root: &Chess, multipv: u32, score: Score, pv: &[String]) -> Engin
bound: uci::ScoreBound::Exact,
}
.to_white(side);
let (eval, cp, mate) = match white.eval {
WhiteEval::Cp(cp) => (pawns(cp), Some(cp), None),
let (cp, mate) = match white.eval {
WhiteEval::Cp(cp) => (Some(cp), None),
WhiteEval::Mate { winner, moves } => {
let n = moves as i32;
if winner == Side::White {
(format!("#{n}"), None, Some(n))
} else {
(format!("#\u{2212}{n}"), None, Some(-n))
}
(None, Some(if winner == Side::White { n } else { -n }))
}
};
line_with(root, multipv, cp, mate, pv)
}
/// The line `pv` (UCI) from `root` with its evaluation for White: centipawns, or moves
/// to mate (positive when White mates). Stops at the first move that is not legal.
pub(crate) fn line_with(
root: &Chess,
multipv: u32,
cp: Option<i32>,
mate: Option<i32>,
pv: &[String],
) -> EngineLine {
let eval = match (mate, cp) {
(Some(n), _) if n < 0 => format!("#\u{2212}{}", -n),
(Some(n), _) => format!("#{n}"),
(None, cp) => pawns(cp.unwrap_or(0)),
};
let mut pos = root.clone();
let mut words = Vec::new();
let mut steps = Vec::new();
@ -337,7 +350,7 @@ fn engine_line(root: &Chess, multipv: u32, score: Score, pv: &[String]) -> Engin
}
/// Centipawns as pawns with a sign: "+0.45", "−1.20", "0.00".
fn pawns(cp: i32) -> String {
pub(crate) fn pawns(cp: i32) -> String {
let sign = match cp.signum() {
1 => "+",
-1 => "\u{2212}",