Play against Maia: dialog, clocks, game screen, result strip

«⚔ Play» (Ctrl+G) opens «Play against the computer»: name and rating
(optional), strength 600–2600 (or weaker/as me/stronger), colour, Lichess time
controls, custom, no clock. The game screen in play mode: clock cards above
and below the notation (read-only), take back, resign (abort before the first
moves); no engine, analysis or editing. Maia answers in a background thread
with a human-like pause bounded so she never loses on time; stale answers are
dropped. Endings: mate, stalemate, no material, threefold, fifty moves, time
(draw when the other side cannot mate), resignation; then the result strip
(Analyse, Rematch, New game, Save to a database) and an ordinary game with the
tags of a played game and [%clk]. Leaving during a game asks (resign and add /
resign and leave / keep playing), the clocks wait meanwhile. maia reads the
published PyTorch checkpoint directly (zip + a small pickle reader that refuses
everything but tensors); maia_download fetches it on request (pinned revision,
SHA-256). Dev hooks CP_PLAY, CP_PLAY_AUTO, CP_MAIA. Russian texts; the other
languages follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-25 04:10:02 +03:00
parent 8b468f99a7
commit 9cd28b9039
18 changed files with 2843 additions and 151 deletions

View file

@ -22,6 +22,8 @@ pub struct Notation<'a> {
pub translations: Option<&'a HashMap<String, Translated>>,
/// The comment being written, drawn where the comment stands (user-comments.md §3).
pub editor: Option<&'a mut CommentEditor>,
/// A game being played: moves only show their position (no menus, no editing).
pub read_only: bool,
}
/// Result of a frame of the notation panel.
@ -328,6 +330,9 @@ fn handle_move_response(
resp.scroll_to_me(Some(egui::Align::Center));
}
let is_variation = n.game.child_index(id).is_some_and(|i| i > 0) || !n.game.is_mainline(id);
if n.read_only {
return;
}
// The menu is about the move it opens on: the move becomes the current one.
if resp.secondary_clicked() && id != n.cursor {
out.clicked = Some(id);