From f54f4d924dd3c787584b849e8837b5b57d692e9e Mon Sep 17 00:00:00 2001 From: vrubelroman Date: Mon, 26 Oct 2026 03:39:04 +0300 Subject: [PATCH] Play: tester's findings on Rodent V MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The slider no longer flips between Maia and Rodent while dragged through the gap between them (2100–2250): Rodent stays, at his lowest. - The result strip names Rodent in his games («Left: you … · Rodent V …»). - The opponent's name in the side panel stays on one line (cut, whole on hover). - Remembered settings outside the opponent's range are brought into it. - Changing the opponent cancels «Download and play» for the other one. - A Rodent folder counts as installed only with nets and books and a mark written after it started (a cut-short unpacking is downloaded again). - «Did not start» in words, the details to the log; toolbar and move-menu tooltips name the computer, not only Maia; 48 MB, not 49. Co-Authored-By: Claude Opus 5.5 --- apps/desktop/src/game_view.rs | 11 ++++-- apps/desktop/src/i18n.rs | 46 ++++++++++++++++++++++++- apps/desktop/src/library.rs | 2 +- apps/desktop/src/notation.rs | 2 +- apps/desktop/src/play.rs | 52 +++++++++++++++++++++++++---- apps/desktop/src/rodent_download.rs | 21 +++++++++--- 6 files changed, 119 insertions(+), 15 deletions(-) diff --git a/apps/desktop/src/game_view.rs b/apps/desktop/src/game_view.rs index 57c5b04..4c93b6c 100644 --- a/apps/desktop/src/game_view.rs +++ b/apps/desktop/src/game_view.rs @@ -3050,7 +3050,10 @@ impl GameView { } else { format!("{king} {}", s.rival_label()) }; - ui.label(RichText::new(name).size(15.0)); + // One line however narrow the panel: a long style is cut, not wrapped + // under the clock (the whole name on hover). + ui.add(egui::Label::new(RichText::new(&name).size(15.0)).truncate()) + .on_hover_text(&name); let state = if side != user && s.resign_offer.is_some() { tr("resigns") } else if side != user && s.opponent.thinking { @@ -3244,7 +3247,11 @@ impl GameView { if let Some((you, maia)) = end.left { ui.label( RichText::new(trf( - "Left: you {you} · Maia {maia}", + crate::play::said( + end.start.rival, + "Left: you {you} · Maia {maia}", + "Left: you {you} · Rodent V {maia}", + ), &[ ("you", &crate::play::clock_text(you)), ("maia", &crate::play::clock_text(maia)), diff --git a/apps/desktop/src/i18n.rs b/apps/desktop/src/i18n.rs index 22d4440..dccf3af 100644 --- a/apps/desktop/src/i18n.rs +++ b/apps/desktop/src/i18n.rs @@ -11327,7 +11327,7 @@ const ROWS: &[[&str; 9]] = &[ "Rodent V's time is up, but you cannot checkmate", "у Rodent V вышло время, но вам нечем поставить мат", "le temps de Rodent V est écoulé, mais vous ne pouvez pas mater", - "Rodent Vs Zeit ist um, aber Sie können nicht mattsetzen", + "Die Zeit von Rodent V ist um, aber Sie können nicht mattsetzen", "a Rodent V se le acabó el tiempo, pero no puedes dar mate", "il tempo di Rodent V è scaduto, ma non puoi dare matto", "o tempo do Rodent V acabou, mas você não pode dar mate", @@ -11499,6 +11499,50 @@ const ROWS: &[[&str; 9]] = &[ "{elo} dan kuchliroq Rodent V o‘ynaydi, {min} dan: Maia bunchalik kuchli o‘ynamaydi.", "{elo}-ден күштірек Rodent V ойнайды, {min} бастап: Maia мұндай күшті ойнамайды.", ], + [ + "Left: you {you} · Rodent V {maia}", + "Осталось: вы {you} · Rodent V {maia}", + "Restant : vous {you} · Rodent V {maia}", + "Verbleibend: Sie {you} · Rodent V {maia}", + "Queda: tú {you} · Rodent V {maia}", + "Rimasto: tu {you} · Rodent V {maia}", + "Restante: você {you} · Rodent V {maia}", + "Qoldi: siz {you} · Rodent V {maia}", + "Қалды: сіз {you} · Rodent V {maia}", + ], + [ + "it stopped while playing", + "он остановился во время игры", + "il s’est arrêté pendant la partie", + "er hat während der Partie aufgehört", + "se detuvo durante la partida", + "si è fermato durante la partita", + "ele parou durante a partida", + "u o‘yin paytida to‘xtadi", + "ол ойын кезінде тоқтады", + ], + [ + "A game against the computer: Maia, who plays like a human, or Rodent V, strong and with a style (Ctrl+G)", + "Партия с компьютером: Maia играет как человек, Rodent V — сильно и со стилем (Ctrl+G)", + "Une partie contre l’ordinateur : Maia joue comme un humain, Rodent V fort et avec un style (Ctrl+G)", + "Eine Partie gegen den Computer: Maia spielt wie ein Mensch, Rodent V stark und mit Stil (Strg+G)", + "Una partida contra el ordenador: Maia juega como una persona, Rodent V fuerte y con estilo (Ctrl+G)", + "Una partita contro il computer: Maia gioca come un umano, Rodent V forte e con uno stile (Ctrl+G)", + "Uma partida contra o computador: a Maia joga como um humano, o Rodent V forte e com estilo (Ctrl+G)", + "Kompyuter bilan o‘yin: Maia odamdek o‘ynaydi, Rodent V — kuchli va uslubli (Ctrl+G)", + "Компьютермен ойын: Maia адам сияқты ойнайды, Rodent V — күшті және стилімен (Ctrl+G)", + ], + [ + "A game against the computer from this position", + "Партия с компьютером с этой позиции", + "Une partie contre l’ordinateur depuis cette position", + "Eine Partie gegen den Computer ab dieser Stellung", + "Una partida contra el ordenador desde esta posición", + "Una partita contro il computer da questa posizione", + "Uma partida contra o computador a partir desta posição", + "Shu pozitsiyadan kompyuter bilan o‘yin", + "Осы позициядан компьютермен ойын", + ], [ "Maia resigned", "Maia сдалась", diff --git a/apps/desktop/src/library.rs b/apps/desktop/src/library.rs index 512a9ee..e59370f 100644 --- a/apps/desktop/src/library.rs +++ b/apps/desktop/src/library.rs @@ -714,7 +714,7 @@ impl Library { .on_hover_text(shelf_hint( icons, tr("♞ Play"), - tr("A game against Maia, which plays like a human of the chosen rating (Ctrl+G)"), + tr("A game against the computer: Maia, who plays like a human, or Rodent V, strong and with a style (Ctrl+G)"), )) .clicked() { diff --git a/apps/desktop/src/notation.rs b/apps/desktop/src/notation.rs index c1bcaae..189ce06 100644 --- a/apps/desktop/src/notation.rs +++ b/apps/desktop/src/notation.rs @@ -452,7 +452,7 @@ fn handle_move_response( over.is_none(), egui::Button::new(tr("Play on from here…")).shortcut_text("Ctrl+G"), ) - .on_hover_text(tr("A game against Maia from this position")); + .on_hover_text(tr("A game against the computer from this position")); let play = match over { Some(why) => play.on_disabled_hover_text(crate::i18n::trf( "The game is over here: {why}", diff --git a/apps/desktop/src/play.rs b/apps/desktop/src/play.rs index 1195f78..d64b200 100644 --- a/apps/desktop/src/play.rs +++ b/apps/desktop/src/play.rs @@ -515,7 +515,7 @@ impl Opponent { }; let engine = match uci::Engine::spawn_with(config, Box::new(|| {})) { Ok(e) => e, - Err(e) => return fail(e.to_string()), + Err(e) => return fail(start_failure(&e.to_string())), }; let personality = format!("personalities/{style}.txt"); let mut setup = vec![ @@ -528,11 +528,11 @@ impl Opponent { } let ready = engine.set_threads(1).and_then(|()| engine.set_hash_mb(64)); if let Err(e) = ready { - return fail(e.to_string()); + return fail(start_failure(&e.to_string())); } for (name, value) in &setup { if let Err(e) = engine.set_option(name, Some(value)) { - return fail(e.to_string()); + return fail(start_failure(&e.to_string())); } } let _ = engine.new_game(); @@ -560,7 +560,9 @@ impl Opponent { }) if search_id == id => { break b; } - Some(uci::EngineEvent::Terminated(e)) => return fail(format!("{e:?}")), + Some(uci::EngineEvent::Terminated(_)) => { + return fail(tr("it stopped while playing").to_owned()); + } _ if started.elapsed() > think + Duration::from_secs(20) => { let _ = engine.stop(); } @@ -1033,6 +1035,20 @@ impl Dialog { if prefs.clock.is_some_and(|c| !c.allowed()) { prefs.clock = PlayPrefs::default().clock; } + // A remembered strength the opponent does not play (another build's range, an + // edited file): to the nearest one that is played. + let rodent_ok = crate::rodent_download::available(); + if prefs.rival == Rival::Rodent && !rodent_ok { + prefs.rival = Rival::Maia; + } + match prefs.rival { + Rival::Maia if prefs.strength > STRENGTH_MAX && rodent_ok => { + prefs.rival = Rival::Rodent; + prefs.strength = prefs.strength.clamp(RODENT_MIN, RODENT_MAX); + } + Rival::Maia => prefs.strength = prefs.strength.clamp(STRENGTH_MIN, STRENGTH_MAX), + Rival::Rodent => prefs.strength = prefs.strength.clamp(RODENT_MIN, RODENT_MAX), + } let custom = prefs.clock.is_some_and(|c| !PRESETS.contains(&c)); Dialog { name: settings.your_name.clone(), @@ -1098,6 +1114,7 @@ impl Dialog { ) -> Option { use egui::RichText; let mut out = None; + let rival_before = self.prefs.rival; let model = model_for(self.prefs.strength); let body_h = (ctx.content_rect().height() - 140.0).max(160.0); egui::Modal::new(egui::Id::new("play_dialog")).show(ctx, |ui| { @@ -1187,7 +1204,13 @@ impl Dialog { let fill = if on { ui.visuals().selection.bg_fill } else { v.weak_bg_fill }; ui.painter().rect(rect, v.corner_radius, fill, v.bg_stroke, egui::StrokeKind::Inside); let (text, weak) = if enabled { - (if on { ui.visuals().selection.stroke.color } else { v.text_color() }, ui.visuals().weak_text_color()) + if on { + // On the selected fill the caption takes its text colour, softer. + let c = ui.visuals().selection.stroke.color; + (c, c.gamma_multiply(0.8)) + } else { + (v.text_color(), ui.visuals().weak_text_color()) + } } else { let c = ui.visuals().weak_text_color(); (c, c) @@ -1285,9 +1308,15 @@ impl Dialog { "Stronger than {elo} plays Rodent V, from {min} on: Maia does not play that strong.", &[("elo", &STRENGTH_MAX), ("min", &RODENT_MIN)], )); + } else if self.prefs.rival == Rival::Rodent + && self.prefs.strength < RODENT_MIN + && self.prefs.strength > STRENGTH_MAX + { + // In the gap nobody plays: Rodent stays, at his lowest (a drag through + // it does not flip between the two every frame). + self.prefs.strength = RODENT_MIN; } else if self.prefs.rival == Rival::Rodent && self.prefs.strength < RODENT_MIN { self.prefs.rival = Rival::Maia; - self.prefs.strength = self.prefs.strength.min(STRENGTH_MAX); self.auto_switched = false; self.event = Some(crate::i18n::trf("Weaker than {elo} plays Maia.", &[("elo", &RODENT_MIN)])); } else if self.auto_switched && self.prefs.strength <= STRENGTH_MAX { @@ -1433,6 +1462,11 @@ impl Dialog { // seen. The line stays while either Maia's large model or Rodent is missing, // so that switching the opponent does not change the dialog's height; it is // about the opponent chosen. + // The opponent changed: a game asked for by «Download and play» is not started + // for the other one when its file comes. + if self.prefs.rival != rival_before { + self.play_after = false; + } let rodent = self.prefs.rival == Rival::Rodent; let stage = self.download.as_ref().map(|d| d.stage()); let rstage = self.rodent_download.as_ref().map(|d| d.stage()); @@ -1689,6 +1723,12 @@ fn download_failure(f: &crate::engine_download::Failure) -> String { } } +/// Why an engine did not start, in words: the details go to the log. +fn start_failure(detail: &str) -> String { + eprintln!("rodent: {detail}"); + tr("it does not start on this computer").to_owned() +} + /// What the download button brings: Maia herself, or (the small one being there) the /// large one for the strength chosen. fn download_note(model: Option) -> String { diff --git a/apps/desktop/src/rodent_download.rs b/apps/desktop/src/rodent_download.rs index e311706..146856d 100644 --- a/apps/desktop/src/rodent_download.rs +++ b/apps/desktop/src/rodent_download.rs @@ -38,7 +38,7 @@ pub fn available() -> bool { } pub fn size_mb() -> u64 { - ARCHIVE.size.div_ceil(1_000_000) + (ARCHIVE.size + 500_000) / 1_000_000 } /// `/engines/rodent_v_1.2/` (`CP_RODENT` elsewhere: development). @@ -50,11 +50,20 @@ pub fn dir() -> Option { .map(|d| d.data_local_dir().join("engines").join("rodent_v_1.2")) } -/// The installed engine, if it is there (with its personalities beside it). +/// Written last, once the engine started from its unpacked folder: a folder cut short +/// (the program closed while unpacking) is not taken for an installed engine. +const COMPLETE: &str = ".complete"; + +/// The installed engine, if it is all there (its personalities, nets and books beside +/// it; a development folder of `CP_RODENT` needs no mark). pub fn installed() -> Option { let d = dir()?; let exe = d.join(EXE); - (exe.is_file() && d.join("personalities").is_dir()).then_some(exe) + let whole = ["personalities", "nets", "books"] + .iter() + .all(|f| d.join(f).is_dir()); + let marked = std::env::var_os("CP_RODENT").is_some() || d.join(COMPLETE).is_file(); + (exe.is_file() && whole && marked).then_some(exe) } /// Removes the downloaded engine (a broken one, or to free its space). @@ -86,7 +95,11 @@ fn run(report: &dyn Fn(Stage), cancel: &AtomicBool) -> Result report(Stage::Unpacking); unpack(&archive, &dir, bin) }) - .and_then(|exe| check_runs(&exe).map(|()| exe)); + .and_then(|exe| check_runs(&exe).map(|()| exe)) + .and_then(|exe| { + std::fs::write(dir.join(COMPLETE), TAG).map_err(disk)?; + Ok(exe) + }); let _ = std::fs::remove_file(&archive); if result.is_err() { // Nothing half-installed is left behind.