From 424c7830e73321d225bbd64203c8cc1dc5300fda Mon Sep 17 00:00:00 2001 From: vrubelroman Date: Wed, 28 Oct 2026 01:00:29 +0300 Subject: [PATCH] Notation: the review's mark right after the move, in its color; no reasons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As on Lichess: «Qg7??» in red instead of a pill at the cell's edge, on the desktop and on Android; the author's own sign stands instead when there is one. !! and ! get no block under the move (the reason line was more than needed). Task 18: a shorter draw-offer button. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 3 + .../vrubelroman/chesspenguin/ui/Notation.kt | 13 ++-- .../chesspenguin/ui/ReviewViews.kt | 26 -------- .../app/src/main/res/values-de/strings.xml | 2 - .../app/src/main/res/values-es/strings.xml | 2 - .../app/src/main/res/values-fr/strings.xml | 2 - .../app/src/main/res/values-it/strings.xml | 2 - .../app/src/main/res/values-kk/strings.xml | 2 - .../app/src/main/res/values-pt/strings.xml | 2 - .../app/src/main/res/values-ru/strings.xml | 2 - .../app/src/main/res/values-uz/strings.xml | 2 - .../app/src/main/res/values/strings.xml | 2 - apps/desktop/src/i18n.rs | 22 ------- apps/desktop/src/notation.rs | 62 +++++++++---------- apps/desktop/src/review.rs | 14 +---- docs/dev/tasks.md | 4 ++ 16 files changed, 46 insertions(+), 116 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dbb249..ca92203 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ All notable changes are listed here. Versions follow [Semantic Versioning](https engine searches a second time for the moves that could be such (about a third longer analysis); for an analysis from before, «Update» looks for them without evaluating the game again. With evaluations from the PGN alone there are none (the report says so). +- The review's mark in the notation stands right after the move, the move in its color + (Qg7?? in red), as on Lichess, instead of a colored pill at the edge of the cell; the + author's own sign, when there is one, stands instead. - Android: the board shows the move's mark in the corner of its square, as on the desktop: the review's ?!, ?, ??, !, !! or the author's own sign. diff --git a/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/Notation.kt b/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/Notation.kt index fcea838..0b9ed88 100644 --- a/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/Notation.kt +++ b/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/Notation.kt @@ -357,9 +357,9 @@ private fun MoveCell( onLongMove: ((Int) -> Unit)?, ) { val selected = id != null && id == current - // The engine's mark is left out where the author already put the same sign ("Nf6? ?" - // reads as a typo, §21.4). - val mark = mark?.takeIf { m -> id == null || game.nodes[id].nags.none { it.toInt() == judgementNag(m) } } + // The engine's mark stands right after the move, the move in its color (as on Lichess); + // where the author already gave the move a sign, the author's sign stands instead. + val mark = mark?.takeIf { id == null || game.nodes[id].nags.none { (it.toInt() and 0xFF) in 1..6 } } // TalkBack reads "4, White, dxe5", the engine's judgement, and whether it is the // current move. val markName = mark?.let { judgementName(it) } @@ -411,7 +411,11 @@ private fun MoveCell( .padding(horizontal = 8.dp, vertical = 6.dp), horizontalArrangement = Arrangement.spacedBy(1.dp), ) { - Text(san(n.san), fontSize = 17.sp, fontWeight = FontWeight.Medium, color = MaterialTheme.colorScheme.onSurface) + val markColor = mark?.takeIf { !selected }?.let { judgementColor(it, chess.dark) } + Text(san(n.san), fontSize = 17.sp, fontWeight = FontWeight.Medium, color = markColor ?: MaterialTheme.colorScheme.onSurface) + if (mark != null) { + Text(judgementSymbol(mark), fontSize = 17.sp, fontWeight = FontWeight.Medium, color = markColor ?: MaterialTheme.colorScheme.onSurface) + } if (n.nagSymbols.isNotEmpty()) { Text( n.nagSymbols, @@ -425,7 +429,6 @@ private fun MoveCell( ) } } - if (mark != null) ReviewBadge(mark, Modifier.padding(start = 2.dp)) } } } diff --git a/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/ReviewViews.kt b/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/ReviewViews.kt index ab2e8a8..48012e7 100644 --- a/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/ReviewViews.kt +++ b/androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/ui/ReviewViews.kt @@ -125,14 +125,6 @@ fun judgementName(j: MoveJudgement): String = stringResource( }, ) -/// Why a move of note is one (none for an error). -@Composable -fun judgementReason(j: MoveJudgement): String? = when (j) { - MoveJudgement.BRILLIANT -> stringResource(R.string.review_why_brilliant) - MoveJudgement.GREAT -> stringResource(R.string.review_why_great) - else -> null -} - @Composable private fun judgementPlural(j: MoveJudgement): String = stringResource( when (j) { @@ -144,23 +136,6 @@ private fun judgementPlural(j: MoveJudgement): String = stringResource( }, ) -/// The engine's mark after a main-line move in the notation (§21.4): a layer of its own, -/// apart from the author's NAGs. -@Composable -fun ReviewBadge(j: MoveJudgement, modifier: Modifier = Modifier) { - val c = judgementColor(j, LocalChessColors.current.dark) - Text( - judgementSymbol(j), - fontSize = 13.sp, - fontWeight = FontWeight.Bold, - color = c, - modifier = modifier - .clip(RoundedCornerShape(4.dp)) - .background(c.copy(alpha = 0.16f)) - .padding(horizontal = 4.dp, vertical = 1.dp), - ) -} - /// The place in `state.points` of a node: itself on the main line, or the main-line move /// its variation leaves from. fun pointIndex(points: Map, game: GameData, node: Int): Int? { @@ -228,7 +203,6 @@ fun ReviewPanel( val link = MaterialTheme.colorScheme.primary val text = buildAnnotatedString { withStyle(SpanStyle(color = c, fontWeight = FontWeight.Bold)) { append(judgementSymbol(mark.judgement) + " " + name) } - judgementReason(mark.judgement)?.let { append(" · "); append(it) } if (better != null && betterText != null) { append(" · ") append(betterText.first()) diff --git a/androidApp/app/src/main/res/values-de/strings.xml b/androidApp/app/src/main/res/values-de/strings.xml index 8391b12..923d260 100644 --- a/androidApp/app/src/main/res/values-de/strings.xml +++ b/androidApp/app/src/main/res/values-de/strings.xml @@ -251,8 +251,6 @@ Brillanter Zug Starke Züge Brillante Züge - Ein korrektes Opfer - Der einzige gute Zug Ohne Bewertung: %d Die Analyse wurde unterbrochen Fortsetzen diff --git a/androidApp/app/src/main/res/values-es/strings.xml b/androidApp/app/src/main/res/values-es/strings.xml index 7a4e8ee..f996d52 100644 --- a/androidApp/app/src/main/res/values-es/strings.xml +++ b/androidApp/app/src/main/res/values-es/strings.xml @@ -255,8 +255,6 @@ Jugada brillante Grandes jugadas Jugadas brillantes - Un sacrificio correcto - La única buena jugada Sin evaluar: %d El análisis se interrumpió Continuar diff --git a/androidApp/app/src/main/res/values-fr/strings.xml b/androidApp/app/src/main/res/values-fr/strings.xml index 1fc78fa..de35c28 100644 --- a/androidApp/app/src/main/res/values-fr/strings.xml +++ b/androidApp/app/src/main/res/values-fr/strings.xml @@ -255,8 +255,6 @@ Coup brillant Excellents coups Coups brillants - Un sacrifice correct - Le seul bon coup Non évaluées : %d L\'analyse s\'est interrompue Continuer diff --git a/androidApp/app/src/main/res/values-it/strings.xml b/androidApp/app/src/main/res/values-it/strings.xml index 4c7820f..8a89420 100644 --- a/androidApp/app/src/main/res/values-it/strings.xml +++ b/androidApp/app/src/main/res/values-it/strings.xml @@ -255,8 +255,6 @@ Mossa brillante Ottime mosse Mosse brillanti - Un sacrificio corretto - L\'unica buona mossa Non valutate: %d L\'analisi si è interrotta Continua diff --git a/androidApp/app/src/main/res/values-kk/strings.xml b/androidApp/app/src/main/res/values-kk/strings.xml index f4a1b38..c54fa50 100644 --- a/androidApp/app/src/main/res/values-kk/strings.xml +++ b/androidApp/app/src/main/res/values-kk/strings.xml @@ -251,8 +251,6 @@ Тамаша жүріс Мықты жүрістер Тамаша жүрістер - Дұрыс құрбандық - Жалғыз жақсы жүріс Бағаланбаған: %d Талдау тоқтап қалды Жалғастыру diff --git a/androidApp/app/src/main/res/values-pt/strings.xml b/androidApp/app/src/main/res/values-pt/strings.xml index 410b0fb..901c64e 100644 --- a/androidApp/app/src/main/res/values-pt/strings.xml +++ b/androidApp/app/src/main/res/values-pt/strings.xml @@ -255,8 +255,6 @@ Lance brilhante Ótimos lances Lances brilhantes - Um sacrifício correto - O único lance bom Não avaliadas: %d A análise parou Continuar diff --git a/androidApp/app/src/main/res/values-ru/strings.xml b/androidApp/app/src/main/res/values-ru/strings.xml index ae71ff9..c663ce9 100644 --- a/androidApp/app/src/main/res/values-ru/strings.xml +++ b/androidApp/app/src/main/res/values-ru/strings.xml @@ -259,8 +259,6 @@ Блестящий ход Отличные ходы Блестящие ходы - Корректная жертва - Единственный хороший ход Без оценки: %d Анализ прервался Продолжить diff --git a/androidApp/app/src/main/res/values-uz/strings.xml b/androidApp/app/src/main/res/values-uz/strings.xml index 4471c11..0051aef 100644 --- a/androidApp/app/src/main/res/values-uz/strings.xml +++ b/androidApp/app/src/main/res/values-uz/strings.xml @@ -251,8 +251,6 @@ Ajoyib yurish Kuchli yurishlar Ajoyib yurishlar - Toʻgʻri qurbonlik - Yagona yaxshi yurish Baholanmagan: %d Tahlil toʻxtadi Davom etish diff --git a/androidApp/app/src/main/res/values/strings.xml b/androidApp/app/src/main/res/values/strings.xml index c79144b..59b96f9 100644 --- a/androidApp/app/src/main/res/values/strings.xml +++ b/androidApp/app/src/main/res/values/strings.xml @@ -254,8 +254,6 @@ Brilliant move Great moves Brilliant moves - A sound sacrifice - The only good move Not evaluated: %d The analysis stopped Continue diff --git a/apps/desktop/src/i18n.rs b/apps/desktop/src/i18n.rs index ba98228..199f8a8 100644 --- a/apps/desktop/src/i18n.rs +++ b/apps/desktop/src/i18n.rs @@ -10078,28 +10078,6 @@ const ROWS: &[[&str; 9]] = &[ "Bu tahlilda !! va ! hali qidirilmagan", "Бұл талдауда !! мен ! әлі ізделмеген", ], - [ - "A sound sacrifice.", - "Корректная жертва.", - "Un sacrifice correct.", - "Ein korrektes Opfer.", - "Un sacrificio correcto.", - "Un sacrificio corretto.", - "Um sacrifício correto.", - "To‘g‘ri qurbonlik.", - "Дұрыс құрбандық.", - ], - [ - "The only good move.", - "Единственный хороший ход.", - "Le seul bon coup.", - "Der einzige gute Zug.", - "La única buena jugada.", - "L'unica buona mossa.", - "O único lance bom.", - "Yagona yaxshi yurish.", - "Жалғыз жақсы жүріс.", - ], [ "Good move", "Хороший ход", diff --git a/apps/desktop/src/notation.rs b/apps/desktop/src/notation.rs index 099496d..71563e2 100644 --- a/apps/desktop/src/notation.rs +++ b/apps/desktop/src/notation.rs @@ -4,9 +4,7 @@ use std::collections::HashMap; use crate::i18n::tr; -use crate::review::{ - Mark, judgement_color, judgement_name, judgement_reason, judgement_symbol, judgement_text_color, -}; +use crate::review::{Mark, judgement_name, judgement_symbol, judgement_text_color}; use crate::translate_ui::Mark as Translated; use chess_core::shakmaty::{Color, Position}; use chess_core::{Game, Nag, NodeId}; @@ -235,7 +233,12 @@ impl Notation<'_> { } let after = comment_text(n.comments_after()); let vars = game.variations(node); - let mark = self.marks.and_then(|m| m.get(&child)); + // A block under the move only for an error (its better line): !! and ! say + // all they have to say beside the move. + let mark = self + .marks + .and_then(|m| m.get(&child)) + .filter(|m| m.judgement.is_error()); let editing_after = editing == Some(Slot::After(child)); let interrupted = editing_after || !after.is_empty() @@ -311,11 +314,17 @@ impl Row { let dim = n .dim_until .is_some_and(|p| n.game.node(id).is_some_and(|nd| nd.ply() <= p)); - let text_right = - paint_move_cell(ui, cell, n.game, id, id == n.cursor, resp.hovered(), dim); - if let Some(mark) = n.marks.and_then(|m| m.get(&id)) { - paint_badge(ui, cell, mark); - } + let mark = n.marks.and_then(|m| m.get(&id)); + let text_right = paint_move_cell( + ui, + cell, + n.game, + id, + mark, + id == n.cursor, + resp.hovered(), + dim, + ); if let Some(&(count, shown)) = n.mistakes.and_then(|m| m.get(&id)) { let color = if shown { ui.visuals().warn_fg_color @@ -547,11 +556,13 @@ fn symbol_hint(nag: Nag, name: &'static str) -> String { } } +#[allow(clippy::too_many_arguments)] fn paint_move_cell( ui: &Ui, cell: egui::Rect, game: &Game, id: NodeId, + mark: Option<&Mark>, current: bool, hovered: bool, dim: bool, @@ -567,9 +578,18 @@ fn paint_move_cell( let node = game.node(id); let san = game.game_move(id).map(|m| m.san.as_str()).unwrap_or("?"); let san = crate::san::show(san); - let (sym, color) = node + let (mut sym, mut color) = node .map(|n| move_glyph(n.nags())) .unwrap_or((String::new(), None)); + // The engine's verdict right after the move, the move in its color (as on Lichess); + // the author's own sign stands instead when there is one. + let authored = node.is_some_and(|n| n.nags().iter().any(|g| g.is_move_assessment())); + if let Some(m) = mark + && !authored + { + sym.insert_str(0, judgement_symbol(m.judgement)); + color = Some(judgement_text_color(m.judgement, visuals.dark_mode)); + } let text_color = if current { visuals.selection.stroke.color } else if dim { @@ -588,25 +608,6 @@ fn paint_move_cell( .right() } -/// Engine verdict at the right edge of a move cell: a filled pill, unlike the author's NAGs. -fn paint_badge(ui: &Ui, cell: egui::Rect, mark: &Mark) { - let color = judgement_color(mark.judgement); - let font = FontId::proportional(12.0); - let galley = ui.painter().layout_no_wrap( - judgement_symbol(mark.judgement).to_string(), - font, - Color32::WHITE, - ); - let size = vec2(galley.size().x + 10.0, 16.0); - let rect = egui::Rect::from_min_size( - egui::pos2(cell.right() - size.x - 6.0, cell.center().y - size.y / 2.0), - size, - ); - ui.painter().rect_filled(rect, 8.0, color); - ui.painter() - .galley(rect.center() - galley.size() / 2.0, galley, Color32::WHITE); -} - /// "Mistake. Best: 23…Nf6 24.Nd5 …" under a marked main-line move. Each move opens the line /// on the board up to it; the move shown on the board is highlighted like the game cursor. fn mark_block(ui: &mut Ui, n: &Notation, id: NodeId, mark: &Mark, out: &mut NotationResponse) { @@ -637,9 +638,6 @@ fn mark_block(ui: &mut Ui, n: &Notation, id: NodeId, mark: &Mark, out: &mut Nota .color(color) .strong(), ); - if let Some(why) = judgement_reason(mark.judgement) { - ui.label(RichText::new(why).weak()); - } if mark.best_san.is_empty() { return; } diff --git a/apps/desktop/src/review.rs b/apps/desktop/src/review.rs index e6471c3..2e67bdd 100644 --- a/apps/desktop/src/review.rs +++ b/apps/desktop/src/review.rs @@ -290,10 +290,7 @@ impl Review { // Written into the game: Latin, as PGN always is. &[("judgement", &name), ("best", best)], ), - None => match judgement_reason(mark.judgement) { - Some(why) => format!("{name}. {why}"), - None => format!("{name}."), - }, + None => format!("{name}."), }; if !comments.contains(&text) { comments.push(text); @@ -888,15 +885,6 @@ pub fn judgement_text_color(j: Judgement, dark: bool) -> Color32 { } } -/// Why a move of note is one, under it in the notation and in the game's comment. -pub fn judgement_reason(j: Judgement) -> Option<&'static str> { - match j { - Judgement::Brilliant => Some(tr("A sound sacrifice.")), - Judgement::Great => Some(tr("The only good move.")), - _ => None, - } -} - pub fn judgement_symbol(j: Judgement) -> &'static str { match j { Judgement::Inaccuracy => "?!", diff --git a/docs/dev/tasks.md b/docs/dev/tasks.md index cd8ba5d..4b5c0ab 100644 --- a/docs/dev/tasks.md +++ b/docs/dev/tasks.md @@ -131,6 +131,10 @@ Решение — `docs/decisions.md`, «Android: ввод ходов…»; исследование — `docs/research/android-port.md`. Этапы: (1) сессия партии в ядре и ввод ходов на доске, новая партия, свои базы (несколько, во внутренней папке, выгрузка); (2) тренировка дебюта — `train.rs` в общий крейт; (3) Maia 5M без часов, «Играть отсюда», запись в свою базу — логика игры в общий крейт, исправить пик памяти загрузки Maia. Статус: сделано (выпуски 1.5–1.8). +### 18. Короче кнопка «½ Предложить ничью» (2026-10-28) +- **Статус:** на будущее, штрих. +- **Суть:** в партии с компьютером кнопка «½ Предложить ничью» слишком длинная, ряд кнопок под часами переносится. Владелец: переименовать в «½–½» или похоже; полное «Предложить ничью» оставить во всплывающей подсказке (и для экранного чтения). Компьютер; на телефоне проверить ту же кнопку. + ## Сделано (пусто)