Game screen: result in the header, move badges, refutation arrows, viewed games
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run

- Header shows the result (1-0, 0-1, ½-½) next to the players.
- Lichess-style badge on the moved piece: engine judgement (??, ?, ?!) when the
  game analysis is shown, otherwise the author's !/?/!!/!?/?! symbol.
- On a marked move the board shows the engine's refutation (opponent's best
  reply) and the best answer to it instead of the better move.
- Engine arrows are all blue and deduplicated; with the live engine on only its
  arrows are drawn.
- Library marks games opened before with a check (remembered by content in
  viewed.json); context menu to mark/unmark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubel 2026-10-18 14:00:19 +03:00
parent bb7d3b3fa6
commit f25826664a
9 changed files with 362 additions and 39 deletions

View file

@ -321,6 +321,19 @@ fn mark_block(ui: &mut Ui, n: &Notation, id: NodeId, mark: &Mark, out: &mut Nota
});
}
/// Colour of a move-assessment NAG ($1-$6), the Lichess palette.
pub fn assessment_color(nag: Nag) -> Option<Color32> {
Some(match nag.0 {
1 => Color32::from_rgb(0x62, 0x9c, 0x2e),
2 => Color32::from_rgb(0xe6, 0x8f, 0x00),
3 => Color32::from_rgb(0x22, 0xac, 0x9a),
4 => Color32::from_rgb(0xdf, 0x53, 0x53),
5 => Color32::from_rgb(0xea, 0x45, 0xd8),
6 => Color32::from_rgb(0x56, 0xb4, 0xe9),
_ => return None,
})
}
/// Move-assessment glyph (`!`, `?`, …) with its color, plus position assessments.
fn move_glyph(nags: &[Nag]) -> (String, Option<Color32>) {
let mut s = String::new();
@ -331,15 +344,10 @@ fn move_glyph(nags: &[Nag]) -> (String, Option<Color32>) {
continue;
};
if nag.is_move_assessment() {
color = Some(match nag.0 {
1 => Color32::from_rgb(0x62, 0x9c, 0x2e),
2 => Color32::from_rgb(0xe6, 0x8f, 0x00),
3 => Color32::from_rgb(0x22, 0xac, 0x9a),
4 => Color32::from_rgb(0xdf, 0x53, 0x53),
5 => Color32::from_rgb(0xea, 0x45, 0xd8),
6 => Color32::from_rgb(0x56, 0xb4, 0xe9),
_ => continue,
});
let Some(c) = assessment_color(*nag) else {
continue;
};
color = Some(c);
s.push_str(sym);
} else {
s.push(' ');