Notation: the review's mark right after the move, in its color; no reasons
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 <noreply@anthropic.com>
This commit is contained in:
parent
1aa85f59d3
commit
424c7830e7
16 changed files with 46 additions and 116 deletions
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Int, Int>, 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())
|
||||
|
|
|
|||
|
|
@ -251,8 +251,6 @@
|
|||
<string name="review_brilliant">Brillanter Zug</string>
|
||||
<string name="review_greats">Starke Züge</string>
|
||||
<string name="review_brilliants">Brillante Züge</string>
|
||||
<string name="review_why_brilliant">Ein korrektes Opfer</string>
|
||||
<string name="review_why_great">Der einzige gute Zug</string>
|
||||
<string name="review_missing">Ohne Bewertung: %d</string>
|
||||
<string name="review_failed">Die Analyse wurde unterbrochen</string>
|
||||
<string name="review_resume">Fortsetzen</string>
|
||||
|
|
|
|||
|
|
@ -255,8 +255,6 @@
|
|||
<string name="review_brilliant">Jugada brillante</string>
|
||||
<string name="review_greats">Grandes jugadas</string>
|
||||
<string name="review_brilliants">Jugadas brillantes</string>
|
||||
<string name="review_why_brilliant">Un sacrificio correcto</string>
|
||||
<string name="review_why_great">La única buena jugada</string>
|
||||
<string name="review_missing">Sin evaluar: %d</string>
|
||||
<string name="review_failed">El análisis se interrumpió</string>
|
||||
<string name="review_resume">Continuar</string>
|
||||
|
|
|
|||
|
|
@ -255,8 +255,6 @@
|
|||
<string name="review_brilliant">Coup brillant</string>
|
||||
<string name="review_greats">Excellents coups</string>
|
||||
<string name="review_brilliants">Coups brillants</string>
|
||||
<string name="review_why_brilliant">Un sacrifice correct</string>
|
||||
<string name="review_why_great">Le seul bon coup</string>
|
||||
<string name="review_missing">Non évaluées : %d</string>
|
||||
<string name="review_failed">L\'analyse s\'est interrompue</string>
|
||||
<string name="review_resume">Continuer</string>
|
||||
|
|
|
|||
|
|
@ -255,8 +255,6 @@
|
|||
<string name="review_brilliant">Mossa brillante</string>
|
||||
<string name="review_greats">Ottime mosse</string>
|
||||
<string name="review_brilliants">Mosse brillanti</string>
|
||||
<string name="review_why_brilliant">Un sacrificio corretto</string>
|
||||
<string name="review_why_great">L\'unica buona mossa</string>
|
||||
<string name="review_missing">Non valutate: %d</string>
|
||||
<string name="review_failed">L\'analisi si è interrotta</string>
|
||||
<string name="review_resume">Continua</string>
|
||||
|
|
|
|||
|
|
@ -251,8 +251,6 @@
|
|||
<string name="review_brilliant">Тамаша жүріс</string>
|
||||
<string name="review_greats">Мықты жүрістер</string>
|
||||
<string name="review_brilliants">Тамаша жүрістер</string>
|
||||
<string name="review_why_brilliant">Дұрыс құрбандық</string>
|
||||
<string name="review_why_great">Жалғыз жақсы жүріс</string>
|
||||
<string name="review_missing">Бағаланбаған: %d</string>
|
||||
<string name="review_failed">Талдау тоқтап қалды</string>
|
||||
<string name="review_resume">Жалғастыру</string>
|
||||
|
|
|
|||
|
|
@ -255,8 +255,6 @@
|
|||
<string name="review_brilliant">Lance brilhante</string>
|
||||
<string name="review_greats">Ótimos lances</string>
|
||||
<string name="review_brilliants">Lances brilhantes</string>
|
||||
<string name="review_why_brilliant">Um sacrifício correto</string>
|
||||
<string name="review_why_great">O único lance bom</string>
|
||||
<string name="review_missing">Não avaliadas: %d</string>
|
||||
<string name="review_failed">A análise parou</string>
|
||||
<string name="review_resume">Continuar</string>
|
||||
|
|
|
|||
|
|
@ -259,8 +259,6 @@
|
|||
<string name="review_brilliant">Блестящий ход</string>
|
||||
<string name="review_greats">Отличные ходы</string>
|
||||
<string name="review_brilliants">Блестящие ходы</string>
|
||||
<string name="review_why_brilliant">Корректная жертва</string>
|
||||
<string name="review_why_great">Единственный хороший ход</string>
|
||||
<string name="review_missing">Без оценки: %d</string>
|
||||
<string name="review_failed">Анализ прервался</string>
|
||||
<string name="review_resume">Продолжить</string>
|
||||
|
|
|
|||
|
|
@ -251,8 +251,6 @@
|
|||
<string name="review_brilliant">Ajoyib yurish</string>
|
||||
<string name="review_greats">Kuchli yurishlar</string>
|
||||
<string name="review_brilliants">Ajoyib yurishlar</string>
|
||||
<string name="review_why_brilliant">Toʻgʻri qurbonlik</string>
|
||||
<string name="review_why_great">Yagona yaxshi yurish</string>
|
||||
<string name="review_missing">Baholanmagan: %d</string>
|
||||
<string name="review_failed">Tahlil toʻxtadi</string>
|
||||
<string name="review_resume">Davom etish</string>
|
||||
|
|
|
|||
|
|
@ -254,8 +254,6 @@
|
|||
<string name="review_brilliant">Brilliant move</string>
|
||||
<string name="review_greats">Great moves</string>
|
||||
<string name="review_brilliants">Brilliant moves</string>
|
||||
<string name="review_why_brilliant">A sound sacrifice</string>
|
||||
<string name="review_why_great">The only good move</string>
|
||||
<string name="review_missing">Not evaluated: %d</string>
|
||||
<string name="review_failed">The analysis stopped</string>
|
||||
<string name="review_resume">Continue</string>
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
"Хороший ход",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 => "?!",
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
- **Статус:** на будущее, штрих.
|
||||
- **Суть:** в партии с компьютером кнопка «½ Предложить ничью» слишком длинная, ряд кнопок под часами переносится. Владелец: переименовать в «½–½» или похоже; полное «Предложить ничью» оставить во всплывающей подсказке (и для экранного чтения). Компьютер; на телефоне проверить ту же кнопку.
|
||||
|
||||
## Сделано
|
||||
|
||||
(пусто)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue