From 9ecc1a0a074b4bb432db3f7d771b412932962401 Mon Sep 17 00:00:00 2001 From: vrubelroman Date: Sun, 25 Oct 2026 12:12:35 +0300 Subject: [PATCH] Premoves, the auto-queen setting, the play dialog redone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Premoves in the game against Maia, as on Lichess: while she thinks, a move of the user's piece by its pattern on an empty board (a pawn forward and both diagonals, sliders through pieces, the king at home to castle with an own rook, by the king's square or the rook's) is set and shown in dark blue; after her move it is played at once when legal (a promotion as a queen), else dropped. A right click or a click beside the own pieces cancels it; a take-back, the leave question and the end drop it. A piece in hand stays there when Maia moves, unless she took it. Settings › Board: «Always promote to a queen», off by default — then the piece is chosen, as before. The dialog «Play against the computer» redone after the owner's review: You, Opponent (the strength in the title, the slider edge to edge with 600/2600, Weaker · As me · Stronger lit when they match, or a line asking for the rating), Colour, Time; every choice a framed tile of one height, the tiles of a row sharing its width; time 3+0…30+20 without category captions, Custom with aligned sliders, Unlimited (no clocks) as a double tile; a solid scroll bar in a low window, where the introduction is left out. Dev hook CP_PREMOVE. Adjourning a game recorded as a task. Co-Authored-By: Claude Opus 5.5 --- apps/desktop/src/board.rs | 203 ++++++++++++++++++++++- apps/desktop/src/board_search.rs | 2 + apps/desktop/src/game_view.rs | 46 +++++- apps/desktop/src/i18n.rs | 128 +++++++++------ apps/desktop/src/large_db.rs | 2 + apps/desktop/src/play.rs | 272 +++++++++++++++++-------------- apps/desktop/src/settings.rs | 3 + apps/desktop/src/settings_ui.rs | 6 + docs/dev/desktop.md | 2 +- docs/dev/tasks.md | 5 + 10 files changed, 485 insertions(+), 184 deletions(-) diff --git a/apps/desktop/src/board.rs b/apps/desktop/src/board.rs index a875228..a913096 100644 --- a/apps/desktop/src/board.rs +++ b/apps/desktop/src/board.rs @@ -47,6 +47,9 @@ pub struct BoardState { /// A move was dropped by dragging the piece from this square: that piece is /// already in place (a castling rook or a captured pawn still move). dropped: Option, + /// A premove set while the opponent thinks (from, to): played at once after their + /// move if it is legal then (Lichess). + premove: Option<(Square, Square)>, } impl BoardState { @@ -57,6 +60,30 @@ impl BoardState { self.promotion = None; } + /// The opponent has moved: a piece of `own` in the hand (selected or dragged) stays + /// there, as on Lichess; one that was captured, and a promotion choice, are dropped. + pub fn opponent_moved(&mut self, board: &Board, own: Color) { + let mine = |sq: Square| board.piece_at(sq).is_some_and(|p| p.color == own); + self.selected = self.selected.filter(|&s| mine(s)); + self.drag = self.drag.filter(|&s| mine(s)); + self.promotion = None; + } + + /// The premove set, taken (it is played or dropped after the opponent's move). + pub fn take_premove(&mut self) -> Option<(Square, Square)> { + self.premove.take() + } + + /// Sets a premove (dev hook `CP_PREMOVE`). + pub fn set_premove(&mut self, from: Square, to: Square) { + self.premove = Some((from, to)); + } + + /// Drops the premove (a take-back, the end of the game). + pub fn clear_premove(&mut self) { + self.premove = None; + } + /// The shape the user has just drawn, once. pub fn take_shape(&mut self) -> Option { self.shape.take() @@ -145,6 +172,10 @@ pub struct BoardView<'a> { pub pieces: PieceSet, /// Seconds a move takes to slide (0: no animation). pub animation: f32, + /// Not this side's turn, but it may set a premove (a game against the computer). + pub premove: Option, + /// A pawn reaching the last rank becomes a queen without asking. + pub auto_queen: bool, } impl BoardView<'_> { @@ -162,9 +193,15 @@ impl BoardView<'_> { let painter = ui.painter_at(rect); let legal = self.pos.legal_moves(); let mut result = None; + // A premove is set instead of a move: the board takes input for that side. + let premoving = !self.interactive && self.premove.is_some(); + if !self.interactive && !premoving { + state.selected = None; + state.drag = None; + } // --- input ----------------------------------------------------------------------- - if self.interactive && state.promotion.is_none() { + if (self.interactive || premoving) && state.promotion.is_none() { let pointer = response.interact_pointer_pos(); if response.drag_started() { let origin = ui.input(|i| i.pointer.press_origin()).or(pointer); @@ -197,7 +234,13 @@ impl BoardView<'_> { result = self.try_move(state, &legal, from, sq); } Some(from) if from == sq => state.selected = None, - _ => state.selected = self.own_piece(sq).then_some(sq), + _ => { + state.selected = self.own_piece(sq).then_some(sq); + // A click beside the own pieces cancels a premove. + if premoving && state.selected.is_none() { + state.premove = None; + } + } } } // The right button draws: a drag — an arrow, a click — a circle on the square. @@ -222,6 +265,7 @@ impl BoardView<'_> { } if response.secondary_clicked() { state.clear(); + state.premove = None; if let Some(sq) = pointer.and_then(|p| geo.square_at(p)) { let color = shape_color_for(ui.input(|i| i.modifiers)); state.shape = Some(Drawn::Circle(color, sq)); @@ -276,6 +320,10 @@ impl BoardView<'_> { hl(&painter, from, self.theme.last_move); hl(&painter, to, self.theme.last_move); } + if let Some((from, to)) = state.premove.filter(|_| premoving) { + hl(&painter, from, PREMOVE); + hl(&painter, to, PREMOVE); + } if let Some(sel) = state.selected { hl(&painter, sel, self.theme.selected); } @@ -323,8 +371,17 @@ impl BoardView<'_> { } } + // where the selected piece may premove to + if let Some(sel) = state.selected.filter(|_| premoving) + && let Some(piece) = self.pos.board().piece_at(sel) + { + for to in premove_targets(self.pos.board(), sel, piece) { + let r = geo.square_rect(to); + painter.circle_filled(r.center(), sq_size * 0.15, PREMOVE_DOT); + } + } // legal targets of the selected piece - if let Some(sel) = state.selected { + if let Some(sel) = state.selected.filter(|_| !premoving) { for m in legal.iter().filter(|m| m.from() == Some(sel)) { let to = ui_target(m); let r = geo.square_rect(to); @@ -459,11 +516,19 @@ impl BoardView<'_> { result } + /// The side that moves on this board now: the side to move, or the premoving one. + fn mover(&self) -> Color { + match self.premove { + Some(c) if !self.interactive => c, + _ => self.pos.turn(), + } + } + fn own_piece(&self, sq: Square) -> bool { self.pos .board() .piece_at(sq) - .is_some_and(|p| p.color == self.pos.turn()) + .is_some_and(|p| p.color == self.mover()) } fn try_move( @@ -473,6 +538,19 @@ impl BoardView<'_> { from: Square, to: Square, ) -> Option { + if !self.interactive && self.premove.is_some() { + let piece = self.pos.board().piece_at(from)?; + if premove_targets(self.pos.board(), from, piece).contains(to) { + state.premove = Some((from, to)); + state.selected = None; + } else { + state.selected = self.own_piece(to).then_some(to); + if state.selected.is_none() { + state.premove = None; + } + } + return None; + } let candidates: Vec<&Move> = legal .iter() .filter(|m| m.from() == Some(from) && (ui_target(m) == to || m.to() == to)) @@ -483,6 +561,10 @@ impl BoardView<'_> { None } [m] => Some(*(*m)), + _ if self.auto_queen && candidates.iter().all(|m| m.is_promotion()) => candidates + .iter() + .find(|m| m.promotion() == Some(Role::Queen)) + .map(|m| *(*m)), _ if candidates.iter().all(|m| m.is_promotion()) => { state.promotion = Some((from, to)); state.selected = None; @@ -533,6 +615,73 @@ impl BoardView<'_> { } } +/// The premove highlight (Lichess's dark blue) and its target dots. +const PREMOVE: Color32 = Color32::from_rgba_premultiplied(10, 15, 43, 128); +const PREMOVE_DOT: Color32 = Color32::from_rgba_premultiplied(10, 15, 43, 140); + +/// Where a piece may premove: how it moves on an empty board (the position will have +/// changed), a pawn forward and diagonally, the king at home also to castle with an own +/// rook of `board` on the a- or h-file — on the king's square or the rook's (chessground +/// `premove.ts`). +pub fn premove_targets(board: &Board, from: Square, piece: Piece) -> shakmaty::Bitboard { + use shakmaty::{Bitboard, attacks}; + match piece.role { + Role::Pawn => { + let mut b = attacks::pawn_attacks(piece.color, from); + let step: i32 = if piece.color == Color::White { 8 } else { -8 }; + let home = if piece.color == Color::White { + Rank::Second + } else { + Rank::Seventh + }; + if let Some(one) = from.offset(step) { + b.add(one); + if from.rank() == home + && let Some(two) = from.offset(2 * step) + { + b.add(two); + } + } + b + } + Role::King => { + let mut b = attacks::king_attacks(from); + let back = piece.color.backrank(); + let rook = Piece { + color: piece.color, + role: Role::Rook, + }; + if from == Square::from_coords(File::E, back) { + for (rook_file, king_file) in [(File::H, File::G), (File::A, File::C)] { + let r = Square::from_coords(rook_file, back); + if board.piece_at(r) == Some(rook) { + b.add(Square::from_coords(king_file, back)); + b.add(r); + } + } + } + b + } + _ => attacks::attacks(from, piece, Bitboard::EMPTY), + } +} + +/// The move a premove means in `pos`, if it is legal there (a pawn promotes to a queen). +pub fn premove_move(pos: &Chess, from: Square, to: Square) -> Option { + let legal = pos.legal_moves(); + let mut found = legal + .iter() + .filter(|m| m.from() == Some(from) && (ui_target(m) == to || m.to() == to)); + let first = *found.next()?; + if first.is_promotion() { + return legal + .iter() + .find(|m| m.from() == Some(from) && m.to() == to && m.promotion() == Some(Role::Queen)) + .copied(); + } + Some(first) +} + /// Square the user clicks to make a move: for castling, the king's destination. pub fn ui_target(m: &Move) -> Square { match (m, m.castling_side()) { @@ -625,6 +774,52 @@ fn draw_arrow(painter: &egui::Painter, geo: &Geometry, a: &Arrow) { #[cfg(test)] mod tests { + #[test] + fn premoves_as_on_lichess() { + use shakmaty::fen::Fen; + let sq = |s: &str| s.parse::().unwrap(); + let wp = Piece { + color: Color::White, + role: Role::Pawn, + }; + // A pawn: forward one or two from home, both diagonals. + let start = Board::default(); + let t = premove_targets(&start, sq("e2"), wp); + for s in ["e3", "e4", "d3", "f3"] { + assert!(t.contains(sq(s)), "{s}"); + } + assert_eq!(t.count(), 4); + // A rook through pieces: the position will change. + let wr = Piece { + color: Color::White, + role: Role::Rook, + }; + assert_eq!(premove_targets(&start, sq("a1"), wr).count(), 14); + // The king at home: also its castling squares. + let wk = Piece { + color: Color::White, + role: Role::King, + }; + // The king at home: castling by its square or the rook's, only with the rook. + let k = premove_targets(&start, sq("e1"), wk); + assert!(k.contains(sq("g1")) && k.contains(sq("h1")) && k.contains(sq("c1"))); + let no_h_rook: Board = "4k3/8/8/8/8/8/8/R3K3".parse().unwrap(); + let k = premove_targets(&no_h_rook, sq("e1"), wk); + assert!(!k.contains(sq("g1")) && k.contains(sq("c1")) && k.contains(sq("a1"))); + // Played when legal; a promotion becomes a queen; castling by the king's square. + let pos: Chess = "4k3/1P6/8/8/8/8/8/4K2R w K - 0 1" + .parse::() + .unwrap() + .into_position(shakmaty::CastlingMode::Standard) + .unwrap(); + let m = premove_move(&pos, sq("b7"), sq("b8")).unwrap(); + assert_eq!(m.promotion(), Some(Role::Queen)); + assert!(premove_move(&pos, sq("e1"), sq("g1")).unwrap().is_castle()); + assert!(premove_move(&pos, sq("e1"), sq("h1")).unwrap().is_castle()); + assert!(premove_move(&pos, sq("h1"), sq("h8")).is_some()); + assert!(premove_move(&pos, sq("b7"), sq("c8")).is_none()); + } + use super::*; use shakmaty::fen::Fen; use shakmaty::san::San; diff --git a/apps/desktop/src/board_search.rs b/apps/desktop/src/board_search.rs index 5e9316b..887ade2 100644 --- a/apps/desktop/src/board_search.rs +++ b/apps/desktop/src/board_search.rs @@ -523,6 +523,8 @@ impl SearchBoard { theme: settings.board_theme.theme(), pieces: settings.piece_set, animation: settings.animation.seconds(), + premove: None, + auto_queen: settings.auto_queen, }; let played = ui .allocate_ui(vec2(side, side), |ui| view.show(ui, &mut self.board)) diff --git a/apps/desktop/src/game_view.rs b/apps/desktop/src/game_view.rs index 85d9c34..7ab0bb6 100644 --- a/apps/desktop/src/game_view.rs +++ b/apps/desktop/src/game_view.rs @@ -1229,6 +1229,8 @@ impl GameView { theme: settings.board_theme.theme(), pieces: settings.piece_set, animation: settings.animation.seconds(), + premove: self.premove_side(), + auto_queen: settings.auto_queen, }; if let Some(m) = view.show(ui, &mut self.board) { self.play_move(m, actions); @@ -1961,6 +1963,12 @@ impl GameView { ctx: &egui::Context, ) { use crate::play::{Clock, Opponent, Session}; + // Dev hook `CP_PREMOVE=e7e5`: a premove set at the start (to see it without a mouse). + if let Some(pm) = std::env::var("CP_PREMOVE").ok().filter(|p| p.len() == 4) + && let (Ok(from), Ok(to)) = (pm[..2].parse(), pm[2..].parse()) + { + self.board.set_premove(from, to); + } let maia = format!("Maia {}", start.strength); let you = if start.user_name.is_empty() { "?".to_owned() @@ -2043,6 +2051,17 @@ impl GameView { .map_or(Color::White, |p| p.turn()) } + /// The side that may set a premove now: the user, while Maia is to move, at the + /// current position of the game. + fn premove_side(&self) -> Option { + let s = self.play.as_ref()?; + (self.preview.is_none() + && self.play_leave.is_none() + && self.play_turn() != s.user + && self.cursor == self.play_end_node()) + .then_some(s.user) + } + /// The user may move: their turn, at the current position, Maia not thinking. fn user_may_move(&self) -> bool { match &self.play { @@ -2115,7 +2134,20 @@ impl GameView { .annotate(id, Vec::new(), vec![crate::play::clk_command(left)]); } } - self.goto(id); + // Maia's move: what the user holds in hand stays there (Lichess); any other + // move goes to its position as usual. + let user = self.play.as_ref().map(|s| s.user); + if user.is_some_and(|u| u != mover) && self.cursor == end { + self.commit_editor(); + self.cursor = id; + self.scroll_to_cursor = true; + self.preview = None; + if let (Some(u), Some(pos)) = (user, self.game.position(id)) { + self.board.opponent_moved(pos.board(), u); + } + } else { + self.goto(id); + } if let Some(snd) = self.sound_for(id) { actions.push(GameAction::Sound(snd)); } @@ -2156,6 +2188,15 @@ impl GameView { if let Some((m, pause)) = s.opponent.answer() { // Maia's clock takes her pause, not the program's computing. self.play_add(m, Some(pause), actions); + // The user's premove, at once when it is legal now (else it is dropped). + if let Some((from, to)) = self.board.take_premove() + && self.play.is_some() + && self.user_may_move() + && let Some(pos) = self.game.position(self.play_end_node()) + && let Some(m) = crate::board::premove_move(pos, from, to) + { + self.play_add(m, None, actions); + } } let now = std::time::Instant::now(); let end_pos = self.game.position(self.play_end_node()).cloned(); @@ -2181,6 +2222,7 @@ impl GameView { return; }; s.opponent.forget(); + self.board.clear_premove(); let now = std::time::Instant::now(); let left = s.clock.as_mut().map(|c| { c.stop(now); @@ -2225,6 +2267,7 @@ impl GameView { /// Takes back the user's last move and Maia's answer to it (no variation is left). fn take_back(&mut self) { + self.board.clear_premove(); let Some(s) = self.play.as_mut() else { return }; s.opponent.forget(); let user = s.user; @@ -2346,6 +2389,7 @@ impl GameView { /// Leaving a game in progress (any way: back, the window closed, …) asks first; /// the clocks wait while the question is open. pub fn ask_leave(&mut self, intent: crate::app::CloseIntent) { + self.board.clear_premove(); if self.play_leave.is_none() { self.play_leave = Some((intent, std::time::Instant::now())); } diff --git a/apps/desktop/src/i18n.rs b/apps/desktop/src/i18n.rs index 6f46095..691abfb 100644 --- a/apps/desktop/src/i18n.rs +++ b/apps/desktop/src/i18n.rs @@ -10561,17 +10561,6 @@ const ROWS: &[[&str; 9]] = &[ "Reyting:", "Рейтинг:", ], - [ - "Not required; the opponent's strength is chosen relative to it.", - "Не обязательно; по нему подбирается сила соперника.", - "Facultatif ; la force de l’adversaire est choisie par rapport à lui.", - "Optional; die Stärke des Gegners wird danach gewählt.", - "Opcional; la fuerza del rival se elige en relación con él.", - "Facoltativo; la forza dell’avversario si sceglie in base a esso.", - "Opcional; a força do adversário é escolhida em relação a ele.", - "Majburiy emas; raqib kuchi shunga nisbatan tanlanadi.", - "Міндетті емес; қарсыластың күші соған қатысты таңдалады.", - ], [ "Your colour", "Цвет", @@ -10693,28 +10682,6 @@ const ROWS: &[[&str; 9]] = &[ "Kuchliroq", "Күштірек", ], - [ - "Enter your rating to choose relative to it", - "Укажите свой рейтинг, чтобы выбирать относительно него", - "Indiquez votre classement pour choisir par rapport à lui", - "Geben Sie Ihre Wertungszahl an, um relativ dazu zu wählen", - "Indica tu rating para elegir en relación con él", - "Inserisci il tuo rating per scegliere in base a esso", - "Informe seu rating para escolher em relação a ele", - "Unga nisbatan tanlash uchun reytingingizni kiriting", - "Соған қатысты таңдау үшін рейтингіңізді енгізіңіз", - ], - [ - "Download Maia", - "Скачать Maia", - "Télécharger Maia", - "Maia herunterladen", - "Descargar Maia", - "Scarica Maia", - "Baixar a Maia", - "Maia yuklab olish", - "Maia-ны жүктеп алу", - ], [ "Play", "Играть", @@ -10869,17 +10836,6 @@ const ROWS: &[[&str; 9]] = &[ "Yuklab olish va o‘ynash", "Жүктеп алып ойнау", ], - [ - "∞\nNo time limit", - "∞\nБез ограничения", - "∞\nSans limite", - "∞\nOhne Zeitlimit", - "∞\nSin límite", - "∞\nSenza limite", - "∞\nSem limite", - "∞\nCheklovsiz", - "∞\nШектеусіз", - ], [ "No clocks: think as long as you like", "Без часов: думайте сколько угодно", @@ -10892,15 +10848,81 @@ const ROWS: &[[&str; 9]] = &[ "Сағатсыз: қалағаныңызша ойланыңыз", ], [ - "Maia's rating is on the Lichess scale, which runs higher than FIDE and club ratings: Maia 1500 is weaker than a club player rated 1500.", - "Рейтинг Maia — по шкале Lichess, а она выше ФИДЕ и клубной: Maia 1500 слабее клубного игрока с рейтингом 1500.", - "Le classement de Maia suit l’échelle Lichess, plus haute que celles de la FIDE et des clubs : Maia 1500 est plus faible qu’un joueur de club classé 1500.", - "Maias Wertung folgt der Lichess-Skala, die höher liegt als FIDE- und Vereinswertungen: Maia 1500 ist schwächer als ein Vereinsspieler mit 1500.", - "El rating de Maia está en la escala de Lichess, más alta que la FIDE y la de club: Maia 1500 es más débil que un jugador de club con 1500.", - "Il rating di Maia è sulla scala di Lichess, più alta di quella FIDE e dei circoli: Maia 1500 è più debole di un giocatore di circolo con 1500.", - "O rating de Maia está na escala do Lichess, mais alta que a FIDE e a de clube: Maia 1500 é mais fraca que um jogador de clube com 1500.", - "Maia reytingi Lichess shkalasida, u FIDE va klub reytinglaridan yuqori: Maia 1500 reytingi 1500 bo‘lgan klub o‘yinchisidan kuchsizroq.", - "Maia рейтингі Lichess шкаласы бойынша, ол ФИДЕ мен клуб рейтингтерінен жоғары: Maia 1500 рейтингі 1500 клуб ойыншысынан әлсіздеу.", + "Always promote to a queen", + "Всегда превращать пешку в ферзя", + "Toujours promouvoir en dame", + "Immer in eine Dame umwandeln", + "Coronar siempre en dama", + "Promuovi sempre a donna", + "Sempre promover a dama", + "Piyodani doim farzinga aylantirish", + "Пешканы әрқашан уәзірге айналдыру", + ], + [ + "Off: a pawn on the last rank asks which piece it becomes", + "Выключено: пешка на последней горизонтали спрашивает, в какую фигуру превратиться", + "Désactivé : un pion sur la dernière rangée demande en quelle pièce il se transforme", + "Aus: Ein Bauer auf der letzten Reihe fragt, in welche Figur er sich umwandelt", + "Desactivado: un peón en la última fila pregunta en qué pieza se convierte", + "Disattivato: un pedone sull’ultima traversa chiede in quale pezzo trasformarsi", + "Desligado: um peão na última fileira pergunta em qual peça se transforma", + "O‘chiq: oxirgi qatordagi piyoda qaysi donaga aylanishini so‘raydi", + "Өшірулі: соңғы көлденеңдегі пешка қай тасқа айналатынын сұрайды", + ], + [ + "not required", + "не обязательно", + "facultatif", + "optional", + "opcional", + "facoltativo", + "opcional", + "majburiy emas", + "міндетті емес", + ], + [ + "Opponent — Maia {elo}", + "Соперник — Maia {elo}", + "Adversaire — Maia {elo}", + "Gegner — Maia {elo}", + "Rival — Maia {elo}", + "Avversario — Maia {elo}", + "Adversário — Maia {elo}", + "Raqib — Maia {elo}", + "Қарсылас — Maia {elo}", + ], + [ + "Unlimited", + "Бессрочно", + "Illimité", + "Unbegrenzt", + "Ilimitado", + "Illimitato", + "Ilimitado", + "Cheklovsiz", + "Шектеусіз", + ], + [ + "The Lichess scale: Maia 1500 is weaker than a club player rated 1500.", + "Шкала Lichess: Maia 1500 слабее клубного игрока с рейтингом 1500.", + "Échelle Lichess : Maia 1500 est plus faible qu’un joueur de club classé 1500.", + "Lichess-Skala: Maia 1500 ist schwächer als ein Vereinsspieler mit 1500.", + "Escala de Lichess: Maia 1500 es más débil que un jugador de club con 1500.", + "Scala Lichess: Maia 1500 è più debole di un giocatore di circolo con 1500.", + "Escala do Lichess: Maia 1500 é mais fraca que um jogador de clube com 1500.", + "Lichess shkalasi: Maia 1500 reytingi 1500 bo‘lgan klub o‘yinchisidan kuchsizroq.", + "Lichess шкаласы: Maia 1500 рейтингі 1500 клуб ойыншысынан әлсіздеу.", + ], + [ + "Enter your rating: Weaker · As me · Stronger will choose for you", + "Укажите рейтинг — сила подберётся кнопками Слабее · Как я · Сильнее", + "Indiquez votre classement : Plus faible · Comme moi · Plus fort choisiront pour vous", + "Geben Sie Ihre Wertung ein: Schwächer · Wie ich · Stärker wählen dann für Sie", + "Indica tu rating: Más débil · Como yo · Más fuerte elegirán por ti", + "Inserisci il tuo rating: Più debole · Come me · Più forte sceglieranno per te", + "Informe seu rating: Mais fraco · Como eu · Mais forte escolherão por você", + "Reytingingizni kiriting: Kuchsizroq · Men kabi · Kuchliroq siz uchun tanlaydi", + "Рейтингіңізді енгізіңіз: Әлсіздеу · Мендей · Күштірек өзі таңдайды", ], ]; diff --git a/apps/desktop/src/large_db.rs b/apps/desktop/src/large_db.rs index 7b2133a..f6ffa23 100644 --- a/apps/desktop/src/large_db.rs +++ b/apps/desktop/src/large_db.rs @@ -2431,6 +2431,8 @@ fn chip(ui: &mut Ui, c: &Condition) -> (bool, bool) { theme: theme.theme(), pieces: *pieces, animation: 0.0, + premove: None, + auto_queen: false, }; ui.allocate_ui(vec2(160.0, 160.0), |ui| { view.show(ui, &mut crate::board::BoardState::default()) diff --git a/apps/desktop/src/play.rs b/apps/desktop/src/play.rs index 5221e62..df6cf0e 100644 --- a/apps/desktop/src/play.rs +++ b/apps/desktop/src/play.rs @@ -724,98 +724,168 @@ impl Dialog { ui.set_width(460.0); ui.heading(tr("Play against the computer")); // The body scrolls in a low window; the buttons below it stay in view. + // A solid bar, seen without hovering: in a low window the time is below it. + ui.style_mut().spacing.scroll = egui::style::ScrollStyle::solid(); let rating = egui::ScrollArea::vertical() .max_height(body_h) .auto_shrink([false, true]) + .scroll_bar_visibility(egui::scroll_area::ScrollBarVisibility::VisibleWhenNeeded) .show(ui, |ui| { - ui.label( - RichText::new(tr( - "Maia plays like a human of the chosen rating: it makes the moves people of that level make, mistakes included.", - )) - .weak(), - ); - ui.add_space(10.0); + // In a low window the choices matter more than the introduction. + if body_h >= 420.0 { + ui.label( + RichText::new(tr( + "Maia plays like a human of the chosen rating: it makes the moves people of that level make, mistakes included.", + )) + .weak(), + ); + } + + // The blocks in the order of the choice: who plays, against whom, which + // colour, how long. Every choice is a framed tile; the tiles of a row share + // its width. + const W: f32 = 460.0; + const GAP: f32 = 6.0; + const TILE_H: f32 = 32.0; + let section = |ui: &mut egui::Ui, text: &str| { + ui.add_space(12.0); + ui.label(RichText::new(text).strong().size(15.0)); + ui.add_space(2.0); + }; + let choice = |ui: &mut egui::Ui, on: bool, text: &str, size: [f32; 2]| { + ui.add_sized( + size, + egui::Button::selectable(on, RichText::new(text).size(14.0)) + .frame_when_inactive(true), + ) + }; + ui.spacing_mut().item_spacing = egui::vec2(GAP, GAP); // You. - ui.label(RichText::new(tr("You")).strong()); + section(ui, tr("You")); + egui::Grid::new("play_you") + .num_columns(2) + .spacing(egui::vec2(8.0, GAP)) + .show(ui, |ui| { + ui.label(tr("Name:")); + let r = ui.add( + egui::TextEdit::singleline(&mut self.name).desired_width(f32::INFINITY), + ); + if std::mem::take(&mut self.focus) && self.name.is_empty() { + r.request_focus(); + } + ui.end_row(); + ui.label(tr("Rating:")); + ui.horizontal(|ui| { + let r = ui.add( + egui::TextEdit::singleline(&mut self.rating) + .desired_width(70.0), + ); + if r.changed() { + self.rating.retain(|c| c.is_ascii_digit()); + self.rating.truncate(4); + } + ui.label(RichText::new(tr("not required")).weak()); + }); + ui.end_row(); + }); + + // The opponent: Maia's rating, or relative to the user's. + section( + ui, + &crate::i18n::trf("Opponent — Maia {elo}", &[("elo", &self.prefs.strength)]), + ); ui.horizontal(|ui| { - ui.label(tr("Name:")); - let r = ui.add(egui::TextEdit::singleline(&mut self.name).desired_width(200.0)); - if std::mem::take(&mut self.focus) && self.name.is_empty() { - r.request_focus(); - } - ui.label(tr("Rating:")); - let r = ui.add( - egui::TextEdit::singleline(&mut self.rating) - .desired_width(60.0) - .hint_text("1500"), + let end = |ui: &mut egui::Ui, v: u32| { + ui.add_sized([34.0, 18.0], egui::Label::new(RichText::new(v.to_string()).weak())) + }; + end(ui, STRENGTH_MIN); + ui.spacing_mut().slider_width = W - 2.0 * 34.0 - 2.0 * GAP; + ui.add( + egui::Slider::new(&mut self.prefs.strength, STRENGTH_MIN..=STRENGTH_MAX) + .step_by(100.0) + .show_value(false), ); - if r.changed() { - self.rating.retain(|c| c.is_ascii_digit()); - self.rating.truncate(4); - } + end(ui, STRENGTH_MAX); }); ui.label( - RichText::new(tr("Not required; the opponent's strength is chosen relative to it.")) + RichText::new(tr("The Lichess scale: Maia 1500 is weaker than a club player rated 1500.")) .weak() .size(11.5), ); - ui.add_space(10.0); + // Relative to the user's rating; without one, a line saying so instead. + let rating = self.rating(); + match rating { + Some(r) => { + ui.horizontal(|ui| { + for (label, delta) in [(tr("Weaker"), -200), (tr("As me"), 0), (tr("Stronger"), 200)] { + let target = strength_like((r as i32 + delta).max(0) as u32); + if choice(ui, target == self.prefs.strength, label, [(W - 2.0 * GAP) / 3.0, TILE_H]) + .clicked() + { + self.prefs.strength = target; + } + } + }); + } + None => { + ui.allocate_ui_with_layout( + egui::vec2(W, TILE_H), + egui::Layout::left_to_right(egui::Align::Center), + |ui| { + ui.label(RichText::new(tr("Enter your rating: Weaker · As me · Stronger will choose for you")).weak()); + }, + ); + } + } // Colour. - ui.label(RichText::new(tr("Your colour")).strong()); + section(ui, tr("Your colour")); ui.horizontal(|ui| { for (c, label) in [ (ColorChoice::White, tr("♔ White")), (ColorChoice::Random, tr("Random")), (ColorChoice::Black, tr("♚ Black")), ] { - ui.selectable_value(&mut self.prefs.color, c, label); + if choice(ui, self.prefs.color == c, label, [(W - 2.0 * GAP) / 3.0, TILE_H]).clicked() { + self.prefs.color = c; + } } }); - ui.add_space(10.0); - // Time. - ui.label(RichText::new(tr("Time")).strong()); - egui::Grid::new("play_presets") - .spacing(egui::vec2(6.0, 6.0)) - .show(ui, |ui| { - for (k, tc) in PRESETS.iter().enumerate() { + // Time: the presets four in a row, then «Custom» and «Unlimited». + section(ui, tr("Time")); + let w = (W - 3.0 * GAP) / 4.0; + let (rows, last) = PRESETS.split_at(8); + for row in rows.chunks(4).chain([last]) { + ui.horizontal(|ui| { + for tc in row { let on = !self.custom && self.prefs.clock == Some(*tc); - let text = format!("{}\n{}", tc.label(), tc.speed().name()); - if ui - .add_sized([110.0, 40.0], tile(ui, on, &text)) - .clicked() - { + if choice(ui, on, &tc.label(), [w, TILE_H]).clicked() { self.prefs.clock = Some(*tc); self.custom = false; } - if k % 4 == 3 { - ui.end_row(); + } + if row.len() < 4 { + if choice(ui, self.custom, tr("Custom"), [w, TILE_H]).clicked() { + self.custom = true; + if self.prefs.clock.is_none() { + self.prefs.clock = Some(TimeControl { base: 600, increment: 0 }); + } + } + // No clock at all: as long as you like (Maia answers in a second + // or two). + let none = self.prefs.clock.is_none(); + if choice(ui, none, tr("Unlimited"), [2.0 * w + GAP, TILE_H]) + .on_hover_text(tr("No clocks: think as long as you like")) + .clicked() + { + self.prefs.clock = None; + self.custom = false; } } - if ui - .add_sized([110.0, 40.0], tile(ui, self.custom, tr("Custom"))) - .clicked() - { - self.custom = true; - if self.prefs.clock.is_none() { - self.prefs.clock = Some(TimeControl { base: 600, increment: 0 }); - } - } - // No clock at all: think as long as you like (Maia answers in a - // second or two). - let none = self.prefs.clock.is_none(); - if ui - .add_sized([110.0, 40.0], tile(ui, none, tr("∞\nNo time limit"))) - .on_hover_text(tr("No clocks: think as long as you like")) - .clicked() - { - self.prefs.clock = None; - self.custom = false; - } - ui.end_row(); }); + } if self.custom && let Some(tc) = self.prefs.clock.as_mut() { @@ -824,56 +894,24 @@ impl Dialog { .iter() .position(|&x| x >= tc.increment) .unwrap_or(0); - ui.horizontal(|ui| { - ui.label(tr("Minutes:")); - ui.add(egui::Slider::new(&mut b, 0..=CUSTOM_BASES.len() - 1).show_value(false)); - ui.label(TimeControl { base: CUSTOM_BASES[b], increment: 0 }.label().trim_end_matches("+0")); - }); - ui.horizontal(|ui| { - ui.label(tr("Increment, s:")); - ui.add( - egui::Slider::new(&mut i, 0..=CUSTOM_INCREMENTS.len() - 1).show_value(false), - ); - ui.label(CUSTOM_INCREMENTS[i].to_string()); - }); + ui.add_space(4.0); + egui::Grid::new("play_custom") + .num_columns(3) + .spacing(egui::vec2(10.0, GAP)) + .show(ui, |ui| { + ui.spacing_mut().slider_width = W - 120.0 - 28.0 - 20.0; + ui.add_sized([120.0, 18.0], egui::Label::new(tr("Minutes:"))); + ui.add(egui::Slider::new(&mut b, 0..=CUSTOM_BASES.len() - 1).show_value(false)); + ui.add_sized([28.0, 18.0], egui::Label::new(RichText::new((CUSTOM_BASES[b] / 60).to_string()).strong())); + ui.end_row(); + ui.label(tr("Increment, s:")); + ui.add(egui::Slider::new(&mut i, 0..=CUSTOM_INCREMENTS.len() - 1).show_value(false)); + ui.add_sized([28.0, 18.0], egui::Label::new(RichText::new(CUSTOM_INCREMENTS[i].to_string()).strong())); + ui.end_row(); + }); tc.base = CUSTOM_BASES[b]; tc.increment = CUSTOM_INCREMENTS[i]; - ui.label( - RichText::new(format!("{} · {}", tc.label(), tc.speed().name())).weak(), - ); } - ui.add_space(10.0); - - // Strength. - ui.label(RichText::new(tr("Opponent")).strong()); - ui.horizontal(|ui| { - ui.add( - egui::Slider::new(&mut self.prefs.strength, STRENGTH_MIN..=STRENGTH_MAX) - .step_by(100.0) - .show_value(false), - ); - ui.label(RichText::new(format!("Maia {}", self.prefs.strength)).strong()); - }); - let rating = self.rating(); - ui.add_enabled_ui(rating.is_some(), |ui| { - ui.horizontal(|ui| { - for (label, delta) in [(tr("Weaker"), -200), (tr("As me"), 0), (tr("Stronger"), 200)] { - if ui.button(label).clicked() - && let Some(r) = rating - { - self.prefs.strength = - strength_like((r as i32 + delta).max(0) as u32); - } - } - }); - }) - .response - .on_disabled_hover_text(tr("Enter your rating to choose relative to it")); - ui.label( - RichText::new(tr("Maia's rating is on the Lichess scale, which runs higher than FIDE and club ratings: Maia 1500 is weaker than a club player rated 1500.")) - .weak() - .size(11.5), - ); rating }) .inner; @@ -946,7 +984,7 @@ impl Dialog { clock: self.prefs.clock, })); } - if ui.button(tr("Cancel")).clicked() { + if ui.add(egui::Button::new(tr("Cancel")).min_size(egui::vec2(0.0, 30.0))).clicked() { out = Some(DialogOutcome::Cancel); } }); @@ -958,22 +996,6 @@ impl Dialog { } } -/// A time tile: its lines centred under each other (egui puts them flush left). -fn tile(ui: &egui::Ui, on: bool, text: &str) -> egui::Button<'static> { - let mut job = egui::text::LayoutJob::simple( - text.to_owned(), - egui::TextStyle::Button.resolve(ui.style()), - if on { - ui.visuals().strong_text_color() - } else { - ui.visuals().text_color() - }, - f32::INFINITY, - ); - job.halign = egui::Align::Center; - egui::Button::selectable(on, job) -} - fn trf_size() -> String { crate::i18n::trf( "Maia is downloaded once ({mb} MB, from huggingface.co, the authors' own file).", diff --git a/apps/desktop/src/settings.rs b/apps/desktop/src/settings.rs index 988fb1f..f8f3ab7 100644 --- a/apps/desktop/src/settings.rs +++ b/apps/desktop/src/settings.rs @@ -102,6 +102,8 @@ pub struct Settings { pub show_coords: bool, /// How fast moves slide on the board. pub animation: Animation, + /// A pawn reaching the last rank becomes a queen without the choice of a piece. + pub auto_queen: bool, /// How moves are shown: Latin letters, figurines or the interface language's letters. pub move_notation: crate::san::MoveNotation, /// Translating game comments (docs/design/translation.md). @@ -185,6 +187,7 @@ impl Default for Settings { board_theme: BoardThemeId::default(), show_coords: true, animation: Animation::default(), + auto_queen: false, move_notation: Default::default(), translation: Default::default(), sound_enabled: true, diff --git a/apps/desktop/src/settings_ui.rs b/apps/desktop/src/settings_ui.rs index b1fd5d8..546bdc2 100644 --- a/apps/desktop/src/settings_ui.rs +++ b/apps/desktop/src/settings_ui.rs @@ -565,6 +565,12 @@ fn board_tab(ui: &mut Ui, s: &mut Settings, changed: &mut bool) { *changed |= ui .checkbox(&mut s.show_coords, tr("Show coordinates")) .changed(); + *changed |= ui + .checkbox(&mut s.auto_queen, tr("Always promote to a queen")) + .on_hover_text(tr( + "Off: a pawn on the last rank asks which piece it becomes", + )) + .changed(); *changed |= ui .checkbox(&mut s.show_best_arrow, tr("Show engine best-move arrows")) .changed(); diff --git a/docs/dev/desktop.md b/docs/dev/desktop.md index 7669d46..51f9dab 100644 --- a/docs/dev/desktop.md +++ b/docs/dev/desktop.md @@ -51,7 +51,7 @@ XDG_CONFIG_HOME=/tmp/cfg CP_OPEN=11 CP_PLY=3 CP_ANALYZE=1 ./target/debug/chesspe ``` `CP_OPEN` — индекс партии (с 0) в первой базе списка, `CP_PLY` — шагов по основной линии, -`CP_ONLINE=<ник>` (или `<ник Lichess>,<ник Chess.com>`) — открыть окно онлайн-партий и найти ник (`CP_ONLINE_DOWNLOAD=1` — сразу скачать). `CP_UPDATE_CHECK=<адрес>` — спрашивать о выпуске этот сайт вместо chess.vrubel.xyz/api/update (локальный, чтобы проверить счёт установок). `CP_UPDATE_SOURCE=<папка>` — брать «последний выпуск» из `latest.json` и файлов этой папки вместо GitHub, `CP_UPDATE_KIND=deb|rpm|arch|aur|flatpak|appimage|tarball|windows|mac` — считать установку такой, `CP_UPDATE_OPEN=1` — открыть окно обновления (`=start` — сразу начать), `CP_TAB=reference` — открыть у партии вкладку «Справочник», `CP_ANALYZE` — запустить активный движок, `CP_SETTINGS` — открыть настройки (`=board`, `=about`, `=translation` — сразу эту вкладку), `CP_TRANSLATE_SETUP=1` — окно «Как переводить?» (`=key` — с выбранным ключом API), `CP_ENGINE_PANEL` — раскрыть панель настроек движка, `CP_VAR` — перейти в первый вариант после `CP_PLY`, `CP_REVIEW=1` — запустить анализ партии (`=dialog` — только открыть окно), `CP_REPORT=1` — открыть вкладку «Отчёт» (нужен готовый анализ), `CP_BEST=k` — показать на доске k-й ход лучшей линии у первой отметки движка (нужен готовый анализ), `CP_ENGINE_OFFER=1` — окно предложения скачать Stockfish (`=download` — сразу начать загрузку), `CP_BOARD="e4 c5 Nf3"` — доска поиска базы с этими ходами (SAN), `CP_SORT=date` — база по дате (новые сверху), `CP_PANE=hidden` — база без правой панели (`=drawer` — фильтры поверх таблицы в узком окне), `CP_FILTER="player=carlsen;years=2015-2026;elo=2600"` — несколько фильтров базы, `CP_FILTER_PLAYER=имя` — фильтр «Игрок» базы при запуске, `CP_SEARCH="текст"` — быстрый поиск базы при запуске, `CP_KEYS="ArrowDown Shift+ArrowUp Ctrl+Z Escape"` — нажать эти клавиши (имена egui, по одной раз в полсекунды со второй секунды; модификаторы `Shift+`, `Ctrl+`), `CP_OWN=new|chooser|data|save|delete|newin` (`newin` — «+ Партия» первой базы) — открыть диалог своих баз через 1,5 с: новая база, «Добавить в базу» (для открытой партии, иначе для записи `CP_OPEN` первой базы), данные партии, Ctrl+S, удаление записи `CP_OPEN` первой базы; `CP_PASTE="<текст PGN>"` — перед `CP_OWN` открыть эту партию как вставленную (без базы), `CP_COMMENT=текст` — комментарий к ходу после `CP_PLY` (партия считается изменённой), `CP_COMMENT_EDIT=1` — открыть редактор комментария на текущем ходе, `CP_SHAPE=Ge2e4,Rd5` — нарисовать стрелки/круги на доске у текущего хода (как правой кнопкой), `CP_TYPE=текст` — напечатать текст в поле с фокусом через 2,5 с (после `CP_KEYS`, которые начинаются со 2-й секунды, если их мало), `CP_SETTINGS=interface` — вкладка «Интерфейс», `CP_PLAY=white|black[,5+3|none][,1500]` — сразу начать партию с Maia (`CP_PLAY=dialog` — открыть диалог «Игра с компьютером»), `CP_MAIA=путь/maia3-5m.pt` — веса Maia из этого файла вместо скачанных, `CP_PLAY_AUTO=1` — за пользователя тоже ходит Maia, быстро (партия до конца без мыши), `CP_LOG_FRAMES=1` — писать в `chesspenguin.log` отладочные сообщения egui_wgpu о каждом кадре (пропущенный как «occluded» кадр виден только там); предупреждения библиотек (wgpu, winit) пишутся туда всегда, одинаковые — раз в минуту со счётчиком, `CP_SCREENSHOT=file.png` (+ `CP_SCREENSHOT_DELAY=сек`) — полноэкранный снимок окна и выход; так сделаны `docs/screenshots/`. Ключ `--bench <база> [отчёт.txt]` печатает замеры базы вместо окна (`docs/dev/import.md`, «Замер на другой машине»). `CP_PANEL_CHECK=1` — сообщать в stderr о боковой панели, чьё содержимое шире её места (egui тогда задвигает панель под соседнюю); в отладочной сборке egui ещё и подсвечивает красным, что расширяет родителя (`docs/design/narrow-windows.md`). `CP_MEMORY_LIMIT=<МБ>` — считать доступной памятью не больше этого (пути без дебютного индекса и без таблицы позиций PGN). +`CP_ONLINE=<ник>` (или `<ник Lichess>,<ник Chess.com>`) — открыть окно онлайн-партий и найти ник (`CP_ONLINE_DOWNLOAD=1` — сразу скачать). `CP_UPDATE_CHECK=<адрес>` — спрашивать о выпуске этот сайт вместо chess.vrubel.xyz/api/update (локальный, чтобы проверить счёт установок). `CP_UPDATE_SOURCE=<папка>` — брать «последний выпуск» из `latest.json` и файлов этой папки вместо GitHub, `CP_UPDATE_KIND=deb|rpm|arch|aur|flatpak|appimage|tarball|windows|mac` — считать установку такой, `CP_UPDATE_OPEN=1` — открыть окно обновления (`=start` — сразу начать), `CP_TAB=reference` — открыть у партии вкладку «Справочник», `CP_ANALYZE` — запустить активный движок, `CP_SETTINGS` — открыть настройки (`=board`, `=about`, `=translation` — сразу эту вкладку), `CP_TRANSLATE_SETUP=1` — окно «Как переводить?» (`=key` — с выбранным ключом API), `CP_ENGINE_PANEL` — раскрыть панель настроек движка, `CP_VAR` — перейти в первый вариант после `CP_PLY`, `CP_REVIEW=1` — запустить анализ партии (`=dialog` — только открыть окно), `CP_REPORT=1` — открыть вкладку «Отчёт» (нужен готовый анализ), `CP_BEST=k` — показать на доске k-й ход лучшей линии у первой отметки движка (нужен готовый анализ), `CP_ENGINE_OFFER=1` — окно предложения скачать Stockfish (`=download` — сразу начать загрузку), `CP_BOARD="e4 c5 Nf3"` — доска поиска базы с этими ходами (SAN), `CP_SORT=date` — база по дате (новые сверху), `CP_PANE=hidden` — база без правой панели (`=drawer` — фильтры поверх таблицы в узком окне), `CP_FILTER="player=carlsen;years=2015-2026;elo=2600"` — несколько фильтров базы, `CP_FILTER_PLAYER=имя` — фильтр «Игрок» базы при запуске, `CP_SEARCH="текст"` — быстрый поиск базы при запуске, `CP_KEYS="ArrowDown Shift+ArrowUp Ctrl+Z Escape"` — нажать эти клавиши (имена egui, по одной раз в полсекунды со второй секунды; модификаторы `Shift+`, `Ctrl+`), `CP_OWN=new|chooser|data|save|delete|newin` (`newin` — «+ Партия» первой базы) — открыть диалог своих баз через 1,5 с: новая база, «Добавить в базу» (для открытой партии, иначе для записи `CP_OPEN` первой базы), данные партии, Ctrl+S, удаление записи `CP_OPEN` первой базы; `CP_PASTE="<текст PGN>"` — перед `CP_OWN` открыть эту партию как вставленную (без базы), `CP_COMMENT=текст` — комментарий к ходу после `CP_PLY` (партия считается изменённой), `CP_COMMENT_EDIT=1` — открыть редактор комментария на текущем ходе, `CP_SHAPE=Ge2e4,Rd5` — нарисовать стрелки/круги на доске у текущего хода (как правой кнопкой), `CP_TYPE=текст` — напечатать текст в поле с фокусом через 2,5 с (после `CP_KEYS`, которые начинаются со 2-й секунды, если их мало), `CP_SETTINGS=interface` — вкладка «Интерфейс», `CP_PLAY=white|black[,5+3|none][,1500]` — сразу начать партию с Maia (`CP_PLAY=dialog` — открыть диалог «Игра с компьютером»), `CP_MAIA=путь/maia3-5m.pt` — веса Maia из этого файла вместо скачанных, `CP_PLAY_AUTO=1` — за пользователя тоже ходит Maia, быстро (партия до конца без мыши), `CP_PREMOVE=e7e5` — в начале партии поставить этот предход (виден подсветкой, играется сразу после ответа Maia, если легален), `CP_LOG_FRAMES=1` — писать в `chesspenguin.log` отладочные сообщения egui_wgpu о каждом кадре (пропущенный как «occluded» кадр виден только там); предупреждения библиотек (wgpu, winit) пишутся туда всегда, одинаковые — раз в минуту со счётчиком, `CP_SCREENSHOT=file.png` (+ `CP_SCREENSHOT_DELAY=сек`) — полноэкранный снимок окна и выход; так сделаны `docs/screenshots/`. Ключ `--bench <база> [отчёт.txt]` печатает замеры базы вместо окна (`docs/dev/import.md`, «Замер на другой машине»). `CP_PANEL_CHECK=1` — сообщать в stderr о боковой панели, чьё содержимое шире её места (egui тогда задвигает панель под соседнюю); в отладочной сборке egui ещё и подсвечивает красным, что расширяет родителя (`docs/design/narrow-windows.md`). `CP_MEMORY_LIMIT=<МБ>` — считать доступной памятью не больше этого (пути без дебютного индекса и без таблицы позиций PGN). ## Языки diff --git a/docs/dev/tasks.md b/docs/dev/tasks.md index 262da30..6413c8c 100644 --- a/docs/dev/tasks.md +++ b/docs/dev/tasks.md @@ -105,6 +105,11 @@ - **Узкое окно (640×900):** часы — одна строка из двух половинных карточек над нотацией; нотация прокручивается к последнему ходу. - **Потом:** короли из текущего набора фигур вместо ♔/♚; запоминаемый режим силы «относительно рейтинга»; анимация «думает…»; звук при малом времени; «около N мин» у своего контроля; таймаут «Сдаться?» 4 с; после сохранения кнопка «✓ В «Mine», № N»; перезапуск Maia, если её поток упал. +### 12. Отложить партию с Maia и вернуться к ней +- **Статус:** новая (2026-10-25, от владельца). +- **Суть:** партию с компьютером можно отложить и продолжить позже, хоть через неделю, с той же силой Maia, цветом и временем на часах. Особенно для бессрочного режима: «ушёл и вернулся», как в переписке. +- **Мысли:** отложенная партия пишется в PGN (результат `*`, теги игры с компьютером: сила Maia, `TimeControl`, `[%clk]` у последних ходов) в свою базу или в служебный файл; программа помнит список отложенных (в настройках или по тегу) и показывает их в диалоге «Играть» («Продолжить: Вы — Maia 1500, 23-й ход»). Продолжение восстанавливает сессию: историю позиций для повторений, часы, цвет. Выход из партии получает третий выбор «Отложить» рядом со «Сдаться». + ## Сделано (пусто)