Android: fixes from the tester's report

- An old evaluation never shows for a new position, not even for a frame:
  every snapshot carries its position and the screen compares it with the
  board; the engine handle is held for 40 ms at most.
- Turning the engine off while it starts no longer leaves a Stockfish process
  behind (generations in EngineSession).
- Landscape: the board on the left, the notation, engine and buttons beside it.
- "Undo" after removing a database keeps the access to its file; picking a
  file again restores the access.
- After Android restarts the app the same game comes back (the search is kept).
- Mate and stalemate are named instead of waiting for the engine.
- The download sheet shows progress and "Cancel" at once; a cancelled download
  stops reading and never writes the file together with the next one.
- Plain error texts with "Remove from list"; evaluations rounded ("+0.5",
  "0.0", "#−2"); search results start at the top; tag names translated;
  "PGN copied" / "FEN copied".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-22 02:44:40 +03:00
parent 305fff20b6
commit 7eac8db29a
13 changed files with 416 additions and 181 deletions

View file

@ -36,7 +36,7 @@ pub enum EngineFailure {
pub struct EngineLine {
/// 1 for the best line.
pub multipv: u32,
/// "+0.45", "−1.20", "0.00", "#3" (White mates), "−#2" (Black mates).
/// "+0.45", "−1.20", "0.00", "#3" (White mates), "#−2" (Black mates).
pub eval: String,
/// Centipawns for White, when the score is not a mate.
pub cp: Option<i32>,
@ -288,7 +288,7 @@ fn engine_line(root: &Chess, multipv: u32, score: Score, pv: &[String]) -> Engin
if winner == Side::White {
(format!("#{n}"), None, Some(n))
} else {
(format!("\u{2212}#{n}"), None, Some(-n))
(format!("#\u{2212}{n}"), None, Some(-n))
}
}
};
@ -366,7 +366,7 @@ mod tests {
(Some("e7"), Some("e5"))
);
let m = engine_line(&black_to_move, 1, Score::Mate(2), &[]);
assert_eq!((m.eval.as_str(), m.mate), ("\u{2212}#2", Some(-2)));
assert_eq!((m.eval.as_str(), m.mate), ("#\u{2212}2", Some(-2)));
assert_eq!(pawns(0), "0.00");
assert_eq!(pawns(-120), "\u{2212}1.20");
}