Справочник: novelty instead of "known up to", "Game over" row, whole rows clickable, leaving asks about each modified game; no second Stockfish offer

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-19 23:48:02 +03:00
parent 3f16ba50fe
commit 6b1523b1b9
5 changed files with 74 additions and 50 deletions

View file

@ -454,9 +454,9 @@ impl App {
self.game = self.previous_games.pop();
return;
}
// Games left for others (reference tab) with unsaved edits come first: the last
// such one is shown again and, when quitting, asked about; the library (or the
// search board) waits until none is left.
// Games left for others (reference tab) with unsaved edits are asked about one
// by one (each shown with the question) before the library, the search board or
// quitting.
if let Some(k) = self
.previous_games
.iter()
@ -464,18 +464,9 @@ impl App {
{
self.previous_games.truncate(k + 1);
self.game = self.previous_games.pop();
if let Some(g) = &self.game {
let msg = trf(
"Back to {game}: it has unsaved changes",
&[("game", &g.title())],
);
self.toast(ctx, msg);
}
if intent == CloseIntent::QuitApp {
self.confirm_close = Some(CloseIntent::QuitApp);
}
// The search board asked for was for the game just closed: not later.
self.find_after_close = None;
// Ask about it right away; its answer continues to where the user was going
// (the library, the search board, quitting).
self.confirm_close = Some(intent);
return;
}
self.previous_games.clear();

View file

@ -2031,6 +2031,38 @@ const ROWS: &[[&str; 6]] = &[
"Ninguna otra partida llegó a esta posición",
"Nessun'altra partita ha raggiunto questa posizione",
],
[
"Novelty:",
"Новинка:",
"Nouveauté :",
"Neuerung:",
"Novedad:",
"Novità:",
],
[
"The first move of this game that no other game of this database played; before it the game followed games of the database",
"Первый ход этой партии, которого нет ни в одной другой партии базы; до него партия шла по партиям базы",
"Le premier coup de cette partie qu'aucune autre partie de la base n'a joué ; avant, la partie suivait des parties de la base",
"Der erste Zug dieser Partie, den keine andere Partie der Datenbank spielte; davor folgte sie Partien der Datenbank",
"La primera jugada de esta partida que ninguna otra partida de la base jugó; antes seguía partidas de la base",
"La prima mossa di questa partita che nessun'altra partita della base ha giocato; prima seguiva partite della base",
],
[
"Game over",
"Конец партии",
"Fin de partie",
"Partieende",
"Fin de la partida",
"Fine partita",
],
[
"Games that ended in this position (resignation, draw, mate, time)",
"Столько партий закончилось в этой позиции (сдача, ничья, мат, время)",
"Parties terminées dans cette position (abandon, nulle, mat, temps)",
"Partien, die in dieser Stellung endeten (Aufgabe, Remis, Matt, Zeit)",
"Partidas que terminaron en esta posición (abandono, tablas, mate, tiempo)",
"Partite finite in questa posizione (abbandono, patta, matto, tempo)",
],
[
"Checking engine…",
"Проверка движка…",

View file

@ -976,42 +976,30 @@ impl Reference {
let line = main_line(game);
let book = self.book_for(&path, &line).cloned();
let failed_book = self.book_failed.as_ref() == Some(&(path.clone(), line.clone()));
ui.horizontal(|ui| match &book {
// The novelty: the first move of the game no other game of the database played
// (the line keeps its height while it is worked out, so nothing jumps).
let novelty = book.as_ref().and_then(|b| match b.last {
_ if b.to_the_end => None,
Some(last) => game.main_child(last),
None => game.main_child(game.root()),
});
ui.horizontal(|ui| match (&book, novelty) {
_ if line.is_empty() => {}
Some(b) if b.to_the_end => {
ui.label(RichText::new(tr("The whole game is in this database")).weak());
}
Some(BookEnd {
last: Some(node), ..
}) if *node == game.root() => {
ui.label(
RichText::new(tr(
"The games of this database leave this one at its first move",
))
.weak(),
);
}
Some(BookEnd {
last: Some(node), ..
}) => {
ui.label(RichText::new(tr("Known up to")).weak());
(Some(_), Some(node)) => {
ui.label(RichText::new(tr("Novelty:")).weak());
if ui
.link(node_label(game, *node).unwrap_or_default())
.link(node_label(game, node).unwrap_or_default())
.on_hover_text(tr(
"The last move of the game still played in other games of this database",
"The first move of this game that no other game of this database played; before it the game followed games of the database",
))
.clicked()
{
action = Some(RefAction::Goto(*node));
action = Some(RefAction::Goto(node));
}
}
Some(_) => {
ui.label(
RichText::new(tr("Not even the start of the game is in this database")).weak(),
);
}
None if failed_book => {}
None => {
(Some(_), None) => {}
(None, _) if failed_book => {}
(None, _) => {
ui.label(RichText::new(tr("Comparing the game with the database…")).weak());
}
});
@ -1138,6 +1126,8 @@ impl Reference {
let show_score = width > 400.0 && !books;
let show_elo = width > 330.0 && !books;
let show_bar = !books;
// Text in the rows must not take the clicks meant for the row.
ui.style_mut().interaction.selectable_labels = false;
let mut table = TableBuilder::new(ui)
.id_salt("reference_moves")
.striped(true)
@ -1217,7 +1207,7 @@ impl Reference {
.to_move(pos)
.map(|m| move_label(pos, m))
.unwrap_or_else(|_| s.san.clone()),
None => tr("Ended").to_owned(),
None => tr("Game over").to_owned(),
};
row.col(|ui| {
let text = if in_game {
@ -1227,9 +1217,13 @@ impl Reference {
} else {
RichText::new(format!(" {label}")).weak()
};
let r = ui.label(text);
let r = ui.add(egui::Label::new(text).selectable(false));
if in_game {
r.on_hover_text(tr("The move played in this game"));
} else if stat.is_none() {
r.on_hover_text(tr(
"Games that ended in this position (resignation, draw, mate, time)",
));
}
});
row.col(|ui| {
@ -1412,6 +1406,7 @@ impl Reference {
let show_event = width > 720.0;
let show_then = width > 520.0;
let show_year = width > 380.0;
ui.style_mut().interaction.selectable_labels = false;
let mut table = TableBuilder::new(ui)
.id_salt("reference_games")
.striped(true)

View file

@ -304,8 +304,14 @@ impl SettingsWindow {
}
}
// ChessPenguin's Stockfish can always be (re)downloaded from here.
// Not when a Stockfish of the user's is there already (it would be the same
// engine twice).
let own = crate::engines::own_stockfish().is_some();
if !s.engines.is_empty() && !own && crate::engine_download::available() {
let has_stockfish = s
.engines
.iter()
.any(|e| e.name.to_lowercase().contains("stockfish") && e.executable().is_some());
if !s.engines.is_empty() && !own && !has_stockfish && crate::engine_download::available() {
ui.add_space(6.0);
ui.horizontal(|ui| {
if downloading {

View file

@ -14,7 +14,7 @@
```
- «База» — список баз полки (имя · число партий); по умолчанию самая большая по размеру файла, выбор запоминается.
- Теория: «В базе до хода N» (ссылка), «Вся партия есть в этой базе», «Партии этой базы расходятся с этой уже на первом ходу», «Даже начала партии нет в этой базе». Сама партия и её копии не считаются. Первые 12 полуходов проверяются по одному, дальше граница ищется удвоением и делением пополам (позиция почти всегда есть в базе, если в ней есть более поздняя позиция той же линии). Ответ сохраняется, пока партия удлиняется за его пределы; номера ходов у партий с FEN — от их начала.
- Новинка: «Новинка: 14.Nf3» (ссылка) — первый ход партии, которого нет ни в одной другой партии базы; если такого хода нет (все ходы партии встречаются в базе), строки нет. Сама партия и её копии не считаются. Первые 12 полуходов проверяются по одному, дальше граница ищется удвоением и делением пополам (позиция почти всегда есть в базе, если в ней есть более поздняя позиция той же линии). Ответ сохраняется, пока партия удлиняется за его пределы; номера ходов у партий с FEN — от их начала.
- Пока большая база строит индекс: «Ускоряю поиск по этой базе (один раз)… N %».
Под выбором базы:
@ -33,11 +33,11 @@
| 5.Nc3 | 70 608 | 74 % | ▕██▒▒░░▏ | 55 % | 2236 | 2025 | Carlsen, Caruana |
- **Ход** — SAN с номером; **Партий** и **%** — сколько партий сыграли ход; **Результат** — полоса белые/ничьи/чёрные (как на доске поиска), **Белые** — очки белых в процентах; **Ср. Эло** — средний рейтинг партий, где известны оба; **Год** — последний; **Лучшие игроки** — две фамилии сильнейших (по рейтингу в партии) игроков, сыгравших этот ход.
- Последняя строка — «Закончились» (партии, кончившиеся в позиции), без хода.
- Последняя строка — «Конец партии»: столько партий закончилось в этой позиции (сдача, ничья, мат, время).
- Ход, сыгранный в партии, отмечен «⏵» и полужирным.
- Для книги (большинство партий без результата) — «Главы» вместо «Партий», без колонок результата, очков и Эло.
- **Один клик** выделяет ход: синяя стрелка на доске, таблица партий ниже показывает только партии с этим ходом. Повторный клик снимает выделение. **Двойной клик** играет ход в партии: переход, если такой ход в партии есть, иначе новый вариант (Ctrl+Z отменяет).
- Наведение — синяя стрелка этого хода.
- Наведение — синяя стрелка этого хода. Строки кликаются целиком, и по тексту тоже (текст в ячейках не выделяется).
- Высота — до 40 % панели, дальше прокрутка.
## Таблица партий
@ -54,7 +54,7 @@
- Наведение — синяя стрелка следующего хода этой партии. **Двойной клик** открывает партию на этой позиции; текущая не закрывается, а остаётся в стеке (см. ниже).
- В узкой панели колонки прячутся по очереди: Турнир, Дальше, Год; у таблицы ходов — Лучшие игроки, Год, Белые, Ср. Эло.
- Ссылка «все в библиотеке ➡» открывает позицию на доске поиска этой базы.
- Открытая из списка партия не закрывает текущую: в шапке «⬅ К партии …» возвращает её как была (с несохранёнными правками). «⬅ Библиотека» и выход из программы сначала возвращают к оставленной партии с несохранёнными изменениями, чтобы вопрос «сохранить?» был о ней. Вкладка «Справочник» остаётся открытой и в следующей партии, открытой из библиотеки или из справочника.
- Открытая из списка партия не закрывает текущую: в шапке «⬅ К партии …» возвращает её как была (с несохранёнными правками). «⬅ Библиотека» и выход из программы по очереди спрашивают «сохранить?» про каждую оставленную партию с несохранёнными изменениями (показывая её), затем идут, куда просили. Вкладка «Справочник» остаётся открытой и в следующей партии, открытой из библиотеки или из справочника.
## Состояния