Compare commits

...

323 commits
v1.3.0 ... main

Author SHA1 Message Date
vrubelroman
a37c6a78f4 release: verify 2.5.2 Android packages and website
Some checks failed
CI / check (push) Has been cancelled
CI / windows-build (push) Has been cancelled
CI / macos-build (push) Has been cancelled
2026-11-30 00:28:07 +03:00
vrubelroman
0ee3eecf50 Merge 2.5.2: Android game review and opponent preparation
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release notes / update (push) Has been cancelled
Release / version (push) Has been cancelled
Release / android (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / publish (push) Has been cancelled
2026-11-30 00:13:17 +03:00
vrubelroman
7ad9a79caf release: prepare ChessPenguin 2.5.2 2026-11-30 00:11:25 +03:00
vrubelroman
1e1684f808 android: prepare against a player from the database 2026-11-30 00:11:12 +03:00
vrubelroman
a0051859db android: put game review in the bottom bar 2026-11-28 14:31:28 +03:00
vrubelroman
fd2fbd9b2a desktop: dismiss settings on an outside click
Some checks failed
CI / check (push) Has been cancelled
CI / windows-build (push) Has been cancelled
CI / macos-build (push) Has been cancelled
2026-11-28 01:31:55 +03:00
vrubelroman
f6edbe80a0 Merge 2.5.1: batch review of selected games
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release notes / update (push) Has been cancelled
Release / version (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
2026-11-28 00:33:56 +03:00
vrubelroman
6334462071 release: prepare ChessPenguin 2.5.1 2026-11-28 00:32:46 +03:00
vrubelroman
064e929d2c desktop: analyse manually selected games in batches 2026-11-28 00:27:41 +03:00
vrubelroman
1782569e1c docs: tasks 26, 27, 42-45 released in 2.5.0
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
2026-11-27 18:13:37 +03:00
vrubelroman
fd9ce410c6 release: verify 2.5.0 packages and update AUR checksum
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
2026-11-27 18:13:16 +03:00
vrubelroman
2069858918 Merge 2.5.0: great moves, selected games to a new database, arrows hint, example repertoires
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release notes / update (push) Waiting to run
Release / version (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
2026-11-27 17:55:02 +03:00
vrubelroman
d9b52cc27d release: prepare 2.5.0 — great moves search, new database from selected games, arrows hint, example repertoires 2026-11-27 17:55:02 +03:00
vrubelroman
2654c9cfb1 web: the search for great moves off (CAPS.great_moves), the opening panel's width desktop only — the wasm build compiles again 2026-11-27 17:53:53 +03:00
vrubelroman
c179c44e49 great moves: Shift+A on an empty list explains why; docs: tasks 27 and 45 done 2026-11-27 17:38:40 +03:00
vrubelroman
117a3880f6 kings of the sides drawn as pieces: White light, Black dark, in both themes (task 45) 2026-11-27 17:30:43 +03:00
vrubelroman
70422ce635 great moves (task 27) design review: windows as high as their content, the summary in the middle, the button's text colour, bold signs, the subtitle's separator, the games that cannot be reviewed said 2026-11-27 17:27:10 +03:00
vrubelroman
e46c98848c great moves (task 27) checks: marks checked against the game's main line in the summary and the sort, the index made anew from the cache, «—» for games not analysable, Shift+A over an empty list, one calibrated estimate, plural forms and the conditions in words, no game against the engine during a pass, hooks for the tester 2026-11-27 17:17:33 +03:00
vrubelroman
a37ca57b0b docs: owner's token economy rule; task 45 — kings look inverted on dark 2026-11-27 17:13:15 +03:00
vrubelroman
6e093b0964 great moves (task 27): the column and its sort count the filter's player only, «Continue» keeps the player, «Open at» shows the report, the Stockfish 19 offer before a pass 2026-11-27 16:11:18 +03:00
vrubelroman
e9d22b92c3 design: task 27 summary window 2026-11-27 16:04:47 +03:00
vrubelroman
9a2cebd940 great moves (task 27): the button and progress in the conditions line, the «!!» column, the question, the summary, one engine job 2026-11-27 16:03:04 +03:00
vrubelroman
c3a06653d6 great moves (task 27): the background pass over a list, the marks index beside the analysis cache, totals by category and player 2026-11-27 16:03:04 +03:00
vrubelroman
b6d457bcd0 docs: task 26 done and reviewed 2026-11-27 15:38:30 +03:00
vrubelroman
2d93f0a211 game: «Analyse game» button in the colour of «!!» (task 26) 2026-11-27 15:33:55 +03:00
vrubelroman
f0cde210bd docs: tasks 42 and 43 done and verified 2026-11-27 15:09:04 +03:00
vrubelroman
eb9c9a142a Merge task 43: arrows/circles hint and notation sign 2026-11-27 15:01:20 +03:00
vrubelroman
b6a7047564 qa: task 42 functional and design reviews 2026-11-27 15:00:50 +03:00
vrubelroman
d8533b5c33 library: task 42 checks — duplicates by the record's text (a 128-bit key), the choice let go when its records change, unique temporary files and their cleanup, Enter in a question does not open the game 2026-11-27 15:00:24 +03:00
vrubelroman
6757085381 docs: task 42 duplicate rule (owner) 2026-11-27 14:52:41 +03:00
vrubelroman
14c8f26252 qa: task 43 functional and design reviews — accepted 2026-11-27 14:30:50 +03:00
vrubelroman
6724757e09 dev hooks: CP_BEST_DELAY / CP_BEST_EXIT_AFTER — the better line on a timer after the notation is drawn 2026-11-27 14:29:08 +03:00
vrubelroman
787d2c19fd settings: test without field reassignment (clippy) 2026-11-27 14:25:10 +03:00
vrubelroman
d5eff1a256 library: task 42 review — cursor frame on the row's fill, copied base at the end of the shelf, write error in the conditions line, CP_BATCH_CANCEL_AFTER 2026-11-27 14:24:36 +03:00
vrubelroman
b384f7b792 task 43 review: hint stays dimmed during an engine line, plain text, help under «Board», ring 10×10, reopened game keeps the hint 2026-11-27 14:24:02 +03:00
vrubelroman
e0ca581303 headless-run: floating full-size windows so parallel runs are always 1920x1080 2026-11-27 14:21:18 +03:00
vrubelroman
ed3beef4c9 design: task 27 placement spec 2026-11-27 14:13:20 +03:00
vrubelroman
a7c258c88a docs: task 27 — integral summary dialog and !! marks, owner's answers 2026-11-27 14:13:13 +03:00
vrubelroman
8522f30c28 library: choose several games and copy them into a new database (task 42) 2026-11-27 14:04:39 +03:00
vrubelroman
112fee89a5 task 43: arrows/circles hint above the notation, sign by moves with [%cal]/[%csl], apply_shape tests, CP_HINT_RESET 2026-11-27 13:55:54 +03:00
vrubelroman
57a63fa455 design: tasks 42-43 spec 2026-11-27 13:42:45 +03:00
vrubelroman
e48eddd618 docs: task 27 — owner's answers (limit 100, disabled button with hint, cache, stop) 2026-11-27 13:41:41 +03:00
vrubelroman
919fc2872c qa: fullmove=0 on write — no defects; legacy repair note for task 42 2026-11-27 13:40:44 +03:00
vrubelroman
08d0e878a5 docs: tasks 26 and 27 — owner's 2026-11-27 order and limit 2026-11-27 13:39:59 +03:00
vrubelroman
3cad881f28 docs: task 44 — Russian starter comments verified 2026-11-27 13:31:03 +03:00
vrubelroman
df7ac0c5ae opening trainer: starter repertoires with Russian comments for the Russian interface 2026-11-27 13:27:42 +03:00
vrubelroman
7189e4185f docs: owner confirmed starter rules, Russian comments, 2.4.1 2026-11-27 13:24:03 +03:00
vrubelroman
74b107c821 docs: starter decision awaits owner's confirmation 2026-11-27 12:54:44 +03:00
vrubelroman
2f75b52556 opening trainer: four starter repertoires for new and updated users, wider repertoire panel; headless test windows 2026-11-27 12:54:40 +03:00
vrubelroman
e60b0189c8 release: verify 2.4.0 packages and update AUR checksum
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
2026-11-27 11:24:17 +03:00
vrubelroman
d42fb81850 website: what's new in 2.4.0 in nine languages
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
2026-11-27 10:00:28 +03:00
vrubelroman
80552292b0 Merge rewritten opening training for 2.4.0
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release notes / update (push) Waiting to run
Release / version (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / publish (push) Has been cancelled
2026-11-27 09:58:00 +03:00
vrubelroman
05514c661e release: prepare 2.4.0 with the rewritten opening training 2026-11-27 09:57:49 +03:00
vrubelroman
27217322ed opening trainer: table columns «Today» (review N / new: N / when) and «Passed» (bar at a fixed place, A/Y); «passed / consolidated» wording in the card, the summary and Lines 2026-11-27 09:38:35 +03:00
vrubelroman
613d14bfdd opening trainer: the table's bar is green/blue on a visible track (white on a dark selection), «learning Z» instead of «0/Y», column «Progress», the next review under «Today» 2026-11-27 09:23:54 +03:00
vrubelroman
5034527865 docs: task 40 — core cleanup done 2026-11-27 08:50:13 +03:00
vrubelroman
07c6d0cda3 trainer: drop the dead v2 tree session (session.rs), its queues and paths in stats.rs/tree.rs/scope.rs and their tests; v2/legacy formats, StatsStore and the store/migration tests stay 2026-11-27 08:49:13 +03:00
vrubelroman
87e8a6d794 opening trainer: the mini-bar on a selected row takes the selection's text colour; a grey track in the light theme 2026-11-27 08:42:18 +03:00
vrubelroman
adf89181d5 docs: task 40 — owner's 2026-11-27 changes 2026-11-27 08:24:52 +03:00
vrubelroman
3011bebd80 opening session: the line of moves to the board (block C) is back, by the owner's decision of 2026-11-27 2026-11-27 08:23:31 +03:00
vrubelroman
7cb0291e48 opening trainer: the «Learned» column has the card's two-segment bar and a hint on what «learned» takes; «no moves» for an empty repertoire; the summary shows «Learning +N» 2026-11-27 08:22:02 +03:00
vrubelroman
8ca7f43c3c board: temporary right-button arrows and circles in play and opening training (ported from the working tree) 2026-11-27 08:18:33 +03:00
vrubelroman
67044d7b48 docs: task 40 — QA results 2026-11-27 02:43:52 +03:00
vrubelroman
e938abf0c5 qa: opening trainer v2 — functional scenarios pass 2026-11-27 02:43:37 +03:00
vrubelroman
af0a89a6f6 qa: opening trainer v2 — user data from 2.2/2.3 is read unchanged 2026-11-27 02:37:11 +03:00
vrubelroman
e59f01c47d docs: opening trainer v2 — task, decisions, changelog 2026-11-27 02:20:25 +03:00
vrubelroman
358e1bf08e opening trainer: no «0 left» on the summary; «Learned X of Y · learning Z»; S0 shows the repertoire's start; «Switch colour to …» in the menu 2026-11-27 02:16:55 +03:00
vrubelroman
f717644b6d opening trainer: «Review all» is always in the card's button row when the repertoire has moves; a narrow panel narrows the buttons 2026-11-27 02:14:57 +03:00
vrubelroman
2128573b5d opening trainer: the section header has the game screen's height (separator at 52, the same board) 2026-11-27 02:13:19 +03:00
vrubelroman
ebd705cf5d opening trainer: the branch header names the branch in SAN with move numbers (also from the QA hook) 2026-11-27 02:10:00 +03:00
vrubelroman
94ddbfa27a qa: opening trainer v2 design review 2026-11-27 02:08:29 +03:00
vrubelroman
04af686dfc i18n: drop 202 strings of the removed training section 2026-11-27 01:59:14 +03:00
vrubelroman
9a26290b93 opening session: the summary test computes the summary 2026-11-27 01:57:49 +03:00
vrubelroman
a9fc7b98fe opening session: summary shows new moves left and the next review separately; no «× Finish» on the summary 2026-11-27 01:57:37 +03:00
vrubelroman
e1ea994da4 opening session: test that a first-move mistake returns once and keeps the count (10 → 20 is the next session: 10 learned moves due today + 10 new) 2026-11-27 01:55:43 +03:00
vrubelroman
a5b07e9409 opening trainer: starter repertoires (Spanish for White, Najdorf for Black) on the first opening 2026-11-27 01:51:22 +03:00
vrubelroman
22aedf9011 docs: handoff state 2026-11-27, review notes 2026-11-27 01:47:23 +03:00
vrubelroman
d54e359f76 opening trainer: whole card frames, buttons never cut, path cut on the left, no arrow after a stopped session 2026-11-27 01:40:14 +03:00
vrubelroman
8a94d08822 opening session: a new move's showing is recorded only with the played move
A new move left on the board when the session stops stays new, as the result
and the card say (restores the original expectation of
a_session_needs_no_question_to_go_back_and_counts_refresh_after_it).
2026-11-27 01:34:36 +03:00
vrubelroman
0493965a71 wip: repertoire_ui test fixes in progress 2026-11-27 01:31:14 +03:00
vrubelroman
98f0e4749f wip: opening trainer v2 desktop UI (repertoires, session, lines), i18n, devhooks doc
One repertoire_ui test still fails (see docs/qa/opening-trainer-v2-devhooks.md).
2026-11-26 17:13:34 +03:00
vrubelroman
3db35e4d03 trainer: daily session (due + N new), mistakes return in the session, one-pass and branch review
- LearningSessionSnapshot::new_daily: every due move and at most N unseen, PGN order
- introduce_more: the next N unseen after a finished daily session
- a move answered after a mistake or a hint goes back to the end of the queue;
  preview_new shows a new move without bringing it back
- new_single_pass_review / new_branch_review: one pass, lines through a move
- optional snapshot flags (absent when unused, old files read as before)
2026-11-26 16:47:16 +03:00
vrubelroman
bd72aeacf8 docs: opening trainer v2 research, audit, concept and spec 2026-11-26 16:38:16 +03:00
vrubelroman
ddc836198d release: verify 2.3.0 packages and update AUR checksum
Some checks failed
CI / check (push) Has been cancelled
CI / windows-build (push) Has been cancelled
CI / macos-build (push) Has been cancelled
2026-11-06 01:49:41 +03:00
vrubelroman
aafa89e6ae Merge repertoire annotations, variations and performance improvements for 2.3.0
Some checks failed
Release notes / update (push) Has been cancelled
Release / version (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
2026-11-06 01:31:19 +03:00
vrubelroman
8c430f1eaf release: prepare 2.3.0 with annotated repertoire variations and faster training 2026-11-06 01:31:15 +03:00
vrubelroman
9ba3628751 release: verify 2.2.0 packages and clarify alpha training limitations
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release notes / update (push) Waiting to run
2026-11-06 00:43:39 +03:00
vrubelroman
7654f7342a Merge opening repertoire training for 2.2.0
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release / version (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / publish (push) Has been cancelled
2026-11-06 00:26:59 +03:00
vrubelroman
f425e3abc2 release: prepare ChessPenguin 2.2.0 and update website 2026-11-06 00:26:37 +03:00
vrubelroman
860e84d0d9 fix: refine opening training UI, move feedback and opponent preparation 2026-11-06 00:26:01 +03:00
vrubelroman
a4521d94ed Merge Android clipboard into opening training
# Conflicts:
#	CHANGELOG.md
#	docs/decisions.md
#	docs/dev/tasks.md
2026-11-05 21:23:29 +03:00
vrubelroman
5e3d1ead3f feat: open PGN from Android clipboard 2026-11-05 21:14:42 +03:00
vrubelroman
d1733b4fe5 feat: implement ChessTempo opening learning trainer 2026-11-04 16:24:30 +03:00
vrubelroman
b08aca0b4c refine opening repertoire table 2026-11-03 22:56:09 +03:00
vrubelroman
1b4d30900e feat: refine opening repertoire training 2026-11-03 19:04:22 +03:00
vrubelroman
71ca5ad9e6 feat: simplify opening variation training 2026-11-03 11:03:24 +03:00
vrubelroman
f49aab68fa feat: add opening repertoire training 2026-11-03 00:03:51 +03:00
vrubelroman
4eb0822ec6 AUR: chesspenguin-bin 2.1.5
Some checks failed
CI / check (push) Has been cancelled
CI / windows-build (push) Has been cancelled
CI / macos-build (push) Has been cancelled
2026-11-02 14:58:39 +03:00
vrubelroman
fdcb12bd80 Release 2.1.5
Some checks failed
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release / version (push) Has been cancelled
Automatically save opponent preparations and start the opening-error engine when the report is ready, while preserving manual Stop and saved evaluations.

Remove the book comparison from opponent preparation: its UI, background work, algorithm and development hook are gone. Legacy saved data remains readable and is preserved for a possible future revert.

Align game counts, error counts and percentages in the preparation summary and refresh the architecture and team documentation.
2026-11-02 13:35:21 +03:00
vrubelroman
101e976c48 AUR: chesspenguin-bin 2.1.4
Some checks failed
CI / check (push) Has been cancelled
CI / windows-build (push) Has been cancelled
CI / macos-build (push) Has been cancelled
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 23:26:46 +03:00
vrubelroman
b869e829f4 Release 2.1.4
Some checks failed
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The same as 2.1.3, whose macOS build GitHub cancelled (macOS 14 runners
retired); built on macOS 15.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 23:07:27 +03:00
vrubelroman
8bd2c48609 CI: macOS 15 runners (GitHub retires macOS 14 on 2026-11-02)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The 2.1.3 release run lost its macOS job to a scheduled brownout of the
macOS 14 image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 22:52:05 +03:00
vrubelroman
ea6b80a98f Release 2.1.3
Some checks failed
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Opponent preparation by period or number of games, saved preparations,
and downloaded games opened on Lichess or Chess.com.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 22:07:52 +03:00
vrubelroman
6f61234ac6 Merge prep-period-saved: periods, saved preparations, game links
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 22:05:45 +03:00
vrubelroman
3803165491 Changelog, decisions and tasks: periods, saved preparations, game links
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 22:04:39 +03:00
vrubelroman
b682755f0e Prep row shortens in one order; the game link as in its header everywhere
The period and the depth captions are chosen together: the depth gives
way first at every width. The list's context menu reads the game's link
(once per menu) and names the site as the game screen does; the header's
subtitle leaves the web address to the globe, whose tooltip says what
opens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 22:04:09 +03:00
vrubelroman
a3532d6a73 Open a downloaded game on Lichess or Chess.com
The game screen has a globe after the result and an item in ☰ when the
game's Link or Site is a web address: a Lichess game opens at the move
shown, from the side at the bottom of the board; a Chess.com game (its
Link tag) at its page. The game list's context menu opens it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 22:01:11 +03:00
vrubelroman
eb3b8fd8df Opponent prep: more room for the period's middle caption
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 22:01:11 +03:00
vrubelroman
d4c141a841 Opponent prep: combos as wide as their text, no search or save in no games
The period and the depth fit at 640 px with their middle captions; the
header counts the games of the colour shown; the empty-period note names
the colour; the preparations list says «за 2 года · 8 партий» and
«последние 100».

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 21:58:56 +03:00
vrubelroman
e2f4935ecc Opponent prep: the newest game by its earliest day; dates after today are typos
One game of «2026.??.??» no longer moves a period past the exactly dated
games; a date after today counts as none (in periods and in «Last N»).
Every colour change goes through set_color; a name with two ids in the
database takes both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 21:58:10 +03:00
vrubelroman
758856f458 Opponent prep: the tester's findings
A saved preparation is the player's by his names, not the database's
name ids (they shift when a game is deleted or the file is replaced):
opened from the list, the names are found again. The period counts are
of the games a report can take (set-up games left out first). A partly
known date is in a period when any day it can mean is; a date after
today is not the newest. Reopening a hidden report notices a deleted
preparation; a colour change is saved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 21:54:03 +03:00
vrubelroman
e80933d48d Opponent prep: the designer's review
The period caption shortens in a narrow row; «Last N» with both colours
shows «N + N»; the menu says from which date it counts; undated games
left out are named in the summary; no games in a period offer all games.
Without any dates a period by months takes all. Crisp icons (★, 🗐);
saved is a quiet mark. The list cuts long texts, names the colour in
words, opens on double-click, renames with Cancel, explains a missing
database, and tells while it opens one. CP_PREP_LIST for screenshots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 21:47:08 +03:00
vrubelroman
570bd84dcf Opponent prep: periods of 3 and 6 months, not 5 years
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 20:28:35 +03:00
vrubelroman
57fa98241b Opponent prep: which games by period or number, saved preparations
The report takes all the player's games, those of the last 1/2/5 years
before his newest game, or his last 50/100/200 of each colour; every
choice shows how many games it takes. Undated games count only with all.
«💾 Save» keeps a preparation with its errors in the program's data;
«📑 Preparations» in the library opens, renames and deletes them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 18:11:58 +03:00
vrubelroman
1ac5645ef7 AUR: chesspenguin-bin 2.1.2
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 14:59:42 +03:00
vrubelroman
8a2314f9e2 Release 2.1.2
Some checks failed
Release / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
The review on the user's own Stockfish 19 when it is the same build; files dropped
on the window open as databases; sizes in the interface's language; less memory for
the encoding check of large PGN files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 14:41:42 +03:00
vrubelroman
771162f627 Review engine: the probe started by the user's path, a timeout told and not kept, no wait on quitting; the shelf takes a link once
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
- The «checking your engine» toast only while an engine is really being checked.
- The probe starts the engine by the path of the settings or PATH (a snap or a
  wrapper looks at its name); the verdict stays the real file's.
- A Stockfish 19 that does not finish the check in time: its own text, kept in
  memory until the next request, never on the disk.
- Quitting waits for probes 2 s at most; an engine hung in its handshake dies with
  the probe's thread (uci: EngineConfig::kill_with_parent, PR_SET_PDEATHSIG).
- touch_database: a link to a database on the shelf is that database.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 13:51:29 +03:00
vrubelroman
829bde9fdb Review engine and dropped files: fixes after the independent check
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
- The probe turns down an engine not called «Stockfish 19» right after `uci`, without
  a search; a search has a 10 s guard, the probe 30 s; probes stop and their engines
  quit (or are killed) when the program quits. Play engines (Rodent, Maia) are never
  candidates.
- «Did not start» is its own outcome, said once and tried again next time; verdicts
  are kept for the real file with the reference's key; the engine's name is checked
  again when a job starts (a wrapper may run another program).
- The wait for a probe belongs to its game or preparation; the game analysis and the
  opening errors wait apart; «analyse anew» keeps its `full`.
- The offer says why: another engine (settings / system), a Stockfish 19 that
  calculates otherwise, one that did not start; the size line is back.
- Dropped files: missing ones told, known ChessBase parts only, duplicates by the real
  file, each folder listed once; drops never replace a database being chosen again,
  a cancelled «Choose again» ends it; «Added to the shelf» over a game; a framed
  highlight with a card; long names shortened.
- decisions.md: where dropping works (not in a Wayland session: winit 0.30).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 13:42:19 +03:00
vrubelroman
4fc1d5b67d Tasks: training along a file's tree of variations, as in ChessTempo
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 13:38:42 +03:00
vrubelroman
02b665719f Tasks: training files - positions to solve with points, as in ChessBase
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 13:26:36 +03:00
vrubelroman
391977a5ef Game analysis on the user's own Stockfish 19 once it searches as ours; files dropped on the window open as databases
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
- review_engine: ChessPenguin's Stockfish 19, else a Stockfish 19 of the user's
  (settings, PATH) whose probe (game_review::probe: id name and three searches of the
  analysis's fixed mode at 100k nodes) matches the reference of ours; probed in the
  background, the verdict kept by path, size and time. Other engines: the offer names
  them («В настройках указан …»).
- Dropped files and folders open as «Add database» does (.pgn/.cbh/.cbv/.zip/.7z, the
  .cbh of any ChessBase part); others get a toast; «Release to open» while dragging.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 13:16:15 +03:00
vrubelroman
464016ef52 Ignore agents' worktrees
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 21:19:14 +03:00
vrubelroman
bc873ef24d Merge the web version (computers; phones and tablets get the app page)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 21:19:06 +03:00
vrubelroman
b5da315343 Sizes in the interface's language: units and the decimal sign («2,2 ГБ, предел 2,0 ГБ»)
platform::size_text takes the units from the translations ({n} GB …) and
the decimal comma where the language writes one; every size the web version
shows goes through it. chessbase.mjs takes CP_LANG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 21:15:11 +03:00
vrubelroman
bc104c55b4 Web version: ChessBase databases of several files and folders, a 2 GB limit with a polite refusal, messages without the page's paths
A .cbh chosen alone brings a window: its folder (Chrome, Edge:
showDirectoryPicker opening beside the file, the folder remembered; others:
webkitdirectory) or all its files; the files are grouped into databases by
name (chess_import::group_chosen), the reader opens a ChessBase one with
open_chessbase_owned. The user's files stay the browser's File objects: the
worker reads them, the page never holds a database's bytes; a kept copy
takes the whole database. Over 2 GB of the files read: refused with the way
to the desktop program. A reader out of memory says so in the user's words.
Paths like /opened/... are no longer shown (platform::files::shown).

chess-core: detect_letter_substitution decodes the text a piece at a time;
it held the whole text as chars (four times its size): a 1 GB cp1251 PGN
could not be read in a browser (capacity overflow) and cost gigabytes on a
computer. Now 1.95 GB opens in Firefox and Chromium.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 20:42:18 +03:00
vrubelroman
bda92c5675 Web version: «Allow reading» checked, a kept copy lets the handle go, dropped files told apart in Chrome; docs: §9, the checks in Chromium
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 17:58:01 +03:00
vrubelroman
f694bc768b Web version: databases read in a worker, the shelf's counts, Chrome and Edge remember chosen files
The page's reader: a Web Worker with a second instance of the program reads
a database (PGN, CBV, ZIP, 7Z) and gives back its text and index; the page
puts it together without reading it again (chess_core::PgnIndex,
PgnDatabase::into_index / from_index, serde behind a feature). A 13 MB CBV:
the longest frame 17 ms in Firefox, 67 ms in Chromium (1000 ms before).
platform::open_database is the same on both sides: away from the screen,
done when read. The shelf's cards count the games the same way (one file
at a time); the counts are kept through platform::fs.

Chrome, Edge (File System Access): a chosen file's handle is kept in the
browser's storage; at the next visit the file is read again by itself when
the browser allows it, else the card offers «Allow reading» (the browser's
own question). Files of different visits get folders of their own.

Checks: t.choose(files, open) for both browsers (in Chromium the handles of
the site's private file system stand for the dialog's); app.mjs checks the
draft, the question on leaving and the remembered file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 17:50:54 +03:00
vrubelroman
000821887f Web version: the engine's location as a type, the browser's history and Back, the question on leaving, the draft of an unsaved game
EngineLocation: an engine starts from its program on a computer, from the
address of its Web Worker's script in a browser; analysis, the review job,
the judge and the settings take it instead of a path.

platform::page: a game on the screen is an entry of the browser's history,
so Back is «← Library» (with the same questions); unsaved changes or a
running review make the browser ask before the page is left. The draft of an
unsaved game is written every 5 s while it has changes and offered at the
next start (Open / Delete); a saved or left game takes it away.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 17:35:30 +03:00
vrubelroman
3afeee09c7 Web checks: one driver for Firefox (WebDriver BiDi) and Chromium / Chrome for Testing (DevTools protocol); the scenarios on it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 17:31:27 +03:00
vrubelroman
67c91b6e0d Web version: no engine-file or folder buttons in a browser's settings; docs: the review check (359 of 359 positions the same as on the computer), checks of stage 2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:43:28 +03:00
vrubelroman
027860901d Web version: My games after the samples (a new library opens on the classics); stage 2 browser check
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:39:51 +03:00
vrubelroman
48de2debcf Web version: engine settings without threads and memory; review check reads the browser's storage as JSON; docs for stage 2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:37:38 +03:00
vrubelroman
61ccd763bc Web version, stage 2: Stockfish 19 in workers, live analysis, game review on N workers, My games, files, keys
game-review: what the job does for one target (the full search, the second
best without the move played, the shallow ones) becomes a machine without I/O
(job/work.rs), driven by the engine processes on a computer (job/engines.rs,
the same searches as before) and by Web Workers in a browser
(job/workers.rs: a dispatcher polled from the frames, never blocking). The
analysis cache goes through a CacheStore (a folder, or the program's files of
the platform).

The browser's engine: Stockfish.js 19.0.1 (npm stockfish, GPL-3.0), its
single-threaded build served beside /app/ (engine/, build.sh checks the
package's sha512), its 99 MB wasm downloaded only through the engine offer,
checked against its SHA-256 and kept in Cache Storage; workers get it as a
blob: address. Live analysis (lines, arrows, the bar) and the review run on it;
the review uses one worker per logical CPU, at most 8.

My games (the web version): a PGN in the browser's storage, always on the
shelf; Ctrl+S puts a game there (its own record, or a new one); deleting with
undo. chess-core's store gives the bytes of append/replace/remove/restore, so
the platform writes them into the browser's files; on a computer the files
are written as before. Settings: Browser data (used and free space, keeping
the data for good, Download all as PGN, deleting the engine).

Files: a file of the last visit offers Choose the file again; Keep a copy in
the browser (refused with the room it needs when the browser gives too
little); files over 1 GB are not opened, with a word on why. No reference tab
and no search by position in the web version. Keys: Alt+Left, plain 1-6,
Ctrl+C, N in the library (the browser keeps Ctrl+W/N/1-6/Shift+C).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:35:22 +03:00
vrubelroman
4ccf8099a5 Web version on the site: /app/ from website/static/app, precompressed Brotli/gzip
The site serves precompressed copies next to its files (the program is 19 MB,
6.3 MB in Brotli); the built program goes to website/static/app (ignored by git,
taken into the image); the device page's screenshots by the site's own paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:33:26 +03:00
vrubelroman
dd1f3c6c28 docs/dev/web.md: the size of the download, the device page's variants, the engine's location
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:19:11 +03:00
vrubelroman
30eac472ff Web version: what the browser lacks is not offered, files dropped on the window, checks, docs
The interface hides what the platform does not have (platform::CAPS): play,
new databases, adding to a database, preparation, translation, their
shortcuts and the Translation tab. Files dropped on the window open like
chosen ones (in a browser; the desktop program takes no drops, as before),
with «Release to open» while they are dragged over it.

/app/: ?phone=android and ?phone=ios show those variants of the device page.

apps/web/check: device.test.mjs (14 devices: computer, iPhone, iPad as a Mac,
Android phone and tablet, desktop-site modes, Chromebook, touch laptop) and
app.mjs (headless Firefox: the device page in three languages without the
program, the program, a PGN opened by Ctrl+O and the file chooser, a dropped
PGN, a game of the classics, moves, «Download PGN», e2-e4 on the board, the
settings after a reload). All pass.

docs/dev/web.md: the architecture, the platform layer, what is not built for
a browser, the build and the checks, what comes next; docs/dev/uci.md and
desktop.md updated, web/README.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:18:45 +03:00
vrubelroman
3e69a5d57c Web version, stage 1: the interface as a library over a platform layer; apps/web
apps/desktop becomes a library (chesspenguin_app: the interface) and a thin
binary; apps/web starts the same interface in a page's canvas (eframe's
WebRunner). cfg(web) (build.rs) marks WebAssembly in a browser.

The platform layer (apps/desktop/src/platform): the program's folders, files,
background work, the files the user opens or saves, the clipboard and what
the platform offers (CAPS). On a computer it is the system as before; in a
browser the program's data lives in IndexedDB behind an in-memory file tree
loaded before the start, the files the user opens are read into it for the
session (only read), background jobs run on the page's thread after the
frame, the clipboard is read through the browser's API, sounds play through
audio elements, a game is saved as a download.

What a browser does not have is not built for it: updates, the online games
window and its probe, engine processes (analysis starts a Web Worker there;
the review and preparation jobs, Rodent and the judge are native), blocking
requests (engine, Maia and Rodent downloads report no download for the
platform, translation reports that it makes no requests). The desktop
program behaves as before; its build finds unused code (the web build
compiles parts it never shows).

apps/web: the entry point, the page /app/ (device check before anything large
is loaded: phones and tablets get the page about the apps in the site's nine
languages, keys app_* in website/site/i18n), build.sh (wasm-bindgen, profile
web), a static server and headless Firefox checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:09:17 +03:00
vrubelroman
a4445d2c15 Crates for the browser: trainer and play on web-time, Judge everywhere, files closed by scope
trainer keeps its deadline in web_time::Instant (std's panics in a browser; on a
computer it is std's). play: the Judge type is on every target, only starting
it (an engine process) is native. chess-import: files are closed by the end of
their block before a rename instead of drop(), which a browser's File (no
destructor) makes a lint there. rustfmt of the earlier changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:09:17 +03:00
vrubelroman
1e0fb082e5 online-games, play, prep: what needs processes or blocking requests is not built for a browser
online-games: the network part (lookups, probes, downloads into the database,
with their tests) moves to net.rs, built where a request may block a thread;
ureq is a dependency there only. The names, paths and states of the online
databases stay for every target.

play: the engines that play (Rodent) or judge (Maia's resignations) run as
processes driven from threads: not built for WebAssembly. getrandom has its
browser backend there.

prep: analyse (the job in engine processes) is native.

Nothing changes on the computer or Android; the tests pass as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 14:34:19 +03:00
vrubelroman
2703e5de38 uci: the engine as a Web Worker in a browser, on the same protocol machine; game-review: the process job is native
On WebAssembly the engine is a Web Worker: a line of UCI is one message each
way, the protocol machine is driven by the worker's messages and by timers set
for its deadlines; the handshake does not block (Engine::start_worker gives a
Starting, polled until readyok). EngineHandle has the same methods as the
process one, minus those that block or name a process. Option and search
checks are shared by both transports.

tests/worker.rs runs the worker transport against a fake engine in JavaScript
in headless Firefox (apps/web/check/uci-worker.mjs: wasm-bindgen-test-runner
serves, a WebDriver BiDi client reads the outcome): handshake, analysis and
stop, coalescing of rapid requests without mixing output, an engine hung on
stop, a crash, and every handshake failure. 5 of 5 pass.

game-review: the job in engine processes (run and its workers) moves to
job/engines.rs, built where there are processes. .cargo/config.toml: the
getrandom backend of WebAssembly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 14:29:12 +03:00
vrubelroman
a66d1016d9 uci: the protocol as a machine without I/O, the process as its transport; chess-import: passes and positional I/O on a target without threads
The handshake and the session after it move to uci::protocol: lines, commands
and the time go in, lines to write and events come out, deadlines are named
instead of waited for. The child process with its reader and supervisor
threads is now one transport of it (process.rs, not built for WebAssembly).
Behaviour on the computer and Android is unchanged; the fake engine tests pass
as before, and the machine has its own tests.

chess-import: the parallel passes (booster, position search, opening tallies)
go through parallel::map, which runs a single worker on the calling thread;
on WebAssembly there is one worker (std threads panic there). read_at and
write_all_at have a portable form through the file cursor for targets other
than Unix and Windows. The bench command is not built for WebAssembly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 14:19:21 +03:00
vrubelroman
89269b8849 Decisions: the web app only on computers; phones and tablets get the app page
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 14:08:49 +03:00
vrubelroman
c92d182e87 Design: the web version (light) - screens, files and storage, iPad layouts, keys, install, the phone page
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 14:06:37 +03:00
vrubelroman
3ce1eb588e Decisions: no web app on phones - a page sending Android to the app, iPhone: coming soon
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 13:58:04 +03:00
vrubelroman
81314598df Decisions: the web version - light first, our site, four browsers, read-only databases from disk
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 13:55:41 +03:00
vrubelroman
de18fd93d6 Web version: the concept study; task 22 status
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 13:22:22 +03:00
vrubelroman
5ecd7a4e98 Research: the technical side of a web version (wasm build, Stockfish in the browser, files, workers)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 13:21:47 +03:00
vrubelroman
b30f9635d1 Web version: a subproject to study running ChessPenguin in the browser
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 12:46:33 +03:00
vrubelroman
a8c8ff3002 Revert "Review: a check that wins a piece whatever the reply is not great"
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
This reverts commit d8a5c8f4c7.
2026-10-30 01:45:33 +03:00
vrubelroman
d8a5c8f4c7 Review: a check that wins a piece whatever the reply is not great
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
90.Ra4+ of the owner's son's game, a skewer, is a textbook blow - the owner
calls it plain. The checks of a mating attack stay (22.Bf5+, 23.Bd7+ of the
Evergreen game). ChessCom rules only; the son's game now lists Ra4+ among the
owner's plain moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 01:43:43 +03:00
vrubelroman
ad469153fc AUR: chesspenguin-bin 2.1.1
Some checks are pending
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 23:17:17 +03:00
vrubelroman
52500f61a5 Release 2.1.1
Some checks failed
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Brilliant moves for a hard only move a shallow search misses; surer great moves
(no ! for a quiet step away or the king out of check). Formatting by cargo fmt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 22:59:15 +03:00
vrubelroman
cfa2610dc3 Review: the king stepping out of check is not great
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Three of our ! chess.com did not give (23.Kd3, 20...Ka7, 32.Kd2) and three it
did (22.Ke3, 25...Kb6, 20.Ke2) go; the owner counts the move plain. Our ! are now
chess.com's 27 times of 28. ChessCom rules only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 22:08:10 +03:00
vrubelroman
90b20c0376 Review: a hard only move is brilliant too; the owner's plain moves join the check set
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The shallow search (5 000 nodes) is on: the only good move (10 % ahead) that a
shallow search ranks 30 % lower is !! even without a sacrifice - 17...Be6!! of
Byrne - Fischer and 33.c3+!! of Kasparov - Topalov; !! of chess.com found 35 of 39
(was 32), 95 % of ours right, no wrong one added. Not used for ! (it would take
nearly every ! away). The owner's two games with 10.Be2 and Ra7, which he calls
plain, join the set with an OwnerPlain tag the checker enforces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 21:58:46 +03:00
vrubelroman
6004be32bb Game review: shallow search for how hard a move is to find (off by default)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
For a move that could be brilliant or great and was the engine's best, an
optional shallow search (same fixed search, go nodes SHALLOW_NODES = 5000)
keeps its best move and evaluation and the move played at that depth
(PosEval.shallow, serde default; SEARCH_VERSION unchanged). Ply.difficulty
says how much the shallow search underrates the move (Measure::Choice:
against its own best move; Measure::Depth: against the deep search).

Hardness (report.rs) says how the difficulty counts in !! and ! of the
ChessCom rules: ! only for hard moves, gaps, the capture/quiet-retreat bans,
!! for a very hard only move. The default changes nothing and makes no
shallow search; rules that use it fill old analyses in like the second
search (seconds_missing). chesscom_check takes CP_SHALLOW_NODES and the
rule parameters for experiments; review_bench CP_SHALLOW_NODES. fake_uci
learns --searchmoves and --shallow for the job test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 21:27:16 +03:00
vrubelroman
69b501800a chess.com check: Aronian - Anand; five held-out games summed up
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 21:03:30 +03:00
vrubelroman
45e931ba09 chess.com check: Topalov - Shirov
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 20:59:04 +03:00
vrubelroman
319aa476bf chess.com check: Short - Timman (34.Kg5!! is no material sacrifice)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 20:54:40 +03:00
vrubelroman
76d1114985 chess.com check: Tal - Larsen, prediction 3 of 4 marks right
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 20:51:58 +03:00
vrubelroman
5a6897ba0a chess.com check: Polugaevsky - Nezhmetdinov, prediction 5 of 5 marks right
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 20:49:19 +03:00
vrubelroman
5c73b4a781 chess.com check: five classic games given to the owner, predictions first
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 20:47:29 +03:00
vrubelroman
da4903cb2e Review: an attacked piece stepping quietly to its one good square is not great
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
10.Be2 of the owner's online game (the bishop on d3 under c4, the only square
that keeps f3) was ! - plain, the owner says. A step away with check can still be
great (19...Ne2+, 23.Bd7+ are chess.com's !). ChessCom rules only; 13.Qa4! of the
Evergreen game is given up for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 20:43:54 +03:00
vrubelroman
b2d440e340 Website: a file downloaded again the same day by the same visitor counts once
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
15 requests for one APK within a minute from one Windows browser made 18
downloads out of two people. Repeats are now kind 'repeat' (out of the counts,
as they were out of the notices); rows from before are marked at start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 17:24:00 +03:00
vrubelroman
63ba4b3e08 Tasks: opponent preparation stays on the desktop
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 22:36:45 +03:00
vrubelroman
703af42557 README: the description and screenshots of 2.1
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
Opponent preparation, !! and ! in the game review, the reference tab, search by
position, 100 classic games and the Android app (no longer alpha); the gallery
takes the current English screenshots of the website plus the opponent
preparation. AppStream's default screenshot follows the new file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 22:35:01 +03:00
vrubelroman
5b2898ee46 Tasks: opponent prep - games by age or count; saved preparations
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 22:17:02 +03:00
vrubelroman
30017a9969 AUR: chesspenguin-bin 2.1.0
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 20:50:55 +03:00
vrubelroman
262c0b1711 Release 2.1.0
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release / version (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / publish (push) Has been cancelled
Preparing against an opponent (openings), one fixed engine search for the game
review everywhere, !! and ! recalibrated on chess.com (check set of 15 games),
100 classic sample games that update with the program. Formatting by cargo fmt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 20:37:06 +03:00
vrubelroman
dd26e7261a Samples: 100 classic games (was 38)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
62 famous games added as plain records, from the free player files of
pgnmentor.com, most checked move by move against Wikipedia; two with sources
that disagree were left out. Byrne - Fischer 1956 now has the move order of the
sources (same final position). The new file replaces the old sample on update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 20:31:53 +03:00
vrubelroman
5c54975d6b Review: «Analyse again» for a stale analysis; PGN evaluations never pass for the engine's
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The tester's findings: the stale analysis offered «Дополнить» (fill in) though
it recomputes everything - it now says «Обновить» in 9 languages; and an engine
run over evaluations read from the PGN no longer keeps them under the fixed
search's name - it analyses the whole game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:54:37 +03:00
vrubelroman
a328f429c5 Samples: the built-in databases are brought up to the program's version
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
At every start a sample's file that is not the text built into the program
(an older version, damaged or edited outside) is replaced atomically, under
its name in any language; a sample taken off the shelf stays off. Android
reads the samples from the app's assets: the number of games on a row is
taken again when the sample's SHA-256 is not the one it was counted from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:46:45 +03:00
vrubelroman
1524affd1a chess.com check: Giri - Gukesh 2024 given to the owner, prediction first
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:39:43 +03:00
vrubelroman
2c88e49694 chess.com check: the Opera game and Byrne - Fischer in another move order
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Prediction made before the answer: !! 2 of 3 (10.Nxb5 missed), no wrong mark.
Tried and dropped: a sacrifice from a 1-point net loss (finds 10.Nxb5!! and
22...Rxh3!!, but adds false !! on 22.Nd5 and 17...Rxc3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:39:03 +03:00
vrubelroman
1e834fe1ea Review: stricter great moves - never a capture, the best other move 25 % behind
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The owner wants !! near 100 % and fewer, surer !. Sweeping the thresholds on
the check set, wrong ! came mostly from captures in forced lines; with no !
for a capture and a gap of 25 % (was 10) ours are chess.com's 87 % of the time.
ChessCom rules only. 2M nodes instead of 1M changed !! not at all: kept 1M.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:30:11 +03:00
vrubelroman
63a764bd16 Android: the game analysis in the fixed search; decision and docs
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
- mobile-api GameReview.start(path, eval_file, full): the fixed search in
  one engine process per core (at most 4, by free memory), nice 10;
  ReviewState.stale, nps_per_process; review_estimate_secs().
- The start sheet keeps the description, the time and one button; quality,
  «Start over» and «Analyse again» are gone; a stale analysis offers
  «Update», evaluations of the PGN «Analyse with the engine».
- docs/decisions.md: the owner's decision with the numbers (search, memory,
  times, the first chess.com check); android-ui.md §21.2; chess.com README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:23:46 +03:00
vrubelroman
96e3bcd13f chess.com check: the Opera game given to the owner, our prediction first
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:20:38 +03:00
vrubelroman
2ca494ce27 Review: a threat standing before the move does not undo a sacrifice; Kasparov - Topalov
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
37.Rd7!! of Kasparov - Topalov: 37...Rxd7 38.Bxc4 wins the queen back, but the
bishop has attacked it since 36.Bf1 - the move made no new threat, the rook is
given. Only a threat the move itself makes (18.Bxa7 opening the d-file) means
taking is no answer. Tried and dropped: a pawn given as the only good move as !!
(finds 33.c3+!!, but marks 17.d5 of Steinitz, unmarked by chess.com).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:20:09 +03:00
vrubelroman
968ab221cf Review: one fixed engine search everywhere, in parallel engine processes
Every position of a game analysis (and of the opening errors) is searched by
ChessPenguin's Stockfish 19 to 1M nodes with one thread, a 32 MB hash and
ucinewgame before each search, so the evaluations depend on the position
alone: the same marks on every computer and phone, whatever the number of
engine processes (one per CPU, at most 8 on a computer and 4 on a phone, and
what the free memory holds) or the order of the positions.

- ReviewMeta.search: analyses of another search are stale; shown, but
  Update makes them all again. The prep caches drop such evaluations.
- Desktop: no launch dialog (engine, quality, threads, memory are gone);
  Analyse starts at once, its tooltip gives the time; the prep dialog keeps
  the colour. Without the own Stockfish the download is offered.
- settings.review and prep.quality removed; old settings files still read.
- fake_uci --hash-memory; tests of determinism on processes and order.
- chesscom_check in the fixed search (CP_REVIEW_NODES for experiments);
  review_bench example for times and determinism on a real engine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:19:44 +03:00
vrubelroman
8c9c2d38c2 chess.com check: our prediction for Kasparov - Topalov, before comparing
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:18:43 +03:00
vrubelroman
44d2c3c8d7 chess.com check: Kasparov - Topalov given to the owner
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:15:55 +03:00
vrubelroman
34c816d781 Review: a capture is great only when every other move loses; winning back after an accepted sacrifice is no trade
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Byrne - Fischer (given to chess.com after our prediction was recorded):
12...Nxc3 and 13...Nxe4 were great by us, not by chess.com - in the whole check
set chess.com marks a capture ! only when the best other move loses (20.Rxe7+,
18.fxe6). 18...Bxc4+ wins back after 18.Bxb6 took the queen 17...Be6 left: the
combination goes on. ChessCom rules only. Tried and dropped: counting a piece
left hanging as given (would find 17...Be6!! but adds four false !!).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:13:56 +03:00
vrubelroman
a1d185a67d chess.com check: Byrne - Fischer given to the owner, our prediction recorded first
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:06:29 +03:00
vrubelroman
58aac83927 Review: won anyway means a forced mate (ChessCom); three more chess.com games
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Every sacrifice of the check set whose best other move also won (up to 93 %)
is chess.com's !!, so a won position no longer rules !! out by win % - only a
forced mate without the move does. The checker compares games known only by
chess.com's totals by count (Levitsky - Marshall). Check set: 10 games.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 19:02:47 +03:00
vrubelroman
69ea1ade15 chesscom_check: share of chess.com's !! and ! found, and of ours that match
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 18:48:56 +03:00
vrubelroman
1be3f84802 Review: a piece moved into a new attack is offered; a pawn for a quicker mate; taking back a trade
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Calibrated on three more games marked by chess.com (Pillsbury - Lasker,
Rotlewi - Rubinstein, Reti - Tartakower), ChessCom rules only:
- an attacked piece moved quietly onto another attacked square could have
  stepped away: offered (18...Ra3!!, 20...Ng4!!); only a desperado capture is
  a piece lost anyway;
- a capture winning back what the opponent has just taken elsewhere is no
  winning capture and can be great (18.fxe6!), unless the opponent took a piece
  the mover had just offered (24...Bxe4+);
- a pawn offered for a quicker mate is brilliant (29...b5+!!).
Check set: 7 games, 38 agree, 6 differ (was 34/10).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 18:46:50 +03:00
vrubelroman
9f46fb1d71 Review: no ! or !! for a book move; no ! when the best other move keeps 60 %
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The opening table moves from prep into its own crate, chess-openings, so the
game review can tell a book move (a position on a line of the table), as
chess.com does. A move is no longer great when the best other move still keeps
60 % (was 75): every chess.com ! of the check set is at 59 % or less. ChessCom
rules only. Check set: 23 agree, 5 differ (was 9).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 18:37:42 +03:00
vrubelroman
da367bdaf1 Review: only a threat the move made refutes a sacrifice, not one the capture opens
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
22.Rxe7+!! and 24.Rg7+!! of Steinitz - von Bardeleben (chess.com marks both)
were lost to the previous rule: 22...Qxe7 23.Rxc8+ wins back only because the
queen left d7. The game joins the chess.com check set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 18:31:45 +03:00
vrubelroman
4f573bac6f Review: a sacrifice mating sooner is brilliant; a best move's next-position drop is noise
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The Immortal game against chess.com's marks: 22.Qf6+!! mates in 2 while 22.Qf7
mates in 4 (win % cannot tell them apart), and 9.Nf5! / 12.h4! were lost to
the noise between two searches. ChessCom rules only; the chess.com check set
gains the Immortal game: 17 of 17.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 17:18:48 +03:00
vrubelroman
0efe794662 Review: a piece whose capture loses more at once is no sacrifice; chess.com check set
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
18.Bxa7 (a game against Rodent, 2026-10-27) opens the d-file on the queen:
18...Rxa7 19.Rxd8. chess.com gives it no !!, and neither do the ChessCom rules
now. The games compared with chess.com live in crates/game-review/chesscom/ with
its marks as NAGs; the chesscom_check example runs them all after each change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 17:13:10 +03:00
vrubelroman
856ffd8f21 Merge opponent preparation (openings only, desktop)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 17:04:46 +03:00
vrubelroman
7891d5d051 Opponent prep: everything folded at first, every table sortable
The repertoire starts with its roots folded (no automatic expansion, after a
rebuild, a colour or a depth either); the user opens what he wants.

A click on a column's header orders the table by it, a second click turns the
order round, ⏶/⏷ beside the title as in the library's game table (the header
button is now `widgets::sort_header`, shared with it): the games list (all
columns), the openings (families, and the variations inside each, by name,
ECO, games, %, score, last game, errors), the errors tab (repeated errors by
move, ×, score, opening; «By opening» by games and errors) and the repertoire
(the moves of every position by games, %, score, last game; games first by
default). Each table's order is kept in `settings.prep.sorts`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 16:56:43 +03:00
vrubelroman
3d72f80ab5 Tasks: opponent prep status; «Open as a game» left for the owner to decide
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 16:50:32 +03:00
vrubelroman
d654223665 Opponent prep: the tester's and designer's review
Core: the most precise opening name stays down a line (a deeper position the
table names more generally, «Sicilian Defense» after 3.d4, does not take it
back), in the games' names and in the tree; one name per position across move
orders; the games and the last date of a position over all its move orders;
`evaluated()` (evaluations from the cache count). Report version 3.

Screen: errors judged from cached evaluations show without a run; «Checked N of
M positions · Continue» after «Stop» or a new depth; the report shows the book
only when it was computed with the chosen one; the dialog keeps the remembered
book and the same player reopens with the dialog's colour and book; «Deeper»
and the depth list share one path (setting kept, report from the cache); a
chosen error survives re-judging during the run; quitting during the run asks
first; Ctrl+W returns from a game opened from the report; a game opened at an
error opens after the move, a repeated error at its newest game.

Design (§12): the summary as a grid whose columns give way, counts in the
colours of the signs; result bars without numbers, faint over few games; move
lines numbered at White's moves; whole-move first-move lines; colour icons in
the openings table; ECO kept beside the name; the errors tab as one table with
row selection and keys (↑/↓/→/←/Enter); colour lines there only in the stack;
«Inaccuracies» switch (kept in settings) for the tab, the summary, the tree and
the games; «▾» at the right end; one colour order; the depth caption by the
room left; names first in narrow game lists; two-row games minimum in a low
window; the caption beside the stacked board; «others (N)» when narrow.
Designer's review recorded in docs/design/opponent-prep.md §12.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 16:21:16 +03:00
vrubelroman
5cfadcc7f6 Cargo.lock: the desktop app depends on prep
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-28 15:43:21 +03:00
vrubelroman
f02f140394 Opponent prep: the desktop screen (dialog, report, engine run)
The «Prepare against…» entry points in the library (the filter panel's button
when a player is set, the game row's context menu, Ctrl+Shift+P), the dialog
(database, the player's spellings with the similar names apart, colour, book)
and the report screen in the stack between the library and the game: the
repertoire tree with transpositions, opening names, scores and the book
column, the openings table by family and variation, the errors tab (repeated
errors and by opening), the board of the chosen position with the line under
it, and the games of the selection, which open in the game screen at that move
with «⬅ Back to preparation».

The engine run reuses the game analysis job over the distinct opening
positions of the chosen colour: the launch dialog shares the engine picker and
the quality/threads/memory grid with review.rs (quality «Fast» by default, its
own setting), marks appear as positions are evaluated, «Stop» keeps what was
done, the evaluations and the report are cached under <cache>/prep. One engine
job per program: game analysis and the live engine are blocked meanwhile.

Core: targets and counts by colour (`targets_for`, `missing_for`), the book
step keeps its per-position counts (`book_counts`) for the tree column.
Narrow windows: the board stacks over the lists under 804 px and folds into a
button under 720 px of height; the right column is split explicitly (a nested
bottom panel is not reserved from the content above it in egui).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-28 15:43:15 +03:00
vrubelroman
d54f207889 Opponent prep: the prep crate (openings only)
A new crate shared by the apps, no UI: what a player of a database plays
in the opening and where in the opening he goes wrong.

- Player: candidates from the database's names (initials with a full
  stop work), one or several ids, White, Black or both.
- Lines: the first N plies (default 20) of the main lines, position keys,
  UCI/SAN, result from the player's side, full date, opponent's Elo;
  games from a set-up position are skipped.
- Repertoire tree per colour by move order with position keys:
  games (+/=/-), last date, average opponent Elo, game list,
  transpositions marked.
- Opening names from lichess-org/chess-openings (CC0; revision and
  SHA-256 pinned, files in crates/prep/data, THIRD_PARTY_NOTICES): the
  deepest named position of a line, families and variations with their
  first moves, grouped by name.
- Book: a second database (or the same one without the player's games)
  says where each game left it (first position with fewer than T games,
  T = 5) and whose move it was.
- Engine: every distinct position of the lines once through
  game_review::run, judged with the game analysis rules for the player's
  moves only; errors by opening and the repeated ones (same position,
  same move in two or more games); evaluations cached per position across
  reports, the report cached by database, player and plies.
- examples/prep_report.rs prints it all for a database and a player.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-28 12:32:39 +03:00
vrubelroman
7d041f2a3d Import and review: what the opponent preparation needs
- Name queries: the full stop of an initial separates words too, so
  "Carlsen, M." and "Вафин Р." find the full names (suggestions and
  filters alike).
- `Database::main_line(index, plies)`: the first moves of a game's main
  line; a ChessBase game is decoded without its tree (microseconds), a
  PGN game is parsed. `Database::player_name(id)` for both kinds.
- `position::theory_end`: the linear/doubling/halving search for where
  a line leaves a database, taken out of the reference panel's
  `book_end` so another caller can use it; the panel calls it.
- game-review opens `judge` and `terminal_eval`; `Judgement` is serde.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-28 12:29:08 +03:00
vrubelroman
015fa0cfe3 Design: opponent preparation screen
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-28 12:18:56 +03:00
vrubelroman
53ffc69d40 Opponent prep: owner's scope — openings only, desktop first
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-28 12:07:29 +03:00
vrubelroman
b51ca265ff Research: preparing against an opponent (concept and technical part)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-28 11:59:47 +03:00
vrubelroman
ef498aa7cc Tasks: opening repertoire and opponent preparation
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 10:43:05 +03:00
vrubelroman
02acf51b9d Website: Android is no longer marked alpha
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The app dropped the word in 1.9.3; the site's badge and note go too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 03:47:37 +03:00
vrubelroman
1eb1fa3358 Website: brilliant and great moves, self-updating online databases (2.0)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
New desktop screenshots (bold notation, the new mark colours; the report at the
Evergreen game's 21.Qxd7+!!) and a phone screenshot of Lasker–Bauer at 15.Bxh7+!!.
Texts in nine languages; Android is no longer called an alpha.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 03:45:46 +03:00
vrubelroman
4473fc9d2b AUR: chesspenguin-bin 2.0.0
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 03:45:08 +03:00
vrubelroman
e073592af9 Online databases update on their own; release 2.0.0
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release / version (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / publish (push) Has been cancelled
At the start and on coming back after ten minutes or more, every database
downloaded from Lichess and Chess.com fetches the games played since, one after
another (the sites ask for one export at a time), on the desktop and on Android.
Only new games are told.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 03:28:16 +03:00
vrubelroman
8c04196d49 Desktop: the engine panel keeps its height between positions
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
For one frame after each move the panel had no lines (the old ones gone, the
new not yet come) and was 42 px shorter: the notation below jumped up and back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 03:19:08 +03:00
vrubelroman
df59ff1b32 Notation: moves in Ubuntu Bold (desktop) and bold (Android); Medium dropped
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The designer compared JetBrains Mono: in a monospace face !! and ?? fall apart
and O-O-O reads as 0-0-0; the Ubuntu family stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 03:04:55 +03:00
vrubelroman
1f27c2ae57 Bolder moves and marks; «Блестящий», «Замечательный» in the report
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Ubuntu Medium and Bold (Ubuntu Font Family 0.83, official release, UFL 1.0)
for the notation's moves and the board's marks on the desktop; heavier weights
on Android.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 02:59:14 +03:00
vrubelroman
2e145dc362 Review: both rule sets of !! and ! kept (Strict, ChessCom); ! is «Замечательный ход»
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The first rules stay beside the calibrated ones, selectable through
game_review::Rules, to compare them on annotated games and to go back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 02:23:19 +03:00
vrubelroman
68e2f49e3f Review: !! and ! calibrated on chess.com's marks of the Evergreen game
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
A sacrifice is a piece the move itself gives up; every move of a combination
is marked; a piece saving itself on the only good square and the only good
move of an equal position can be great. 7 of chess.com's 8 marks agree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 02:00:23 +03:00
vrubelroman
27a9c32588 Great move (!) back in #81B64C, chess.com's green as the owner picked it
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 01:31:10 +03:00
vrubelroman
36846b2e68 Inaccuracy (?!) back in Lichess blue
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 01:27:25 +03:00
vrubelroman
9bcb753bb5 Android: dark theme by default; the app's night mode told to Android
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 01:25:39 +03:00
vrubelroman
42828e900c Great move (!) in chess.com's own green, #7AAB59
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
#81B64C was their best-move color.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 01:23:13 +03:00
vrubelroman
df6ad23b45 Move marks in the owner's palette on the desktop and Android
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
!! #26C2A3, ! #81B64C, ?! #F7C631, ? #FFA459, ?? #FA412D (from the owner's
reference); darker variants for text in the light theme; the judgement colors
now come from the NAG colors, and the accuracy follows them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 01:15:53 +03:00
vrubelroman
4ffe45363d Desktop: the draw offer button is «½–½», its words in the tooltip
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 01:04:53 +03:00
vrubelroman
424c7830e7 Notation: the review's mark right after the move, in its color; no reasons
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
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>
2026-10-28 01:00:29 +03:00
vrubelroman
1aa85f59d3 Review: brilliant (!!) and great (!) moves; Android board shows move marks
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
A sound piece sacrifice is !!, the only good move that turns the game is !,
by the rules of docs/research/brilliant-moves.md. Sacrifices come from a static
exchange count over the board (features.rs); the best other move comes from a
second engine search (searchmoves) only where the move played was the engine's
best and could be either. The marks go wherever errors go: report, notation,
graph, board badge, and into the PGN as $3/$1 unless the author's sign is there.
An older analysis is filled in by Update without evaluating it again.

The Android board now draws the move's mark in the corner of its square, as the
desktop does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 00:47:44 +03:00
vrubelroman
fb4e7ba330 AUR: chesspenguin-bin 1.9.4
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 23:52:11 +03:00
vrubelroman
a3218183ba Release 1.9.4
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release / version (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / publish (push) Has been cancelled
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 23:36:32 +03:00
vrubelroman
a5a96671c9 Translation: low reasoning effort for ChatGPT, three requests at once
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
Each request waited for the model's full default thinking, and the batches of a
long game went one after another. A model that rejects the effort is asked again
without it; the first error still stops the job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 23:14:46 +03:00
vrubelroman
93644799d4 Desktop: game counts on the database cards, the rating over the slider, even game buttons
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The cards said «not loaded» for databases not opened yet; a background thread now
counts them one by one and remembers the counts by file size and time. The play
dialog's strength follows the slider's handle. The game buttons are of one height,
navigation on one row and the game's actions on the next.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 23:00:29 +03:00
vrubelroman
9ff19c0a34 AUR: chesspenguin-bin 1.9.3
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 20:54:49 +03:00
vrubelroman
0833b1eabf Release 1.9.3
Some checks failed
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
Android «About»: no «alpha» after the version, a text that says what the app does now
(chess databases, game analysis, play against the computer), and the penguin in a crown
as the app's icon has; packaging/icons/make-icons.sh makes that picture too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 20:37:07 +03:00
vrubelroman
dd4572fd8a Android: a RuStore build, without the app's own updates and the counted check
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The owner puts the app in RuStore: the store updates it, and the store's build
must neither update itself nor be counted by the site. A build type «rustore»
on the same branch (not a branch to catch up each time): the release with
SELF_UPDATE off — no check of releases (the check is what the site counts
installations by), no download or install, no updates block in About, a
release kept from the site's build forgotten; its manifest drops the install
permissions and the installer's receiver. The full build only; the same
package and key, so it goes over the site's one and back with the databases.
release.sh builds it into dist-rustore and checks it asks for no install
permission; the release workflow keeps it as the run's «rustore» artifact, not
a file of the release. The site's builds are as they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 18:49:12 +03:00
vrubelroman
f31023dcd7 AUR: chesspenguin-bin 1.9.2
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 18:06:37 +03:00
vrubelroman
27cffc28ce Release 1.9.2
Some checks failed
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:54:05 +03:00
vrubelroman
6bb0ef2414 Android: «+ Add» in the Files heading instead of a floating button
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The owner's choice: the extended FAB hung over the list; «+ Add» now sits in
the Files heading as «+ New database» in My databases, each group with its
action on the right, with a hint line when there are no files. Nine languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:09:20 +03:00
vrubelroman
5b585b0dee Desktop play: the time control in the header, the set's kings, a low-time tick, which game is left
During a game against the computer the header's chip shows its control («5+3»,
«∞») where the result comes after it. The players' cards show the king of the
board's piece set instead of ♔/♚, the state line under the name. The player's
clock turning red is heard once a game: a double tick made of Kenney's
tick_004 (CC0), every sound set; a game put aside with the time already low
goes on without it. «The game is on» says which game: «Maia 1550 · you play
white · 5+3 · move 5», as the card of a game put aside. Reviewed by the
designer and the tester.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:09:20 +03:00
vrubelroman
b29cc5ebca AUR: chesspenguin-bin 1.9.1
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 16:24:30 +03:00
vrubelroman
684195f32c Release 1.9.1
Some checks failed
Release / version (push) Has been cancelled
Release / publish (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
macOS: Rodent IV from rodent-iv-0.33-3, built with its home folder (it found
none of its personalities, so no game against it started).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 16:08:27 +03:00
vrubelroman
f8a2c6ffa3 Rodent IV on macOS: its home is its own folder, so it offers its personalities
Some checks failed
Rodent IV / build (rodent-iv-macos-arm64, macos-14) (push) Has been cancelled
Rodent IV / build (rodent-iv-windows-x86_64.exe, windows-latest) (push) Has been cancelled
Rodent IV / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Rodent IV / build (rodent-iv-linux-x86_64, ubuntu-22.04) (push) Failing after 1s
On macOS the authors left the engine's home folder unset (a comment where
_NSGetExecutablePath should be). With an empty home every folder was taken
relative to the one it changed into last: reading basic.ini it went into
personalities/ and found none of the personality files, so the Personality
option was not offered and ChessPenguin's «Personality = Tal» was refused —
«Rodent did not start». home-dir.patch now takes the executable's folder there
too, as on Linux and Windows. Reproduced on Linux with the home left empty and
checked with _NSGetExecutablePath shimmed: the play crate's Rodent IV game
fails before and passes after. The workflow now checks that the engine, in a
folder with a space and started from elsewhere, offers «Tal».

Tasks: the Android screenshots done; two copies of the program put off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 15:53:48 +03:00
vrubelroman
12e4c7d5e9 Website: Android screenshots first for a visitor on Android
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Seven phone screens one by one (home with a put-aside game, a database's
games, the Opera game, Stockfish, the play sheet, «Who to play», a game
against Rodent IV) open the gallery and the lightbox on Android, under «On
the phone», before «On the computer»; the hero shows the four phone screens.
Other visitors see the page as before. Nine languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 15:47:09 +03:00
vrubelroman
20d9d018bb Tasks: the Linux hang closed; put-aside games, Rodent and the Android stages done
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 15:31:52 +03:00
vrubelroman
a25b77ba86 Website: Rodent IV on the phone, games put aside, take-backs in blitz (1.8, 1.9)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The Android texts and screenshot: Rodent joins Maia, the play sheet with Rodent IV
(Tal) and the «Who to play» list replace the game against Maia. The play section:
a game can be put aside and finished later; take-backs only in blitz; on the phone
Rodent is inside and its opening books (59 MB) are downloaded once. Nine languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 14:00:35 +03:00
vrubelroman
84300b45f6 AUR: chesspenguin-bin 1.9.0
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 12:35:58 +03:00
vrubelroman
a0c1c1f5e3 Release 1.9.0
Some checks failed
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 12:20:25 +03:00
vrubelroman
b5227dd998 Android: the release check at each start of the app, not once a day
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The owner did not hear of 1.8.0 a day after 1.7.0: the phone asked only 24 h after its
last answer, restarts included. Now each start asks, as the desktop does; a return to
the app asks 6 h after the last answer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 12:15:09 +03:00
vrubelroman
8e79a888ef Desktop: downloads are written beside and put in place, not rewritten
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
On macOS (Apple silicon) Rodent IV build 2, downloaded over the 1.7 build, was killed
at its first start: the kernel keeps the signature of an executable that once ran, and
the file had been rewritten in place. The owner's Mac ran the same build fine from a
fresh file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 12:07:54 +03:00
vrubelroman
fa2be527c6 Desktop: a move is taken back only in a blitz game against the computer
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The owner's choice: in rapid, classical and games without a clock «↶ Take back» is not
offered, and Ctrl+Z does nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 11:56:44 +03:00
vrubelroman
ea183df374 AUR: chesspenguin-bin 1.8.0
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 11:01:35 +03:00
vrubelroman
371f6d6ed5 Release 1.8.0
Some checks failed
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 10:46:00 +03:00
vrubelroman
1504ac6334 Desktop: macOS takes Rodent IV build 2 (the search thread fix)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The macOS build of rodent-iv-0.33 (clang) searched garbage out of its book; the Linux
and Windows builds (GCC) stay. Each platform pins its release; an install from another
release is offered again, and files that did not change are kept, not fetched again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 10:43:50 +03:00
vrubelroman
dbd17e05be Rodent IV builds: the search thread fix, and a check that it searches
Some checks failed
Rodent IV / build (rodent-iv-macos-arm64, macos-14) (push) Has been cancelled
Rodent IV / build (rodent-iv-windows-x86_64.exe, windows-latest) (push) Has been cancelled
Rodent IV / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Rodent IV / build (rodent-iv-linux-x86_64, ubuntu-22.04) (push) Failing after 2s
think-thread.patch (already used for Android) goes into the desktop builds: clang
(macOS) builds searched garbage out of the book. Each build now has to answer a legal
first move from a search without its book.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 09:03:00 +03:00
vrubelroman
b3774d1651 Android: Rodent IV as a second opponent, with its characters and famous players
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The play sheet chooses Maia or Rodent IV, and Rodent's character in a full-screen
list (docs/design/android-rodent.md, docs/decisions.md «Rodent IV на телефоне»).
The engine is built from its authors' sources by androidApp/scripts/rodent4.sh
(patches: no wordexp.h on bionic; the search thread took its parameter by reference,
which clang builds read after it was gone) and ships in both APKs; the opening books
are one checked download. Rodent's tables, its book manifest and its opponent loop
move from the desktop into crates/play, shared by both apps; uci's EngineConfig takes
an environment (RODENT4HOME).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 03:03:02 +03:00
vrubelroman
3dac4a185b Desktop: a game against the computer can be put aside and continued
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
«⏸ Put aside» in the game, the main answer of «The game is on» and closing the
window put the game aside: its journal stays, with what it is played with and
the side to move's time. A card on the library's shelf (a strip in a folded
shelf) continues it with the clocks where they stopped; a crash leaves a game
put aside too (said once). A new game over it asks first; letting it go writes
it unfinished into the player's database, and a failed write keeps it.
A missing opponent is downloaded before it goes on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 23:57:45 +03:00
vrubelroman
115a7c33c8 AUR: chesspenguin-bin 1.7.0
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 23:02:41 +03:00
vrubelroman
50888b12cd Desktop: no disk in the frame for the shelf's files (a lost network drive froze the window)
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
The owner's window froze for about a minute when the network dropped during a
game; its main thread waited in rpc_wait_bit_killable: an NFS mount (hard)
holding a database of the shelf. While a game is shown the reference tab's list
checked every shelf file's existence each frame, and the library asked sizes,
permissions and existence the same way. file_state.rs: a thread of its own looks
at the files the screen asks about every 3 s; the screen reads what it last
found (a file not looked at yet counts as there). The first database at start
is read in the background without a check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 22:51:48 +03:00
vrubelroman
a2e6215cef Website: Rodent with its characters and famous players (1.7)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 22:42:56 +03:00
vrubelroman
8f6244cf59 Release 1.7.0
Some checks failed
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 22:42:28 +03:00
vrubelroman
69c5fa3ed1 Rodent IV's characters are called in the app's language (Защитник, Удав…); the record keeps the engine's English name
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 21:24:01 +03:00
vrubelroman
d6ede805a0 Rodent IV: the sums of the published builds (rodent-iv-0.33): its styles are offered
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Downloaded through the dialog end to end: the engine from our release, the
personalities and books from the authors' repository, the misnamed books
copied, the game against Rodent IV 2000 (Petrosian) started.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 21:21:49 +03:00
vrubelroman
3fe82551ce Play: Rodent IV's characters and players in Rodent's list of styles
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Rodent IV / build (rodent-iv-linux-x86_64, ubuntu-22.04) (push) Failing after 41s
Rodent IV / build (rodent-iv-macos-arm64, macos-14) (push) Has been cancelled
Rodent IV / build (rodent-iv-windows-x86_64.exe, windows-latest) (push) Has been cancelled
Rodent IV / publish (push) Has been cancelled
The owner: «заюзаем rodent 4 со всеми его стилями». One opponent «Rodent»:
its list gets Rodent IV's 13 characters and 22 players (sorted by their names
as shown, the Tals side by side); the engine follows the style (Rodent IV's
UCI_Elo 800–2800), «Rodent IV 2000 (Petrosian)» in the record. Texts say
«Rodent» where they said «Rodent V».

Rodent IV's authors publish no builds for Linux and Windows: the workflow
rodent-iv.yml builds it from their sources at a pinned commit (with one fix,
packaging/rodent-iv/home-dir.patch: on Linux it now and then took a wrong home
folder and played without its personality) into a pre-release that is never
«latest». The app downloads that build and the personalities and books from
the authors' repository at the same commit (scripts/rodent4-manifest.py →
rodent4_files.rs), each checked; three misnamed books get a copy under the
name their personality reads. Until the build's sums are written in, Rodent
IV's styles are not shown.

Reviewed (tester and designer in one) with a local build (CP_RODENT4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 20:53:49 +03:00
vrubelroman
dee8ee41d4 CHANGELOG: Android lists
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 19:29:11 +03:00
vrubelroman
f120c49fd4 Android: the lists dressed up (docs/design/android-lists.md)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The owner approved the designer's «А» for the games list and «Б» for the
databases screen:
- Games: a thin line between games, a disc of each side, the winner's «1»
  on a tile (and the name a little heavier), «½» on quieter tiles, the ECO
  on its own tag that never gives way; the game last opened marked and in
  sight; search matches marked, the ECO tag too. Search finds by the ECO.
- Databases: badges by kind in Catppuccin colours (Mocha dark, Latte light:
  PGN blue, ChessBase peach, archives mauve, online teal, own green, ♞ for the
  player's); the number of games stands out; groups as cards (16/4 dp
  corners, 2 dp apart); the game put aside with its position on a small board
  (no coordinates) and «Continue»; two equal, quiet buttons.
- Settings as cards with icons; the add sheet's icons in tiles of the kind.
- Fixed on the way (the tester): a list read anew after a quick new search
  could show another game's names in a row; clearing a search goes back to
  the top; tiles, tags and buttons grow with a large font.

Reviewed by the designer and the tester on the emulator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 19:29:04 +03:00
vrubelroman
95572c530b Website: nine screenshots (play against the computer, Android) and the texts for 1.6
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The owner's choice: the game, the engine, the reference, the report, the
play dialog (Rodent V, Tal), Android (dark, four screens), filters, position
search, the looks; translation, variations, marks, preview, library and
online go. The play section: Maia 600–2600 and Rodent V 800–3000 on their
own scales, draw offers, games written to the player's database; the hero
and Android texts. The screenshot script follows the new set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:50:11 +03:00
vrubelroman
c361f7353f AUR: chesspenguin-bin 1.6.0
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:15:18 +03:00
vrubelroman
6072d2b2b0 Release 1.6.0
Some checks failed
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
Release / version (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 16:54:25 +03:00
vrubelroman
56a30622fd Play: the engine's strength only in its name, no Elo tag (desktop and Android)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The owner: these are the engines' own ratings, «без поля эло, просто
число» — «Maia 1550», «Rodent V 2400 (Tal)»; the player's own rating keeps
its Elo tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 16:33:38 +03:00
vrubelroman
07a9e120b1 Android: Maia on her own scale (600–2600); games written into the player's database
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
As on the desktop (decisions «Партии игрока записываются сами», «Сила
соперника — по шкале самого движка»):
- mobile-api: Maia plays the rating on the slider, temperature 1; the sheet
  says it is her own rating, not a person's Elo.
- PlayerGames: «<name> — games against the computer» (no name: «Games
  against the computer»), an own database made at the first game; a game
  ends → written once (the mark kept with commit, guarded by the game's
  serial against a rematch); a game put aside and let go (×, «Start new»,
  Maia failing) → written unfinished, once both have moved.
- Play sheet: «Your name» with the phone's players (filtered by what is
  typed), the line where games go; result card «✓ В «…», № n ›» (a new
  database said there), opens it; no third button; a failed write said
  with its reason. ♞ on the row, «пишутся сами»; a setting.
- «Play from here» and «Continue it» inside a play game show the new game.

Checked on the emulator by the tester (kill right after the end, rematch,
rename/delete of the database, setting off) and the designer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 16:30:16 +03:00
vrubelroman
aa136fb85e Play: each engine on its own scale (Maia 600–2600, Rodent V 800–3000)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The owner's decision: no conversion by our measurements. Maia plays the rating
on the slider (temperature 1, the large model when it is there, else the small
one), Rodent V its UCI_Elo; under the slider: these are the engines' own
ratings, not a person's Elo. No automatic switch past Maia's top; changing the
engine brings the strength into its range. Styles without strength ranges.

The journal test waits out a lock held for a moment by another test's child
process (it gets the parent's files until it runs its program).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 15:48:59 +03:00
vrubelroman
300430f2a8 Play: games against the computer go by themselves into the player's database
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
docs/research/player-games-db.md, docs/design/player-games.md, decisions
«Партии игрока записываются сами» (desktop; Android next):
- «Roman — games against the computer» (without a name, «Games against the
  computer»), made at the first game in the folder of new databases; only
  new records are appended.
- During a game a journal after every move (a lock held while the program
  runs); a crash leaves it to the next start, which writes the game once,
  unfinished. A failed write keeps the journal until the game is saved
  elsewhere or left.
- The play dialog says where the games go (wraps under the name), a ▾ list of
  the computer's players with their ratings (↓/↑ in the field); a toast when
  the database is made; the result strip «Written to the database, No. n ·
  Open» instead of «Save to a database…»; the leave question names it.
- ♞ on the player's card and in the folded shelf; a checkbox in Settings →
  Interface → Your databases (on).

Checked by the tester (crash, failed write, two instances, names, files of
the same name) and the designer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 15:33:35 +03:00
vrubelroman
e1292bff3f Play: designer's review of the Rodent dialog; each style's strength measured at four settings
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
- One scale for every choice (1100–3000); the thumb stops at the style's top.
  Under the track Maia's zone and Rodent's with the style chosen, the chosen
  one lit.
- Each style shows its strengths in the list and under it; a word under the
  slider goes when the strength or the style changes.
- Enter plays only when no control has the focus and no list is open.
- The style list as tall as the buttons; «Balanced», «Tal», «Tal (network)»
  without a repeated name.
- The bar: Rodent's style on the second line; in a narrow panel the clock's
  digits get smaller before the name is cut, the same on both bars.
- Style tables from 2400 games (800/1600/2400/3000): research/rodent.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 04:05:02 +03:00
vrubelroman
251b454bba Play: each Rodent style at its own measured strength
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The styles play weaker than the balanced Rodent at the same UCI_Elo (by 115
to 680 Elo: Tal and Hector the most), measured at two settings so far. Each
style has its range (Tal ≈1850–2650, Balanced 2250–3000); the slider's top
follows the style and a style change keeps the strength inside its range,
saying so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 03:51:56 +03:00
vrubelroman
f54f4d924d Play: tester's findings on Rodent V
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
- 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 <noreply@anthropic.com>
2026-10-26 03:39:04 +03:00
vrubelroman
88027f8325 Play: Rodent's measured strength (2250–3000; his lowest setting already ≈2250)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The bottom of the chain is now tied to the Maia-1 bots and Maia-3 levels
(6300 games): the table moves up; between Maia's 2100 and Rodent's 2250 nobody
plays and the slider passes over it, saying so. research/rodent.md: the
measurement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 03:30:55 +03:00
vrubelroman
e471de0a5b THIRD_PARTY_NOTICES: Rodent V (downloaded on request)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 03:07:00 +03:00
vrubelroman
c3d4a0d703 CHANGELOG, desktop.md: Rodent V, CP_RIVAL, CP_RODENT
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 03:06:46 +03:00
vrubelroman
6129359779 Play: Rodent's strength table from the measurement so far (1900–3000 on the Lichess blitz scale)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 03:05:57 +03:00
vrubelroman
04d337c106 engine_download: a type for a download's job
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 03:03:09 +03:00
vrubelroman
73593ddfc5 Play: Rodent V as an opponent (desktop): downloaded on request, strength and style
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The dialog (docs/design/rodent-opponent.md): «Maia · Rodent V» tiles, one
strength slider for both (Maia's zone marked; past it Rodent is chosen at
once), Rodent's style (Balanced, Attacking, Chaotic, Restricting, Classical,
Tal, Tal (network)) always in its place, greyed for Maia. Rodent V 1.2 (the
authors' release, pinned SHA-256) is downloaded and unpacked with its
personalities, nets and books; it plays through UCI at UCI_Elo from the
measured table (provisional until the measurement ends), with its book,
after Maia's human pause. Its own texts where Russian makes Maia «she» and
Rodent «he». The download helper is shared with Stockfish's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 03:02:55 +03:00
vrubelroman
b90bcdf3a3 Offer Maia a draw (desktop and Android)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The shared rule (play::accepts_draw): she accepts when clearly worse or mated,
or when about level (at most +0.2 for her) and her last three scores agree
within 0.3; after a refusal, again two of her moves later. Her judge keeps the
scores of her turns. Desktop: «½ Offer a draw» beside «Resign»; Android: a
«Draw» button in the game's bar (labels may take two lines).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 02:44:05 +03:00
vrubelroman
0d7c0923fa AUR: chesspenguin-bin 1.5.0
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 02:31:23 +03:00
vrubelroman
e5643a624f Release 1.5.0
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release / version (push) Has been cancelled
Release / publish (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / android (push) Has been cancelled
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 02:15:12 +03:00
vrubelroman
a3eac74491 Android: fixes after the second test (trainer on its side, a game put aside is asked about, offer and take-back, late offers, Maia's failure, the report after a rematch)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
- The trainer lays out beside the board when the phone lies on its side.
- A new game while one is put aside asks «Continue it / Start a new one»; the
  card of a game just put aside is scrolled into sight.
- Take back during Maia's offer removes only the user's move and the offer;
  her judge's answer is waited for up to 2 s, so the offer comes on time.
- Maia not starting: a card «Download Maia again / Abort», no raw error.
- A rematch drops the report of the game before; «Analyse» puts the result
  card away; the card goes at the first change after the end.
- Back from the trainer returns to its move; an empty game is not put aside;
  the first sound is loaded at start; «Viewing: …», «Ещё раз».

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 02:13:20 +03:00
vrubelroman
179f92144e decisions: Rodent V as the opponent with character (desktop)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
2026-10-26 02:10:23 +03:00
vrubelroman
28f9a7851c research: Rodent IV/V as a strong opponent with styles
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 02:00:46 +03:00
vrubelroman
8e7eb7863f Android: designer's review (wrong-move flash seen on dark squares, result card buttons fit, Maia's bar without a doubled rating, «You», titles never a bare year, no menu during a game, «Viewing · back to the game» strip, trainer's count beside its message)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:35:08 +03:00
vrubelroman
ed7d040bad Android: fixes after testing (saved copy asks on leaving, forms survive turning, names, cleanup, dates), Maia's «thinking…»
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
- A copy saved into an own database is that database's game: leaving with
  new changes asks; the source file's paging goes.
- The save sheet, data form and leave question survive turning the phone; the
  form starts from the game each time it opens.
- A new database's default name is free («My games 2»); an own file left by
  a deletion whose Undo was cut short is removed at start.
- «Undo» in the menu; «Make it the main line» offers Undo; «Elo» translated;
  31.02 is not a date.
- «thinking…» with a spinner beside Maia's name instead of the result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:28:04 +03:00
vrubelroman
9e7314836d CHANGELOG: Android move input, own databases, Maia, trainer
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
2026-10-26 01:23:08 +03:00
vrubelroman
df22d2812d Android: sounds (the desktop's SFX set and the trainer's wrong move), a «Sound» setting
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Moves (capture, check), the end of a game against Maia, her offer to resign,
the trainer's right, wrong and last moves. Notices in About.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:23:00 +03:00
vrubelroman
66f86ae3e5 Android: games against Maia (small model, no clocks)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
«Play with Maia» on the Databases screen and «Play on from here with Maia…» in
the move sheet: the strength (1100–1800), colour and name; Maia's 21 MB
downloaded there. The game is a mode of the game screen: Maia answers after a
person's pause (shared rules), take back, resign or abort, Maia's offer to
resign judged by Stockfish when it is there; the end card offers analysis,
rematch and saving. The game is written after each move: «back» puts it
aside, the Databases screen offers to go on with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:21:47 +03:00
vrubelroman
57cc4b2360 play: the tags of a game against Maia shared (desktop and Android)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:14:40 +03:00
vrubelroman
68941d3341 mobile-api: a session's own review; a new game from a move of another (play on from here)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:12:59 +03:00
vrubelroman
22843d5985 mobile-api: a game's ending, Maia's pause and ResignJudge over the play crate
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:11:44 +03:00
vrubelroman
9e00d046b0 play: a game against Maia's rules as a crate (ending, pause, resignation judge)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
How a game ends, Maia's pause and her resignation judged by an engine move
from the desktop's play.rs into crates/play; the judge wakes the app through a
callback and takes engine options (Android's EvalFile). The desktop uses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:10:34 +03:00
vrubelroman
a7c832b8c9 Android: CheckedDownload shared by the engine's network and Maia's weights
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The system download with SHA-256 check moves out of EngineFiles into a class
for any such file; EngineFiles keeps its behaviour (same preferences key);
MaiaFiles fetches the small model of the pinned revision on request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:07:21 +03:00
vrubelroman
e33c4f3044 mobile-api: MaiaPlayer — the small model's move at a strength, by the shared tables
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:05:49 +03:00
vrubelroman
5911750506 maia::strength: the strength tables and the choice of a move shared; Android trainer screen
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The measured tables (strength → rating input, temperature) and the choice of
Maia's move (rare moves dropped) move from the desktop's play.rs into the maia
crate; the desktop plays by them. Android: «Learn the opening up to this
move» in the move sheet opens the trainer over the game (tasks bar, wrong
move lit for 400 ms, «Show the move» after three mistakes, the result card).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:05:04 +03:00
vrubelroman
2528138135 mobile-api: Trainer over the shared trainer crate (state, judge, hint, stats file)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:01:25 +03:00
vrubelroman
bb2ef38ef6 trainer: the opening trainer as a crate shared by the desktop and Android
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
apps/desktop/src/train.rs moves to crates/trainer; the rule of a move (right,
the last one, wrong) becomes Training::judge, the desktop uses it; the app
names the stats file (set_file). The line's last move comes in plain SAN; the
desktop shows it its own way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:00:11 +03:00
vrubelroman
45a37fc65b Android: the game's data form (players, ratings, event, date, result); a new game's first save asks for it
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
mobile-api: set_data keeps the Seven Tag Roster whole and in order, as the
desktop does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 00:56:54 +03:00
vrubelroman
3596336cfe Android: new game, own databases (create, rename, export, delete), save and leave questions
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Databases screen: «New game», «My databases» first, then «Files». A game
being changed lives in a ViewModel (the phone may turn). Save puts an own
game back in its place; a new game or a copy goes into an own database
chosen once (or made there), later saves replace it. Leaving with changes
asks only for own and new games.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 00:54:16 +03:00
vrubelroman
08aac5d83b Android: moves on the board (tap-tap, drag, legal dots, queen), variations, move sheet, undo
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
A game of a database is changed in memory (never saved into someone else's
file): a move extends the line, follows an existing one or becomes a
variation; a long press on a move offers make-main and delete (with Undo);
the menu's Undo takes any change back. Research: Maia's strength against
people, reviewed from the literature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 00:39:08 +03:00
vrubelroman
d9f37f1283 mobile-api: a move's id is its node id, kept across edits
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
New moves come at the end and a removed one stays unreachable, so the
cursor and the report's marks stay on their moves when the game changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 00:33:55 +03:00
vrubelroman
68a9a37757 design: Android promotes to a queen always (owner)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
2026-10-26 00:31:43 +03:00
vrubelroman
5041834825 mobile-api: GameSession (moves, variations, undo, data, PGN) and own databases
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The Android app gets a game it can change: moves go into the tree as on the
desktop (followed when they exist, a variation elsewhere, never overwritten),
with undo/redo, main line / delete, an engine line as moves, tags and result,
PGN. Own databases: PGN files in the app's folder created, saved into
(append or replace through chess_core::pgn::store) and removed from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 00:23:08 +03:00
vrubelroman
f224736ff3 README, site: Maia's measured strength 1100–2100, the large model's 316 MB
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 00:20:32 +03:00
vrubelroman
62484b088b decisions: Android play design answers
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
2026-10-26 00:19:48 +03:00
vrubelroman
4f792824ac design: Android move input, own databases, Maia without clocks, the trainer
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 00:15:44 +03:00
vrubelroman
dbcfe81856 Play: Maia up to 2100 (surer choices above a model's top), measured with random openings
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 00:11:02 +03:00
vrubelroman
a94de00199 maia: the weights move into the network (no copy), the file's bytes go once read
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Peak memory while loading: 79M 940 → 636 MB, 5M 72 → 52 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 00:09:21 +03:00
vrubelroman
0fd40f01b4 decisions: Android gets move input, own databases, Maia 5M without clocks, the trainer
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 00:07:35 +03:00
vrubelroman
326b52db89 research: what of the desktop app fits the Android app
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:52:53 +03:00
vrubelroman
ca0a60c5b6 Play: Maia's strength tables measured down to the bottom of the slider
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:10:20 +03:00
vrubelroman
8f94403aa9 Game analysis: options other than the defaults count as chosen before
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:03:16 +03:00
vrubelroman
9c9f7e9178 Game analysis: «Analyse» starts at once with the options chosen before
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The dialog comes the first time (no analysis started from it yet) and with
«Analyse again…». The analysis options are now saved when changed. Dev
hook CP_REVIEW=ask presses «Analyse».

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 22:47:39 +03:00
vrubelroman
d4cccb3f68 Play: the large Maia (79M), the slider in real strength
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
- The slider shows Maia's measured strength on the Lichess blitz scale
  (1100–2000, step 50); per-model tables turn it into her rating input.
- The large model plays every strength once downloaded (316 MB); with only
  the small one, up to 1800, above it «Download and play» brings the large.
- The network runs on half the cores; Maia's clock takes the computing
  when it is longer than her pause.
- A rematch or a game from a position whose model is missing reopens the
  dialog with the same choices; the main button keeps its width; no game
  while a download runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 22:20:09 +03:00
vrubelroman
7fdc22345e maia: network sizes read from the checkpoint (5M, 23M, 79M)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The larger Maia-3 models compress each square before the attention-bias
generator (sm1); the sizes now come from the tensors. Checked against the
original PyTorch model for 5M and 79M (reference test, MAIA_REFERENCE).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:52:09 +03:00
vrubelroman
7cca4eea9a research: Maia-3 strength measured (4200 games against the Lichess Maia-1 bots)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 17:44:18 +03:00
vrubelroman
ede4de72d3 research: what Maia's ratings mean, Russian ranks, a measurement plan
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 16:53:16 +03:00
vrubelroman
f90c636dd7 Play dialog: the strength slider alone (no Weaker · As me · Stronger)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The owner found the relative buttons silly: the slider sets Maia's strength;
named levels (ranks) will come after the study of what Maia's ratings mean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 16:42:57 +03:00
vrubelroman
053b189614 tasks: statuses after 1.2.0–1.4.0
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 16:13:47 +03:00
vrubelroman
cefb8cd4c0 AUR: chesspenguin-bin 1.4.0
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 15:57:51 +03:00
vrubelroman
bdedee57be Release 1.4.0
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Release / version (push) Has been cancelled
Release / macos (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Release / android (push) Has been cancelled
Release / publish (push) Has been cancelled
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 15:23:09 +03:00
vrubelroman
319e8808ab Library title row in three groups: databases | a game to enter | Play
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
The owner's order: «+ Add database · ✚ New database · 🌐 Online games», a line,
«♟ New game · 📋 Paste PGN», a line, «♞ Play»; Settings on the right. The
narrow row (the database list) keeps the same groups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 15:21:04 +03:00
vrubelroman
a5614d91fc Paste a line, play on from here, learn the opening
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Paste a line from the clipboard (Ctrl+V on a game, the move menu, ☰):
chess-core paste.rs plans where the text fits without touching the game — a
PGN game where its moves part from this one along any branch, or where one of
its positions occurs (another move order, noted); a fragment (SAN, numbered
or not, «…» for black, UCI) after the selected move, instead of it, or at its
move number — and grafts the new moves with their comments, symbols and
variations (the pasted game's alternatives along the way too) as one undo
step, the players' names after the line. A game with no position in common
is refused with a message; a line going elsewhere than the selected move is
asked about; an impossible move inserts nothing.

Play on from here (the move menu, Ctrl+G on a game, ☰): the play dialog shows
the position on a small board and the game it comes from; the new game holds
the moves up to it (Maia sees the history, repetitions count), dimmed during
play, with a comment saying where it comes from; take-backs, abort and resign
count only the new moves; the source game waits under it («⬅ Back to the
game»); the side to move plays by default, a rematch keeps the colour.

Learn the opening up to this move (the move menu, ☰): a training screen over
the game; the user plays both sides; a wrong move is counted, shown for
400 ms in red with a short sound and taken back; from the third mistake on a
move «Show the move» puts an arrow (the run marked with a hint); at the end
the mistakes by move, the line's runs (last, best, clean in a row, recent),
«Again» (Enter). Runs are kept in training.json by the line (start position
and moves), shared between games; an entry or a file that does not read is
kept aside, not lost. New sounds Wrong (Kenney, CC0) and Success (Lichess
Victory, Kenney).

Keys of the game do nothing under a modal question or dialog. Dev hooks
CP_PASTE_LINE, CP_PLAY_FROM, CP_TRAIN, CP_TRAIN_MOVES, CP_TRAIN_KEEP,
CP_TRAINING_FILE. Texts in nine languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 14:51:09 +03:00
vrubelroman
1b631ec536 decisions: paste a variation, play from here, the trainer; task: engine styles
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 14:09:51 +03:00
vrubelroman
5d019d6bdb design: paste a variation, play on from a position, the opening trainer
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 14:00:15 +03:00
vrubelroman
19ed5d1a16 research: paste a variation, play on from a position, the opening trainer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:48:44 +03:00
vrubelroman
9fdd91af24 tasks: the opening trainer — the user plays both sides
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:39:45 +03:00
vrubelroman
d4f8650c88 AUR: chesspenguin-bin 1.3.0
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:35:12 +03:00
vrubelroman
ab8e1761ff tasks: paste a variation, play on against Maia, the opening trainer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:34:10 +03:00
691 changed files with 120404 additions and 5519 deletions

View file

@ -2,3 +2,8 @@
# without the Visual C++ Redistributable (VCRUNTIME140.dll).
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
# WebAssembly in a browser: random numbers from crypto.getRandomValues (getrandom 0.3
# needs this as well as its `wasm_js` feature, enabled by apps/web).
[target.wasm32-unknown-unknown]
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]

View file

@ -66,7 +66,7 @@ jobs:
# Apple Silicon: the build and the app bundle (decision 15).
macos-build:
runs-on: macos-14
runs-on: macos-15
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable

52
.github/workflows/release-notes.yml vendored Normal file
View file

@ -0,0 +1,52 @@
name: Release notes
# Corrections to the changelog must also reach an already published release,
# without moving its tag or rebuilding the signed packages.
on:
push:
branches: [main]
paths: [CHANGELOG.md]
workflow_dispatch:
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Update the current release notes if it has been published
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
python3 - <<'PY'
import json, os, pathlib, tomllib, urllib.error, urllib.request
version = tomllib.loads(pathlib.Path('Cargo.toml').read_text())['workspace']['package']['version']
heading = f'## [{version}]'
lines = pathlib.Path('CHANGELOG.md').read_text().splitlines()
start = next(i for i, line in enumerate(lines) if line.startswith(heading)) + 1
end = next((i for i in range(start, len(lines)) if lines[i].startswith('## [')), len(lines))
body = '\n'.join(lines[start:end]).strip()
assert body, 'Release notes must not be empty'
api = f'https://api.github.com/repos/{os.environ["GH_REPO"]}/releases'
headers = {'Authorization': f'Bearer {os.environ["GH_TOKEN"]}',
'Accept': 'application/vnd.github+json', 'User-Agent': 'ChessPenguin-release-notes'}
try:
with urllib.request.urlopen(urllib.request.Request(f'{api}/tags/v{version}', headers=headers), timeout=30) as response:
release = json.load(response)
except urllib.error.HTTPError as error:
if error.code != 404:
raise
print(f'v{version} is not published yet; the release workflow will supply its notes.')
else:
data = json.dumps({'body': body}).encode()
request = urllib.request.Request(f'{api}/{release["id"]}', data=data,
headers={**headers, 'Content-Type': 'application/json'}, method='PATCH')
with urllib.request.urlopen(request, timeout=30) as response:
updated = json.load(response)
assert updated['body'].strip() == body
print(f'Updated notes for v{version}: {updated["html_url"]}')
PY

View file

@ -114,7 +114,7 @@ jobs:
needs: version
# Apple Silicon (arm64). Not signed by Apple yet: the first start goes through
# "Open" in the context menu (decision 15).
runs-on: macos-14
runs-on: macos-15
env:
VERSION: ${{ needs.version.outputs.version }}
steps:
@ -169,6 +169,11 @@ jobs:
with:
name: android
path: androidApp/dist/*.apk
# The RuStore build: uploaded to the store by hand, not a file of the release.
- uses: actions/upload-artifact@v7
with:
name: rustore
path: androidApp/dist-rustore/*.apk
publish:
needs: [version, linux, flatpak, windows, macos, android]
@ -180,6 +185,9 @@ jobs:
with:
path: dist
merge-multiple: true
# The RuStore build stays an artifact of the run (merge-multiple brought it here).
- name: Not the store's build
run: rm -f dist/*-rustore.apk
- name: Stockfish source (GPL-3.0 source offer for the engine bundled in the Flatpak and Android)
run: packaging/stockfish.sh source dist
- name: Checksums

123
.github/workflows/rodent-iv.yml vendored Normal file
View file

@ -0,0 +1,123 @@
# Builds Rodent IV (github.com/nescitus/rodent-iv, GPL-3.0) from the authors' sources at a
# pinned commit for Linux, Windows and macOS: its authors publish no builds for them
# (docs/decisions.md «Rodent IV»). ChessPenguin downloads the engine from this release on
# request, checked against the SHA-256 pinned in apps/desktop/src/rodent4_download.rs; the
# personalities and books come from the authors' repository at the same commit.
#
# Tag rodent-iv-<version> to publish. The release is a pre-release that is never "latest":
# the app's update check and the website look for the latest release of ChessPenguin.
name: Rodent IV
on:
push:
tags: ["rodent-iv-*"]
workflow_dispatch:
permissions:
contents: write
env:
# The authors' last commit (2021-04-29, Rodent IV 0.33).
COMMIT: e8d84c8c8c189a1cf4eb27c578fc573af3b916d2
jobs:
build:
strategy:
matrix:
include:
# An older glibc, so that the engine runs on the distributions ChessPenguin runs on.
- os: ubuntu-22.04
name: rodent-iv-linux-x86_64
- os: windows-latest
name: rodent-iv-windows-x86_64.exe
- os: macos-15
name: rodent-iv-macos-arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
with:
path: cp
- name: Sources at the pinned commit, with our two fixes
shell: bash
# packaging/rodent-iv/home-dir.patch: on Linux the engine now and then took a
# wrong home folder and played without its personality and books; on macOS it
# had none, found no personality and did not offer the Personality option.
# packaging/rodent-iv/think-thread.patch: the search thread read its parameter
# after it was gone; clang builds (macOS) searched garbage out of the book.
run: |
git clone https://github.com/nescitus/rodent-iv.git src
git -C src checkout "$COMMIT"
git -C src apply ../cp/packaging/rodent-iv/home-dir.patch
git -C src apply ../cp/packaging/rodent-iv/think-thread.patch
- name: Windows compiler (MinGW-w64, linked statically)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
install: mingw-w64-ucrt-x86_64-gcc
- name: Build (Linux, macOS)
if: runner.os != 'Windows'
shell: bash
run: |
cd src/sources
extra=""
if [ "$RUNNER_OS" = "Linux" ]; then extra="-static-libstdc++ -static-libgcc"; fi
c++ -O3 -w -pipe -DNDEBUG -fno-rtti -finline-functions -std=c++14 $extra src/*.cpp -o "../../${{ matrix.name }}" -lm
strip "../../${{ matrix.name }}" || true
- name: Build (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
cd src/sources
g++ -O3 -w -pipe -DNDEBUG -fno-rtti -finline-functions -std=c++14 -static src/*.cpp -o "../../${{ matrix.name }}" -lm
strip "../../${{ matrix.name }}"
- name: It answers UCI
shell: bash
run: printf 'uci\nquit\n' | "./${{ matrix.name }}" | grep -q "Rodent IV"
- name: It searches (a legal first move out of a book)
shell: bash
run: |
out=$( (printf 'uci\nsetoption name UseBook value false\nisready\nposition startpos\ngo depth 8\n'; sleep 10; printf 'quit\n') | "./${{ matrix.name }}" )
best=$(printf '%s\n' "$out" | grep -o 'bestmove [a-h1-8]*' | tail -n1 | cut -d' ' -f2)
echo "bestmove: $best"
legal=" a2a3 a2a4 b2b3 b2b4 c2c3 c2c4 d2d3 d2d4 e2e3 e2e4 f2f3 f2f4 g2g3 g2g4 h2h3 h2h4 b1a3 b1c3 g1f3 g1h3 "
[[ -n "$best" && "$legal" == *" $best "* ]]
- name: It offers its personalities (its own folder, a space in it; started elsewhere)
shell: bash
# As ChessPenguin runs it: on macOS from ~/Library/Application Support/….
run: |
home="$PWD/engine home"
mkdir -p "$home" && cp "./${{ matrix.name }}" "$home/" && cp -r src/personalities "$home/"
out=$(cd "$RUNNER_TEMP" && printf 'uci\nquit\n' | "$home/${{ matrix.name }}")
printf '%s\n' "$out" | grep '^option name Personality ' | grep -Eq ' var Tal( |$)'
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}
publish:
needs: build
if: github.ref_type == 'tag'
runs-on: ubuntu-24.04
steps:
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: Checksums and the source offer
run: |
cd dist && sha256sum * > SHA256SUMS.txt
cat > "${RUNNER_TEMP}/notes.md" <<EOF
Rodent IV 0.33 by Paweł Koziol and Bernhard C. Maerz (GPL-3.0), built from the
authors' sources at https://github.com/nescitus/rodent-iv/tree/${COMMIT}
with two fixes (packaging/rodent-iv/home-dir.patch and think-thread.patch in
ChessPenguin's repository: the engine's home folder on Linux and macOS; the search
thread's parameter, which clang builds read after it was gone) for
ChessPenguin, which downloads it on request. Not a ChessPenguin release.
EOF
- uses: softprops/action-gh-release@v3
with:
files: dist/*
body_path: ${{ runner.temp }}/notes.md
prerelease: true
make_latest: false

6
.gitignore vendored
View file

@ -10,3 +10,9 @@
# A local run of the website from the repository root (website/README.md runs it from server/).
/data-dev/
# The web version built for the site (apps/web/build.sh website/static/app)
website/static/app/
# Claude Code worktrees of agents
.claude/worktrees/

View file

@ -4,10 +4,19 @@ mode: subagent
color: "#33A68C"
---
Ты продуктовый и системный аналитик шахматного desktop-приложения. Читай AGENTS.md, техническое задание.txt и связанные исследования. Пиши по-русски. Сохраняй аналитику в назначенные файлы docs/; не изменяй код приложения и исходные материалы без прямого задания.
Ты продуктовый и системный аналитик ChessPenguin. Пиши по-русски. Читай AGENTS.md, `техническое задание.txt`, `docs/dev/tasks.md` и назначенные исследования. Код приложения и исходные материалы (`pgnFilesforExample/`, `designExample/`, ТЗ) без прямого задания не изменяешь.
Связывай требования со сценариями пользователя и проверяемыми критериями приёмки. Отмечай источник каждого требования: ТЗ, подтверждение пользователя, предложение команды. Разделяй первую версию и последующие этапы. Вопросы задавай только там, где ответ меняет решение.
Доказательность:
Исследуй реальные данные: кодировки, заголовки, неизвестные теги, начальные FEN, RAV, NAG, комментарии до и после ходов, расширения аннотаций, усечённые партии и неоднозначности PGN. Статистику снабжай методом подсчёта; подсчёт регулярными выражениями не называй полноценной проверкой легальности.
- Каждое требование веди к источнику: ТЗ, решение в `docs/decisions.md`, слово пользователя, предложение команды; тип источника помечай рядом с требованием.
- Критерии приёмки формулируй наблюдаемо: что видит пользователь или какая проверка их подтверждает. «Быстро», «удобно», «корректно» без измеримого критерия — не критерий.
- Разделяй факт (проверено на данных), гипотезу (нужна проверка) и предложение (вариант решения); не смешивай их в одном выводе.
Продумывай импорт, повторное открытие, изменение внешнего файла, отмену долгих операций, поиск, создание партии, экспорт и восстановление несохранённой работы. Поддерживай журнал решений и открытых вопросов в рамках назначенной области. В итогах сообщай факты, риски, изменённые файлы и рекомендации.
Работа с реальными данными:
- Любую статистику по PGN/ChessBase считай реальными командами над копией данных, с указанием инструмента и методики. Числа из головы недопустимы; подсчёт регулярными выражениями не называй проверкой легальности.
- Граничные случаи проверяй явно: legacy-кодировки, FEN с fullmove=0, учебный `--`, вложенность RAV, комментарии у корня/ходов/ветвей, NAG, усечённые записи, повтор позиции, старт чёрных.
Сценарии мысли сквозными: импорт → просмотр → редактирование → экспорт → повторное открытие; внешнее изменение файла; отмена долгой операции; авария посреди записи. Вопросы задавай только там, где ответ меняет решение, и приводи варианты с последствиями.
Отчёт (обязательный формат): выводы с пометками факт/гипотеза/предложение · изменённые файлы · открытые вопросы · что нужно от других ролей.

View file

@ -4,16 +4,26 @@ mode: subagent
color: "#BD7AD8"
---
Ты senior product designer шахматного аналитического приложения. Прочитай AGENTS.md, ТЗ и релевантные изображения designExample через инструмент просмотра изображений. Изучай референсы визуально, а не только по именам файлов. Пиши и сохраняй результаты по-русски в назначенные файлы.
Ты senior product designer ChessPenguin. Пиши по-русски. Прежде чем предлагать, смотри реальные материалы: изображения `designExample/` и актуальные снимки `docs/screenshots/` — инструментом просмотра изображений, не по именам файлов. Новое решение должно быть неотличимо по системе от существующего интерфейса.
Рабочая методика:
1. Определи основную задачу экрана и приоритет информации.
2. Опиши пользовательский путь, переходы и сохранение контекста между библиотекой и партией.
3. Сделай wireframe и объясни размещение доски, нотации, вариантов, комментариев и анализа.
4. Опиши конкретные компоненты, размеры, плотность, типографику, цвета и состояния. Избегай декоративного dashboard-дизайна, огромных карточек и градиентов без функции.
5. Проверь пустые, загрузочные, ошибочные, переполненные состояния и несохранённые изменения; протестируй компоновку мысленно на небольшом окне и HiDPI.
6. Задай клавиатурную навигацию, фокус, tooltip, видимую выбранную позицию и читаемость без опоры только на цвет.
Методика на каждый экран или изменение:
Доска и чтение аннотированной партии — центр продукта. Основная линия, побочные ветки, комментарии и NAG должны оставаться понятными при глубоком вложении. Предпросмотр PV движка должен визуально отличаться от партии и иметь очевидный возврат. Активная позиция, выбранная строка и раскрытая ветка — разные состояния.
1. Задача экрана и приоритет информации — одной фразой, до макета.
2. Пользовательский путь и сохранение контекста (библиотека ⇄ партия, возврат из предпросмотра).
3. Компоновка: доска, нотация, варианты, комментарии, анализ; обоснуй размещение каждого элемента.
4. Конкретика: компоненты, плотность, типографика, цвета, отступы, состояния. Без декора ради декора: никаких бесполезных карточек, градиентов и dashboard-стилистики.
5. Матрица состояний: пустое, загрузка, ошибка, переполнение, несохранённые изменения, узкое окно, HiDPI, большие базы.
6. Клавиатура: полная карта клавиш и фокуса, tooltip, видимая активная позиция, читаемость без опоры только на цвет.
Учитывай нативные ограничения выбранного Rust UI: перенос rich text, hit testing ходов, виртуализация таблиц, clipboard, диалоги, звук, SVG, IME. Предлагай проверяемый UI-прототип для сомнительных возможностей. Код приложения меняй только по прямому назначению оркестратора. Не скачивай случайные skills и не копируй фирменные ресурсы без проверки происхождения.
Независимая визуальная приёмка после реализации:
- Ревьюер — отдельный агент, не автор макета или кода изменения. Он обязан запустить приложение в изолированных настройках и посмотреть реальные снимки, а не оценивать вёрстку только по коду.
- Обязательны сравнение с главным экраном и экраном партии, широкое и узкое окно, пустые и заполненные состояния, HiDPI в доступном окружении. Проверять типографику, отступы, выравнивание, одинаковые размеры кнопок и строк, читаемость выделения.
- Отдельно проверять последовательность состояний: выбор строки, запуск, завершение, возврат, появление статистики и фоновых сообщений. Размеры блоков не должны скачком меняться без явного действия пользователя; любое изменение высоты фиксировать на серии снимков.
- Вердикт подтверждать ссылками на снимки, размером и состоянием каждого. Общее «всё ровно» без визуальных доказательств не считается приёмкой. Дефекты записывать конкретно: место, ожидаемое/фактическое выравнивание, шаги воспроизведения.
Центр продукта — доска и чтение аннотированной партии: основная линия, ветки, комментарии и NAG остаются понятными при глубоком вложении; предпросмотр PV движка визуально отличим от партии и имеет очевидный выход. Активная позиция, выбранная строка и раскрытая ветка — три разных состояния, не сливать их.
Ограничения egui проверяй по документации и исходникам (перенос rich text, hit testing ходов, виртуализация таблиц, clipboard, диалоги, звук, SVG, IME). Сомнительную возможность не утверждай — предложи проверяемый UI-прототип. Код меняешь только по прямому назначению оркестратора; чужие фирменные ресурсы без проверки происхождения не копируешь.
Отчёт: решения с обоснованием · макеты и состояния · требования к реализации для разработчика · что передать тестировщику.

View file

@ -4,12 +4,25 @@ mode: subagent
color: "#E5AC57"
---
Ты senior Rust desktop разработчик. Читай AGENTS.md, ТЗ, согласованные решения docs/architecture.md и связанные требования. Не выбирай другой UI-фреймворк без объяснения и согласования. Работай только в назначенной области.
Ты senior Rust-разработчик ChessPenguin. Читай AGENTS.md, `docs/architecture.md`, `docs/decisions.md` и dev-доки назначенной области (`docs/dev/`). UI-фреймворк без объяснения и согласования не меняешь; работаешь только в назначенных файлах.
Держи шахматную модель и PGN независимо от UI. Используй проверенную библиотеку правил; самостоятельно проектируй дерево документа, привязку комментариев и сериализацию. Различай идентификатор узла, позицию, историю ходов, активную ветку и временный preview анализа. Проектируй семантический roundtrip PGN с сохранением исходного текста для неизменённых игр.
Дисциплина кода:
UCI реализуй как явную машину состояний, с отдельным процессом, асинхронным чтением stdout/stderr, контролем stop/bestmove, таймаутами, MultiPV, типизированными опциями и привязкой результатов к поиску. Сначала завершай старый поиск, затем начинай новый: внутренний request ID не добавляет идентификатор в сам протокол UCI. Не вызывай движок через shell-строку. Завершай процессы при закрытии документа и приложения.
- Сначала читай существующий код области и следуй его идиомам: стиль файла важнее личных предпочтений. Без абстракций «на вырост» и без комментариев-извинений — код и история говорят сами.
- `unwrap`/`expect`/`panic` на пользовательских данных и границах ввода запрещены: `Result` на границах, ошибки типизированные (thiserror), с понятным текстом для пользователя.
- Зависимость добавляешь только после проверки версии и лицензии и убедившись, что существующие зависимости нужду не покрывают; фиксируешь по стилю workspace.
Отделяй индекс библиотеки от исходного PGN; учитывай изменение файла, отмену импорта, пагинацию и атомарную запись. Не читай большую базу целиком в UI-потоке. Обрабатывай Result на границах; не применяй unwrap к пользовательским данным. Избегай абстракций ради гипотетических функций.
Предметные инварианты (нарушать нельзя):
Проверяй доступные API по документации и исходникам, фиксируй версии и лицензии зависимостей. Для изменений запускай подходящие cargo fmt/check/clippy/test или объясняй блокер. Добавляй значимые тесты на ошибки данных и конкурентность. Отчитывайся о точных командах и фактических результатах; не объявляй UI проверенным без запуска.
- Шахматная модель и PGN независимы от UI. Дерево документа — стабильные NodeId, один шаг Undo на операцию. Различай идентификатор узла, позицию, историю ходов, активную ветку и временный preview анализа.
- Исходные байты PGN/ChessBase сохраняются; roundtrip — семантический, с диагностикой; побайтовую идентичность после редактирования не обещаем.
- UCI — только через крейт `uci`: сначала завершить старый поиск (bestmove, затем readyok), потом начинать новый; таймауты, MultiPV, типизированные опции, движок не через shell-строку, процессы завершать при закрытии документа и приложения.
- Тяжёлая работа не в UI-потоке: фоновые потоки, прогресс, отмена, наружу — события.
Ворота качества — обязательны, с фактическим выводом в отчёте:
- `cargo fmt`, `cargo clippy` без предупреждений в тронутых крейтах, `cargo test -p <crate>` зелёные. Сломать существующий тест нельзя; падающий до тебя тест фиксируешь и сообщаешь, чужое молча не «чинишь».
- Поведенческие изменения — с тестами: ошибки данных, отмена, конкурентность, roundtrip. UI проверенным объявляешь только после реального запуска (dev-хуки `CP_*`, снимок), не «на глаз» по коду.
- Замеры производительности с методикой и оборудованием; цели не выдаёшь за результаты.
Отчёт: изменённые файлы · команды проверки и их итог (скопированный вывод) · принятые решения и почему · непроверенное · вопросы.

View file

@ -4,10 +4,14 @@ mode: primary
color: "#5B8DEF"
---
Ты оркестратор Linux-приложения для шахматных баз и анализа. Общайся по-русски. Сначала прочитай AGENTS.md, исходное ТЗ и актуальную сводку docs/architecture.md, если она существует.
Ты оркестратор ChessPenguin — серьёзного локального шахматного приложения (Rust + egui; релизы на Linux, Windows, macOS, Android). Общайся по-русски. До первого вывода прочитай: AGENTS.md (инварианты продукта), `docs/dev/tasks.md` (что в работе), `docs/decisions.md` (что решено; решения пользователя не переоткрываем), `docs/architecture.md` (устройство системы). ТЗ и `docs/research/` — за исходной постановкой и историей.
Выясняй цель текущего этапа: исследование, согласование, реализация или проверка. Предлагай конкретное решение с аргументами, учитывая желание пользователя использовать стек Artcraft. Не выдавай собственную рекомендацию за решение пользователя.
Твоя работа — доводить до проверенного результата, а не до активности:
Делегируй независимые задачи агентам analyst, designer, developer и tester. Если инструменты текущей сессии ещё не показывают эти профили, используй general с полным контекстом роли и сообщи об этом. Назначай отдельные файлы и ожидаемый результат, не запускай дублирующее исследование. Сам интегрируй результаты, устраняй противоречия, поддерживай docs/architecture.md. Сохраняй существенные решения, открытые вопросы и следующий проверяемый шаг.
1. Определи ближайший проверяемый результат и назови его пользователю до начала работы.
2. Делегируй независимые части агентам analyst, designer, developer, tester: каждой — отдельные файлы без пересечений, в задании — цель, известные пути и факты, ожидаемый артефакт. Не дублируй их исследования своими и не делай их работу за них. После UI-реализации отдельно назначай дизайн-ревьюера, который не писал эту реализацию: обязательны реальные скриншоты, сравнение с основными экранами и проверка отсутствия скачков между состояниями.
3. Интегрируй только проверенное: утверждение агента принимай как гипотезу, пока не увидел доказательства (команда, её вывод, файл:строка). Ключевое и спорное перепроверяй сам.
4. Закрывая задачу, обновляй `docs/dev/tasks.md`, при существенных решениях — `docs/decisions.md`; в отчёте различай: сделано / проверено / рекомендовано / ждёт ответа пользователя.
5. Продуктовые решения предлагай вариантами с рекомендацией и ценой каждого; свою рекомендацию не выдавай за решение пользователя. Объём без согласования не расширяй.
Для реализации выбирай небольшой сквозной сценарий с работающим UI и реальными PGN. Перед расширением функций получай независимую проверку тестировщика. В конце различай выполненное, проверенное, рекомендованное и требующее ответа пользователя. Не перезапускай активный OpenCode самостоятельно.
Если инструменты текущей сессии не показывают профили команды, используй субагентов общего назначения с полным текстом роли из `.opencode/agents/<роль>.md` и скажи об этом пользователю. Активный сервис (OpenCode, Kimi Code) самостоятельно не перезапускай.

View file

@ -4,12 +4,16 @@ mode: subagent
color: "#E87575"
---
Ты инженер качества шахматного desktop-приложения. Читай AGENTS.md, требования и изменённые файлы. Пиши по-русски. Приоритет — реальные дефекты и воспроизводимость, а не число тестов.
Ты инженер качества ChessPenguin. Пиши по-русски. Читай AGENTS.md, назначенное изменение и профильные dev-доки. Приоритет — реальные, воспроизводимые дефекты, а не число тестов. Независимость главная: отчёты разработчика и оркестратора — гипотезы, не доказательства; всё ключевое воспроизводишь сам, с нуля, по шагам.
Проверяй на реальных примерах и малых синтетических fixtures: RAV с несколькими уровнями, FEN и ход чёрных, комментарии у корня/ходов/ветвей, NAG, нестандартные теги, кодировки, усечённые данные, рокировки, en passant, превращения, мат, пат, повторение. Roundtrip сравнивай семантически; отдельно проверяй сохранение неизменённых исходных данных.
Предметные чек-листы:
Для UCI используй детерминированный fake engine, который воспроизводит задержки, старый info, отсутствие readyok, некорректные строки, MultiPV, мат и завершение процесса. Реальный Stockfish — дополнительная интеграция, а не замена управляемым сценариям гонок.
- PGN и дерево: RAV нескольких уровней, FEN и ход чёрных, комментарии у корня/ходов/ветвей, NAG, нестандартные теги, legacy-кодировки, усечённые данные, рокировки, en passant, превращения, мат, пат, повтор позиции. Roundtrip сравнивай семантически; отдельно проверяй, что неизменённый исходник уцелел побайтово.
- UCI: детерминированный fake engine, воспроизводящий задержки, устаревший `info` после `bestmove`, отсутствие `readyok`, мусорные строки, MultiPV, мат и завершение процесса. Реальный Stockfish — дополнительная интеграция, а не замена управляемым сценариям гонок.
- UI и сценарии: переход библиотека—партия—библиотека, клавиатура и фокус, предпросмотр PV без изменения документа, отмена операций, экспорт, восстановление после аварии; Wayland/X11 и HiDPI в доступном окружении.
Проверяй переход библиотека—партия—библиотека, клавиатуру и фокус, preview PV без изменения документа, отмену операций, экспорт, восстановление и Linux Wayland/X11/HiDPI в доступном окружении. Для производительности фиксируй оборудование, размер входа, методику и измерение; цели не называй результатами.
Оформление дефекта — строго: серьёзность · окружение и версия · шаги · ожидаемое и фактическое поведение · файл/строка · минимальный пример воспроизведения. Не воспроизвёл — не репортишь: пишешь «не подтвердилось» с перечнем проверок. Производительность: фиксируешь оборудование, размер входа, методику и измерения; цели не называешь результатами.
Не запускай неподтверждённые бинарники и не изменяй пользовательские PGN. Не исправляй production-код в ревью без задания. На дефект указывай серьёзность, шаги, ожидаемое/фактическое поведение, файл/строку и минимальный пример. Явно перечисляй непроверенное. Внешние тестовые библиотеки не публикуй без выяснения условий их распространения.
Границы: production-код без задания не исправляешь; неподтверждённые бинарники не запускаешь; пользовательские PGN и базы не изменяешь — работаешь на копиях; внешние тестовые библиотеки не публикуешь без выяснения условий распространения.
Отчёт: проверено (чем и каким сценарием) · дефекты (по формату) · не подтвердилось · непроверенное — явным списком · оценка рисков остатка.

View file

@ -5,21 +5,27 @@
- Исходное ТЗ: `техническое задание.txt`.
- Пользовательские материалы: `designExample/`, `pgnFilesforExample/`, `engines/`.
- Рабочий язык обсуждений и проектных заметок — русский; идентификаторы кода — английский.
- Текущий этап: исследование и согласование архитектуры. Рекомендация не равна утверждённому решению.
- Сводка решений: `docs/architecture.md`; исследования: `docs/research/`.
- Подтверждённые пользователем границы первой версии: `docs/decisions.md`; они имеют приоритет над ранними предложениями исследований.
- Текущий этап: развитие выпускаемого продукта (релиз 2.5.2). Задачи и бэклог — `docs/dev/tasks.md`.
- Архитектура реализованной системы: `docs/architecture.md`; архитектурное предложение этапа исследования — `docs/research/architecture-proposal-2026-10-17.md`; исследования: `docs/research/`.
- Журнал решений: `docs/decisions.md`; подтверждённые пользователем решения имеют приоритет над предложениями исследований.
## Команда
Оркестратор распределяет независимые задачи между `analyst`, `designer`, `developer`, `tester`, согласует результаты и обсуждает продуктовые решения с пользователем. Делегирование разрешено. Дочерние агенты не создают дополнительные уровни команды без необходимости.
- Аналитик поддерживает требования, реальные особенности PGN и критерии приёмки.
- Дизайнер отвечает за сценарии, компоновку, состояния, клавиатуру и визуальную систему.
- Дизайнер отвечает за сценарии, компоновку, состояния, клавиатуру и визуальную систему. После UI-реализации отдельный дизайн-ревьюер, не автор реализации, проверяет её на реальных снимках приложения: сравнение с главным экраном и экраном партии, выравнивание, размеры и состояния, отсутствие скачков при переходах и появлении данных. Одного чтения кода и тестов для визуальной приёмки недостаточно.
- Разработчик отвечает за Rust, архитектуру, хранение, PGN и UCI.
- Тестировщик независимо проверяет поведение и сообщает конкретные воспроизводимые дефекты.
Каждой параллельной задаче назначать собственные файлы. Не перезаписывать работу другого агента. В отчёте указывать изменения, проверки и нерешённые вопросы.
### Механика в Kimi Code
Канонические профили ролей — файлы `.opencode/agents/*.md` (orchestrator, analyst, designer, developer, tester); содержимое нейтрально к среде исполнения. Kimi Code не регистрирует собственные типы субагентов, и субагент стартует «холодным», поэтому роль передаётся в задании: ссылка на файл профиля («прочитай и следуй ему») плюс цель, уже известные пути и факты, назначенные файлы и ожидаемый результат.
Тип субагента выбирается по требуемым инструментам: `coder` — ролям, которым нужно править файлы или запускать команды (developer, tester; analyst и designer при записи результатов в docs/); `plan` — read-only планирование и проектирование; `explore` — быстрое read-only исследование без записи файлов. Оркестратор — основная сессия; его рабочие правила — в `.opencode/agents/orchestrator.md`.
## Инварианты продукта
- Локальное приложение для просмотра, ввода и анализа шахматных партий, с PGN как форматом обмена.
@ -34,4 +40,8 @@
## Работа
Не изменять исходное ТЗ и референсы. Не запускать незавершённые загрузки движков. Не устанавливать инструменты и не начинать большой каркас приложения до выбора стека. Проверенные факты отделять от предложений; для внешних технических утверждений сохранять ссылки. Тестировать значимое поведение, особенно сохранность PGN и гонки UCI; не объявлять запланированные проверки выполненными.
Окна приложения для тестов и снимков запускать только через `scripts/dev/headless-run.sh -- ENV=… команда` (невидимый монитор Hyprland 1920×1080, без фокуса и курсора владельца); прямой запуск окна на мониторах владельца запрещён. Не запускать и не подменять службы сессии владельца (AT-SPI, D-Bus, порталы, ydotool и т. п.) для эмуляции ввода; нужное действие — через отладочный хук приложения.
Экономия (владелец, 2026-11-27): визуальная проверка — одно разрешение 1920×1080 и основная (тёмная) тема; светлая — только если меняются цвета. Минимум снимков: только те, что доказывают критерий; не снимать серии и другие разрешения без нужды, не держать несколько агентов на проверке одного и того же.
Не изменять исходное ТЗ и референсы. Не запускать неподтверждённые бинарники и незавершённые загрузки движков. Проверенные факты отделять от предложений; для внешних технических утверждений сохранять ссылки. Тестировать значимое поведение, особенно сохранность PGN и гонки UCI; не объявлять запланированные проверки выполненными.

View file

@ -2,6 +2,370 @@
All notable changes are listed here. Versions follow [Semantic Versioning](https://semver.org/).
## [Unreleased]
## [2.5.2] — 2026-11-30
- Android: the «Analyse game» button is in the bottom bar next to the engine button and has the
brilliant-move colour. Tap the previous/next arrows to go one move, or hold them to jump to the
start/end of the line.
- Android: simple opponent preparation. Pick an exact player name from a database or an open game,
choose their colour, and study from your own side of the board. Continuations are shown by arrows
and a frequency-sorted list with game counts and the selected player's wins/draws/losses; play a move
on the board, from the list or with an arrow. Statistics use exact names, transpositions and main
lines only, without engine analysis or changing the source games.
## [2.5.1] — 2026-11-28
- Desktop: select 1–100 games in a database and use «Find great moves» to analyse just those games.
The confirmation shows how many selected games are hidden by the current filter; those games are
included. Changing the selection after starting does not change the batch. Clear the selection to
analyse the filtered games instead.
## [2.5.0] — 2026-11-27
- Desktop: find great moves in the filtered games of a database (up to 100). The «!! Find great moves»
button on the right of the conditions line asks first with a time estimate, then Stockfish 19 goes
through the games with «Analysed N of M» and «Stop»; games already analysed are taken from the cache.
The summary adds up brilliant, great, inaccuracy, mistake and blunder moves, average centipawn loss and
accuracy, and lists the brilliant moves; with a player in the filter only that player's moves count.
A new «!!» column marks games with brilliant or great moves. Games against the engine wait for the search.
- Desktop: select several games in a database (Ctrl/Shift-click, Shift+arrows, Ctrl+A) and make a new
database of them («New database from selected…», Ctrl+Shift+S). The copy runs in the background with
progress and cancel, never overwrites a file, keeps every game as «Add to database» does and skips only
exact duplicates; the source database is not changed.
- Desktop: a hint above the notation tells that arrows and circles can be drawn with the right mouse
button and are saved in PGN; moves with arrows or circles get a small sign in the notation.
- Desktop: the «Analyse game» button has the colour of a brilliant move.
- Desktop opening training: four example repertoires — Spanish and Queen's Gambit for White, Najdorf and
the Semi-Slav triangle for Black — with Russian comments in the Russian interface. Users who updated get
the missing examples once; deleted examples do not come back. The repertoire panel is wider by default,
names and progress are no longer cut, and side kings are drawn so White and Black read correctly on dark
backgrounds.
- Desktop: Enter in «Delete the game from the database?» no longer also opens the game.
## [2.4.0] — 2026-11-27
- Desktop play and opening training support multiple temporary right-button arrows and circles
until the position changes. They are never written to PGN; shapes drawn in ordinary game
analysis remain PGN annotations and are saved only with the game.
- Desktop opening training rewritten to be simpler: one screen with repertoires and a clear daily session (reviews plus up to 10 new moves), new moves are shown before they are asked, mistakes show the right move and return in the same session, PGN comments and opening names are shown. Review all, train a branch and a lines view remain; modes, context parameters, the statistics dashboard and the both-colours mode are gone. Two example repertoires (Spanish for White, Najdorf for Black) are added on first use. Saved progress is kept.
## [2.3.0] — 2026-11-06
- Desktop opening training (α version) avoids repeated PGN parsing and repeated context planning during
automatic moves. Previously displayed context is persisted in one atomic batch,
retaining every progress event without rewriting the entire history for each old move.
- Opening training displays the PGN author's move badges, arrows and marked squares
after the user's moves and during automatic playback, using the same appearance as
the game viewer. Annotations follow the displayed PGN node, including pauses and retries.
- All enabled repertoire variations can be trained, including several own answers in
one position. A pending alternative credits the move actually played; another known
answer is handled without an error penalty. Preferred moves affect order rather than
excluding alternatives. Shared position-and-move statistics remain deduplicated.
## [2.2.0] — 2026-11-06
- Desktop opening training (α version): collect PGN repertoires, add a line from a game, and learn
one main answer per position for White or Black. Learning history and the SRS schedule
are shared between transpositions and repertoires. Three independent correct answers
mark a move as learnt without ending reviews; mistakes, previews and replays after an
error are recorded separately and do not inflate independent accuracy. Persistent v3
JSON keeps atomic, idempotent session and event writes, migration backups and legacy data.
- Opening training has spaced repetition, ordered review and least-recent modes, four
learning priorities, and resumable sessions. Automatic context plays one move at a time
with fixed or knowledge-adaptive animation; reinforcement, preview and replay are distinct
from independent answers. Each repertoire stores its context policy, while an active session
keeps the policy it started with. The editor preserves PGN while changing the main answer,
training depth and disabled branches.
- The learning dashboard compares repertoires and their branches without double-counting
shared positions, and shows exact move analytics, daily history, scheduled reviews and
answer-sequence charts. Snapshots are captured automatically on the first daily view of
a scope without changing PGN or learning state. Full-line
statistics preserve shared moves on each actual PGN line while the global total deduplicates
them. The library table keeps ECO codes, opening names and the actual number of variations;
the training board has no move list. PGN annotations are preserved, but the new alpha
training screen does not yet display move badges, PGN arrows or marked squares.
- Training follows the main application's layout: clearer progress labels and settings,
consistent buttons, compact session controls and board rotation in the bottom toolbar.
The selected repertoire is ready to train on entry; its saved colour and mode are restored.
Progress saves in the background without a repeated status message or blocking the board.
- Moves no longer jump back after a drag while progress is being saved. A completed move
reused as the next task's context does not repeat its animation or sound.
- Opponent preparation ignores a player's later mistakes once their opponent has made the
first mistake. Saved reports and cached evaluations are rechecked without rerunning the engine.
- The main toolbar keeps its position and button appearance while the app starts and checks
the network. Online games can be opened immediately; connection status and retry are shown
inside that dialog. Startup spinners have been removed from the main screen.
- Android: when the app opens or returns to the foreground, a PGN in the clipboard can be
opened from a small confirmation dialog. One or several games are stored as a local copy,
and the first game always opens on the board. Opening or dismissing the same text is remembered
across restarts; an unsuccessful import can be retried. Clipboard checks are local, generation-safe,
limited to 8 MiB and never start an import without confirmation.
## [2.1.5] — 2026-11-02
- Preparing against an opponent is saved by itself: a preparation appears in the
library's «Preparations» as soon as it is started, and its report and the errors
found are written there as they come. The «★ Save» button is gone.
- Preparing against an opponent: the engine starts looking for the opening errors
by itself once the report is built — progress on the Errors tab, «Stop» keeps the
evaluations and the search does not restart by itself after it; changing the depth
or the period starts it again.
- The book comparison has been removed from opponent preparation: its controls,
background work and book-exit statistics are gone. Old saved data remains readable.
- Preparing against an opponent: the game counts for White and Black line up, the
score percentage stays visible in the compact summary, and the error counts and
their game percentages have separate aligned columns.
## [2.1.4] — 2026-10-31
(2.1.3 was not published: its macOS build was cancelled by GitHub retiring the macOS 14
runners. 2.1.4 is the same release.)
- Preparing against an opponent: choose which of his games — all, the last 3 or 6
months, a year or two (counted back from his newest game), or his last 50, 100 or 200
games of each colour; every choice shows how many games it takes. Games without a date
are taken only with all games, and the report says how many were left out.
- Saved preparations: «★ Save» keeps a preparation with the errors found; «🗐
Preparations» in the library opens, renames and deletes them. New games of the
database are added when it is opened again, and the engine looks only at what is new.
- A game downloaded from Lichess or Chess.com opens on the site: the globe after the
result, the ☰ menu or the game list's menu. A Lichess game opens at the move shown,
from the side at the bottom of the board.
## [2.1.2] — 2026-10-31
- The game review runs on your own Stockfish when it is the same Stockfish 19 as
ChessPenguin's: checked once per engine file with three test searches against our
reference (move, score and node count), so the marks stay the same everywhere. Another
engine is told by name and why Stockfish 19 is needed; your engine stays for the
position analysis. Engines for playing (Rodent, Maia) are never used for the review.
- Desktop: files dropped on the window open as databases (PGN, ChessBase, archives,
several at once or a folder) — on Windows, macOS and X11; a Wayland session does not
take dropped files.
- Sizes are written in the interface's language («2,2 ГБ»).
- Less memory to check the encoding of a large PGN file.
## [2.1.1] — 2026-10-29
- Brilliant moves (!!) also for the only good move that a shallow search misses, sacrifice
or not (as people see brilliance: a move a weak engine rates lower and a strong one
best). The game review adds a short search for the moves that could be such (1–2 %
longer). On chess.com's marks of 20 famous games: 90 % of their !! found, 95 % of ours
are theirs.
- Great moves (!) are surer: no ! for an attacked piece stepping quietly to its one good
square, nor for the king stepping out of check — 27 of our 28 ! are chess.com's.
- Website statistics count a file downloaded again the same day by the same visitor once.
## [2.1.0] — 2026-10-28
- Desktop: preparing against an opponent. Pick a player of a database (similar names
shown apart, spellings can be joined) and get their opening repertoire: a tree of
their moves for each colour with opening names (the Lichess opening table), games,
score and the last game, a table of openings and variations with their first moves,
and — on request — the engine's look at their opening mistakes, by opening, with the
mistakes they repeat. A book from the shelf shows where they leave theory. Every
table sorts by its columns; the tree starts folded.
- The game review always uses the same engine search, on every computer and phone:
Stockfish 19 of ChessPenguin, one million nodes a position, one thread per engine
process and several processes side by side. The same game gets the same marks
everywhere; nothing to choose any more (the analysis dialog is gone). An analysis made
with other settings says so and offers «Update».
- Brilliant (!!) and great (!) moves recalibrated on chess.com's marks of 15 famous
games (a check set the program keeps): !! now agree with chess.com 96 % of the time.
Great moves are rarer and surer: never for a capture, only when every other move is
clearly worse; no ! or !! for a book move.
- The sample «Classic games» grow from 38 to 100 famous games; a new version of a
sample replaces the old one on update (desktop and Android).
## [2.0.0] — 2026-10-28
- The databases downloaded from Lichess and Chess.com get the games played since on their
own: at the start of the program and when one comes back to it after ten minutes or
more, one database after another, on the desktop and on Android. Only new games are
told («+N»); no message when there are none or the network is off.
- Desktop: the notation no longer jumps on every move with the engine on. Between two
positions the old lines go at once and the new ones come a frame later; the engine
panel now keeps their room, so what is below it stays still.
- The moves of the notation and the signs after them are bold (Ubuntu Bold on the desktop,
the bold system font on Android), and so are the marks in the circles on the board. In
Russian the report's rows read «Блестящий» and «Замечательный».
- Android: the dark theme by default (it was the system's); a theme chosen before stays.
Android is told the app's own theme, so the window and the splash screen before the
app draws match it (no white flash before a dark app on a light phone).
- Game review marks brilliant moves (!!, a sound piece sacrifice) and great moves (!, the
only good move that turns the game), next to inaccuracies, mistakes and blunders: in the
report, the notation, the graph and on the board; written to the game as $3 and $1. The
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).
Calibrated on chess.com's marks of the Evergreen game: a sacrifice is a piece the move
itself gives up, every move of a combination is marked, and a piece saving itself on
the only good square or the only good move in an equal position is great too.
The first rules stay in the code beside these (to compare them and go back). In
Russian ! is now «Замечательный ход».
- 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.
- Desktop, a game against the computer: the draw offer is «½–½» on its button («Offer a
draw» in its tooltip), so that the game's buttons fit in a narrow panel.
- Move marks in the owner's palette (as on chess.com): !! #26C2A3, ! #81B64C, ?! Lichess
blue #56B4E9, ? #FFA459, ?? #FA412D, on the board, in the notation, the report and the graph,
on the desktop and Android; as text in the light theme darkened to stay readable. The
accuracy numbers follow the same colors (green, blue, orange, red).
- 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.
## [1.9.4] — 2026-10-27
- Desktop: the database cards show how many games each holds instead of «not loaded»:
the databases are counted in the background, one after another, and the counts are
remembered for the next start (a changed file is counted again).
- Desktop, the play dialog: the strength rides above the slider's handle, where the eye
is while it moves.
- Translation of annotations is faster: ChatGPT is asked to think little (translating
needs no long thought), and a long game goes in three requests at once instead of one
after another.
- Desktop, a game against the computer: the buttons under the clocks are of one height;
the moves and the board flip on one row, the game's own actions on the next.
## [1.9.3] — 2026-10-27
- Android: «About» no longer calls the app an alpha, says what it does now (chess
databases, game analysis, play against the computer) and shows the penguin in a crown,
as the app's icon does; the empty list of databases shows it too.
## [1.9.2] — 2026-10-27
- Desktop, a game against the computer: the header shows its time control («5+3», «∞»)
where the result comes after it; the players' cards show the king of the chosen piece
set; the player's clock turning red is heard once a game (a double tick, every sound
set); «The game is on» says which game is left («Maia 1550 · you play white · 5+3 ·
move 5»).
- Android: «+ Add» sits in the Files heading, as «+ New database» in My databases,
instead of a button floating over the list.
## [1.9.1] — 2026-10-27
- macOS: Rodent IV plays. Its build had no home folder on macOS (its authors left it
unwritten), found none of its personalities and offered no «Personality», so every game
ended at once with «Rodent did not start: it does not start on this computer». The
engine now takes its own folder, as on Linux and Windows; the program offers to
download it again, and only the engine itself (250 KB) is fetched. Its build is now
checked to offer its personalities from a folder like the one the program uses.
## [1.9.0] — 2026-10-27
- Android: a new version is offered at each start of the app, as on the desktop (it used to
ask once a day, so a release out a day after the last check was not seen at once).
- macOS: an engine downloaded over an older one (Rodent IV from 1.7 to 1.8) no longer
fails «it does not start on this computer»: a download is written beside and put in
place, never rewritten in place (Apple silicon kills an executable changed that way).
- Desktop: a move can be taken back only in a blitz game against the computer; in rapid,
classical and games without a clock «↶ Take back» (and Ctrl+Z) is gone.
## [1.8.0] — 2026-10-27
- macOS: Rodent IV out of its opening book searched garbage (a bug of its sources that
only builds by clang show) and is now built with the fix; an installed Rodent IV is
offered for download again, and only the engine itself (250 KB) is fetched.
- Android: Rodent IV joins Maia as an opponent. «Play» opens the sheet with the choice of
Maia or Rodent IV and, for Rodent, one of its 13 characters or 22 famous players (Tal,
Kasparov, Karpov…), each with its own strength scale (Rodent: 800–2800). The engine is
inside both APKs; its opening books are one download of 59 MB, removable in Settings,
and «No book» plays without them. Rematches and put-aside games keep the opponent.
- A game against the computer can be put aside and continued later: «⏸ Put aside» in
the game, the main answer of «The game is on», and closing the window put it aside;
a card on the library's shelf continues it with the clocks as they were. A game a
crash interrupted is put aside too, no longer written into the database unfinished.
Starting a new game over it asks first.
- The window no longer freezes when a database on a network drive (NFS) becomes
unreachable, for example when the network drops during a game: whether the shelf's
files are there, their sizes and permissions are looked at by a thread of their own,
not in the frame.
## [1.7.0] — 2026-10-26
- Rodent's list of styles gets Rodent IV's: 13 characters (Amanda, Defender, Strangler…)
and 22 famous players (Alekhine, Botvinnik, Fischer, Karpov, Kasparov, Petrosian, Tal…),
each with its opening books. The opponent is just «Rodent»; which engine plays follows
the style chosen (Rodent IV's strength: 800–2800). Rodent IV is downloaded once on
request: built by us from its authors' sources, with its characters and books from their
repository — on macOS too, where Rodent was not available before.
- Android: the lists look richer. Games are divided by thin lines, each side has its
colour disc, the winner's «1» stands on a tile, the opening code (ECO) on a tag of its
own, and the game you came back from is marked. Search also finds by the ECO. On
«Databases» each kind has its colour (Catppuccin: PGN, ChessBase, archives, downloaded,
your own), groups are cards, and a game put aside shows its position. Settings are
grouped the same way, with icons.
## [1.6.0] — 2026-10-26
- Games against the computer are written by themselves into the player's database,
«Roman — games against the computer» (without a name, «Games against the computer»),
made at the first game in the folder of new databases. The play dialog says where the
games go; the result strip says «Written to the database, No. n · Open». A game the program
stopped in (a crash, a power cut) is written at the next start, unfinished. Several
players of one computer each get their own database (the ▾ list by the name). It can
be turned off: Settings → Interface → Your databases. Android: the same in «My
databases» (♞), the result card says where the game went; a game put aside and let
go is written unfinished; Settings → «Write games against Maia…».
- Play against Rodent V (desktop, Linux and Windows): a strong engine with a style —
balanced, attacking, chaotic, restricting, classical, or Tal. It is downloaded once on
request (48 MB, the authors' release).
- The opponent's strength is on the engine's own scale, as its authors give it: Maia
600–2600, Rodent V 800–3000 (its UCI_Elo). The dialog says that these are the engines'
ratings, not a person's Elo. (1.5's slider showed Maia's strength measured on the
Lichess blitz scale; a remembered strength keeps its number.) Android too: Maia
600–2600. The engine's strength is in its name in the game («Maia 1550»),
with no Elo tag for it.
- Offer Maia a draw (desktop and Android): she accepts when she is clearly worse, or
when the position is about level (at most +0.2 for her) and has kept its character for
her last three moves; after a refusal, again two of her moves later. She judges with
Stockfish, as for her resignation.
## [1.5.0] — 2026-10-26
- Play against Maia: the large model (79M parameters, 316 MB, downloaded once from the
authors' page) plays every strength; it is stronger and closer to how people play.
The slider shows her measured strength on the Lichess blitz scale (1100–2100; at the
top she chooses her moves more surely). The small model, when it is there, still
plays up to 1800. Maia thinks on half the cores; her clock counts the computing when
it takes longer than her pause.
- Game analysis: «Analyse» starts at once with the options chosen the last time; the
options dialog comes the first time and with «Analyse again…».
- Android: moves on the board (tap a piece and a square, or drag; a pawn becomes a
queen), variations, «Make it the main line» and «Delete» on a long press, «Undo».
A new game from the start; your own databases on the phone (create, rename, export
the file, delete) and saving games into them, with the game's data.
- Android: play against Maia (the small model, 21 MB, downloaded once; no clocks),
from the start or «Play on from here» after a move; take back, resign, Maia offers
to resign when lost; the game is put aside with «back» and goes on later. Learn an
opening up to a move, as on the desktop. Sounds, with a setting.
- The opening trainer and the rules of a game against Maia are shared by both apps.
## [1.4.0] — 2026-10-25
- The library's title row in three groups: databases | a game to enter | Play.
- Paste a line from the clipboard (Ctrl+V on a game, or the move menu): moves («Nf3 d5»,
«12...Rd8», UCI) go after the selected move or instead of it; a PGN game goes where its
moves part from this game — along any branch, or by another move order — with its
comments, symbols and variations and the players' names at the end. A game that shares
no position with this one is not pasted, with a message; a line starting before the
selected move is asked about. One Ctrl+Z takes it all back.
- Play on from here (the move menu, Ctrl+G on a game): a game against Maia from the
position, its moves up to it kept (Maia sees the history, repetitions count); the
game you came from waits under it, «⬅ Back to the game» returns to it. The side to
move plays by default; a rematch keeps the colour.
- Learn the opening (the move menu): replay from memory the moves of both sides up to
the chosen move. A wrong move is counted, shown for a moment with a short sound and
taken back; from the third mistake on a move you may ask to see it. At the end: the
mistakes by move, the runs of the line (last, best, clean in a row, recent), «Again».
The runs are kept by the line itself, across games.
## [1.3.0] — 2026-10-25
- Play against the computer (desktop): «♞ Play» in the library (Ctrl+G) starts a game

172
Cargo.lock generated
View file

@ -716,6 +716,12 @@ dependencies = [
"thiserror 2.0.21",
]
[[package]]
name = "cast"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
[[package]]
name = "cc"
version = "1.8.0"
@ -768,17 +774,18 @@ dependencies = [
[[package]]
name = "chess-core"
version = "1.3.0"
version = "2.5.2"
dependencies = [
"encoding_rs",
"pgn-reader",
"serde",
"shakmaty",
"thiserror 2.0.21",
]
[[package]]
name = "chess-import"
version = "1.3.0"
version = "2.5.2"
dependencies = [
"chess-core",
"encoding_rs",
@ -789,14 +796,24 @@ dependencies = [
"zip",
]
[[package]]
name = "chess-openings"
version = "2.5.2"
dependencies = [
"chess-import",
"serde",
"shakmaty",
]
[[package]]
name = "chesspenguin"
version = "1.3.0"
version = "2.5.2"
dependencies = [
"arboard",
"base64 0.22.1",
"chess-core",
"chess-import",
"chess-openings",
"chrono",
"directories",
"eframe",
@ -807,9 +824,12 @@ dependencies = [
"game-review",
"getrandom 0.3.4",
"image",
"js-sys",
"log",
"maia",
"online-games",
"play",
"prep",
"releases",
"rfd",
"rodio",
@ -820,13 +840,31 @@ dependencies = [
"skrifa",
"sys-locale",
"tar",
"thiserror 2.0.21",
"trainer",
"uci",
"ureq",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"web-time",
"whatlang",
"winresource",
"zip",
]
[[package]]
name = "chesspenguin-web"
version = "2.5.2"
dependencies = [
"chesspenguin",
"eframe",
"log",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]]
name = "chrono"
version = "0.4.45"
@ -834,7 +872,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"
dependencies = [
"iana-time-zone",
"js-sys",
"num-traits",
"wasm-bindgen",
"windows-link",
]
@ -1666,13 +1706,15 @@ dependencies = [
[[package]]
name = "game-review"
version = "1.3.0"
version = "2.5.2"
dependencies = [
"chess-core",
"chess-openings",
"serde",
"serde_json",
"shakmaty",
"uci",
"web-time",
]
[[package]]
@ -1703,9 +1745,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"r-efi 5.3.0",
"wasip2",
"wasm-bindgen",
]
[[package]]
@ -2383,7 +2427,7 @@ dependencies = [
[[package]]
name = "maia"
version = "1.3.0"
version = "2.5.2"
dependencies = [
"serde_json",
"shakmaty",
@ -2432,6 +2476,16 @@ dependencies = [
"unicase",
]
[[package]]
name = "minicov"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4869b6a491569605d66d3952bcdf03df789e5b536e5f0cf7758a7f08a55ae24d"
dependencies = [
"cc",
"walkdir",
]
[[package]]
name = "minimal-lexical"
version = "0.2.1"
@ -2460,15 +2514,18 @@ dependencies = [
[[package]]
name = "mobile-api"
version = "1.3.0"
version = "2.5.2"
dependencies = [
"chess-core",
"chess-import",
"game-review",
"maia",
"online-games",
"play",
"releases",
"shakmaty",
"thiserror 2.0.21",
"trainer",
"uci",
"uniffi",
]
@ -2603,6 +2660,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "nu-ansi-term"
version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "num-bigint"
version = "0.4.8"
@ -3056,7 +3122,7 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "online-games"
version = "1.3.0"
version = "2.5.2"
dependencies = [
"chess-core",
"serde",
@ -3064,6 +3130,12 @@ dependencies = [
"ureq",
]
[[package]]
name = "oorandom"
version = "11.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
[[package]]
name = "option-ext"
version = "0.2.0"
@ -3321,6 +3393,16 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
[[package]]
name = "play"
version = "2.5.2"
dependencies = [
"chess-core",
"getrandom 0.3.4",
"shakmaty",
"uci",
]
[[package]]
name = "png"
version = "0.17.16"
@ -3412,6 +3494,19 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "196a7c80b9a7652aba7cc070827516c2abe4ccdf53d128e1944003cf5726cff1"
[[package]]
name = "prep"
version = "2.5.2"
dependencies = [
"chess-core",
"chess-import",
"chess-openings",
"game-review",
"serde",
"serde_json",
"uci",
]
[[package]]
name = "presser"
version = "0.3.1"
@ -3600,7 +3695,7 @@ dependencies = [
[[package]]
name = "releases"
version = "1.3.0"
version = "2.5.2"
dependencies = [
"serde_json",
"ureq",
@ -4351,7 +4446,10 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4"
dependencies = [
"js-sys",
"libc",
"wasm-bindgen",
"web-sys",
]
[[package]]
@ -4593,6 +4691,17 @@ dependencies = [
"once_cell",
]
[[package]]
name = "trainer"
version = "2.5.2"
dependencies = [
"chess-core",
"chrono",
"serde",
"serde_json",
"web-time",
]
[[package]]
name = "tree_magic_mini"
version = "3.2.2"
@ -4627,10 +4736,16 @@ checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
[[package]]
name = "uci"
version = "1.3.0"
version = "2.5.2"
dependencies = [
"js-sys",
"libc",
"thiserror 2.0.21",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-bindgen-test",
"web-sys",
"web-time",
]
[[package]]
@ -5001,6 +5116,45 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "wasm-bindgen-test"
version = "0.3.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae7499dfd45780a0a91d7ee6bb9ac51970a4479a41a89da443fdda5a39547d42"
dependencies = [
"async-trait",
"cast",
"js-sys",
"libm",
"minicov",
"nu-ansi-term",
"num-traits",
"oorandom",
"serde",
"serde_json",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-bindgen-test-macro",
"wasm-bindgen-test-shared",
]
[[package]]
name = "wasm-bindgen-test-macro"
version = "0.3.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b84b5ac638bfb168196a1a461fcc8f46a294a18b1b6be52133b4e0db122cc9f"
dependencies = [
"proc-macro2",
"quote",
"syn 3.0.9",
]
[[package]]
name = "wasm-bindgen-test-shared"
version = "0.2.129"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f692aa943ccd88363733b77063f32cfed5bc6cbea8e6e8b251b302f881606fe"
[[package]]
name = "wayland-backend"
version = "0.3.17"

View file

@ -4,16 +4,21 @@ members = [
"crates/chess-core",
"crates/chess-import",
"crates/uci",
"crates/openings",
"crates/game-review",
"crates/online-games",
"crates/releases",
"crates/mobile-api",
"crates/maia",
"crates/trainer",
"crates/play",
"crates/prep",
"apps/desktop",
"apps/web",
]
[workspace.package]
version = "1.3.0"
version = "2.5.2"
edition = "2024"
rust-version = "1.97"
license = "GPL-3.0-or-later"
@ -26,6 +31,8 @@ shakmaty = "0.30.2"
pgn-reader = "0.29.1"
encoding_rs = "0.8"
thiserror = "2"
# `Instant`/`SystemTime` that also work in a browser (std's panic there).
web-time = "1.1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
egui = "=0.36.2"
@ -41,8 +48,20 @@ chess-import = { path = "crates/chess-import" }
uci = { path = "crates/uci" }
maia = { path = "crates/maia" }
game-review = { path = "crates/game-review" }
chess-openings = { path = "crates/openings" }
online-games = { path = "crates/online-games" }
releases = { path = "crates/releases" }
trainer = { path = "crates/trainer" }
play = { path = "crates/play" }
prep = { path = "crates/prep" }
[profile.dev.package."*"]
opt-level = 2
# The web version (apps/web/build.sh): small to download, the release otherwise.
[profile.web]
inherits = "release"
opt-level = "s"
lto = "fat"
codegen-units = 1
panic = "abort"

View file

@ -5,8 +5,9 @@
<h1 align="center">ChessPenguin</h1>
<p align="center">
A native chess database for Linux: open PGN collections, read annotated games,
enter your own and analyse them with Stockfish or any UCI engine.
A chess database for Linux, Windows, macOS and Android: open PGN and ChessBase collections,
read annotated games, enter your own, analyse them with Stockfish, prepare against an
opponent and play against the computer.
</p>
<p align="center">
@ -14,7 +15,7 @@
<a href="README.ru.md">Русский</a>
</p>
![Analysis](docs/screenshots/analysis.png)
![A game with its review](docs/screenshots/game.png)
## Features
@ -28,11 +29,24 @@
- **Notation** — main line as a two-column table, comments and variations as blocks,
mouse and keyboard navigation.
- **Stockfish included** — analysis works right after installation; other UCI engines can be added.
- **Reference** — the moves played from the current position in a database of your shelf
(a big one for theory) with their statistics, how long the game stays in it, the
strongest games that reached it.
- **Search by position** — set up moves on a board and filter a database of millions of
games by the position, next to filters by player, years, rating, opening and result.
- **Engine analysis** — any UCI engine, up to 5 lines, best-move arrows, evaluation bar;
search time, threads and memory are set right in the analysis panel.
- **Game analysis** — evaluate the whole game in the background: evaluation graph under the board,
- **Game review** — evaluate the whole game in the background: evaluation graph under the board,
accuracy, inaccuracies, mistakes and blunders per player and per game phase (Lichess method),
better moves in the notation; write it into the game as NAGs, comments and `[%eval]` (undoable).
**brilliant (!!) and great (!) moves** calibrated on chess.com's marks of famous games, better
moves in the notation and marks on the board; write it into the game as NAGs, comments and
`[%eval]` (undoable). The review always runs the same engine search, so a game gets the same
marks on every computer and phone.
- **Preparing against an opponent** — pick a player of a database and see their opening
repertoire for each colour: a tree of their moves with opening names, games, score and the
last game, a table of openings and variations with their first moves, where they leave
theory; on request the engine finds their opening mistakes, by opening, with the ones they
repeat. Every table sorts by its columns.
- **Engine lines on the board** — step through a line without touching the game, add it as a
variation with one click (undoable).
- **Editing** — enter moves and variations, promote or delete lines, undo/redo,
@ -47,22 +61,38 @@
Undo. Any PGN file on the shelf takes games; writes happen only when you ask, by appending
to the file or rewriting it atomically. Online and ChessBase databases stay read-only; a
file in a legacy encoding gets a UTF-8 copy.
- **Paste a line** — moves or a whole PGN game from the clipboard go into the open game as a
variation, from where they part from it, with their comments and variations (Ctrl+V).
- **Learn an opening** — replay from memory the moves of both sides of a game up to a chosen
move; mistakes are counted, the runs of each line remembered. Or play on from any move
against Maia.
- **Play against the computer** — Maia, a neural network trained on human games, plays like a
human of the rating you choose (600–2600), mistakes included. Lichess time controls (3+0 to
30+20, your own, unlimited), clocks, premoves, take-backs; Maia offers to resign when lost.
Its weights (21 MB) are downloaded on request.
human of the level you choose, mistakes included (600–2600 on her own scale); Rodent, a
strong engine with a character: styles, characters and 22 famous players from Morphy to
Kasparov (Rodent V and Rodent IV, 800–3000). Lichess
time controls (3+0 to 30+20, your own, unlimited), clocks, premoves, take-backs, draw
offers; the opponent offers to resign when lost. Played games go by themselves into the
player's database. Maia (316 MB) and Rodent (48 and 70 MB) are downloaded on request.
- **Looks** — 17 piece sets, 37 boards (flat colours and textures), 7 sound sets,
dark and light themes.
- **Online games** — download anyone's games from Lichess and Chess.com by nickname (yours, a pupil's, an opponent's; no login) into a database, both sites merged or one per site, and fetch the new ones with one click.
- **Online games** — download anyone's games from Lichess and Chess.com by nickname (yours, a pupil's, an opponent's; no login) into a database, both sites merged or one per site; new games arrive by themselves.
- **100 classic games** built in — from Anderssen and Morphy to Carlsen, the famous ones
with short introductions; the sample databases update with the program.
- **Android app** — databases and games in the same formats, moves on the board, your own
databases, game review with !! and !, play against Maia, learning an opening.
- **Languages** — English, Русский, Français, Deutsch, Español, Italiano, Português, Oʻzbekcha, Қазақша.
| Game analysis: graph and report | Engine marks and better lines |
| Preparing against an opponent | Game review: report, !! and ! |
| --- | --- |
| ![Game analysis](docs/screenshots/review.png) | ![Engine marks](docs/screenshots/marks.png) |
| **Engine settings in the analysis panel** | **Library** |
| ![Engine settings](docs/screenshots/engine.png) | ![Library](docs/screenshots/library.png) |
| **Boards and pieces** | |
| ![Settings](docs/screenshots/settings.png) | |
| ![Preparing against an opponent](docs/screenshots/prep-openings.jpg) | ![Game review](docs/screenshots/review.png) |
| **Engine analysis** | **Reference: what was played here** |
| ![Engine analysis](docs/screenshots/engine.jpg) | ![Reference](docs/screenshots/reference.jpg) |
| **Library with filters** | **Search by position** |
| ![Library](docs/screenshots/library.png) | ![Search by position](docs/screenshots/position-search.jpg) |
| **Play against the computer** | **Android** |
| ![Play](docs/screenshots/play.jpg) | ![Android](docs/screenshots/android.jpg) |
| **Boards, pieces and a light theme** | |
| ![Looks](docs/screenshots/looks.jpg) | |
## Install
@ -77,7 +107,7 @@ Packages for every release are on the [Releases](https://github.com/vrubelroman/
| Flatpak | `flatpak install --user ChessPenguin-<version>-x86_64.flatpak` |
| Windows | unzip `ChessPenguin-<version>-windows-x86_64.zip`, run `ChessPenguin.exe` |
| macOS (Apple Silicon) | open `ChessPenguin-<version>-macos-arm64.dmg`, drag ChessPenguin to Applications |
| Android 12+ (alpha) | open `ChessPenguin-<version>-android.apk` (Stockfish built in) or `…-android-noengine.apk` (Stockfish downloaded in the app) on the phone |
| Android 12+ | open `ChessPenguin-<version>-android.apk` (Stockfish built in) or `…-android-noengine.apk` (Stockfish downloaded in the app) on the phone |
On macOS the app is not signed by Apple yet: the first time, right-click ChessPenguin in
Applications and choose **Open** (on macOS 15: System Settings → Privacy & Security → Open Anyway).
@ -87,8 +117,10 @@ official Stockfish 19 (about 80 MB, checked before use, installed for your accou
button is also in **Settings → Engines**. A `stockfish` installed on the system is found
automatically, any other UCI engine can be added from a file. The Flatpak includes Stockfish.
The **Android app** (alpha) views databases and games (the same formats), with the notation under
the board and Stockfish. The two APKs install over each other; databases and settings are kept.
The **Android app** opens databases and games (the same formats), with the notation under the
board and Stockfish. Moves are made on the board (variations, undo); your own databases live on
the phone; game review with !! and !; play against Maia and Rodent IV; learn an opening up to a
move. The two APKs install over each other; databases and settings are kept.
### Build from source

View file

@ -1,11 +1,14 @@
# ChessPenguin
Нативная шахматная база для Linux: открывайте PGN-сборники, читайте аннотированные партии,
вводите свои и анализируйте их со Stockfish или любым UCI-движком.
Шахматная база для Linux, Windows, macOS и Android: открывайте сборники PGN и ChessBase, читайте
аннотированные партии, вводите свои, анализируйте их со Stockfish, готовьтесь к сопернику и
играйте с компьютером.
[English](README.md) · [Скачать](https://github.com/vrubelroman/chessPenguin/releases/latest)
![Анализ](docs/screenshots/ru/analysis.png)
![Партия с разбором](docs/screenshots/game.png)
Скриншоты — английского интерфейса; в программе девять языков, русский среди них.
## Возможности
@ -17,29 +20,55 @@
(windows-1251, windows-1252, KOI8-R, CP866) и учебные нулевые ходы `--`. Исходные файлы не изменяются.
- **Нотация** — основная линия таблицей в две колонки, комментарии и варианты блоками,
навигация мышью и клавиатурой.
- **Справочник** — какие ходы делали из текущей позиции в базе с полки (для теории — в большой),
их статистика, сколько партия держится в базе, сильнейшие партии с этой позицией.
- **Поиск по позиции** — расставьте ходы на доске и отфильтруйте базу на миллионы партий по
позиции, рядом — фильтры по игроку, годам, рейтингу, дебюту и результату.
- **Анализ движком** — любой UCI-движок, до 5 линий, стрелки лучших ходов, шкала оценки;
время, потоки и память настраиваются прямо в панели анализа.
- **Анализ партии** — оценка всей партии в фоне: график под доской, точность, неточности, ошибки
и зевки каждого игрока и по стадиям партии (методика Lichess), лучшие ходы в нотации;
запись анализа в партию знаками, комментариями и `[%eval]` (с отменой).
- **Разбор партии** — оценка всей партии в фоне: график под доской, точность, неточности, ошибки
и зевки каждого игрока и по стадиям партии (методика Lichess), **блестящие (!!) и
замечательные (!) ходы**, сверенные с отметками chess.com на известных партиях, лучшие ходы в
нотации и значки на доске; запись разбора в партию знаками, комментариями и `[%eval]` (с
отменой). Разбор всегда идёт на одних и тех же параметрах движка, поэтому у партии одинаковые
отметки на любом компьютере и телефоне.
- **Подготовка к сопернику** — выберите игрока базы и посмотрите его дебютный репертуар за белых и
за чёрных: дерево его ходов с названиями дебютов, партиями, счётом и датой последней партии,
таблица дебютов и вариантов с первыми ходами, где он уходит из теории; по кнопке движок находит
его ошибки в дебютах — по дебютам и те, что он повторяет. Все таблицы сортируются по колонкам.
- **Линии движка на доске** — просмотр линии без изменения партии и вставка её вариантом (с отменой).
- **Редактирование** — ввод ходов и вариантов, повышение и удаление линий, отмена/повтор,
копирование PGN/FEN, сохранение партии в новый файл.
- **Вставка варианта** — ходы или целая партия PGN из буфера встают в открытую партию вариантом
с того места, где расходятся, с комментариями и вариантами (Ctrl+V).
- **Изучение дебюта** — повторите по памяти ходы обеих сторон партии до выбранного хода; ошибки
считаются, прохождения каждой линии запоминаются. Или продолжите партию с любого хода против Maia.
- **Игра с компьютером** — Maia, нейросеть, обученная на партиях людей, играет как человек
выбранного рейтинга (600–2600), вместе с ошибками. Контроль времени как на Lichess (от 3+0 до
30+20, свой, бессрочно), часы, предходы, ход назад; в проигранной позиции Maia предлагает сдаться.
Её веса (21 МБ) скачиваются по кнопке.
выбранного уровня, вместе с ошибками (600–2600 по её собственной шкале); Rodent — сильный
движок с характером: стили, характеры и 22 великих шахматиста от Морфи до Каспарова
(Rodent V и Rodent IV, 800–3000). Контроль времени как на
Lichess (от 3+0 до 30+20, свой, бессрочно), часы, предходы, ход назад, предложение ничьей;
в проигранной позиции соперник предлагает сдаться. Сыгранные партии сами записываются в базу
игрока. Maia (316 МБ) и Rodent (48 и 70 МБ) скачиваются по кнопке.
- **Оформление** — 17 наборов фигур, 37 досок (цвета и текстуры), 7 наборов звуков, тёмная и светлая тема.
- **Ваши онлайн-партии** — загрузка своих партий с Lichess и Chess.com по нику (без входа) в базу и обновление одной кнопкой.
- **Онлайн-партии** — партии любого игрока с Lichess и Chess.com по нику (без входа) в базу; новые партии приходят сами.
- **100 классических партий** встроены — от Андерсена и Морфи до Карлсена, знаменитые — с
короткими введениями; встроенные базы обновляются вместе с программой.
- **Приложение для Android** — базы и партии тех же форматов, ходы на доске, свои базы, разбор
партии с !! и !, игра с Maia, изучение дебюта.
- **Языки** — English, Русский, Français, Deutsch, Español, Italiano, Português, Oʻzbekcha, Қазақша.
| Анализ партии: график и отчёт | Отметки движка и лучшие варианты |
| Подготовка к сопернику | Разбор партии: отчёт, !! и ! |
| --- | --- |
| ![Анализ партии](docs/screenshots/ru/review.png) | ![Отметки движка](docs/screenshots/ru/marks.png) |
| **Настройки движка в панели анализа** | **Библиотека** |
| ![Настройки движка](docs/screenshots/ru/engine.png) | ![Библиотека](docs/screenshots/ru/library.png) |
| **Доски и фигуры** | |
| ![Настройки](docs/screenshots/ru/settings.png) | |
| ![Подготовка к сопернику](docs/screenshots/prep-openings.jpg) | ![Разбор партии](docs/screenshots/review.png) |
| **Анализ движком** | **Справочник: что здесь играли** |
| ![Анализ движком](docs/screenshots/engine.jpg) | ![Справочник](docs/screenshots/reference.jpg) |
| **Библиотека с фильтрами** | **Поиск по позиции** |
| ![Библиотека](docs/screenshots/library.png) | ![Поиск по позиции](docs/screenshots/position-search.jpg) |
| **Игра с компьютером** | **Android** |
| ![Игра](docs/screenshots/play.jpg) | ![Android](docs/screenshots/android.jpg) |
| **Доски, фигуры и светлая тема** | |
| ![Оформление](docs/screenshots/looks.jpg) | |
## Установка
@ -52,7 +81,9 @@ Stockfish 19 (около 80 МБ, проверяется перед запуск
в **Настройки → Движки**. Установленный в системе `stockfish` находится сам, другие UCI-движки
добавляются из файла. Во Flatpak Stockfish уже есть.
**Android 12+ (альфа-версия):** приложение для просмотра баз и партий (те же форматы), нотация под доской, Stockfish.
**Android 12+:** базы и партии (те же форматы), нотация под доской, Stockfish; ходы на доске
(варианты, отмена), свои базы на телефоне, разбор партии с !! и !, игра с Maia и Rodent IV,
изучение дебюта.
Две сборки: `ChessPenguin-<версия>-android.apk` — Stockfish уже внутри, `…-android-noengine.apk` —
Stockfish скачивается в приложении. Ставятся одна поверх другой, базы и настройки сохраняются.

View file

@ -51,14 +51,21 @@ Downloaded unmodified (files renamed `wk.svg` → `wK.svg`) from https://github.
"Interface Sounds" (https://kenney.nl, CC0 1.0): leading silence trimmed, loudness matched to the
other sets, re-encoded as Ogg Vorbis.
| Set | Move | Capture | Check | Checkmate | Defeat |
| --- | --- | --- | --- | --- | --- |
| wood | impactWood_light_002 | impactWood_heavy_002 | impactPlank_medium_002 | impactBell_heavy_001 | minimize_008 |
| glass | impactGlass_light_001 | impactGlass_heavy_001 | glass_002 | impactBell_heavy_000 | minimize_004 |
| clicks | click_002 | drop_002 | confirmation_001 | maximize_006 | minimize_006 |
| Set | Move | Capture | Check | Checkmate | Defeat | Success |
| --- | --- | --- | --- | --- | --- | --- |
| wood | impactWood_light_002 | impactWood_heavy_002 | impactPlank_medium_002 | impactBell_heavy_001 | minimize_008 | confirmation_004 |
| glass | impactGlass_light_001 | impactGlass_heavy_001 | glass_002 | impactBell_heavy_000 | minimize_004 | confirmation_002 |
| clicks | click_002 | drop_002 | confirmation_001 | maximize_006 | minimize_006 | confirmation_003 |
The Defeat sounds of the Lichess sets (`Defeat.ogg` of `public/sound/sfx`, `piano`,
`futuristic`, `nes`, by Enigmahack, AGPLv3+) were downloaded unmodified on 2026-10-25.
`apps/desktop/assets/sounds/common/Wrong.ogg` (a wrong move while learning an opening, every
set) is Kenney's `error_003` of "Interface Sounds" (CC0), made the same way.
`apps/desktop/assets/sounds/common/LowTime.ogg` (the player's clock getting low, every set) is
two of Kenney's `tick_004` of "Interface Sounds" (CC0) 180 ms apart, 4 dB quieter, re-encoded
as Ogg Vorbis.
The Defeat and Success sounds of the Lichess sets (`Defeat.ogg` and `Victory.ogg` of
`public/sound/sfx`, `piano`, `futuristic`, `nes`, by Enigmahack, AGPLv3+) were downloaded
unmodified on 2026-10-25.
Notes:
- Lichess keeps a set's checkmate sound as a link to its check sound; ChessPenguin plays the check
@ -80,6 +87,50 @@ downloads the authors' own file `maia3-5m.pt` from https://huggingface.co/UofTCS
(revision and SHA-256 pinned in `apps/desktop/src/maia_download.rs`) into the user's data
directory. The weights' licence is not stated by the authors.
## Rodent V (an opponent with a style)
**Rodent V 1.2** (Naman Thanki and Paweł Koziol, based on Sungorus by Pablo Vázquez) is not
part of ChessPenguin. On the user's request the program downloads the authors' unmodified
release archive `release-1-2.zip` from https://github.com/nescitus/Rodent-V/releases/tag/Rodent_v_1.2
(SHA-256 pinned in `apps/desktop/src/rodent_download.rs`) into the user's data directory and
takes from it the engine for the platform and its `personalities/`, `nets/` and `books/`. It
runs as a separate program through UCI.
- License: GNU General Public License version 3 (https://github.com/nescitus/Rodent-V/blob/main/LICENSE);
source: https://github.com/nescitus/Rodent-V.
- The opening books of the release come with it as the authors publish them.
## Rodent IV (characters and famous players)
**Rodent IV 0.33** (Paweł Koziol and Bernhard C. Maerz, based on Sungorus by Pablo Vázquez) is
not part of ChessPenguin. Its authors publish no builds for Linux and Windows, so the engine
is built from their sources at commit `e8d84c8c8c189a1cf4eb27c578fc573af3b916d2` of
https://github.com/nescitus/rodent-iv with one fix of ours, `packaging/rodent-iv/home-dir.patch`
(on Linux the engine now and then took a wrong home folder and played without its
personality), by `.github/workflows/rodent-iv.yml`, and published as the release
`rodent-iv-0.33` of this repository. On the user's request the program downloads
that build (SHA-256 pinned in `apps/desktop/src/rodent4_download.rs`) and the engine's
personalities and opening books from the authors' repository at the same commit (each file's
SHA-256 pinned in `crates/play/src/rodent4_files.rs`) into the user's data directory. It runs
as a separate program through UCI.
On Android the engine is built from the same commit with the same fix and two more,
`packaging/rodent-iv/think-thread.patch` (the search thread read its position from a dead
stack frame; clang builds searched garbage) and `packaging/rodent-iv/android.patch` (bionic has
no `wordexp`), by `androidApp/scripts/rodent4.sh`; the executable and the personalities are in
the APK (both builds), with the license, the authors' README and the credits of the books
(`licenses/rodent-iv` among the APK's assets). The opening books the characters use are
downloaded on the user's request from the authors' repository at the same commit, each file
checked against its SHA-256.
- License: GNU General Public License version 3 (https://github.com/nescitus/rodent-iv/blob/master/LICENSE);
source: the commit above.
- The opening books come as the authors publish them, with their own credits (`#readme.txt`
in each folder of `books/`).
- Three personalities (Strangler, Spassky, Deborah) name their book by a path not in the
authors' files; the program puts a copy of the book under that name (on Android the book is
saved under that name).
## Stockfish (engine)
**Stockfish 19** (tag `sf_19`) is the unmodified official "universal" build from
@ -98,6 +149,39 @@ platform into the user's data directory and checks its SHA-256 (pinned in
Open Database License (ODbL).
- ChessPenguin runs Stockfish as a separate process over the UCI protocol.
### Stockfish.js (the web version)
The web version (`/app/` on the site) uses **Stockfish.js 19.0.1** by Nathan Rugg and Chess.com
(https://github.com/nmrugg/stockfish.js), its single-threaded build `stockfish-19-single.js` +
`stockfish-19-single.wasm`, unmodified, from the npm package `stockfish@19.0.1`
(https://registry.npmjs.org/stockfish/-/stockfish-19.0.1.tgz, integrity
`sha512-bTwsO4e9HAwPBKls1+szcfibmaWRNzTF20rQE/XPdB3LOSoT6XTZDr1zYwriwSRRFT5MkvqrglPmJrKEVXGnyQ==`,
checked by `apps/web/build.sh`). It is Stockfish 19 compiled to WebAssembly with the network
`nn-1a298aa575a0` built in. Our site serves the files beside the program (`/app/engine/`, with the
package's `Copying.txt`); the browser downloads the `.wasm` only when the user agrees and keeps it
in its Cache Storage; it runs in Web Workers over UCI.
- License: GNU General Public License version 3 (the engine; `Copying.txt`); the JavaScript
wrapper as published in the package.
- Source code: https://github.com/nmrugg/stockfish.js/tree/v19.0.1 (the build scripts and the
emscripten glue) and the Stockfish source above.
## Opening names (preparing against an opponent)
`crates/openings/data/a.tsv` … `e.tsv` are the five files of the Lichess opening table
https://github.com/lichess-org/chess-openings (the lichess.org contributors), downloaded
unmodified at revision `f06a50d5c7c140e50b068049fa31d289e2c3d347` (2026-10-27) on 2026-10-28 and
embedded in the program. Its README: "As a collection of facts, this data set is in the public
domain … released under the CC0 Public Domain Dedication" (CC0 1.0). SHA-256 of the files:
| File | SHA-256 |
| --- | --- |
| `a.tsv` | `3282e4c9155289a29224f9a85fba0decb46efa35c2fa5e39662d2ac48fb0f793` |
| `b.tsv` | `4bf2269a8e7571a00a7b346bae4fa86a241a6e7e86beab01783c81acb1622b63` |
| `c.tsv` | `45e843c7b7e79a0d04d5bda879c9bd23f5a10974488bd8615e4f4c5d0749986f` |
| `d.tsv` | `1cf4057a8aece94f27bb3f278ad410ee2844831a642364eeceaafa091dbcceda` |
| `e.tsv` | `48c6f6645b031a5937c8386839debab0e2e48837251687ba1afb6369677f8546` |
## ChessBase formats
- `crates/chess-import/src/cbv.rs` reads ChessBase archives following uncbv
@ -119,3 +203,16 @@ Three evaluation signs (⩲ ⩱ ⌓) come from Noto Sans Math (Copyright 2022 Go
cut down to those glyphs: `apps/desktop/assets/fonts/NotoSansMath-nag.ttf`, licence beside it.
The figurines of the move notation (♔♕♖♗♘) are the five chess glyphs of egui's
emoji-icon-font (MIT), cut out to `apps/desktop/assets/fonts/figurines.ttf`.
The moves of the notation and the move marks on the board are in Ubuntu Bold (Ubuntu Font
Family 0.83, © 2010–2011 Canonical Ltd., Ubuntu Font Licence 1.0), from
the official release `https://assets.ubuntu.com/v1/fad7939b-ubuntu-font-family-0.83.zip`
(SHA-256 456d7d42…05b42, as in Arch Linux's `ttf-ubuntu-font-family`):
`apps/desktop/assets/fonts/Ubuntu-B.ttf`, licence `UFL.txt` beside it.
## Classic games (examples/classics.pgn)
62 of the 100 sample classic games (added 2026-10-28) are game records — players,
event, date, result and moves, which are historical facts — taken from the free player
files of pgnmentor.com (64 Squares; "available for download, completely free") and,
where possible, checked against Wikipedia articles (used only for comparison, no text
copied). Details: `docs/research/classics-sources.md`.

View file

@ -14,4 +14,5 @@
.cxx
local.properties
/dist
/dist-rustore
.env

View file

@ -68,8 +68,19 @@ val stockfish = tasks.register<Exec>("stockfish") {
outputs.dir(stockfishOut)
}
/// The sample games, the piece sets and the board images of the desktop app, as app
/// assets.
/// Rodent IV for Android (scripts/rodent4.sh, docs/design/android-rodent.md): the executable
/// and its personalities in both builds; its opening books are downloaded on request.
val rodent4Out = layout.buildDirectory.dir("rodent4")
val rodent4 = tasks.register<Exec>("rodent4") {
environment("ANDROID_NDK_HOME", ndkHome)
commandLine(File(rootDir, "scripts/rodent4.sh").path, rodent4Out.get().asFile.path)
inputs.file(File(rootDir, "scripts/rodent4.sh"))
inputs.dir(File(repo, "packaging/rodent-iv"))
outputs.dir(rodent4Out)
}
/// The sample games, the piece sets, the board images and sounds of the desktop app, as
/// app assets.
val bundleAssets = tasks.register<Copy>("bundleAssets") {
from(File(repo, "examples")) {
include("*.pgn")
@ -83,10 +94,26 @@ val bundleAssets = tasks.register<Copy>("bundleAssets") {
include("*.jpg", "*.png")
into("boards")
}
// One set of sounds (the desktop's «SFX») and the trainer's wrong move (§33).
from(File(repo, "apps/desktop/assets/sounds/sfx")) {
include("*.ogg")
into("sounds")
}
from(File(repo, "apps/desktop/assets/sounds/common")) {
include("Wrong.ogg")
into("sounds")
}
from(stockfishOut.map { it.dir("source") }) {
into("licenses/stockfish")
}
dependsOn(stockfish)
// Rodent IV's personalities, copied into its home folder on the phone (RodentFiles).
from(rodent4Out.map { it.dir("home/personalities") }) {
into("rodent4/personalities")
}
from(rodent4Out.map { it.dir("source") }) {
into("licenses/rodent-iv")
}
dependsOn(stockfish, rodent4)
into(bundled)
}
@ -120,6 +147,9 @@ android {
buildConfigField("String", "NET_NAME", "\"nn-1a298aa575a0.nnue\"")
buildConfigField("String", "NET_SHA256", "\"1a298aa575a085434d29027978dc36867fe9c5bcea9376654b7a8eba1e52dfc2\"")
buildConfigField("long", "NET_SIZE", "98511183L")
// The app checks for its releases and installs them itself (android-ui.md §25);
// the check is what the site counts installations by. Off for stores.
buildConfigField("boolean", "SELF_UPDATE", "true")
buildConfigField(
"String",
"NET_URL",
@ -155,6 +185,14 @@ android {
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
signingConfig = signingConfigs.findByName("release")
}
// RuStore (docs/decisions.md «RuStore»): the release, signed with the same key,
// without the app's own updates and the check the site counts installations by;
// the store updates it. Its manifest (src/rustore) drops the install permissions.
create("rustore") {
initWith(getByName("release"))
buildConfigField("boolean", "SELF_UPDATE", "false")
matchingFallbacks += listOf("release")
}
}
// The languages of the interface; the libraries' other translations stay out.
androidResources {
@ -174,6 +212,7 @@ android {
getByName("main") {
jniLibs.directories.add(rustLibs.get().asFile.path)
jniLibs.directories.add(stockfishOut.get().dir("jniLibs").asFile.path)
jniLibs.directories.add(rodent4Out.get().dir("jniLibs").asFile.path)
kotlin.directories.add(bindings.get().asFile.path)
assets.directories.add(bundled.get().asFile.path)
}
@ -182,7 +221,8 @@ android {
}
}
packaging {
// Unpacked at install: Stockfish runs from nativeLibraryDir as its own process.
// Unpacked at install: Stockfish and Rodent IV run from nativeLibraryDir as their
// own processes.
jniLibs {
useLegacyPackaging = true
}
@ -197,7 +237,12 @@ kotlin {
}
tasks.named("preBuild") {
dependsOn(uniffiBindings, bundleAssets, stockfish)
dependsOn(uniffiBindings, bundleAssets, stockfish, rodent4)
}
// RuStore gets the full build only (Stockfish inside: nothing to fetch from GitHub).
androidComponents {
beforeVariants(selector().withBuildType("rustore").withFlavor("engine" to "light")) { it.enable = false }
}
dependencies {

View file

@ -24,6 +24,7 @@
<!-- One task: a file opened from another app comes to the app already open. -->
<activity
android:name=".MainActivity"
android:configChanges="uiMode"
android:exported="true"
android:launchMode="singleTask">
<intent-filter>

View file

@ -7,8 +7,16 @@ import androidx.compose.runtime.setValue
import android.net.Uri
import android.provider.OpenableColumns
import io.github.vrubelroman.chesspenguin.data.AppUpdates
import io.github.vrubelroman.chesspenguin.data.CLIPBOARD_PREFERENCES
import io.github.vrubelroman.chesspenguin.data.ClipboardOffer
import io.github.vrubelroman.chesspenguin.data.ClipboardPgn
import io.github.vrubelroman.chesspenguin.data.DbEntry
import io.github.vrubelroman.chesspenguin.data.EngineFiles
import io.github.vrubelroman.chesspenguin.data.MaiaFiles
import io.github.vrubelroman.chesspenguin.data.MaiaGames
import io.github.vrubelroman.chesspenguin.data.PlayerGames
import io.github.vrubelroman.chesspenguin.data.RodentFiles
import io.github.vrubelroman.chesspenguin.data.Sounds
import io.github.vrubelroman.chesspenguin.data.Library
import io.github.vrubelroman.chesspenguin.data.OnlineDownloads
import io.github.vrubelroman.chesspenguin.data.Settings
@ -19,7 +27,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import java.util.concurrent.atomic.AtomicInteger
import java.io.FileNotFoundException
import java.util.UUID
@ -30,14 +37,47 @@ class ChessPenguinApp : Application() {
val library by lazy { Library(this) }
val settings by lazy { Settings(this) }
val engineFiles by lazy { EngineFiles(this, scope) }
/// Maia's weights, downloaded on request (android-play.md §31).
val maiaFiles by lazy { MaiaFiles(this, scope) }
/// Rodent IV's home and its book pack (android-rodent.md).
val rodentFiles by lazy { RodentFiles(this, scope) }
/// The game against the computer in hand (android-play.md §31.7).
val maiaGames by lazy { MaiaGames(this) }
/// The players' databases: games against Maia written by themselves (player-games.md).
val playerGames by lazy { PlayerGames(this, library) }
/// The sounds of moves and of the end of a game (android-play.md §33).
val sounds by lazy { Sounds(this, settings) }
/// Games from Lichess and Chess.com being downloaded (android-ui.md §23).
val downloads by lazy { OnlineDownloads(library, scope) }
/// The app's own updates (android-ui.md §25).
val updates by lazy { AppUpdates(this, scope, engineFiles) }
val clipboardPgn by lazy {
ClipboardPgn(
library,
scope,
getSharedPreferences(CLIPBOARD_PREFERENCES, MODE_PRIVATE),
latestIncoming.lock,
) {
if (latestIncoming.invalidateClipboard() && incoming.value == Incoming.Opening) {
incoming.value = null
}
}
}
override fun onCreate() {
super.onCreate()
// The opening trainer's runs (android-play.md §32.3).
uniffi.mobile_api.trainerSetFile(java.io.File(filesDir, "training.json").path)
// Loaded now: the first move's sound is ready when it is played.
sounds
}
/// The games shown on the list of each database (after a search), for paging
/// games from the game screen: database id → game numbers.
val shown = HashMap<String, List<UInt>>()
/// The game last opened from a database's list: the search it was found with and its
/// place there (android-lists.md §3.6; the list marks it and shows it again).
val lastOpened = HashMap<String, Pair<String, Int>>()
/// Changes each time the app goes to the background, and in every new process: the
/// engine button of a game holds only for the visit it was pressed in (§8.3).
@ -53,13 +93,14 @@ class ChessPenguinApp : Application() {
/// One copy at a time, in the order the files came; only the last one opened is shown.
private val copying = Mutex()
private val waiting = AtomicInteger()
private val latestIncoming = LatestIncoming()
/// Copies a file another app gave (it gives access only for a while) and puts it on
/// the list; `incoming` tells the screens how it went.
fun receive(uri: Uri) {
waiting.incrementAndGet()
incoming.value = Incoming.Opening
val request = latestIncoming.withLock {
latestIncoming.next(IncomingOrigin.Uri).also { incoming.value = Incoming.Opening }
}
scope.launch {
val result = copying.withLock {
try {
@ -75,9 +116,47 @@ class ChessPenguinApp : Application() {
Incoming.Failed(e)
}
}
val more = waiting.decrementAndGet() > 0
// A file opened while another one was still being copied comes after it.
if (!(more && result is Incoming.Opened)) incoming.value = result
latestIncoming.publish(request) { incoming.value = result }
}
}
fun openClipboard(offer: ClipboardOffer, name: String) {
val (accepted, request) = latestIncoming.withLock {
val accepted = clipboardPgn.accept(offer) ?: return
val request = latestIncoming.next(IncomingOrigin.Clipboard)
incoming.value = Incoming.Opening
accepted to request
}
scope.launch {
val result = copying.withLock {
try {
Incoming.Pasted(library.addCopy("clipboard.pgn", accepted.bytes.inputStream()) { name })
} catch (e: Exception) {
Incoming.Failed(e)
}
}
latestIncoming.withLock {
if (!latestIncoming.isLatest(request)) {
clipboardPgn.finish(accepted, false)
return@withLock
}
if (!clipboardPgn.canPublish(accepted)) {
if (incoming.value == Incoming.Opening) incoming.value = null
return@withLock
}
when (result) {
is Incoming.Pasted -> {
clipboardPgn.finish(accepted, true)
incoming.value = result
}
is Incoming.Failed -> {
clipboardPgn.finish(accepted, false)
incoming.value = result
}
else -> incoming.value = null
}
latestIncoming.clear(request)
}
}
}
@ -93,8 +172,47 @@ class ChessBasePart : Exception()
private val CHESSBASE_PARTS = setOf("cbh", "cbg", "cba", "cbp", "cbs", "cbj", "cbt", "cbc", "cbe", "cbm")
internal enum class IncomingOrigin {
Uri,
Clipboard,
}
internal class LatestIncoming {
internal val lock = Any()
private var generation = 0L
private var origin: IncomingOrigin? = null
fun next(origin: IncomingOrigin = IncomingOrigin.Uri): Long = synchronized(lock) {
this.origin = origin
++generation
}
fun isLatest(request: Long): Boolean = synchronized(lock) { request == generation }
fun invalidateClipboard(): Boolean = synchronized(lock) {
if (origin != IncomingOrigin.Clipboard) return false
origin = null
generation += 1
true
}
fun clear(request: Long) = synchronized(lock) {
if (isLatest(request)) origin = null
}
fun publish(request: Long, action: () -> Unit): Boolean = synchronized(lock) {
if (!isLatest(request)) return false
action()
clear(request)
true
}
inline fun <T> withLock(action: () -> T): T = synchronized(lock, action)
}
sealed interface Incoming {
data object Opening : Incoming
data class Opened(val entry: DbEntry) : Incoming
data class Pasted(val entry: DbEntry) : Incoming
data class Failed(val error: Throwable) : Incoming
}

View file

@ -1,6 +1,8 @@
package io.github.vrubelroman.chesspenguin
import android.content.ClipboardManager
import android.content.Context
import android.app.UiModeManager
import android.content.Intent
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
@ -19,6 +21,7 @@ import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import io.github.vrubelroman.chesspenguin.data.Language
@ -60,6 +63,18 @@ class MainActivity : ComponentActivity() {
Theme.Light -> false
Theme.Dark -> true
}
// Android keeps the app's own day or night (Android 12+): the window and the
// splash screen before Compose draws then match the theme chosen, not the
// system's (no white flash before a dark app).
LaunchedEffect(prefs.theme) {
getSystemService(UiModeManager::class.java)?.setApplicationNightMode(
when (prefs.theme) {
Theme.System -> UiModeManager.MODE_NIGHT_AUTO
Theme.Light -> UiModeManager.MODE_NIGHT_NO
Theme.Dark -> UiModeManager.MODE_NIGHT_YES
},
)
}
// The system bars follow the theme chosen in the app, not the system's: light
// icons over a dark app even when the phone itself is light, and back.
DisposableEffect(dark) {
@ -97,11 +112,15 @@ class MainActivity : ComponentActivity() {
val updates = (application as ChessPenguinApp).updates
updates.foreground = true
updates.checkIfDue()
// The downloaded databases get their new games (at most every ten minutes).
(application as ChessPenguinApp).downloads.updateAllQuietly()
}
override fun onResume() {
super.onResume()
(application as ChessPenguinApp).updates.onResume()
val app = application as ChessPenguinApp
app.updates.onResume()
app.clipboardPgn.check(clipboardText(this))
}
override fun onStop() {
@ -111,3 +130,10 @@ class MainActivity : ComponentActivity() {
if (!isChangingConfigurations) (application as ChessPenguinApp).leftApp()
}
}
fun clipboardText(context: Context): String? = context.getSystemService(ClipboardManager::class.java)
?.primaryClip
?.takeIf { it.itemCount > 0 }
?.getItemAt(0)
?.text
?.toString()

View file

@ -16,6 +16,8 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
@ -39,18 +41,33 @@ import io.github.vrubelroman.chesspenguin.ui.BoardStyleScreen
import io.github.vrubelroman.chesspenguin.ui.DatabasesScreen
import io.github.vrubelroman.chesspenguin.ui.SettingsScreen
import io.github.vrubelroman.chesspenguin.ui.GameScreen
import io.github.vrubelroman.chesspenguin.ui.NEW_GAME
import io.github.vrubelroman.chesspenguin.ui.PLAY_GAME
import io.github.vrubelroman.chesspenguin.ui.GamesScreen
import io.github.vrubelroman.chesspenguin.ui.OnlineScreen
import io.github.vrubelroman.chesspenguin.ui.PlayersScreen
import io.github.vrubelroman.chesspenguin.ui.PrepScreen
import io.github.vrubelroman.chesspenguin.ui.PrepStart
import kotlinx.serialization.Serializable
@Serializable data object Databases : NavKey
@Serializable data class Games(val db: String) : NavKey
@Serializable data class Players(val db: String) : NavKey
@Serializable data class Preparation(val request: PrepStart) : NavKey
/// The game at `place` on the list of games found by `query` in the database (kept, so
/// the same game comes back after Android restarts the app).
@Serializable data class GameAt(val db: String, val place: Int, val query: String = "") : NavKey
/// A new game from the start position (android-play.md §30.4).
@Serializable data object NewGameKey : NavKey
/// The game against Maia in hand (android-play.md §31).
@Serializable data object PlayKey : NavKey
@Serializable data object SettingsKey : NavKey
@Serializable data object AboutKey : NavKey
@ -69,17 +86,67 @@ fun MainNavigation() {
backStack.add(Games(entry.id))
if (entry.games == 1) backStack.add(GameAt(entry.id, 0))
}
fun showPasted(entry: DbEntry) {
while (backStack.size > 1) backStack.removeAt(backStack.lastIndex)
backStack.add(Games(entry.id))
backStack.add(GameAt(entry.id, 0))
}
val app = app()
val incoming by app.incoming.collectAsState()
LaunchedEffect(incoming) {
(incoming as? Incoming.Opened)?.let {
app.incoming.value = null
show(it.entry)
when (val i = incoming) {
is Incoming.Opened -> {
if (app.incoming.compareAndSet(i, null)) show(i.entry)
}
is Incoming.Pasted -> {
if (app.incoming.compareAndSet(i, null)) {
resetPastedView(app.shown, app.lastOpened, i.entry.id)
showPasted(i.entry)
}
}
else -> {}
}
}
// The app's update, over any screen (android-ui.md §25.3).
val updateSheet by app.updates.sheet.collectAsState()
if (updateSheet) UpdateSheet()
val clipboardUnblocked = incoming == null && !updateSheet
val context = LocalContext.current
LaunchedEffect(clipboardUnblocked) {
if (clipboardUnblocked) app.clipboardPgn.check(clipboardText(context))
}
val clipboardOffer by app.clipboardPgn.offer.collectAsState()
if (clipboardUnblocked) {
clipboardOffer?.let { offer ->
val clipboardName = stringResource(R.string.clipboard_database_name)
AlertDialog(
onDismissRequest = { app.clipboardPgn.dismiss(offer) },
title = { Text(pluralStringResource(R.plurals.clipboard_open_title, offer.games, offer.games)) },
text = {
Text(
if (offer.games == 1) {
stringResource(R.string.clipboard_open_one)
} else {
stringResource(
R.string.clipboard_open_many,
pluralStringResource(R.plurals.games_count, offer.games, offer.games),
)
},
)
},
confirmButton = {
TextButton(onClick = { app.openClipboard(offer, clipboardName) }) {
Text(stringResource(R.string.clipboard_open))
}
},
dismissButton = {
TextButton(onClick = { app.clipboardPgn.dismiss(offer) }) {
Text(stringResource(R.string.cancel))
}
},
)
}
}
when (val i = incoming) {
Incoming.Opening -> Dialog(onDismissRequest = {}, properties = DialogProperties(dismissOnBackPress = false, dismissOnClickOutside = false)) {
Surface(shape = MaterialTheme.shapes.extraLarge, color = MaterialTheme.colorScheme.surfaceContainerHigh) {
@ -91,10 +158,10 @@ fun MainNavigation() {
}
}
is Incoming.Failed -> AlertDialog(
onDismissRequest = { app.incoming.value = null },
onDismissRequest = { app.incoming.compareAndSet(i, null) },
title = { Text(stringResource(R.string.file_failed)) },
text = { Text(incomingProblem(i.error)) },
confirmButton = { TextButton(onClick = { app.incoming.value = null }) { Text(stringResource(R.string.ok)) } },
confirmButton = { TextButton(onClick = { app.incoming.compareAndSet(i, null) }) { Text(stringResource(R.string.ok)) } },
)
else -> {}
}
@ -114,13 +181,49 @@ fun MainNavigation() {
onAdded = ::show,
onSettings = { backStack.add(SettingsKey) },
onOnline = { backStack.add(OnlineKey) },
onNewGame = { backStack.add(NewGameKey) },
onPlay = { backStack.add(PlayKey) },
)
}
entry<NewGameKey> {
GameScreen(NEW_GAME, 0, "", onBack = { backStack.removeLastOrNull() }, onSettings = { backStack.add(SettingsKey) }, onPlayGame = { backStack.add(PlayKey) })
}
entry<PlayKey> {
GameScreen(PLAY_GAME, 0, "", onBack = { backStack.removeLastOrNull() }, onSettings = { backStack.add(SettingsKey) }, onPlayGame = {
backStack.removeLastOrNull()
backStack.add(PlayKey)
}, onOpenDatabase = { id -> backStack.add(Games(id)) })
}
entry<Games> { key ->
GamesScreen(key.db, onBack = { backStack.removeLastOrNull() }, onGame = { place, query -> backStack.add(GameAt(key.db, place, query)) })
GamesScreen(
key.db,
onBack = { backStack.removeLastOrNull() },
onGame = { place, query -> backStack.add(GameAt(key.db, place, query)) },
onPlayers = { backStack.add(Players(key.db)) },
)
}
entry<Players> { key ->
PlayersScreen(
key.db,
onBack = { backStack.removeLastOrNull() },
onPrepare = { player, white ->
backStack.add(Preparation(PrepStart(db = key.db, player = player.name, white = white)))
},
)
}
entry<Preparation> { key ->
PrepScreen(key.request, onBack = { backStack.removeLastOrNull() })
}
entry<GameAt> { key ->
GameScreen(key.db, key.place, key.query, onBack = { backStack.removeLastOrNull() }, onSettings = { backStack.add(SettingsKey) })
GameScreen(
key.db,
key.place,
key.query,
onBack = { backStack.removeLastOrNull() },
onSettings = { backStack.add(SettingsKey) },
onPlayGame = { backStack.add(PlayKey) },
onPrepare = { backStack.add(Preparation(it)) },
)
}
entry<SettingsKey> {
SettingsScreen(
@ -149,6 +252,15 @@ fun MainNavigation() {
)
}
internal fun resetPastedView(
shown: HashMap<String, List<UInt>>,
lastOpened: HashMap<String, Pair<String, Int>>,
id: String,
) {
shown.remove(id)
lastOpened.remove(id)
}
/// Why a file from another app did not open; it never got on the list, so the advice is
/// not that of a database on it (openProblem).
@Composable

View file

@ -186,8 +186,9 @@ class AppUpdates(private val context: Context, private val scope: CoroutineScope
}
val update = known()
when {
// Installed by hand from the site, or never newer than this app.
update == null || !newer(update.version) -> forgetAll()
// Installed by hand from the site, or never newer than this app; or a store's
// build put over the site's (the store updates it, a release kept is dropped).
!BuildConfig.SELF_UPDATE || update == null || !newer(update.version) -> forgetAll()
prefs.getLong(DOWNLOAD, -1L) != -1L -> watch(update, prefs.getLong(DOWNLOAD, -1L))
update.sha256.isEmpty() -> _state.value = UpdateState.Failed(update, UpdateProblem.BadRelease, null)
prefs.getString(READY, null) == update.version && apk(update).exists() -> _state.value = UpdateState.Ready(update, aborted = false)
@ -198,21 +199,29 @@ class AppUpdates(private val context: Context, private val scope: CoroutineScope
}
}
/// On start and on return to the app: a check when one is due (§25.6).
/// Whether this run of the app asked already: the first start always asks.
private var askedThisRun = false
/// On start and on return to the app: a check when one is due (§25.6): at each start
/// of the app, as the desktop does (a release out since the last check is offered at
/// once), and on return 6 h after the last answer (1 h after a failed try).
fun checkIfDue() {
if (!_auto.value || busy()) return
if (!BuildConfig.SELF_UPDATE || !_auto.value || busy()) return
val now = System.currentTimeMillis()
if (now - _lastCheck.value < DAY || now - prefs.getLong(LAST_ATTEMPT, 0L) < HOUR) return
if (askedThisRun && (now - _lastCheck.value < RECHECK || now - prefs.getLong(LAST_ATTEMPT, 0L) < HOUR)) return
askedThisRun = true
scope.launch { runCheck(manual = false) }
}
/// «Check now» (works with the automatic check off).
fun checkNow() {
if (_check.value == CheckState.Checking) return
if (!BuildConfig.SELF_UPDATE || _check.value == CheckState.Checking) return
scope.launch { runCheck(manual = true) }
}
private suspend fun runCheck(manual: Boolean) {
// A store's build never asks the site (nor counts itself there).
if (!BuildConfig.SELF_UPDATE) return
if (busy()) {
if (manual) _check.value = CheckState.Idle
return
@ -613,7 +622,7 @@ class AppUpdates(private val context: Context, private val scope: CoroutineScope
const val UPDATED_FROM = "updatedFrom"
/// No longer used (until 1.0.1).
const val UPDATED_PAGE = "updatedPage"
const val DAY = 24 * 60 * 60 * 1000L
const val RECHECK = 6 * 60 * 60 * 1000L
const val HOUR = 60 * 60 * 1000L
}
}

View file

@ -0,0 +1,286 @@
package io.github.vrubelroman.chesspenguin.data
import android.app.DownloadManager
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.net.Uri
import android.os.storage.StorageManager
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
import java.io.IOException
import java.io.InputStream
import java.security.MessageDigest
/// Why a downloaded file is not there.
enum class NetProblem { NoInternet, Interrupted, NoSpace, Corrupt }
sealed interface NetState {
data object Missing : NetState
data class Loading(val done: Long, val total: Long) : NetState
data class Failed(val problem: NetProblem) : NetState
data object Ready : NetState
}
/// A file of known size and SHA-256 fetched on request into the app's storage: the
/// engine's network, Maia's weights, a book of Rodent IV.
data class FileSpec(
/// Folder in the app's files, and the file's name.
val dir: String,
val name: String,
val url: String,
val size: Long,
val sha256: String,
/// The download's title in the system's notification.
val title: String,
/// The preferences that keep the system's download id (one file each).
val prefs: String,
/// The folder is the file's own: other files there (of other versions) are removed.
/// Not for a folder of several files (Rodent's books: their pack sees to them).
val ownFolder: Boolean = true,
)
/// The download is the system's (DownloadManager): it goes on with the app closed,
/// waits for the network and resumes, and shows its progress in a notification. Its id
/// is kept, so the app picks the download up again when it starts. The file is checked
/// by its SHA-256 as it is moved into place.
class CheckedDownload(private val context: Context, private val scope: CoroutineScope, private val spec: FileSpec) {
private val dir = File(context.filesDir, spec.dir)
val file = File(dir, spec.name)
val size: Long get() = spec.size
private val part = File(dir, spec.name + ".part")
private val prefs = context.getSharedPreferences(spec.prefs, Context.MODE_PRIVATE)
private val downloads get() = context.getSystemService(DownloadManager::class.java)
private val _state = MutableStateFlow<NetState>(NetState.Missing)
val state: StateFlow<NetState> = _state.asStateFlow()
private var job: Job? = null
init {
// Files of other versions (kept before an update) are of no use to this one.
if (spec.ownFolder) dir.listFiles()?.filter { it.name != file.name && it.name != part.name }?.forEach { it.delete() }
when {
installed() -> _state.value = NetState.Ready
downloadId() != NO_DOWNLOAD -> {
_state.value = NetState.Loading(0, spec.size)
watch(downloadId())
}
}
}
/// A file checked when it was written: the right size is enough later.
fun installed() = file.length() == spec.size
/// True when the phone is on a metered (mobile) connection right now.
fun metered(): Boolean {
val cm = context.getSystemService(ConnectivityManager::class.java) ?: return false
val caps = cm.getNetworkCapabilities(cm.activeNetwork) ?: return false
return !caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED)
}
/// Fetches the file from the internet.
fun download() {
if (_state.value == NetState.Ready || _state.value is NetState.Loading) return
if (!online()) {
_state.value = NetState.Failed(NetProblem.NoInternet)
return
}
// The file is downloaded next to the app's files, then checked and moved in.
if (freeSpace() < 2 * spec.size) {
_state.value = NetState.Failed(NetProblem.NoSpace)
return
}
target()?.delete()
val request = DownloadManager.Request(Uri.parse(spec.url))
.setTitle(spec.title)
.setDestinationInExternalFilesDir(context, null, spec.name)
.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
.setAllowedOverMetered(true)
val id = try {
downloads.enqueue(request)
} catch (e: IllegalArgumentException) {
// No shared storage for the download (or the download service is off).
_state.value = NetState.Failed(NetProblem.Interrupted)
return
}
prefs.edit().putLong(KEY, id).apply()
_state.value = NetState.Loading(0, spec.size)
watch(id)
}
/// Writes the file from `open()` (inside the APK) into place, checked, in the
/// background, the progress shown as a download's.
fun installFrom(open: () -> InputStream) {
if (_state.value == NetState.Ready || _state.value is NetState.Loading) return
_state.value = NetState.Loading(0, spec.size)
job = scope.launch(Dispatchers.IO) {
val result = try {
open().use { install(it, progress = true) }
NetState.Ready
} catch (e: Failure) {
NetState.Failed(e.problem)
} catch (e: IOException) {
NetState.Failed(if (freeSpace() < spec.size) NetProblem.NoSpace else NetProblem.Interrupted)
}
if (isActive) _state.value = result
}
}
/// The same, at once (the caller waits): false when it could not (no space).
suspend fun installNow(open: () -> InputStream): Boolean = withContext(Dispatchers.IO) {
if (installed()) return@withContext true
if (freeSpace() < 2 * spec.size) return@withContext false
try {
open().use { install(it, progress = false) }
_state.value = NetState.Ready
true
} catch (e: Exception) {
part.delete()
if (!installed()) _state.value = NetState.Missing
false
}
}
/// Stops a download and throws away what came.
fun cancel() {
job?.cancel()
val id = downloadId()
if (id != NO_DOWNLOAD) downloads.remove(id)
forget()
part.delete()
if (!installed()) _state.value = NetState.Missing
}
/// Removes the file.
fun delete() {
cancel()
file.delete()
_state.value = NetState.Missing
}
private class Failure(val problem: NetProblem) : Exception()
private fun downloadId(): Long = prefs.getLong(KEY, NO_DOWNLOAD)
private fun forget() = prefs.edit().remove(KEY).apply()
/// Where the system puts the downloaded file (the app's own external folder).
private fun target(): File? = context.getExternalFilesDir(null)?.let { File(it, spec.name) }
/// Follows a download of the system until it ends. The state is set on the main
/// thread, as "Cancel" sets it: after a cancel the watcher sets nothing more.
private fun watch(id: Long) {
job = scope.launch(Dispatchers.Main.immediate) {
while (isActive) {
val row = withContext(Dispatchers.IO) { progress(id) }
if (row == null) {
// Removed in the system's list of downloads.
forget()
_state.value = NetState.Missing
return@launch
}
when (row.status) {
DownloadManager.STATUS_SUCCESSFUL -> {
val result = withContext(Dispatchers.IO) {
try {
val f = target() ?: throw IOException("no external folder")
f.inputStream().use { install(it, progress = false) }
NetState.Ready
} catch (e: Failure) {
NetState.Failed(e.problem)
} catch (e: IOException) {
NetState.Failed(if (freeSpace() < spec.size) NetProblem.NoSpace else NetProblem.Interrupted)
}
}
downloads.remove(id)
forget()
_state.value = result
return@launch
}
DownloadManager.STATUS_FAILED -> {
downloads.remove(id)
forget()
_state.value = NetState.Failed(
if (row.reason == DownloadManager.ERROR_INSUFFICIENT_SPACE) NetProblem.NoSpace else NetProblem.Interrupted,
)
return@launch
}
else -> _state.value = NetState.Loading(row.done.coerceAtLeast(0), spec.size)
}
delay(500)
}
}
}
private class Row(val status: Int, val reason: Int, val done: Long)
private fun progress(id: Long): Row? =
downloads.query(DownloadManager.Query().setFilterById(id))?.use { c ->
if (!c.moveToFirst()) return null
Row(
c.getInt(c.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS)),
c.getInt(c.getColumnIndexOrThrow(DownloadManager.COLUMN_REASON)),
c.getLong(c.getColumnIndexOrThrow(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR)),
)
}
/// Writes the file into place, checking its SHA-256 on the way; a wrong file is
/// thrown away.
private suspend fun install(input: InputStream, progress: Boolean) {
dir.mkdirs()
val digest = MessageDigest.getInstance("SHA-256")
var done = 0L
part.outputStream().use { out ->
val buf = ByteArray(256 * 1024)
var last = 0L
while (true) {
kotlin.coroutines.coroutineContext.ensureActive()
val n = input.read(buf)
if (n < 0) break
out.write(buf, 0, n)
digest.update(buf, 0, n)
done += n
if (progress && done - last > 512 * 1024) {
last = done
_state.value = NetState.Loading(done, spec.size)
}
}
}
val sum = digest.digest().joinToString("") { "%02x".format(it) }
if (sum != spec.sha256 || done != spec.size) {
part.delete()
throw Failure(NetProblem.Corrupt)
}
if (!part.renameTo(file)) throw IOException("cannot move the file into place")
}
/// The space the app can take, with the caches the system would clear for it. Asked
/// of filesDir, which always exists: a folder not made yet answers 0.
private fun freeSpace(): Long = try {
val storage = context.getSystemService(StorageManager::class.java)
storage.getAllocatableBytes(storage.getUuidForPath(context.filesDir))
} catch (e: IOException) {
context.filesDir.usableSpace
}
private fun online(): Boolean {
val cm = context.getSystemService(ConnectivityManager::class.java) ?: return true
val caps = cm.getNetworkCapabilities(cm.activeNetwork) ?: return false
return caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
}
private companion object {
const val KEY = "download"
const val NO_DOWNLOAD = -1L
}
}

View file

@ -0,0 +1,173 @@
package io.github.vrubelroman.chesspenguin.data
import android.content.SharedPreferences
import java.security.MessageDigest
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
internal const val CLIPBOARD_PGN_MAX_BYTES = 8 * 1024 * 1024
internal const val CLIPBOARD_PREFERENCES = "clipboard-pgn"
private const val PREFS_DIGESTS = "decided-sha256"
data class ClipboardOffer(
val bytes: ByteArray,
val games: Int,
internal val digest: String,
internal val generation: Long,
)
data class ClipboardAccept(
val bytes: ByteArray,
internal val digest: String,
internal val generation: Long,
)
class ClipboardPgn(
private val library: Library,
private val scope: CoroutineScope,
preferences: SharedPreferences,
private val requestLock: Any,
private val invalidateIncoming: () -> Unit,
) {
private val gate = ClipboardPromptGate(
decided = preferences.getStringSet(PREFS_DIGESTS, null).orEmpty(),
onDecide = { digests -> preferences.edit().putStringSet(PREFS_DIGESTS, digests).apply() },
)
private val _offer = MutableStateFlow<ClipboardOffer?>(null)
val offer: StateFlow<ClipboardOffer?> = _offer.asStateFlow()
private var hasSnapshot = false
private var lastSnapshot: String? = null
fun check(text: String?) {
val generation = synchronized(requestLock) {
val changed = if (hasSnapshot && text == lastSnapshot) {
false
} else {
hasSnapshot = true
lastSnapshot = text
true
}
if (!changed) return
invalidateIncoming()
gate.invalidate().also { _offer.value = null }
}
if (text.isNullOrBlank() || !clipboardPgnLengthMayFit(text)) return
scope.launch {
val bytes = clipboardUtf8(text)
if (!clipboardPgnWithinLimit(bytes.size)) return@launch
val digest = clipboardSha256(bytes)
val games = try {
library.countPgnGames(bytes)
} catch (e: CancellationException) {
throw e
} catch (_: Exception) {
null
}
if (games == null) return@launch
val offer = ClipboardOffer(bytes, games, digest, generation)
synchronized(requestLock) {
if (gate.publish(offer)) {
_offer.value = offer
}
}
}
}
fun accept(offer: ClipboardOffer): ClipboardAccept? = synchronized(requestLock) {
gate.accept(offer)?.also { _offer.value = null }
}
fun dismiss(offer: ClipboardOffer) {
synchronized(requestLock) {
if (gate.dismiss(offer)) {
_offer.value = null
}
}
}
fun canPublish(accept: ClipboardAccept): Boolean = synchronized(requestLock) { gate.canPublish(accept) }
fun finish(accept: ClipboardAccept, success: Boolean): Boolean = synchronized(requestLock) {
val finished = gate.finish(accept, success)
if (finished && !success) {
hasSnapshot = false
lastSnapshot = null
}
finished
}
}
internal class ClipboardPromptGate(
decided: Set<String> = emptySet(),
private val onDecide: (Set<String>) -> Unit = {},
) {
private val decided = HashSet(decided)
private var generation = 0L
private var offer: ClipboardOffer? = null
private var accepted: ClipboardAccept? = null
@Synchronized
fun invalidate(): Long {
generation += 1
offer = null
accepted = null
return generation
}
@Synchronized
fun publish(offer: ClipboardOffer): Boolean {
if (offer.generation != generation || offer.digest in decided || accepted != null) return false
this.offer = offer
return true
}
@Synchronized
fun accept(offer: ClipboardOffer): ClipboardAccept? {
if (this.offer != offer || accepted != null) return null
val accept = ClipboardAccept(offer.bytes, offer.digest, offer.generation)
accepted = accept
this.offer = null
return accept
}
@Synchronized
fun dismiss(offer: ClipboardOffer): Boolean {
if (this.offer != offer) return false
this.offer = null
decide(offer.digest)
return true
}
@Synchronized
fun canPublish(accept: ClipboardAccept): Boolean =
accepted == accept && accept.generation == generation
@Synchronized
fun finish(accept: ClipboardAccept, success: Boolean): Boolean {
if (accepted != accept || accept.generation != generation) return false
accepted = null
if (success) {
decide(accept.digest)
} else {
invalidate()
}
return true
}
private fun decide(digest: String) {
if (decided.add(digest)) onDecide(decided.toSet())
}
}
internal fun clipboardPgnLengthMayFit(text: String): Boolean = text.length <= CLIPBOARD_PGN_MAX_BYTES
internal fun clipboardUtf8(text: String): ByteArray = text.toByteArray(Charsets.UTF_8)
internal fun clipboardSha256(bytes: ByteArray): String =
MessageDigest.getInstance("SHA-256").digest(bytes).joinToString("") { "%02x".format(it) }
internal fun clipboardPgnWithinLimit(size: Int): Boolean = size <= CLIPBOARD_PGN_MAX_BYTES

View file

@ -1,280 +1,55 @@
package io.github.vrubelroman.chesspenguin.data
import android.app.DownloadManager
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.net.Uri
import android.os.storage.StorageManager
import io.github.vrubelroman.chesspenguin.BuildConfig
import io.github.vrubelroman.chesspenguin.R
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
import java.io.IOException
import java.io.InputStream
import java.security.MessageDigest
/// Why the network of the engine is not there.
enum class NetProblem { NoInternet, Interrupted, NoSpace, Corrupt }
sealed interface NetState {
data object Missing : NetState
data class Loading(val done: Long, val total: Long) : NetState
data class Failed(val problem: NetProblem) : NetState
data object Ready : NetState
}
/// Stockfish and its network (android-ui.md §8). The executable is a "library" of the
/// APK; the network is a file in the app's storage: copied from the APK in the "full"
/// build, downloaded on request in the "light" one, checked by its SHA-256 either way.
///
/// The download is the system's (DownloadManager): it goes on with the app closed,
/// waits for the network and resumes, and shows its progress in a notification. Its
/// id is kept, so the app picks the download up again when it starts.
class EngineFiles(private val context: Context, private val scope: CoroutineScope) {
private val dir = File(context.filesDir, "engine")
val net = File(dir, BuildConfig.NET_NAME)
private val part = File(dir, BuildConfig.NET_NAME + ".part")
private val prefs = context.getSharedPreferences("engine", Context.MODE_PRIVATE)
private val downloads get() = context.getSystemService(DownloadManager::class.java)
/// build, downloaded on request in the "light" one, checked by its SHA-256 either way
/// ([CheckedDownload]).
class EngineFiles(private val context: Context, scope: CoroutineScope) {
private val download = CheckedDownload(
context,
scope,
FileSpec(
dir = "engine",
name = BuildConfig.NET_NAME,
url = BuildConfig.NET_URL,
size = BuildConfig.NET_SIZE,
sha256 = BuildConfig.NET_SHA256,
title = context.getString(R.string.download_title),
prefs = "engine",
),
)
val net: File get() = download.file
/// The executable, unpacked by the installer (useLegacyPackaging).
val executable: String get() = context.applicationInfo.nativeLibraryDir + "/libstockfish.so"
private val _state = MutableStateFlow<NetState>(NetState.Missing)
val state: StateFlow<NetState> = _state.asStateFlow()
private var job: Job? = null
init {
// A network of another version of Stockfish (kept before an update, §25.6) is of
// no use to this one.
dir.listFiles()?.filter { it.name != net.name && it.name != part.name }?.forEach { it.delete() }
when {
installed() -> _state.value = NetState.Ready
download() != NO_DOWNLOAD -> {
_state.value = NetState.Loading(0, BuildConfig.NET_SIZE)
watch(download())
}
}
}
/// A network checked when it was written: the right size is enough later.
private fun installed() = net.length() == BuildConfig.NET_SIZE
val state: StateFlow<NetState> get() = download.state
val builtIn: Boolean get() = BuildConfig.NET_BUILT_IN
/// True when the phone is on a metered (mobile) connection right now.
fun metered(): Boolean {
val cm = context.getSystemService(ConnectivityManager::class.java) ?: return false
val caps = cm.getNetworkCapabilities(cm.activeNetwork) ?: return false
return !caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED)
}
fun metered(): Boolean = download.metered()
/// Gets the network ready: from the APK, or from the internet.
fun prepare() {
if (_state.value == NetState.Ready || _state.value is NetState.Loading) return
if (builtIn) {
_state.value = NetState.Loading(0, BuildConfig.NET_SIZE)
job = scope.launch(Dispatchers.IO) {
val result = try {
dir.mkdirs()
context.assets.open(BuildConfig.NET_NAME).use { install(it) }
NetState.Ready
} catch (e: NetFailure) {
NetState.Failed(e.problem)
} catch (e: IOException) {
NetState.Failed(if (freeSpace() < BuildConfig.NET_SIZE) NetProblem.NoSpace else NetProblem.Interrupted)
}
if (isActive) _state.value = result
}
return
}
if (!online()) {
_state.value = NetState.Failed(NetProblem.NoInternet)
return
}
// The file is downloaded next to the app's files, then checked and moved in.
if (freeSpace() < 2 * BuildConfig.NET_SIZE) {
_state.value = NetState.Failed(NetProblem.NoSpace)
return
}
target()?.delete()
val request = DownloadManager.Request(Uri.parse(BuildConfig.NET_URL))
.setTitle(context.getString(R.string.download_title))
.setDestinationInExternalFilesDir(context, null, BuildConfig.NET_NAME)
.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
.setAllowedOverMetered(true)
val id = try {
downloads.enqueue(request)
} catch (e: IllegalArgumentException) {
// No shared storage for the download (or the download service is off).
_state.value = NetState.Failed(NetProblem.Interrupted)
return
}
prefs.edit().putLong(KEY, id).apply()
_state.value = NetState.Loading(0, BuildConfig.NET_SIZE)
watch(id)
if (builtIn) download.installFrom { context.assets.open(BuildConfig.NET_NAME) } else download.download()
}
/// Keeps the network of the full build in the app's storage, so that it stays after
/// the app is updated to the light build (android-ui.md §25.6). False when it could
/// not (no space): the light build then offers the download, as always.
suspend fun keepBuiltIn(): Boolean = withContext(Dispatchers.IO) {
if (!builtIn || installed()) return@withContext true
if (freeSpace() < 2 * BuildConfig.NET_SIZE) return@withContext false
try {
dir.mkdirs()
context.assets.open(BuildConfig.NET_NAME).use { install(it) }
_state.value = NetState.Ready
true
} catch (e: Exception) {
part.delete()
if (!installed()) _state.value = NetState.Missing
false
}
}
suspend fun keepBuiltIn(): Boolean = !builtIn || download.installNow { context.assets.open(BuildConfig.NET_NAME) }
/// Stops a download and throws away what came.
fun cancel() {
job?.cancel()
val id = download()
if (id != NO_DOWNLOAD) downloads.remove(id)
forget()
part.delete()
if (!installed()) _state.value = NetState.Missing
}
fun cancel() = download.cancel()
/// Removes a downloaded network (Settings → "Delete the engine").
fun delete() {
cancel()
net.delete()
_state.value = NetState.Missing
}
private class NetFailure(val problem: NetProblem) : Exception()
private fun download(): Long = prefs.getLong(KEY, NO_DOWNLOAD)
private fun forget() = prefs.edit().remove(KEY).apply()
/// Where the system puts the downloaded file (the app's own external folder).
private fun target(): File? = context.getExternalFilesDir(null)?.let { File(it, BuildConfig.NET_NAME) }
/// Follows a download of the system until it ends. The state is set on the main
/// thread, as "Cancel" sets it: after a cancel the watcher sets nothing more.
private fun watch(id: Long) {
job = scope.launch(Dispatchers.Main.immediate) {
while (isActive) {
val row = withContext(Dispatchers.IO) { progress(id) }
if (row == null) {
// Removed in the system's list of downloads.
forget()
_state.value = NetState.Missing
return@launch
}
when (row.status) {
DownloadManager.STATUS_SUCCESSFUL -> {
val result = withContext(Dispatchers.IO) {
try {
dir.mkdirs()
val file = target() ?: throw IOException("no external folder")
file.inputStream().use { install(it) }
NetState.Ready
} catch (e: NetFailure) {
NetState.Failed(e.problem)
} catch (e: IOException) {
NetState.Failed(if (freeSpace() < BuildConfig.NET_SIZE) NetProblem.NoSpace else NetProblem.Interrupted)
}
}
downloads.remove(id)
forget()
_state.value = result
return@launch
}
DownloadManager.STATUS_FAILED -> {
downloads.remove(id)
forget()
_state.value = NetState.Failed(
if (row.reason == DownloadManager.ERROR_INSUFFICIENT_SPACE) NetProblem.NoSpace else NetProblem.Interrupted,
)
return@launch
}
else -> _state.value = NetState.Loading(row.done.coerceAtLeast(0), BuildConfig.NET_SIZE)
}
delay(500)
}
}
}
private class Row(val status: Int, val reason: Int, val done: Long)
private fun progress(id: Long): Row? =
downloads.query(DownloadManager.Query().setFilterById(id))?.use { c ->
if (!c.moveToFirst()) return null
Row(
c.getInt(c.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS)),
c.getInt(c.getColumnIndexOrThrow(DownloadManager.COLUMN_REASON)),
c.getLong(c.getColumnIndexOrThrow(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR)),
)
}
/// Writes the network into place, checking its SHA-256 on the way; a wrong file is
/// thrown away.
private suspend fun install(input: InputStream) {
val digest = MessageDigest.getInstance("SHA-256")
var done = 0L
part.outputStream().use { out ->
val buf = ByteArray(256 * 1024)
var last = 0L
while (true) {
kotlin.coroutines.coroutineContext.ensureActive()
val n = input.read(buf)
if (n < 0) break
out.write(buf, 0, n)
digest.update(buf, 0, n)
done += n
if (builtIn && done - last > 512 * 1024) {
last = done
_state.value = NetState.Loading(done, BuildConfig.NET_SIZE)
}
}
}
val sum = digest.digest().joinToString("") { "%02x".format(it) }
if (sum != BuildConfig.NET_SHA256 || done != BuildConfig.NET_SIZE) {
part.delete()
throw NetFailure(NetProblem.Corrupt)
}
if (!part.renameTo(net)) throw IOException("cannot move the network into place")
}
/// The space the app can take, with the caches the system would clear for it. Asked
/// of filesDir, which always exists: a folder not made yet (the engine's, before the
/// first download) answers 0.
private fun freeSpace(): Long = try {
val storage = context.getSystemService(StorageManager::class.java)
storage.getAllocatableBytes(storage.getUuidForPath(context.filesDir))
} catch (e: IOException) {
context.filesDir.usableSpace
}
private fun online(): Boolean {
val cm = context.getSystemService(ConnectivityManager::class.java) ?: return true
val caps = cm.getNetworkCapabilities(cm.activeNetwork) ?: return false
return caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
}
private companion object {
const val KEY = "download"
const val NO_DOWNLOAD = -1L
}
fun delete() = download.delete()
}

View file

@ -20,6 +20,10 @@ import uniffi.mobile_api.FolderFile
import uniffi.mobile_api.openBytes
import uniffi.mobile_api.openChessbase
import uniffi.mobile_api.openFile
import uniffi.mobile_api.openPath
import uniffi.mobile_api.ownCreate
import uniffi.mobile_api.ownRemove
import uniffi.mobile_api.ownSave
import java.io.File
import java.util.UUID
@ -43,9 +47,13 @@ enum class Source {
/// A player's games downloaded from Lichess and Chess.com (`files/online/`, with the
/// state of the download beside it, android-ui.md §23).
Online,
/// The user's own database (`files/own/`, android-play.md §30): the only file the app
/// writes, and only on "Save".
Own,
}
/// A database on the list. The file itself is never changed.
/// A database on the list. Its file is never changed, except an own database's.
@Serializable
data class DbEntry(
val id: String,
@ -65,7 +73,8 @@ data class DbEntry(
val format: String? = null,
/// A sample shows the name of the current language until it is renamed (displayName).
val renamed: Boolean = false,
/// A copy's SHA-256: the same file opened again is not copied twice.
/// A copy's SHA-256: the same file opened again is not copied twice. A sample's: of
/// the text its number of games was taken from (a new app may bring a new text).
val sha256: String? = null,
/// A downloaded database: when its last download finished (Unix seconds).
val updated: Long? = null,
@ -119,6 +128,8 @@ class Library(private val context: Context) {
private val copies = File(context.filesDir, "copies")
/// Downloaded databases (android-ui.md §23).
val onlineDir = File(context.filesDir, "online")
/// The user's own databases (android-play.md §30).
val ownDir = File(context.filesDir, "own")
private val json = Json { ignoreUnknownKeys = true }
private val _entries = MutableStateFlow(load())
val entries: StateFlow<List<DbEntry>> = _entries.asStateFlow()
@ -157,6 +168,9 @@ class Library(private val context: Context) {
listOf("$stem.pgn", "$stem.online.json", "$stem.online.lock")
}.toSet()
onlineDir.listFiles()?.filter { it.name !in online }?.forEach { it.delete() }
// An own database deleted while its "Undo" was offered, the app closed meanwhile.
val own = _entries.value.filter { it.source == Source.Own }.map { it.location }.toSet()
ownDir.listFiles()?.filter { it.name !in own }?.forEach { it.delete() }
val used = _entries.value.mapNotNull { it.tree ?: it.location.takeIf { _ -> it.source == Source.File || it.source == Source.ChessBase } }.toSet()
for (p in context.contentResolver.persistedUriPermissions) {
if (p.uri.toString() !in used) {
@ -191,6 +205,18 @@ class Library(private val context: Context) {
return names.map { (f, name) -> DbEntry(id = "sample-$f", name = name, source = Source.Sample, location = "examples/$f", fileName = f) }
}
/// Counts the samples on the list not counted yet, or counted in a text other than
/// the one in this app: an update of the app brings a sample's new version (more
/// games), read from the app itself as ever, and its row shows it at once.
suspend fun countSamples() {
for (e in _entries.value.filter { it.source == Source.Sample }) {
if (e.games != null && e.sha256 == withContext(Dispatchers.IO) { sha256(sampleBytes(e)) }) continue
database(e.id)
}
}
private fun sampleBytes(e: DbEntry): ByteArray = context.assets.open(e.location).use { it.readBytes() }
/// Puts the sample games back on the list (those not on it), at its end.
fun addSamples() = update { list -> list + samples().filter { s -> list.none { it.id == s.id } } }
@ -225,6 +251,27 @@ class Library(private val context: Context) {
return entry
}
/// Counts real games in PGN text without keeping a copy of it.
suspend fun countPgnGames(text: String): Int? = countPgnGames(clipboardUtf8(text))
suspend fun countPgnGames(bytes: ByteArray): Int? = withContext(Dispatchers.IO) {
if (!clipboardPgnWithinLimit(bytes.size)) return@withContext null
val db = runCatching { openBytes("clipboard.pgn", bytes) }.getOrNull() ?: return@withContext null
try {
val count = db.len().toInt()
if (count == 0) {
null
} else {
val first = db.game(0u)
if (firstPgnGameIsMeaningful(count, first.tags.size, first.nodes.size)) count else null
}
} catch (_: ApiException) {
null
} finally {
db.close()
}
}
/// Keeps a copy of `input` (named `fileName`, for its format) in the app and puts it
/// on the list, or gives the entry of the same copy already there. Throws [NoGames]
/// when there is no game in it, or the core's error when it cannot be read; nothing
@ -246,7 +293,7 @@ class Library(private val context: Context) {
}
val sum = digest.digest().joinToString("") { "%02x".format(it) }
lock.withLock {
_entries.value.firstOrNull { it.source == Source.Copy && it.sha256 == sum }?.let { return@withContext it }
copyWithDigest(_entries.value, sum)?.let { return@withContext it }
}
val id = UUID.randomUUID().toString()
val kept = File(copies, "$id.$ext")
@ -279,6 +326,11 @@ class Library(private val context: Context) {
sha256 = sum,
)
lock.withLock {
copyWithDigest(_entries.value, sum)?.let { existing ->
db.close()
kept.delete()
return@withContext existing
}
open[id] = db
update { it + entry }
}
@ -291,6 +343,36 @@ class Library(private val context: Context) {
/// The file of a downloaded database.
fun onlineFile(e: DbEntry): File = File(onlineDir, e.location)
/// The file of an own database.
fun ownFile(e: DbEntry): File = File(ownDir, e.location)
/// A new empty own database named `name`, first among the own ones.
suspend fun createOwn(name: String): DbEntry = withContext(Dispatchers.IO) {
val id = UUID.randomUUID().toString()
val entry = DbEntry(id = id, name = name, source = Source.Own, location = "$id.pgn", fileName = "$id.pgn", games = 0, format = "PGN")
ownCreate(ownFile(entry).path)
update { list -> listOf(entry) + list }
entry
}
/// Saves the game `pgn` into the own database `id`: as game `index`, or at the end.
/// Returns its number; the database is read again when next opened.
suspend fun saveOwn(id: String, index: UInt?, pgn: String): UInt = lock.withLock {
val e = entry(id)?.takeIf { it.source == Source.Own } ?: throw IllegalArgumentException("not an own database")
val n = withContext(Dispatchers.IO) { ownSave(ownFile(e).path, index, pgn) }
open.remove(id)
update { list -> list.map { if (it.id == id) it.copy(games = if (index == null) (it.games ?: 0) + 1 else it.games) else it } }
n
}
/// Takes game `index` out of the own database `id`.
suspend fun removeOwnGame(id: String, index: UInt) = lock.withLock {
val e = entry(id)?.takeIf { it.source == Source.Own } ?: return@withLock
withContext(Dispatchers.IO) { ownRemove(ownFile(e).path, index) }
open.remove(id)
update { list -> list.map { if (it.id == id) it.copy(games = ((it.games ?: 1) - 1).coerceAtLeast(0)) else it } }
}
/// Puts a downloaded database (a file of [onlineDir]) on the list, or gives its entry.
fun addOnline(file: File): DbEntry = synchronized(this) {
_entries.value.firstOrNull { it.source == Source.Online && it.location == file.name }?.let { return it }
@ -351,6 +433,12 @@ class Library(private val context: Context) {
uniffi.mobile_api.deleteOnlineDatabase(onlineFile(entry).path)
return
}
// The only copy of the user's games: gone once "Undo" is (asked before when not
// empty, android-play.md §30.3).
if (entry.source == Source.Own) {
ownFile(entry).delete()
return
}
// The permission of a folder is given back with the last of its databases, also
// counting those whose "Undo" is still offered.
val granted = entry.tree ?: entry.location
@ -530,10 +618,14 @@ class Library(private val context: Context) {
suspend fun database(id: String): Result<Database> = lock.withLock {
open[id]?.let { return@withLock Result.success(it) }
val e = entry(id) ?: return@withLock Result.failure(IllegalArgumentException("no database $id"))
var text: String? = e.sha256
val result = withContext(Dispatchers.IO) {
runCatching {
when (e.source) {
Source.Sample -> openBytes(e.fileName, context.assets.open(e.location).use { it.readBytes() })
Source.Sample -> sampleBytes(e).let { bytes ->
text = sha256(bytes)
openBytes(e.fileName, bytes)
}
Source.File -> openFile(e.fileName, openDocument(Uri.parse(e.location)).detachFd())
Source.ChessBase -> openChessBase(e)
Source.Copy -> openFile(
@ -544,6 +636,7 @@ class Library(private val context: Context) {
e.fileName,
android.os.ParcelFileDescriptor.open(onlineFile(e), android.os.ParcelFileDescriptor.MODE_READ_ONLY).detachFd(),
)
Source.Own -> openPath(ownFile(e).path)
}
}
}
@ -551,10 +644,20 @@ class Library(private val context: Context) {
open[id] = db
val games = db.len().toInt()
val format = db.format()
if (e.games != games || e.format != format) {
update { list -> list.map { if (it.id == id) it.copy(games = games, format = format) else it } }
val sum = text
if (e.games != games || e.format != format || e.sha256 != sum) {
update { list -> list.map { if (it.id == id) it.copy(games = games, format = format, sha256 = sum) else it } }
}
}
result
}
}
internal fun firstPgnGameIsMeaningful(count: Int, tags: Int, nodes: Int): Boolean =
count > 0 && (tags > 0 || nodes > 1)
internal fun copyWithDigest(entries: List<DbEntry>, digest: String): DbEntry? =
entries.firstOrNull { it.source == Source.Copy && it.sha256 == digest }
private fun sha256(bytes: ByteArray): String =
java.security.MessageDigest.getInstance("SHA-256").digest(bytes).joinToString("") { "%02x".format(it) }

View file

@ -0,0 +1,24 @@
package io.github.vrubelroman.chesspenguin.data
import android.content.Context
import io.github.vrubelroman.chesspenguin.R
import kotlinx.coroutines.CoroutineScope
/// Maia's weights (android-play.md §31.2): the small model (`maia3-5m.pt`, 21 MB) of a
/// pinned revision, downloaded on request from the authors' Hugging Face page — the
/// file is theirs, not shipped in the APK. The same file as the desktop app's.
class MaiaFiles(context: Context, scope: CoroutineScope) {
val download = CheckedDownload(
context,
scope,
FileSpec(
dir = "maia",
name = "maia3-5m.pt",
url = "https://huggingface.co/UofTCSSLab/Maia3-5M/resolve/b6559de2398d7140b985f28fd2c19fb5e47ddabe/maia3-5m.pt",
size = 20_968_049,
sha256 = "ba14208b2992d85502f5fb501934abf6aaaeb355e9f3fdf90e326911f562524f",
title = context.getString(R.string.maia_download_title),
prefs = "maia",
),
)
}

View file

@ -0,0 +1,114 @@
package io.github.vrubelroman.chesspenguin.data
import android.content.Context
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import java.io.File
/// A game against the computer: the opponent (Maia, or Rodent IV in the character
/// `style`), its strength, the user's colour and name; `floor`: the half-moves that came
/// from another game ("Play on from here", not taken back); `over`: it ended.
data class PlayMeta(
val strength: Int,
val userWhite: Boolean,
val name: String,
val floor: Int,
val over: Boolean = false,
val rival: Opponent = Opponent.Maia,
val style: String = "",
)
/// The game against the computer being played (android-play.md §31.7, android-rodent.md
/// §6.5): its PGN is written after every move, so that "back" puts it aside and it
/// outlives the app being closed. One at a time. (Named when Maia was the only opponent.)
class MaiaGames(context: Context) {
private val file = File(context.filesDir, "play/current.pgn")
private val prefs = context.getSharedPreferences("play", Context.MODE_PRIVATE)
private val _current = MutableStateFlow(read())
/// The game in hand, if any.
val current: StateFlow<PlayMeta?> = _current.asStateFlow()
private fun read(): PlayMeta? {
if (!file.isFile || !prefs.contains("strength")) return null
return PlayMeta(
strength = prefs.getInt("strength", 1500),
userWhite = prefs.getBoolean("white", true),
name = prefs.getString("name", "") ?: "",
floor = prefs.getInt("floor", 0),
over = prefs.getBoolean("over", false),
// A game put aside before Rodent came is a game against Maia.
rival = Opponent.entries.firstOrNull { it.key == prefs.getString("rival", null) } ?: Opponent.Maia,
style = prefs.getString("style", "") ?: "",
)
}
/// The PGN of the game in hand.
fun pgn(): String? = runCatching { file.readText() }.getOrNull()
/// Which game is in hand: bumped by each new one (a write that ends after a rematch
/// began is not taken for the new game's).
var serial = 0
private set
/// A new game: it replaces the one in hand.
fun begin(pgn: String, meta: PlayMeta) {
serial++
write(pgn)
prefs.edit()
.remove("writtenDb")
.remove("writtenIndex")
.putInt("strength", meta.strength)
.putBoolean("white", meta.userWhite)
.putString("name", meta.name)
.putInt("floor", meta.floor)
.putBoolean("over", meta.over)
.putString("rival", meta.rival.key)
.putString("style", meta.style)
.apply()
_current.value = meta
}
/// The game after a move.
fun save(pgn: String) {
if (_current.value != null) write(pgn)
}
/// The game ended: it is not offered to go on with any more.
fun finish(pgn: String) {
save(pgn)
// At once (commit): a game over must not come back as one to go on with.
prefs.edit().putBoolean("over", true).commit()
_current.value = _current.value?.copy(over = true)
}
/// The game was written into its player's database: database and number there.
fun setWritten(id: String, index: UInt, game: Int) {
if (game != serial) return
prefs.edit().putString("writtenDb", id).putLong("writtenIndex", index.toLong()).commit()
}
/// Where the game in hand was written, if it was.
fun written(): Pair<String, UInt>? {
val id = prefs.getString("writtenDb", null) ?: return null
return id to prefs.getLong("writtenIndex", 0).toUInt()
}
/// The game is gone (left after its end, removed by the user).
fun clear() {
file.delete()
prefs.edit().clear().apply()
_current.value = null
}
/// Written beside and moved in: a cut-off write leaves the last move's game whole.
private fun write(pgn: String) {
file.parentFile?.mkdirs()
val tmp = File(file.path + ".tmp")
tmp.writeText(pgn)
if (!tmp.renameTo(file)) {
file.writeText(pgn)
tmp.delete()
}
}
}

View file

@ -2,6 +2,7 @@ package io.github.vrubelroman.chesspenguin.data
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
@ -22,8 +23,9 @@ import java.util.concurrent.ConcurrentHashMap
/// database did not exist before it (its first download).
data class DownloadView(val accounts: List<OnlineAccount>, val state: DownloadState, val fresh: Boolean = false)
/// A download that has ended, for the snackbar of the screen that is shown then.
data class Finished(val id: String, val name: String, val view: DownloadView, val games: Int)
/// A download that has ended, for the snackbar of the screen that is shown then;
/// `quiet` when the app started it on its own (said only when it added games).
data class Finished(val id: String, val name: String, val view: DownloadView, val games: Int, val quiet: Boolean = false)
/// The downloads of games from Lichess and Chess.com (android-ui.md §23). They belong to
/// the app, not to a screen: leaving the screen does not stop them, and the list of
@ -44,13 +46,15 @@ class OnlineDownloads(private val library: Library, private val scope: Coroutine
/// Starts fetching the new games of `accounts` into the database file `path` (put on
/// the list at once); one download per database. Returns the database's entry.
fun start(accounts: List<OnlineAccount>, path: String): DbEntry {
fun start(accounts: List<OnlineAccount>, path: String): DbEntry = run(accounts, path, false).first
private fun run(accounts: List<OnlineAccount>, path: String, quiet: Boolean): Pair<DbEntry, Job?> {
val fresh = !File(path).exists()
val entry = library.addOnline(File(path))
if (running.containsKey(entry.id)) return entry
if (running.containsKey(entry.id)) return entry to null
val d = OnlineDownload.start(accounts, path)
running[entry.id] = d
scope.launch(Dispatchers.IO) {
val job = scope.launch(Dispatchers.IO) {
while (true) {
val s = d.state()
_views.update { it + (entry.id to DownloadView(accounts, s, fresh)) }
@ -64,9 +68,9 @@ class OnlineDownloads(private val library: Library, private val scope: Coroutine
// No game at all (no standard chess there, or it failed at once): not a database.
val name = library.entry(entry.id)?.name ?: entry.name
if (games == 0) library.dropEmpty(entry.id) else library.downloaded(entry.id, games, info?.updated)
_views.value[entry.id]?.let { _finished.tryEmit(Finished(entry.id, name, it, games)) }
_views.value[entry.id]?.let { _finished.tryEmit(Finished(entry.id, name, it, games, quiet)) }
}
return entry
return entry to job
}
/// Fetches the games played since the last download of a database.
@ -76,6 +80,26 @@ class OnlineDownloads(private val library: Library, private val scope: Coroutine
start(info.accounts, path)
}
/// Every downloaded database gets the games played since, one after another (the
/// sites ask for one export at a time): at the app's start and when it comes back to
/// the screen, at most every [AUTO_EVERY_MS].
fun updateAllQuietly() {
val now = System.currentTimeMillis()
if (auto?.isActive == true || now - lastAuto < AUTO_EVERY_MS) return
lastAuto = now
auto = scope.launch(Dispatchers.IO) {
for (e in library.entries.value.filter { it.source == Source.Online }) {
if (isRunning(e.id)) continue
val path = library.onlineFile(e).path
val info = onlineDatabase(path) ?: continue
run(info.accounts, path, true).second?.join()
}
}
}
private var lastAuto = 0L
private var auto: Job? = null
/// Stops a download; what it fetched stays.
fun cancel(id: String) {
running[id]?.cancel()
@ -85,5 +109,6 @@ class OnlineDownloads(private val library: Library, private val scope: Coroutine
private companion object {
const val POLL_MS = 400L
const val AUTO_EVERY_MS = 10 * 60 * 1000L
}
}

View file

@ -0,0 +1,111 @@
package io.github.vrubelroman.chesspenguin.data
import android.content.Context
import io.github.vrubelroman.chesspenguin.R
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
/// A game written into its player's database: the database, its number there (from 0),
/// and whether the database was made for it.
data class Written(val id: String, val name: String, val index: UInt, val created: Boolean)
/// The players' databases (docs/design/player-games.md §6, decisions «Партии игрока
/// записываются сами»): every game against Maia goes by itself into an own database of
/// its player — «Roman — games against the computer», made at their first game; without
/// a name, «Games against the computer». Only new games are added; replacing and
/// deleting stay the user's.
class PlayerGames(private val context: Context, private val library: Library) {
private val store = context.getSharedPreferences("players", Context.MODE_PRIVATE)
private val lock = Mutex()
/// The name as it is kept: trimmed, inner spaces single.
fun tidy(name: String): String = name.trim().split(Regex("\\s+")).filter { it.isNotEmpty() }.joinToString(" ")
/// Names that are the same player: «Иван» and «иван ».
private fun key(name: String) = tidy(name).lowercase()
/// The name of a new database for the player.
fun dbName(name: String): String = tidy(name).let {
if (it.isEmpty()) context.getString(R.string.player_db_shared) else context.getString(R.string.player_db_name, it)
}
/// The player's database, while it is on the list.
fun database(name: String): DbEntry? =
store.getString("db:" + key(name), null)?.let { library.entry(it) }?.takeIf { it.source == Source.Own }
/// Whether `id` is a player's database (a knight on its row).
fun isPlayers(id: String): Boolean = store.all.any { (k, v) -> k.startsWith("db:") && v == id }
/// The players who played here, the last first (named ones).
fun players(): List<String> =
(store.getString("order", "") ?: "").split('\n').filter { it.isNotEmpty() }
.mapNotNull { store.getString("name:$it", null) }
/// The player who starts a game goes first in the list.
fun remember(name: String) {
val k = key(name)
if (k.isEmpty()) return
val order = listOf(k) + (store.getString("order", "") ?: "").split('\n').filter { it.isNotEmpty() && it != k }
store.edit().putString("name:$k", tidy(name)).putString("order", order.joinToString("\n")).apply()
}
/// The game in hand let go unfinished (× on its card, a new game in its place, Maia
/// failing): kept in the player's database with `*` once both have moved, unless it
/// was written already or the user turned writing off. What is in hand is taken at
/// once (the caller may put a new game there right after); `then` on `scope`.
/// Whether it is written (a game without moves of both sides is not).
fun keepUnfinished(games: MaiaGames, record: Boolean, scope: CoroutineScope, then: (Written) -> Unit = {}): Boolean {
if (!wouldKeep(games, record)) return false
val m = games.current.value ?: return false
val pgn = games.pgn() ?: return false
scope.launch { runCatching { writeUnfinished(m, pgn) }.getOrNull()?.let(then) }
return true
}
/// Whether the game in hand, let go now, would be kept.
fun wouldKeep(games: MaiaGames, record: Boolean): Boolean {
val m = games.current.value ?: return false
if (m.over || !record || games.written() != null) return false
val pgn = games.pgn() ?: return false
return plies(pgn) - m.floor >= 2
}
/// Half-moves of the main line.
private fun plies(pgn: String): Int {
val s = uniffi.mobile_api.GameSession.fromPgn(pgn)
try {
val d = s.data()
var n = 0
var plies = 0
while (true) {
n = d.nodes[n].children.firstOrNull()?.toInt() ?: return plies
plies++
}
} finally {
s.close()
}
}
private suspend fun writeUnfinished(m: PlayMeta, pgn: String): Written {
val s = uniffi.mobile_api.GameSession.fromPgn(pgn)
val text = try {
s.setData(listOf(uniffi.mobile_api.Tag("Termination", "Unterminated")), "*")
s.pgn()
} finally {
s.close()
}
return write(m.name, text)
}
/// Adds `pgn` to the player's database, making it first when they have none.
suspend fun write(name: String, pgn: String): Written = lock.withLock {
val existing = database(name)
val entry = existing ?: library.createOwn(dbName(name)).also {
store.edit().putString("db:" + key(name), it.id).apply()
}
val n = library.saveOwn(entry.id, null, pgn)
Written(entry.id, entry.name, n, existing == null)
}
}

View file

@ -0,0 +1,129 @@
package io.github.vrubelroman.chesspenguin.data
import io.github.vrubelroman.chesspenguin.ui.PlayerPage
import io.github.vrubelroman.chesspenguin.ui.PlayerSummary
import io.github.vrubelroman.chesspenguin.ui.PrepContinuation
import io.github.vrubelroman.chesspenguin.ui.PrepGameMatch
import io.github.vrubelroman.chesspenguin.ui.PrepOutOfMemory
import io.github.vrubelroman.chesspenguin.ui.PrepPlayerNotFound
import io.github.vrubelroman.chesspenguin.ui.PrepPosition
import io.github.vrubelroman.chesspenguin.ui.PrepSearchFailed
import io.github.vrubelroman.chesspenguin.ui.PrepStart
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.delay
import kotlinx.coroutines.ensureActive
import kotlin.coroutines.coroutineContext
import uniffi.mobile_api.Database
import uniffi.mobile_api.PrepPhase
import uniffi.mobile_api.PrepResult
import uniffi.mobile_api.PrepSearch as RustPrepSearch
internal data class PrepQuery(
val player: String,
val white: Boolean,
val fen: String,
)
internal fun PrepStart.query(fen: String): PrepQuery = PrepQuery(player, white, fen)
/// The Android side of mobile-api's preparation contract. Database aggregation stays in
/// Rust; the object being closed is the search, never the library's shared Database.
internal interface PrepBackend {
suspend fun players(query: String, offset: Int, limit: Int): PlayerPage
suspend fun position(query: PrepQuery): PrepPosition
fun cancel()
fun close()
}
internal object PrepBackends {
fun open(database: Database): PrepBackend = RustPrepBackend(database)
}
private class RustPrepBackend(private val database: Database) : PrepBackend {
private val lock = Any()
private val playerIds = java.util.concurrent.ConcurrentHashMap<String, UInt>()
private var active: RustPrepSearch? = null
@Volatile private var closed = false
override suspend fun players(query: String, offset: Int, limit: Int): PlayerPage {
coroutineContext.ensureActive()
if (closed) throw CancellationException("The player list is closed")
val start = offset.coerceAtLeast(0)
val answer = database.suggestPlayers(query, start.toUInt(), limit.coerceIn(0, 200).toUInt())
val players = answer.players.map {
PlayerSummary(it.id.toInt(), it.name, it.games.toInt(), it.whiteGames.toInt(), it.blackGames.toInt())
}
val end = start + players.size
return PlayerPage(players, answer.total.toInt(), end.takeIf { players.isNotEmpty() && it < answer.total.toInt() })
}
override suspend fun position(query: PrepQuery): PrepPosition {
coroutineContext.ensureActive()
val id = findPlayer(query.player)
coroutineContext.ensureActive()
val search = synchronized(lock) {
if (closed) throw CancellationException("The position search is closed")
active?.cancel()
database.preparePosition(id, query.white, query.fen).also { active = it }
}
try {
while (true) {
val state = search.state()
when (state.phase) {
PrepPhase.GAMES, PrepPhase.INDEX, PrepPhase.SEARCH -> delay(25)
PrepPhase.READY -> return state.result?.toUi()
?: throw PrepSearchFailed(state.failure.ifEmpty { "The position search returned no result" })
PrepPhase.CANCELLED -> throw CancellationException("The position search was cancelled")
PrepPhase.NO_MEMORY -> throw PrepOutOfMemory()
PrepPhase.FAILED -> throw PrepSearchFailed(state.failure.ifEmpty { "The position search failed" })
}
}
} finally {
synchronized(lock) {
if (active === search) active = null
}
search.close()
}
}
private fun findPlayer(name: String): UInt {
playerIds[name]?.let { return it }
var offset = 0
while (true) {
val page = database.suggestPlayers(name, offset.toUInt(), 200u)
page.players.firstOrNull { it.name == name }?.let {
playerIds[name] = it.id
return it.id
}
if (page.players.isEmpty()) break
offset += page.players.size
if (offset >= page.total.toInt()) break
}
throw PrepPlayerNotFound(name)
}
override fun cancel() {
synchronized(lock) { active?.cancel() }
}
override fun close() {
synchronized(lock) {
closed = true
active?.cancel()
active = null
}
}
}
private fun PrepResult.toUi() = PrepPosition(
games = games.toInt(),
continuations = continuations.map {
PrepContinuation(it.uci, it.san, it.count.toInt(), it.wins.toInt(), it.draws.toInt(), it.losses.toInt(), it.unknown.toInt())
},
endedHere = ended.toInt(),
noNormalContinuation = noNormalContinuation.toInt(),
unknownResults = unknown.toInt(),
playerToMove = playerToMove,
matches = matches.map { PrepGameMatch(it.index, it.ply) },
matchesTotal = matchesTotal.toInt(),
)

View file

@ -15,11 +15,9 @@ import uniffi.mobile_api.Database
import uniffi.mobile_api.GameReview
import uniffi.mobile_api.ReviewState
/// Nodes per position of the three qualities, as on the desktop (android-ui.md §21.2).
val REVIEW_NODES = listOf(250_000UL, 1_000_000UL, 3_000_000UL)
/// A first guess at the engine's speed per thread before it was measured on this phone.
const val GUESS_NPS_PER_THREAD = 250_000L
/// A first guess at the speed of one engine process (one thread) before it was measured
/// on this phone.
const val GUESS_NPS = 250_000L
/// The analysis of the game on the screen (its report, android-ui.md §21): the cached
/// or PGN evaluations at once, the engine job when asked for. One game at a time; the
@ -39,33 +37,40 @@ class ReviewSession(private val cacheDir: String, private val scope: CoroutineSc
/// Shows the analysis of game `index` of database `db` (from the cache or its
/// `[%eval]` comments); the analysis of the game before is stopped and kept.
suspend fun open(db: String, database: Database, index: UInt) {
if (game == db to index) return
suspend fun open(db: String, database: Database, index: UInt) = openWith(db to index) { database.review(index, cacheDir) }
/// The analysis of a game being changed or played (no file of its own), as it is
/// now; `stamp` names this state of it (a new stamp: the game changed).
suspend fun openSession(stamp: String, session: uniffi.mobile_api.GameSession) = openWith("session" to stamp.hashCode().toUInt()) { session.review(cacheDir) }
private suspend fun openWith(key: Pair<String, UInt>, make: () -> GameReview) {
if (game == key) return
val gen = ++generation
_state.value = null
lock.withLock {
closeLocked()
val r = withContext(Dispatchers.IO) { runCatching { database.review(index, cacheDir) }.getOrNull() } ?: return
val r = withContext(Dispatchers.IO) { runCatching { make() }.getOrNull() } ?: return
if (gen != generation) {
withContext(Dispatchers.IO) { r.close() }
return
}
review = r
game = db to index
game = key
_state.value = withContext(Dispatchers.IO) { r.state() }
}
}
/// Starts the engine on the positions without an evaluation, or on all when `full`.
/// `done` gets the final state when the job ends by itself.
fun start(path: String, evalFile: String, threads: Int, hashMb: Int, nodes: ULong, full: Boolean, done: (ReviewState) -> Unit) {
/// Starts the engine on the positions without an evaluation, or on all when `full`
/// (or when the analysis is stale). The search is fixed, the same as on the desktop
/// (decisions.md, 2026-10-28). `done` gets the final state when the job ends by itself.
fun start(path: String, evalFile: String, full: Boolean, done: (ReviewState) -> Unit) {
val gen = generation
scope.launch {
lock.withLock {
val r = review ?: return@withLock
if (gen != generation) return@withLock
val started = withContext(Dispatchers.IO) {
r.start(path, evalFile, threads.toUInt(), hashMb.toUInt(), nodes, full)
r.start(path, evalFile, full)
}
_state.value = withContext(Dispatchers.IO) { r.state() }
if (started) poll(r, gen, done)

View file

@ -0,0 +1,168 @@
package io.github.vrubelroman.chesspenguin.data
import android.content.Context
import io.github.vrubelroman.chesspenguin.R
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
import java.io.IOException
/// Rodent IV on the phone (android-rodent.md): the engine is a "library" of the APK
/// (scripts/rodent4.sh), its personalities come with the APK and are copied into its
/// home folder, its opening books are one pack downloaded on request from the authors'
/// repository ([BookPack]). The engine finds both in its home (RODENT4HOME).
class RodentFiles(private val context: Context, scope: CoroutineScope) {
/// The engine's home: `personalities/` and `books/`.
val home = File(context.filesDir, "rodent4")
/// The executable, unpacked by the installer (useLegacyPackaging).
val executable: String get() = context.applicationInfo.nativeLibraryDir + "/librodent4.so"
val books = BookPack(context, scope, home)
/// Copies the personalities out of the APK when they are not there or are of another
/// version (written beside, then moved in: a cut-off copy is not taken for whole).
/// False when they could not be (no space): Rodent then does not start.
suspend fun prepare(): Boolean = withContext(Dispatchers.IO) {
val version = uniffi.mobile_api.rodentVersion()
val dir = File(home, "personalities")
val mark = File(home, "personalities.version")
if (dir.isDirectory && runCatching { mark.readText() }.getOrNull() == version) return@withContext true
val fresh = File(home, "personalities.new")
try {
fresh.deleteRecursively()
fresh.mkdirs()
val assets = context.assets
for (name in assets.list(ASSETS).orEmpty()) {
assets.open("$ASSETS/$name").use { input -> File(fresh, name).outputStream().use { input.copyTo(it) } }
}
dir.deleteRecursively()
if (!fresh.renameTo(dir)) throw IOException("cannot move the personalities into place")
mark.writeText(version)
true
} catch (e: IOException) {
fresh.deleteRecursively()
false
}
}
private companion object {
const val ASSETS = "rodent4/personalities"
}
}
/// Rodent IV's opening books as one pack (android-rodent.md §5): the books its characters
/// open, each a [CheckedDownload] of the system's, fetched one after another and each
/// checked by its SHA-256. A file checked stays: after a cancel or a break only the rest
/// is fetched. The pack is ready only when every file is there.
class BookPack(context: Context, private val scope: CoroutineScope, home: File) {
private val files: List<CheckedDownload> = uniffi.mobile_api.rodentBookPack().map { b ->
val local = File(home, b.local)
CheckedDownload(
context,
scope,
FileSpec(
dir = local.parentFile!!.relativeTo(context.filesDir).path,
name = local.name,
url = b.url,
size = b.size.toLong(),
sha256 = b.sha256,
title = context.getString(R.string.books_notification),
prefs = "rodent4-book-" + local.name,
ownFolder = false,
),
)
}
/// The pack in all (bytes).
val size: Long = files.sumOf { it.size }
private val _state = MutableStateFlow<NetState>(if (installed()) NetState.Ready else NetState.Missing)
/// Missing (some or all of it), Loading (of what was left when it began), Failed, Ready.
val state: StateFlow<NetState> = _state.asStateFlow()
private var job: Job? = null
private val books = File(home, "books")
init {
sweep()
// A download of the system's still going on from before: the pack goes on.
if (files.any { it.state.value is NetState.Loading }) download()
}
fun installed() = files.all { it.installed() }
/// Files of another version of the pack (or left half-written) go, and folders left
/// empty.
private fun sweep() {
val known = files.flatMap { listOf(it.file.path, it.file.path + ".part") }.toSet()
books.walkBottomUp().forEach { f ->
if (f.isFile && f.path !in known) f.delete()
if (f.isDirectory && f != books && f.list().isNullOrEmpty()) f.delete()
}
}
/// What is left to download (bytes).
fun remaining(): Long = files.filterNot { it.installed() }.sumOf { it.size }
/// Fetches the files not there yet, one after another; stops at the first failure.
fun download() {
if (_state.value == NetState.Ready || _state.value is NetState.Loading) return
val left = files.filterNot { it.installed() }
val total = left.sumOf { it.size }
_state.value = NetState.Loading(0, total)
job = scope.launch(Dispatchers.Main.immediate) {
var done = 0L
for (f in left) {
f.download()
// Its progress as part of the whole, until it is in place or fails.
val end = f.state.first { s ->
if (s is NetState.Loading) _state.value = NetState.Loading(done + s.done, total)
s !is NetState.Loading
}
when (end) {
NetState.Ready -> done += f.size
is NetState.Failed -> {
_state.value = end
return@launch
}
// Removed in the system's list of downloads.
else -> {
_state.value = NetState.Missing
return@launch
}
}
}
_state.value = if (installed()) NetState.Ready else NetState.Missing
}
}
/// The failure of an earlier attempt is forgotten (the network may be back): the pack
/// is offered again as it is.
fun forgetFailure() {
if (_state.value is NetState.Failed) _state.value = if (installed()) NetState.Ready else NetState.Missing
}
/// Stops the download; the files checked so far stay.
fun cancel() {
job?.cancel()
job = null
files.forEach { if (it.state.value is NetState.Loading) it.cancel() }
_state.value = if (installed()) NetState.Ready else NetState.Missing
}
/// Removes the books (Settings → Engine).
fun delete() {
cancel()
files.forEach { it.delete() }
sweep()
_state.value = NetState.Missing
}
}

View file

@ -7,12 +7,15 @@ import kotlinx.coroutines.flow.asStateFlow
enum class Theme { System, Light, Dark }
/// Who plays against the user (android-rodent.md): kept by these names.
enum class Opponent(val key: String) { Maia("maia"), Rodent("rodent4") }
/// How moves are written on the screen (PGN keeps K Q R B N).
enum class Notation { Latin, Figurines, Local }
/// The user's choices (android-ui.md §9), applied at once and kept across starts.
data class Prefs(
val theme: Theme = Theme.System,
val theme: Theme = Theme.Dark,
val notation: Notation = Notation.Latin,
val board: BoardTheme = BoardTheme.Green,
val pieces: PieceSet = PieceSet.Merida,
@ -24,11 +27,23 @@ data class Prefs(
val engineSeconds: Int = 20,
val engineThreads: Int = defaultThreads(),
val engineHashMb: Int = 64,
/// The game report's quality, an index into REVIEW_NODES (§21.2).
val reviewQuality: Int = 1,
/// The engine's speed per thread measured by the last game analysis (0 = not yet),
/// for the time estimate.
/// The speed of one engine process (one thread) measured by the last game analysis
/// (0 = not yet), for the time estimate.
val reviewNps: Long = 0,
/// The last choices of a game against the computer (android-play.md §31.1,
/// android-rodent.md §7.1): the opponent, each one's strength on its own scale,
/// Rodent's character ("" = never chosen), the user's colour (-1 Black, 0 at
/// random, 1 White), the user's name.
val opponent: Opponent = Opponent.Maia,
val maiaStrength: Int = 1500,
val rodentStrength: Int = 1500,
val rodentPersonality: String = "",
val playColor: Int = 0,
val yourName: String = "",
/// Sounds of moves and of the end of a game (§33).
val sound: Boolean = true,
/// Games against the computer go by themselves into the player's database (player-games.md).
val recordGames: Boolean = true,
)
/// Half the cores, at most 2: the engine leaves the phone's interface room (§9).
@ -63,8 +78,16 @@ class Settings(context: Context) {
engineSeconds = store.getInt("engineSeconds", d.engineSeconds),
engineThreads = store.getInt("engineThreads", d.engineThreads),
engineHashMb = store.getInt("engineHashMb", d.engineHashMb),
reviewQuality = store.getInt("reviewQuality", d.reviewQuality).coerceIn(0, REVIEW_NODES.size - 1),
reviewNps = store.getLong("reviewNps", d.reviewNps),
opponent = Opponent.entries.firstOrNull { it.key == store.getString("opponent", null) } ?: d.opponent,
maiaStrength = store.getInt("maiaStrength", d.maiaStrength),
rodentStrength = store.getInt("rodentStrength", d.rodentStrength),
rodentPersonality = store.getString("rodentPersonality", d.rodentPersonality) ?: d.rodentPersonality,
// Kept as `maiaColor` up to 1.7, when Maia was the only opponent.
playColor = store.getInt("playColor", store.getInt("maiaColor", d.playColor)).coerceIn(-1, 1),
yourName = store.getString("yourName", d.yourName) ?: d.yourName,
sound = store.getBoolean("sound", d.sound),
recordGames = store.getBoolean("recordGames", d.recordGames),
)
}
@ -83,8 +106,16 @@ class Settings(context: Context) {
.putInt("engineSeconds", p.engineSeconds)
.putInt("engineThreads", p.engineThreads)
.putInt("engineHashMb", p.engineHashMb)
.putInt("reviewQuality", p.reviewQuality)
.putLong("reviewNps", p.reviewNps)
.putString("opponent", p.opponent.key)
.putInt("maiaStrength", p.maiaStrength)
.putInt("rodentStrength", p.rodentStrength)
.putString("rodentPersonality", p.rodentPersonality)
.putInt("playColor", p.playColor)
.remove("maiaColor")
.putString("yourName", p.yourName)
.putBoolean("sound", p.sound)
.putBoolean("recordGames", p.recordGames)
.apply()
}
}

View file

@ -0,0 +1,41 @@
package io.github.vrubelroman.chesspenguin.data
import android.content.Context
import android.media.AudioAttributes
import android.media.SoundPool
/// What a sound says (android-play.md §33).
enum class Sound(val file: String) {
Move("Move"),
Capture("Capture"),
Check("Check"),
Defeat("Defeat"),
Success("Success"),
Wrong("Wrong"),
}
/// The desktop's «SFX» set, loaded once; played when the setting «Sound» is on.
class Sounds(context: Context, private val settings: Settings) {
private val pool = SoundPool.Builder()
.setMaxStreams(2)
.setAudioAttributes(AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_GAME).setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).build())
.build()
private val ids: Map<Sound, Int> = Sound.entries.associateWith { s ->
runCatching { context.assets.openFd("sounds/${s.file}.ogg").use { pool.load(it, 1) } }.getOrDefault(0)
}
fun play(sound: Sound) {
if (!settings.prefs.value.sound) return
val id = ids[sound] ?: return
if (id != 0) pool.play(id, 1f, 1f, 1, 0, 1f)
}
/// The sound of a move by its SAN: a check, a capture, or a move.
fun move(san: String) = play(
when {
san.endsWith("+") || san.endsWith("#") -> Sound.Check
'x' in san -> Sound.Capture
else -> Sound.Move
},
)
}

View file

@ -54,26 +54,52 @@ val DarkChess = LightChess.copy(
comment = Color(0xFF9EC4E0),
)
/// Move assessments in the colors of Lichess (as on the desktop). On a light background
/// they are darkened to stay readable (contrast at least 4.5:1).
/// Move assessments in the owner's palette (chess.com's), as on the desktop. On a light
/// background they are darkened to stay readable (contrast at least 4.5:1).
fun nagColor(nag: Int, dark: Boolean): Color? = if (dark) {
when (nag) {
1 -> Color(0xFF629C2E) // !
2 -> Color(0xFFE68F00) // ?
3 -> Color(0xFF22AC9A) // !!
4 -> Color(0xFFDF5353) // ??
1 -> Color(0xFF81B64C) // !
2 -> Color(0xFFFFA459) // ?
3 -> Color(0xFF26C2A3) // !!
4 -> Color(0xFFFA412D) // ??
5 -> Color(0xFFEA45D8) // !?
6 -> Color(0xFF56B4E9) // ?!
6 -> Color(0xFF56B4E9) // ?! (Lichess blue)
else -> null
}
} else {
when (nag) {
1 -> Color(0xFF4E7F22)
2 -> Color(0xFFA35F00)
3 -> Color(0xFF12806F)
4 -> Color(0xFFC23B3B)
1 -> Color(0xFF5B8135)
2 -> Color(0xFFC25700)
3 -> Color(0xFF1A846F)
4 -> Color(0xFFD2301C)
5 -> Color(0xFFB0259F)
6 -> Color(0xFF1F72A8)
else -> null
}
}
/// The kinds of databases, each in its own colour on its badge (android-lists.md §5.1).
enum class DbKind { Pgn, ChessBase, Archive, Online, Own }
/// A badge's background and what is written on it.
data class KindColor(val container: Color, val content: Color)
/// The colour of a kind of database, from Catppuccin (the owner's choice): Mocha in the
/// dark theme, Latte in the light one, on a tint of the same hue (contrast at least 5:1).
fun kindColor(kind: DbKind, dark: Boolean): KindColor = if (dark) {
when (kind) {
DbKind.Pgn -> KindColor(Color(0xFF384660), Color(0xFF89B4FA)) // blue
DbKind.ChessBase -> KindColor(Color(0xFF55443B), Color(0xFFFAB387)) // peach
DbKind.Archive -> KindColor(Color(0xFF4A3F5E), Color(0xFFCBA6F7)) // mauve
DbKind.Online -> KindColor(Color(0xFF3A5250), Color(0xFF94E2D5)) // teal
DbKind.Own -> KindColor(Color(0xFF3F523F), Color(0xFFA6E3A1)) // green
}
} else {
when (kind) {
DbKind.Pgn -> KindColor(Color(0xFFDFEAFE), Color(0xFF1957D0))
DbKind.ChessBase -> KindColor(Color(0xFFFFE9DD), Color(0xFFA54107))
DbKind.Archive -> KindColor(Color(0xFFEEE3FD), Color(0xFF7A33D7))
DbKind.Online -> KindColor(Color(0xFFDFF0F1), Color(0xFF116D73))
DbKind.Own -> KindColor(Color(0xFFE4F2E1), Color(0xFF2D701E))
}
}

View file

@ -49,6 +49,11 @@ private val NOTICES = listOf(
"Pieces kosal" to "CC BY 4.0 · Kosal Sen, philatype.com (via PyChess)",
"Pieces metaltops" to "GPL · PyChess",
"Board images" to "AGPLv3+ · the lila authors and pirouetti (Lichess)",
"Sounds (SFX)" to "AGPLv3+ · Enigmahack (via Lichess)",
"Sound of a wrong move" to "CC0-1.0 · Kenney, kenney.nl",
"Rodent IV 0.33" to "GPL-3.0 · Paweł Koziol, Bernhard C. Maerz (based on Sungorus by Pablo Vázquez) · github.com/nescitus/rodent-iv",
"Rodent IV opening books (downloaded from its authors on request)" to "Their authors' credits in the books' folders · github.com/nescitus/rodent-iv",
"Maia-3 (downloaded from its authors on request)" to "CSSLab, University of Toronto · huggingface.co/UofTCSSLab",
"Figurines, Noto Sans Math" to "SIL Open Font License 1.1",
"Jetpack Compose, AndroidX, Kotlin" to "Apache-2.0 · Google, JetBrains",
"UniFFI" to "MPL-2.0 · Mozilla",
@ -79,11 +84,14 @@ fun AboutScreen(onBack: () -> Unit) {
Spacer(Modifier.height(16.dp))
Text(stringResource(R.string.app_name), style = MaterialTheme.typography.titleLarge)
val build = stringResource(if (BuildConfig.NET_BUILT_IN) R.string.build_full else R.string.build_light)
Text("${BuildConfig.VERSION_NAME} ${stringResource(R.string.alpha)} · $build", color = MaterialTheme.colorScheme.onSurfaceVariant)
Spacer(Modifier.height(24.dp))
// Right under the version (android-ui.md §25.5).
AboutUpdates()
Text("${BuildConfig.VERSION_NAME} · $build", color = MaterialTheme.colorScheme.onSurfaceVariant)
Spacer(Modifier.height(24.dp))
// Right under the version (android-ui.md §25.5); a store's build is updated by
// the store.
if (BuildConfig.SELF_UPDATE) {
AboutUpdates()
Spacer(Modifier.height(24.dp))
}
Text(stringResource(R.string.about_text), style = MaterialTheme.typography.bodyLarge)
TextButton(onClick = { uri.openUri(SITE) }, contentPadding = androidx.compose.foundation.layout.PaddingValues(0.dp)) {
Text(stringResource(R.string.website))

View file

@ -1,5 +1,8 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.ui.draw.clip
import androidx.compose.foundation.background
import io.github.vrubelroman.chesspenguin.theme.DbKind
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
@ -53,6 +56,16 @@ import io.github.vrubelroman.chesspenguin.data.FolderScan
import io.github.vrubelroman.chesspenguin.data.Found
import io.github.vrubelroman.chesspenguin.data.Source
/// The icon of a way to add, in a round tile coloured as the database it brings
/// (android-lists.md §6).
@Composable
private fun KindIcon(kind: DbKind, icon: androidx.compose.ui.graphics.vector.ImageVector) {
val c = io.github.vrubelroman.chesspenguin.theme.kindColor(kind, io.github.vrubelroman.chesspenguin.theme.LocalChessColors.current.dark)
Box(Modifier.size(40.dp).clip(androidx.compose.foundation.shape.CircleShape).background(c.container), contentAlignment = Alignment.Center) {
Icon(icon, null, tint = c.content, modifier = Modifier.size(22.dp))
}
}
/// "Add a database": games in the clipboard, a file, every database in a folder, or a
/// player's games from Lichess and Chess.com.
@OptIn(ExperimentalMaterial3Api::class)
@ -71,7 +84,7 @@ fun AddSheet(onFile: () -> Unit, onFolder: () -> Unit, onPaste: (() -> Unit)?, o
ListItem(
headlineContent = { Text(stringResource(R.string.add_paste)) },
supportingContent = { Text(stringResource(R.string.add_paste_hint)) },
leadingContent = { Icon(Icons.Outlined.ContentPaste, null) },
leadingContent = { KindIcon(DbKind.Pgn, Icons.Outlined.ContentPaste) },
colors = ListItemDefaults.colors(containerColor = Color.Transparent),
modifier = Modifier.clickable(role = Role.Button, onClick = onPaste).padding(horizontal = 8.dp),
)
@ -79,21 +92,21 @@ fun AddSheet(onFile: () -> Unit, onFolder: () -> Unit, onPaste: (() -> Unit)?, o
ListItem(
headlineContent = { Text(stringResource(R.string.online_title)) },
supportingContent = { Text(stringResource(R.string.add_online_hint)) },
leadingContent = { Icon(Icons.Outlined.CloudDownload, null) },
leadingContent = { KindIcon(DbKind.Online, Icons.Outlined.CloudDownload) },
colors = ListItemDefaults.colors(containerColor = Color.Transparent),
modifier = Modifier.clickable(role = Role.Button, onClick = onOnline).padding(horizontal = 8.dp),
)
ListItem(
headlineContent = { Text(stringResource(R.string.add_file)) },
supportingContent = { Text(stringResource(R.string.add_file_hint)) },
leadingContent = { Icon(Icons.Outlined.Description, null) },
leadingContent = { KindIcon(DbKind.Pgn, Icons.Outlined.Description) },
colors = ListItemDefaults.colors(containerColor = Color.Transparent),
modifier = Modifier.clickable(role = Role.Button, onClick = onFile).padding(horizontal = 8.dp),
)
ListItem(
headlineContent = { Text(stringResource(R.string.add_folder)) },
supportingContent = { Text(stringResource(R.string.add_folder_hint)) },
leadingContent = { Icon(Icons.Outlined.Folder, null) },
leadingContent = { KindIcon(DbKind.Pgn, Icons.Outlined.Folder) },
colors = ListItemDefaults.colors(containerColor = Color.Transparent),
modifier = Modifier.clickable(role = Role.Button, onClick = onFolder).padding(horizontal = 8.dp),
)
@ -197,7 +210,7 @@ private fun FoundRow(f: Found, checked: Boolean, onChange: (Boolean) -> Unit) {
) {
Checkbox(checked = checked || f.added, onCheckedChange = null, enabled = enabled)
Spacer(Modifier.size(12.dp))
FormatBadge(label, error = f.incomplete)
FormatBadge(label, error = f.incomplete, kind = when (label) { "CB" -> DbKind.ChessBase; "7Z", "ZIP" -> DbKind.Archive; else -> DbKind.Pgn })
Column(Modifier.weight(1f).padding(start = 16.dp)) {
Text(f.name, style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)
val where = if (f.path.isEmpty()) note else "${f.path} · $note"

View file

@ -10,6 +10,8 @@ import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.gestures.awaitEachGesture
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@ -29,10 +31,14 @@ import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalViewConfiguration
import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.semantics.CustomAccessibilityAction
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.customActions
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.drawText
@ -40,6 +46,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.rememberTextMeasurer
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.caverock.androidsvg.SVG
import io.github.vrubelroman.chesspenguin.data.BoardTheme
@ -119,12 +126,51 @@ fun boardCorner(context: Context, file: String, size: Int): ImageBitmap? = runCa
}
}.getOrNull()
/// "e4" of the square with index `i` of [placement] (a8 = 0).
fun squareName(i: Int): String = "${'a' + i % 8}${'8' - i / 8}"
/// Moves on the board (android-play.md §29): the legal moves of the position in UCI and
/// what to do with the one made. A pawn on the last rank becomes a queen (owner's
/// decision §29.4); `promotion` may name another piece for a from–to pair (the trainer
/// takes the line's own piece).
class BoardInput(
val legal: List<String>,
val onMove: (String) -> Unit,
val promotion: (String) -> Char? = { null },
) {
/// The squares a piece on `from` can go to.
fun targets(from: String): Set<String> = legal.filter { it.startsWith(from) }.map { it.substring(2, 4) }.toSet()
/// The move from `from` to `to`, or null when there is none.
fun move(from: String, to: String): String? {
val pair = from + to
val all = legal.filter { it.startsWith(pair) }
if (all.isEmpty()) return null
if (all.size == 1) return all[0]
val piece = promotion(pair) ?: 'q'
return all.firstOrNull { it == pair + piece } ?: all.firstOrNull { it == pair + 'q' } ?: all[0]
}
}
/// An arrow on the board: a comment's `[%cal]` or the engine's best move.
data class BoardArrow(val from: String, val to: String, val color: Color, val weight: Float = 1f)
/// A continuation attached to an arrow. Several UCI moves may share one direction
/// (promotions); in that case the callback receives all of them for an explicit choice.
data class BoardArrowMove(
val uci: String,
val from: String,
val to: String,
val actionLabel: String,
)
/// A marked square of a comment (`[%csl]`), drawn as a ring.
data class BoardMark(val square: String, val color: Color)
/// A round label over the corner of the square a move went to: the move's assessment
/// (`!!`, `?`, …) or the review's judgement, as on the desktop (board.rs `Badge`).
data class BoardBadge(val square: String, val text: String, val color: Color)
/// The comment colors of the desktop app (game_view.rs `shape_color`).
fun markColor(letter: String): Color = when (letter) {
"R" -> Color(136, 32, 32, 170)
@ -137,9 +183,60 @@ fun markColor(letter: String): Color = when (letter) {
/// The engine's arrows are blue, as on the desktop.
val EngineArrow = Color(0, 48, 136, 160)
internal fun boardCell(index: Int, square: Float, flipped: Boolean): Offset {
val row = index / 8
val col = index % 8
val (r, c) = if (flipped) (7 - row) to (7 - col) else row to col
return Offset(c * square, r * square)
}
private data class ArrowGeometry(val start: Offset, val base: Offset, val tip: Offset)
private fun arrowGeometry(from: Offset, to: Offset, square: Float, weight: Float): ArrowGeometry? {
val delta = to - from
val length = delta.getDistance()
if (length < 1f) return null
val direction = delta / length
val headLength = square * 0.42f * kotlin.math.sqrt(weight)
val tip = to - direction * (square * 0.12f)
return ArrowGeometry(from + direction * (square * 0.2f), tip - direction * headLength, tip)
}
private fun distanceToSegment(point: Offset, start: Offset, end: Offset): Float {
val segment = end - start
val length2 = segment.x * segment.x + segment.y * segment.y
if (length2 < 1f) return (point - start).getDistance()
val t = (((point - start).x * segment.x + (point - start).y * segment.y) / length2).coerceIn(0f, 1f)
return (point - (start + segment * t)).getDistance()
}
/// Hit testing uses the same square transform and arrow endpoints as drawing. The head
/// has at least a 48 dp target; shaft corridors stay narrower so neighbours do not all
/// become one arbitrary shortcut.
internal fun arrowHits(
point: Offset,
square: Float,
flipped: Boolean,
moves: List<BoardArrowMove>,
headRadius: Float,
): List<BoardArrowMove> {
if (square <= 0f || point.x < 0 || point.y < 0 || point.x > square * 8 || point.y > square * 8) return emptyList()
val corridor = maxOf(square * 0.16f, headRadius * 0.5f)
return moves.filter { move ->
val from = squareIndex(move.from) ?: return@filter false
val to = squareIndex(move.to) ?: return@filter false
val center = Offset(square / 2, square / 2)
val geometry = arrowGeometry(boardCell(from, square, flipped) + center, boardCell(to, square, flipped) + center, square, 1f) ?: return@filter false
(point - geometry.tip).getDistance() <= headRadius ||
distanceToSegment(point, geometry.start, geometry.base) <= corridor ||
distanceToSegment(point, geometry.base, geometry.tip) <= corridor
}
}
/// The board: full width, the chosen board and pieces, the last move lit, the
/// coordinates inside the edge squares (as on Lichess). It takes no touches in the first
/// version (docs/design/android-ui.md §7.2). A move slides into place (250 ms).
/// coordinates inside the edge squares (as on Lichess). With `input` a move is made by
/// tapping a piece and then a square, or by dragging it (android-play.md §29.2–29.3);
/// without it the board takes no touches. A move slides into place (250 ms).
@Composable
fun Board(
fen: String,
@ -152,9 +249,17 @@ fun Board(
description: String,
modifier: Modifier = Modifier,
arrows: List<BoardArrow> = emptyList(),
arrowMoves: List<BoardArrowMove> = emptyList(),
onArrowMoves: (List<String>) -> Unit = {},
marks: List<BoardMark> = emptyList(),
check: Boolean = false,
animated: Boolean = true,
input: BoardInput? = null,
/// Two squares lit red: a wrong move of the trainer, shown for a moment (§32.2).
alert: Pair<String, String>? = null,
/// The files and ranks along the edges (none on a small board that only shows).
coordinates: Boolean = true,
badge: BoardBadge? = null,
) {
val colors = LocalChessColors.current
val context = LocalContext.current
@ -185,20 +290,102 @@ fun Board(
}
val coordStyle = TextStyle(fontSize = 10.sp, fontWeight = FontWeight.Medium)
val density = LocalDensity.current
// A move being made: the piece chosen, and while dragged, where the finger is.
var selected by remember(fen) { mutableStateOf<Int?>(null) }
var dragAt by remember(fen) { mutableStateOf<Offset?>(null) }
val slop = LocalViewConfiguration.current.touchSlop
val currentInput = androidx.compose.runtime.rememberUpdatedState(input)
val currentArrowMoves = androidx.compose.runtime.rememberUpdatedState(arrowMoves)
val currentArrowAction = androidx.compose.runtime.rememberUpdatedState(onArrowMoves)
val lift = with(density) { 22.dp.toPx() }
fun indexAt(p: Offset, sq: Float): Int? {
val col = (p.x / sq).toInt()
val row = (p.y / sq).toInt()
if (p.x < 0 || p.y < 0 || col !in 0..7 || row !in 0..7) return null
return if (flipped) (7 - row) * 8 + (7 - col) else row * 8 + col
}
val touch = if (input == null) Modifier else Modifier.pointerInput(fen, flipped) {
awaitEachGesture {
val down = awaitFirstDown()
val inp = currentInput.value ?: return@awaitEachGesture
val sq = size.width / 8f
val start = indexAt(down.position, sq) ?: return@awaitEachGesture
val startName = squareName(start)
val movable = inp.targets(startName).isNotEmpty()
val was = selected
// A tap on a target of the piece chosen makes the move. An already chosen
// piece always has priority over continuation arrows.
if (was != null && start != was) {
inp.move(squareName(was), startName)?.let { m ->
selected = null
inp.onMove(m)
return@awaitEachGesture
}
}
if (movable) selected = start
val shortcutCandidate = was == null && !movable
var dragging = false
while (true) {
val e = awaitPointerEvent()
val c = e.changes.firstOrNull { it.id == down.id } ?: break
if (!c.pressed) {
if (dragging) {
val end = indexAt(c.position, sq)
dragAt = null
val m = end?.let { inp.move(startName, squareName(it)) }
if (m != null) {
selected = null
inp.onMove(m)
}
// A drop elsewhere: the piece goes back, still chosen.
} else {
if (!movable || start == was) {
// A tap on the same piece, an empty square or the other side's
// piece: nothing chosen any more.
selected = null
}
if (shortcutCandidate) {
val hits = arrowHits(
c.position,
sq,
flipped,
currentArrowMoves.value,
with(density) { 24.dp.toPx() },
)
if (hits.isNotEmpty()) currentArrowAction.value(hits.map { it.uci }.distinct())
}
}
c.consume()
break
}
if (!dragging && (c.position - down.position).getDistance() > slop) dragging = true
if (dragging) {
if (movable) dragAt = c.position
c.consume()
}
}
}
}
Canvas(
modifier
.aspectRatio(1f)
.onSizeChanged { side = it.width }
.semantics { contentDescription = description },
.then(touch)
.semantics {
contentDescription = description
if (arrowMoves.isNotEmpty()) {
customActions = arrowMoves.map { move ->
CustomAccessibilityAction(move.actionLabel) {
onArrowMoves(listOf(move.uci))
true
}
}
}
},
) {
val sq = size.width / 8f
val px = sq.toInt()
fun cell(i: Int): Offset {
val row = i / 8
val col = i % 8
val (r, c) = if (flipped) (7 - row) to (7 - col) else row to col
return Offset(c * sq, r * sq)
}
fun cell(i: Int): Offset = boardCell(i, sq, flipped)
val image = texture
if (image != null) {
// The squares of the image are the same seen from either side: it is not turned.
@ -209,6 +396,17 @@ fun Board(
if (image == null) drawRect(if (light) theme.light else theme.dark, cell(i), Size(sq, sq))
if (i == from || i == to) drawRect(colors.lastMove, cell(i), Size(sq, sq))
}
alert?.let { (a, b) ->
// A fill and a ring: seen on dark squares of every board too.
for (sqName in listOf(a, b)) squareIndex(sqName)?.let {
val c = cell(it)
drawRect(Color(220, 40, 40, 153), c, Size(sq, sq))
val w = with(density) { 3.dp.toPx() }
drawRect(Color(186, 26, 26), c + Offset(w / 2, w / 2), Size(sq - w, sq - w), style = Stroke(width = w))
}
}
val chosen = selected
if (chosen != null) drawRect(colors.lastMove.copy(alpha = 0.5f), cell(chosen), Size(sq, sq))
for (m in marks) {
val i = squareIndex(m.square) ?: continue
val c = cell(i)
@ -239,15 +437,33 @@ fun Board(
if (p == ' ') continue
val bmp = pieces.bitmap(set, p, px) ?: continue
var at = cell(i)
// The piece being dragged: faint on its square, drawn under the finger below.
if (i == chosen && dragAt != null) {
drawImage(bmp, dstOffset = IntOffset(at.x.toInt(), at.y.toInt()), dstSize = IntSize(px, px), alpha = 0.3f)
continue
}
if (animate && i == to && from != null && slide.value < 1f) {
val start = cell(from)
at = Offset(start.x + (at.x - start.x) * slide.value, start.y + (at.y - start.y) * slide.value)
}
drawImage(bmp, dstOffset = IntOffset(at.x.toInt(), at.y.toInt()), dstSize = IntSize(px, px))
}
// Where the piece chosen can go: a dot, a ring round a capture (as on Lichess).
if (chosen != null && input != null) {
val shade = Color(0, 0, 0, 64)
for (t in input.targets(squareName(chosen))) {
val i = squareIndex(t) ?: continue
val c = cell(i) + Offset(sq / 2, sq / 2)
if (squares[i] != ' ') {
drawCircle(shade, radius = sq / 2 - sq * 0.045f, center = c, style = Stroke(width = sq * 0.09f))
} else {
drawCircle(shade, radius = sq * 0.155f, center = c)
}
}
}
// Over the pieces, so that b, c, f, g stay readable (as on Lichess).
// Coordinates: files along the bottom edge, ranks along the left edge.
for (k in 0 until 8) {
for (k in 0 until (if (coordinates) 8 else 0)) {
val fileIndex = if (flipped) 7 - k else k
val rankIndex = if (flipped) k else 7 - k
val bottomLight = (7 + k) % 2 == 0
@ -262,28 +478,53 @@ fun Board(
val t = squareIndex(a.to) ?: continue
drawArrow(cell(f) + Offset(sq / 2, sq / 2), cell(t) + Offset(sq / 2, sq / 2), sq, a)
}
badge?.let { b ->
val i = squareIndex(b.square) ?: return@let
val c = cell(i)
// Readable on a small board too (a split screen).
val r = maxOf(sq * 0.21f, with(density) { 9.dp.toPx() })
// Over the corner of the square, kept inside the board.
val center = Offset(
(c.x + sq - r * 0.35f).coerceAtMost(size.width - r - 1f),
(c.y + r * 0.35f).coerceAtLeast(r + 1f),
)
drawCircle(Color(0, 0, 0, 90), r, center + Offset(0f, sq * 0.015f))
drawCircle(b.color, r, center)
drawCircle(Color.White, r, center, style = Stroke(width = sq * 0.025f))
val label = measurer.measure(
b.text,
TextStyle(color = Color.White, fontWeight = FontWeight.Black, fontSize = with(density) { (r * 1.05f).toSp() }),
)
drawText(label, topLeft = center - Offset(label.size.width / 2f, label.size.height / 2f))
}
// The dragged piece: bigger and lifted above the finger, a shade on the square
// under it so that one sees where it goes.
val held = dragAt
if (held != null && chosen != null) {
val under = indexAt(held, sq)
if (under != null) drawCircle(Color(0, 0, 0, 31), radius = sq, center = cell(under) + Offset(sq / 2, sq / 2))
val big = (px * 1.5f).toInt()
pieces.bitmap(set, squares[chosen], big)?.let {
drawImage(it, dstOffset = IntOffset((held.x - big / 2f).toInt(), (held.y - lift - big / 2f).toInt()), dstSize = IntSize(big, big))
}
}
}
}
/// An arrow as on the desktop (board.rs `draw_arrow`): a shaft and a head that stops
/// short of the square's center.
private fun DrawScope.drawArrow(from: Offset, to: Offset, sq: Float, a: BoardArrow) {
val geometry = arrowGeometry(from, to, sq, a.weight) ?: return
val d = to - from
val len = d.getDistance()
if (len < 1f) return
val dir = d / len
val dir = d / d.getDistance()
val width = sq * 0.16f * a.weight
val headLen = sq * 0.42f * kotlin.math.sqrt(a.weight)
val headW = sq * 0.38f * kotlin.math.sqrt(a.weight)
val tip = to - dir * (sq * 0.12f)
val base = tip - dir * headLen
val start = from + dir * (sq * 0.2f)
val normal = Offset(-dir.y, dir.x)
drawLine(a.color, start, base, strokeWidth = width)
drawLine(a.color, geometry.start, geometry.base, strokeWidth = width)
val head = Path().apply {
moveTo(tip.x, tip.y)
lineTo(base.x + normal.x * headW, base.y + normal.y * headW)
lineTo(base.x - normal.x * headW, base.y - normal.y * headW)
moveTo(geometry.tip.x, geometry.tip.y)
lineTo(geometry.base.x + normal.x * headW, geometry.base.y + normal.y * headW)
lineTo(geometry.base.x - normal.x * headW, geometry.base.y - normal.y * headW)
close()
}
drawPath(head, a.color)

View file

@ -1,11 +1,14 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.border
import androidx.compose.ui.graphics.Color
@ -32,6 +35,12 @@ import androidx.compose.ui.text.withStyle
import io.github.vrubelroman.chesspenguin.ChessPenguinApp
import io.github.vrubelroman.chesspenguin.R
import io.github.vrubelroman.chesspenguin.theme.Tabular
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.fillMaxSize
import io.github.vrubelroman.chesspenguin.theme.kindColor
import io.github.vrubelroman.chesspenguin.theme.LocalChessColors
import io.github.vrubelroman.chesspenguin.theme.DbKind
import io.github.vrubelroman.chesspenguin.data.Notation
import io.github.vrubelroman.chesspenguin.data.DbEntry
import io.github.vrubelroman.chesspenguin.data.Source
@ -72,21 +81,57 @@ fun formatName(e: DbEntry): String = when (e.fileName.substringAfterLast('.', ""
else -> "PGN"
}
/// What kind of database an entry is (its badge's colour, android-lists.md §5.1).
fun kindOf(e: DbEntry): DbKind {
return when {
e.source == Source.Own -> DbKind.Own
e.source == Source.Online -> DbKind.Online
else -> when (badge(e)) {
"CB" -> DbKind.ChessBase
"7Z", "ZIP" -> DbKind.Archive
else -> DbKind.Pgn
}
}
}
/// A database's badge: 40 dp, the colour of its kind, a word or an icon on it.
@Composable
fun FormatBadge(text: String, error: Boolean = false) {
fun KindBadge(
kind: DbKind,
error: Boolean = false,
content: @Composable (Color) -> Unit,
) {
val c = kindColor(kind, LocalChessColors.current.dark)
Box(
Modifier
.size(40.dp)
.clip(RoundedCornerShape(8.dp))
.background(if (error) MaterialTheme.colorScheme.errorContainer else MaterialTheme.colorScheme.primaryContainer),
.clip(RoundedCornerShape(10.dp))
.background(if (error) MaterialTheme.colorScheme.errorContainer else c.container),
contentAlignment = Alignment.Center,
) {
Text(
text,
style = MaterialTheme.typography.labelSmall,
color = if (error) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.onPrimaryContainer,
)
}
) { content(if (error) MaterialTheme.colorScheme.error else c.content) }
}
@Composable
fun FormatBadge(text: String, error: Boolean = false, kind: DbKind = DbKind.Pgn) {
KindBadge(kind, error) { color -> Text(text, style = MaterialTheme.typography.labelSmall, color = color) }
}
/// The shape of a card in a group of `count` (android-lists.md §5.3): 16 dp outside,
/// 4 dp where it meets its neighbours.
fun groupShape(index: Int, count: Int): RoundedCornerShape {
val top = if (index == 0) 16.dp else 4.dp
val bottom = if (index == count - 1) 16.dp else 4.dp
return RoundedCornerShape(topStart = top, topEnd = top, bottomStart = bottom, bottomEnd = bottom)
}
/// A row of a group drawn as its card: 12 dp from the screen's edges, 2 dp between cards.
@Composable
fun Modifier.groupCard(index: Int, count: Int): Modifier {
val shape = groupShape(index, count)
return this
.padding(start = 12.dp, end = 12.dp, bottom = 2.dp)
.clip(shape)
.background(MaterialTheme.colorScheme.surfaceContainerLow, shape)
}
/// "Carlsen, Magnus" → "Carlsen M."; other names stay as in the file (§6.2).
@ -110,11 +155,57 @@ fun PlayerName(
color: Color = Color.Unspecified,
maxLines: Int = 1,
abbreviate: Boolean = true,
/// Words searched for: shown marked where they are in the name as shown.
highlight: String? = null,
) {
val measurer = rememberTextMeasurer()
BoxWithConstraints(modifier) {
val text = if (abbreviate && measurer.measure(name, style, softWrap = false).size.width > constraints.maxWidth) shortName(name) else name
Text(text, style = style, color = color, maxLines = maxLines, overflow = TextOverflow.Ellipsis)
Text(highlighted(text, highlight), style = style, color = color, maxLines = maxLines, overflow = TextOverflow.Ellipsis)
}
}
/// `text` with the first place of each searched word marked (android-lists.md §3.7);
/// case does not matter.
@Composable
fun highlighted(text: String, query: String?): AnnotatedString {
val words = query?.split(' ')?.filter { it.isNotBlank() }.orEmpty()
if (words.isEmpty()) return AnnotatedString(text)
val mark = SpanStyle(
background = MaterialTheme.colorScheme.primaryContainer,
color = MaterialTheme.colorScheme.onPrimaryContainer,
)
return buildAnnotatedString {
append(text)
for (w in words) {
val at = text.indexOf(w, ignoreCase = true)
if (at >= 0) addStyle(mark, at, at + w.length)
}
}
}
/// A player's share of the result in the list of games (android-lists.md §3.3): the
/// winner's «1» on a tile, «½» on a quieter one, a loss as a plain «0».
@Composable
fun ResultTile(result: String?) {
// At least 24×20 dp; it grows with the font.
Box(Modifier.widthIn(min = 24.dp).heightIn(min = 20.dp), contentAlignment = Alignment.Center) {
when (result) {
"1" -> Box(
Modifier.widthIn(min = 24.dp).heightIn(min = 20.dp).clip(RoundedCornerShape(6.dp)).background(MaterialTheme.colorScheme.primaryContainer),
contentAlignment = Alignment.Center,
) {
Text("1", style = MaterialTheme.typography.labelLarge.merge(Tabular), fontWeight = FontWeight.Bold, color = MaterialTheme.colorScheme.onPrimaryContainer)
}
"½" -> Box(
Modifier.widthIn(min = 24.dp).heightIn(min = 20.dp).clip(RoundedCornerShape(6.dp)).background(MaterialTheme.colorScheme.surfaceContainerHigh),
contentAlignment = Alignment.Center,
) {
Text("½", style = MaterialTheme.typography.labelLarge.merge(Tabular), color = MaterialTheme.colorScheme.onSurface)
}
null -> {}
else -> Text(result, style = MaterialTheme.typography.labelLarge.merge(Tabular), color = MaterialTheme.colorScheme.onSurfaceVariant)
}
}
}
@ -131,11 +222,14 @@ fun elo(value: String): String = value.trim().takeIf { v -> v.toIntOrNull()?.let
/// The colour of a side: a small disc (white with a rim, or black).
@Composable
fun SideDisc(white: Boolean) {
fun SideDisc(white: Boolean, size: androidx.compose.ui.unit.Dp = 12.dp) {
// Black darker than any background, white whiter; the ring in the text's muted colour
// keeps either from reading as an empty circle (android-lists.md §3.2).
val dark = LocalChessColors.current.dark
Box(
Modifier.size(12.dp).clip(CircleShape)
.background(if (white) Color(0xFFF5F5F0) else Color(0xFF26282B))
.border(1.dp, MaterialTheme.colorScheme.outline, CircleShape),
Modifier.size(size).clip(CircleShape)
.background(if (white) Color.White else if (dark) Color(0xFF0E0F10) else Color(0xFF1C1D1F))
.border(1.dp, MaterialTheme.colorScheme.onSurfaceVariant, CircleShape),
)
}
@ -151,6 +245,8 @@ fun PlayerLine(
nameColor: Color = Color.Unspecified,
maxLines: Int = 1,
abbreviate: Boolean = true,
/// What the player is doing now («thinking…» of Maia, android-play.md §31.3).
status: String? = null,
) {
Row(modifier, verticalAlignment = Alignment.CenterVertically) {
if (disc != null) {
@ -164,6 +260,10 @@ fun PlayerLine(
Text(elo, style = MaterialTheme.typography.bodyMedium.merge(Tabular), color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 1)
}
}
if (status != null) {
androidx.compose.material3.CircularProgressIndicator(Modifier.size(14.dp), strokeWidth = 2.dp)
Text(status, Modifier.padding(start = 6.dp), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 1, softWrap = false)
}
Text(
result ?: "",
style = style.merge(Tabular),

View file

@ -1,5 +1,15 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.foundation.layout.heightIn
import androidx.compose.material3.ButtonDefaults
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.width
import androidx.compose.ui.text.font.FontWeight
import io.github.vrubelroman.chesspenguin.theme.DbKind
import androidx.compose.material.icons.rounded.CloudDownload
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.text.SpanStyle
import android.content.ClipboardManager
import android.text.format.DateUtils
import androidx.activity.compose.rememberLauncherForActivityResult
@ -22,16 +32,24 @@ import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.background
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.ui.draw.clip
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Add
import androidx.compose.material.icons.rounded.EditNote
import androidx.compose.material.icons.rounded.Close
import androidx.compose.material.icons.rounded.SmartToy
import androidx.compose.material.icons.rounded.MoreVert
import androidx.compose.material.icons.rounded.Settings
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExtendedFloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
@ -48,7 +66,6 @@ import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@ -82,7 +99,7 @@ import kotlinx.coroutines.launch
/// The first screen: the databases on the list (android-ui.md §3).
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSettings: () -> Unit, onOnline: () -> Unit) {
fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSettings: () -> Unit, onOnline: () -> Unit, onNewGame: () -> Unit, onPlay: () -> Unit) {
val library = app().library
val downloads = app().downloads
val views by downloads.views.collectAsState()
@ -91,6 +108,7 @@ fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSett
val scope = rememberCoroutineScope()
val removedText = stringResource(R.string.removed)
val removedCopyText = stringResource(R.string.removed_copy)
val removedOwnText = stringResource(R.string.own_removed)
val update = shownUpdate()
val offersOffText = stringResource(R.string.upd_offers_off_snack)
val offersUndoText = stringResource(R.string.undo)
@ -141,7 +159,62 @@ fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSett
}
val add = { choosing = true }
var renaming by remember { mutableStateOf<DbEntry?>(null) }
// Own databases (android-play.md §30): a new one asked for, one to delete asked about.
var creating by remember { mutableStateOf(false) }
var deleting by remember { mutableStateOf<DbEntry?>(null) }
var exporting by remember { mutableStateOf<DbEntry?>(null) }
val context = androidx.compose.ui.platform.LocalContext.current
val exportedText = stringResource(R.string.own_exported)
val exportFailedText = stringResource(R.string.own_export_failed)
val export = rememberLauncherForActivityResult(ActivityResultContracts.CreateDocument("application/x-chess-pgn")) { uri ->
val e = exporting
exporting = null
if (uri == null || e == null) return@rememberLauncherForActivityResult
scope.launch {
val ok = withContext(Dispatchers.IO) {
runCatching {
context.contentResolver.openOutputStream(uri, "wt")!!.use { out -> library.ownFile(e).inputStream().use { it.copyTo(out) } }
}.isSuccess
}
snackbar.currentSnackbarData?.dismiss()
snackbar.showSnackbar(if (ok) exportedText else exportFailedText)
}
}
val own = entries.filter { it.source == Source.Own }
val theApp = app()
val adjourned by theApp.maiaGames.current.collectAsState()
// Back on the list of databases, a list of games was left: its mark goes (android-lists.md §3.6).
LaunchedEffect(Unit) { theApp.lastOpened.clear() }
val playRemovedText = stringResource(R.string.play_removed)
val keptText = stringResource(R.string.player_kept_unfinished)
var playing by remember { mutableStateOf(false) }
// A game put aside: asked about before a new one replaces it.
var askingAdjourned by remember { mutableStateOf(false) }
adjourned?.takeIf { askingAdjourned && !it.over }?.let { m ->
AdjournedQuestion(m, onContinue = {
askingAdjourned = false
onPlay()
}, onNew = {
askingAdjourned = false
playing = true
}, onDismiss = { askingAdjourned = false })
}
val eventText = stringResource(R.string.play_event)
if (playing) {
PlaySheet(null, onPlay = { choice ->
playing = false
val s = uniffi.mobile_api.GameSession.newGame("")
beginComputerGame(theApp, s, choice.meta(0), eventText, null)
s.close()
onPlay()
}, onDismiss = { playing = false })
}
val files = entries.filter { it.source != Source.Own }
val list = rememberLazyListState()
// The card of a game just put aside is brought into sight.
LaunchedEffect(adjourned) {
if (adjourned?.over == false) list.animateScrollToItem(0)
}
// The card comes when GitHub answers, after the list is drawn: a list at its top then
// keeps its first database in place and the card lands above the screen. It is
// brought into sight; a list scrolled down by the user stays where it is.
@ -149,12 +222,9 @@ fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSett
LaunchedEffect(cardShown) {
if (cardShown && list.firstVisibleItemIndex == 1 && list.firstVisibleItemScrollOffset == 0) list.animateScrollToItem(0)
}
val expanded by remember { derivedStateOf { list.firstVisibleItemIndex == 0 } }
val scroll = TopAppBarDefaults.pinnedScrollBehavior()
// The samples are small: read them at once, so their rows show the number of games.
LaunchedEffect(Unit) {
library.entries.value.filter { it.source == Source.Sample && it.games == null }.forEach { library.database(it.id) }
}
LaunchedEffect(Unit) { library.countSamples() }
Scaffold(
modifier = Modifier.nestedScroll(scroll.nestedScrollConnection),
@ -168,19 +238,6 @@ fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSett
)
},
snackbarHost = { SnackbarHost(snackbar) },
floatingActionButton = {
if (entries.isNotEmpty()) {
val addLabel = stringResource(R.string.add_database)
ExtendedFloatingActionButton(
// Folded while the list is scrolled: its label is still read out.
modifier = Modifier.semantics { contentDescription = addLabel },
onClick = add,
expanded = expanded,
icon = { Icon(Icons.Rounded.Add, null) },
text = { Text(stringResource(R.string.add_database)) },
)
}
},
) { padding ->
if (entries.isEmpty()) {
Column(Modifier.padding(padding)) {
@ -194,11 +251,165 @@ fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSett
LazyColumn(
Modifier.fillMaxSize(),
state = list,
contentPadding = PaddingValues(top = padding.calculateTopPadding(), bottom = padding.calculateBottomPadding() + 88.dp),
contentPadding = PaddingValues(top = padding.calculateTopPadding(), bottom = padding.calculateBottomPadding() + 16.dp),
) {
// A newer version of the app (android-ui.md §25.2): the first item of the list.
update?.let { u -> item(key = "update") { UpdateCard(u, onDismissed = onUpdateDismissed, modifier = Modifier.animateItem()) } }
items(entries, key = { it.id }) { e ->
// A game against the computer put aside (§31.7): go on with it, or let it go.
adjourned?.takeIf { !it.over }?.let { m ->
item(key = "adjourned") {
// The game's position on a small board, the side and the move, and
// «Continue» as the screen's main action while it waits (android-lists.md §5.4).
val shownAt = remember(m) { adjournedPosition(theApp.maiaGames.pgn()) }
val sideText = stringResource(if (m.userWhite) R.string.play_as_white else R.string.play_as_black)
// «you play Black · move 2», Rodent's character first, as the game's header
// says it (android-rodent.md §6.5): «Tal · you play Black · move 2».
val played = shownAt?.second?.let { stringResource(R.string.play_adjourned_sub, sideText, stringResource(R.string.play_move_n, it)) } ?: sideText
val sub = listOfNotNull(m.styleShown(), played).joinToString(" · ")
val title = stringResource(R.string.play_adjourned_title, m.label())
Row(
Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 4.dp)
.clip(RoundedCornerShape(16.dp))
.background(MaterialTheme.colorScheme.primaryContainer)
.clickable(onClick = onPlay)
.semantics(mergeDescendants = true) {}
.padding(start = 12.dp, top = 12.dp, bottom = 12.dp, end = 4.dp),
verticalAlignment = Alignment.Top,
) {
shownAt?.let { (fen, _) ->
Box(Modifier.clip(RoundedCornerShape(6.dp))) { MiniBoard(fen, flipped = !m.userWhite, size = 72.dp) }
Spacer(Modifier.width(12.dp))
}
Column(Modifier.weight(1f)) {
Text(title, style = MaterialTheme.typography.bodyLarge, fontWeight = FontWeight.Medium, color = MaterialTheme.colorScheme.onPrimaryContainer)
Text(sub, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onPrimaryContainer)
Spacer(Modifier.height(8.dp))
Button(onClick = onPlay, modifier = Modifier.heightIn(min = 32.dp), contentPadding = PaddingValues(horizontal = 16.dp, vertical = 4.dp)) {
Text(stringResource(R.string.play_continue))
}
}
IconButton(onClick = {
// Played on both sides: kept in the player's database,
// unfinished (no «Undo»: it is there to be deleted).
val kept = theApp.playerGames.keepUnfinished(theApp.maiaGames, theApp.settings.prefs.value.recordGames, scope) { w ->
scope.launch {
snackbar.currentSnackbarData?.dismiss()
snackbar.showSnackbar(String.format(keptText, w.name))
}
}
if (kept) {
theApp.maiaGames.clear()
return@IconButton
}
val pgn = theApp.maiaGames.pgn()
theApp.maiaGames.clear()
scope.launch {
snackbar.currentSnackbarData?.dismiss()
if (snackbar.showSnackbar(playRemovedText, undoText, duration = SnackbarDuration.Long) == SnackbarResult.ActionPerformed && pgn != null) {
theApp.maiaGames.begin(pgn, m)
}
}
}) { Icon(Icons.Rounded.Close, stringResource(R.string.close)) }
}
}
}
item(key = "actions") {
// Two equal buttons over the whole width (android-lists.md §5.5).
// Neutral, as the cards' edges: the blue stays for the game put aside.
val quiet = ButtonDefaults.filledTonalButtonColors(
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
contentColor = MaterialTheme.colorScheme.onSurface,
)
Row(Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 8.dp), horizontalArrangement = Arrangement.spacedBy(12.dp)) {
// «Play»: the opponent is chosen on the sheet (android-rodent.md, question 6).
val playLabel = stringResource(R.string.play_button_cd)
FilledTonalButton(
onClick = { if (adjourned?.over == false) askingAdjourned = true else playing = true },
modifier = Modifier.weight(1f).heightIn(min = 56.dp).semantics { contentDescription = playLabel },
shape = RoundedCornerShape(16.dp),
colors = quiet,
) {
Icon(Icons.Rounded.SmartToy, null, tint = MaterialTheme.colorScheme.primary)
Spacer(Modifier.size(8.dp))
Text(stringResource(R.string.play_button))
}
FilledTonalButton(onClick = onNewGame, modifier = Modifier.weight(1f).heightIn(min = 56.dp), shape = RoundedCornerShape(16.dp), colors = quiet) {
Icon(Icons.Rounded.Add, null, tint = MaterialTheme.colorScheme.primary)
Spacer(Modifier.size(8.dp))
Text(stringResource(R.string.new_game))
}
}
}
item(key = "own-head") {
Row(Modifier.fillMaxWidth().height(48.dp).padding(start = 16.dp, end = 4.dp), verticalAlignment = Alignment.CenterVertically) {
Text(stringResource(R.string.own_databases), Modifier.weight(1f), style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary)
TextButton(onClick = { creating = true }) { Text(stringResource(R.string.own_new)) }
}
}
if (own.isEmpty()) {
item(key = "own-empty") {
Text(
stringResource(R.string.own_empty),
Modifier.padding(start = 16.dp, end = 16.dp, bottom = 8.dp),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
}
items(own.size, key = { own[it].id }) { k ->
val e = own[k]
OwnRow(
e,
player = theApp.playerGames.isPlayers(e.id),
onOpen = { onOpen(e.id) },
onRename = { renaming = e },
onExport = {
exporting = e
export.launch(e.name + ".pgn")
},
onDelete = {
if ((e.games ?: 0) == 0) {
val removed = library.remove(e.id) ?: return@OwnRow
scope.launch {
snackbar.currentSnackbarData?.dismiss()
var restored = false
try {
if (snackbar.showSnackbar(removedOwnText, undoText, withDismissAction = false, duration = SnackbarDuration.Long) == SnackbarResult.ActionPerformed) {
library.restore(removed.first, removed.second)
restored = true
}
} finally {
if (!restored) library.forget(removed.second)
}
}
} else {
deleting = e
}
},
modifier = Modifier.animateItem().groupCard(k, own.size),
)
}
// «+ Add» in the section's heading, as «+ New database» in its own: nothing
// floats over the list.
item(key = "files-head") {
val addLabel = stringResource(R.string.add_database)
Row(Modifier.fillMaxWidth().padding(top = 8.dp).height(48.dp).padding(start = 16.dp, end = 4.dp), verticalAlignment = Alignment.CenterVertically) {
Text(stringResource(R.string.files), Modifier.weight(1f), style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary)
TextButton(onClick = add, modifier = Modifier.semantics { contentDescription = addLabel }) { Text(stringResource(R.string.files_add)) }
}
}
if (files.isEmpty()) {
item(key = "files-empty") {
Text(
stringResource(R.string.files_empty),
Modifier.padding(start = 16.dp, end = 16.dp, bottom = 8.dp),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
}
items(files.size, key = { files[it].id }) { k ->
val e = files[k]
DatabaseRow(
e,
download = views[e.id],
@ -231,13 +442,12 @@ fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSett
}
}
},
modifier = Modifier.animateItem(),
modifier = Modifier.animateItem().groupCard(k, files.size),
)
}
}
}
}
val context = androidx.compose.ui.platform.LocalContext.current
val pasteNone = stringResource(R.string.paste_none)
val resources = LocalResources.current
if (choosing) {
@ -304,11 +514,119 @@ fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSett
)
}
renaming?.let { e ->
RenameDialog(displayName(e), onDismiss = { renaming = null }, onSave = {
RenameDialog(displayName(e), own = e.source == Source.Own, onDismiss = { renaming = null }, onSave = {
library.rename(e.id, it)
renaming = null
})
}
if (creating) {
NewOwnDialog(
suggested = freeName(stringResource(R.string.own_default_name), own.map { it.name }),
onDismiss = { creating = false },
onCreate = { name ->
creating = false
scope.launch { runCatching { library.createOwn(name) } }
},
)
}
deleting?.let { e ->
val n = e.games ?: 0
AlertDialog(
onDismissRequest = { deleting = null },
title = { Text(stringResource(R.string.own_delete_title, displayName(e))) },
text = { Text(pluralStringResource(R.plurals.own_delete_text, n, groupDigits(n))) },
confirmButton = {
TextButton(onClick = {
deleting = null
library.remove(e.id)?.let { library.forget(it.second) }
}) { Text(stringResource(R.string.delete), color = MaterialTheme.colorScheme.error) }
},
dismissButton = { TextButton(onClick = { deleting = null }) { Text(stringResource(R.string.cancel)) } },
)
}
}
/// "My games", or "My games 2" when that one is taken.
fun freeName(base: String, taken: List<String>): String {
if (base !in taken) return base
var i = 2
while ("$base $i" in taken) i++
return "$base $i"
}
@Composable
private fun NewOwnDialog(suggested: String, onDismiss: () -> Unit, onCreate: (String) -> Unit) {
var value by remember { mutableStateOf(TextFieldValue(suggested, TextRange(0, suggested.length))) }
val trimmed = value.text.trim()
AlertDialog(
onDismissRequest = onDismiss,
title = { Text(stringResource(R.string.own_new_title)) },
text = {
OutlinedTextField(
value = value,
onValueChange = { value = it },
singleLine = true,
label = { Text(stringResource(R.string.own_name)) },
supportingText = { Text(stringResource(R.string.own_new_hint)) },
)
},
confirmButton = { TextButton(onClick = { onCreate(trimmed) }, enabled = trimmed.isNotEmpty()) { Text(stringResource(R.string.create)) } },
dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.cancel)) } },
)
}
/// An own database: its games are the user's, kept on the phone (android-play.md §30.2).
@OptIn(ExperimentalFoundationApi::class)
@Composable
private fun OwnRow(e: DbEntry, player: Boolean, onOpen: () -> Unit, onRename: () -> Unit, onExport: () -> Unit, onDelete: () -> Unit, modifier: Modifier) {
var menu by remember { mutableStateOf(false) }
val n = e.games ?: 0
Box(modifier) {
Row(
Modifier
.fillMaxWidth()
.height(72.dp)
.combinedClickable(onClick = onOpen, onLongClick = { menu = true })
.padding(start = 12.dp, end = 4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
KindBadge(DbKind.Own) { color ->
// A player's database (games against Maia written by themselves): a knight.
if (player) {
Text("♞", style = MaterialTheme.typography.titleLarge, color = color)
} else {
Icon(Icons.Rounded.EditNote, null, tint = color)
}
}
Column(Modifier.weight(1f).padding(start = 12.dp)) {
Text(displayName(e), style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(
countFirst(pluralStringResource(R.plurals.games_count, n, groupDigits(n)), stringResource(if (player) R.string.player_db_row else R.string.own_on_phone)),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
Box {
IconButton(onClick = { menu = true }) { Icon(Icons.Rounded.MoreVert, stringResource(R.string.menu)) }
DropdownMenu(expanded = menu, onDismissRequest = { menu = false }) {
DropdownMenuItem(text = { Text(stringResource(R.string.rename)) }, onClick = {
menu = false
onRename()
})
DropdownMenuItem(text = { Text(stringResource(R.string.own_export)) }, onClick = {
menu = false
onExport()
})
DropdownMenuItem(text = { Text(stringResource(R.string.own_delete)) }, onClick = {
menu = false
onDelete()
})
}
}
}
}
}
@Composable
@ -358,6 +676,7 @@ private fun DatabaseRow(
val subtitle = e.games?.let {
stringResource(R.string.games_with_format, pluralStringResource(R.plurals.games_count, it, groupDigits(it)), e.format ?: format)
} ?: stringResource(R.string.not_opened, formatName(e))
val gamesText = e.games?.let { pluralStringResource(R.plurals.games_count, it, groupDigits(it)) }
val shownSubtitle = when {
// A copy kept in the app says so: removing it deletes it.
e.source == Source.Copy -> subtitle + " · " + stringResource(R.string.db_copy)
@ -381,14 +700,20 @@ private fun DatabaseRow(
.fillMaxWidth()
.height(72.dp)
.combinedClickable(onClick = onOpen, onLongClick = { menu = true })
.padding(start = 16.dp, end = 4.dp),
.padding(start = 12.dp, end = 4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
FormatBadge(format)
Column(Modifier.weight(1f).padding(start = 16.dp)) {
// A downloaded database is told by where it comes from, not by its format.
val kind = kindOf(e)
KindBadge(kind) { color ->
if (kind == DbKind.Online) Icon(Icons.Rounded.CloudDownload, null, tint = color, modifier = Modifier.size(22.dp))
else Text(format, style = MaterialTheme.typography.labelSmall, color = color)
}
Column(Modifier.weight(1f).padding(start = 12.dp)) {
Text(displayName(e), style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(
shownSubtitle,
// The number of games stands out (a big database from a small one).
if (failure == null && gamesText != null && shownSubtitle.startsWith(gamesText)) countFirst(gamesText, shownSubtitle.removePrefix(gamesText).removePrefix(" · ")) else androidx.compose.ui.text.AnnotatedString(shownSubtitle),
style = MaterialTheme.typography.bodyMedium,
color = if (failure != null) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 1,
@ -425,7 +750,7 @@ private fun DatabaseRow(
}
@Composable
private fun RenameDialog(name: String, onDismiss: () -> Unit, onSave: (String) -> Unit) {
private fun RenameDialog(name: String, own: Boolean = false, onDismiss: () -> Unit, onSave: (String) -> Unit) {
var value by remember { mutableStateOf(TextFieldValue(name, TextRange(0, name.length))) }
val trimmed = value.text.trim()
AlertDialog(
@ -436,7 +761,8 @@ private fun RenameDialog(name: String, onDismiss: () -> Unit, onSave: (String) -
value = value,
onValueChange = { value = it },
singleLine = true,
supportingText = { Text(stringResource(R.string.rename_hint)) },
// An own database's file is ours: no "the file does not change".
supportingText = if (own) null else { { Text(stringResource(R.string.rename_hint)) } },
)
},
confirmButton = { TextButton(onClick = { onSave(trimmed) }, enabled = trimmed.isNotEmpty()) { Text(stringResource(R.string.save)) } },
@ -444,6 +770,31 @@ private fun RenameDialog(name: String, onDismiss: () -> Unit, onSave: (String) -
)
}
/// «**267 games** · PGN»: the number of games heavier and in the text's colour.
@Composable
private fun countFirst(count: String, rest: String): androidx.compose.ui.text.AnnotatedString {
val strong = SpanStyle(fontWeight = FontWeight.Medium, color = MaterialTheme.colorScheme.onSurface)
return buildAnnotatedString {
withStyle(strong) { append(count) }
if (rest.isNotEmpty()) append(" · $rest")
}
}
/// The position on the board of a game put aside, and the number of its last move.
private fun adjournedPosition(pgn: String?): Pair<String, Int>? {
pgn ?: return null
val s = runCatching { uniffi.mobile_api.GameSession.fromPgn(pgn) }.getOrNull() ?: return null
return try {
val d = s.data()
val end = lineEnd(d)
val node = d.nodes[end]
// The move to be made: after White's, the same number; after Black's, the next.
node.fen to (if (end == 0) 1 else node.moveNumber.toInt() + if (node.white) 0 else 1)
} finally {
s.close()
}
}
/// The name of pasted games: one game by its players, games of one event by it, others by
/// when they were pasted (`dated`), so that two pastes differ.
private fun pastedName(db: Database, dated: String): String {
@ -462,6 +813,8 @@ private fun pastedName(db: Database, dated: String): String {
fun finishedText(res: android.content.res.Resources, f: Finished): String? {
val s = f.view.state
val games = res.getQuantityString(R.plurals.games_count, f.games, groupDigits(f.games))
// An update of its own speaks only of new games.
if (f.quiet && (s.failure != null || s.added == 0UL)) return null
s.failure?.let { return res.getString(R.string.online_snack_failed, f.name, problemShort(res, it)) }
return when {
s.cancelled || f.games == 0 -> null

View file

@ -0,0 +1,19 @@
package io.github.vrubelroman.chesspenguin.ui
internal enum class ReviewAction { Start, Report, Wait }
/// The same availability the menu entry had, now used by the visible bottom-bar button.
internal fun reviewEnabled(
hasMoves: Boolean,
gameOn: Boolean,
sessionGame: Boolean,
loaded: Boolean,
hasData: Boolean,
running: Boolean,
): Boolean = hasMoves && !gameOn && (sessionGame || loaded) && (hasData || !running)
internal fun reviewAction(hasData: Boolean, running: Boolean): ReviewAction = when {
hasData -> ReviewAction.Report
running -> ReviewAction.Wait
else -> ReviewAction.Start
}

View file

@ -0,0 +1,171 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Close
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SegmentedButton
import androidx.compose.material3.SegmentedButtonDefaults
import androidx.compose.material3.SingleChoiceSegmentedButtonRow
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import io.github.vrubelroman.chesspenguin.R
import uniffi.mobile_api.GameData
import uniffi.mobile_api.Tag
/// "2026.10.26", "2026.10", "2026", "26.10.2026" (as people write it) → the PGN date
/// ("2026.10.26", "2026.10.??", "2026.??.??"); "" stays ""; null when it is not a date.
fun pgnDateOf(text: String): String? {
val t = text.trim()
if (t.isEmpty()) return ""
Regex("""(\d{4})(?:[.\-/](\d{1,2}|\?\?))?(?:[.\-/](\d{1,2}|\?\?))?""").matchEntire(t)?.let { m ->
val (y, mo, d) = m.destructured
return listOf(y, part(mo, 12) ?: return null, part(d, 31) ?: return null).joinToString(".").takeIf(::realDay)
}
Regex("""(\d{1,2})[.\-/](\d{1,2})[.\-/](\d{4})""").matchEntire(t)?.let { m ->
val (d, mo, y) = m.destructured
return listOf(y, part(mo, 12) ?: return null, part(d, 31) ?: return null).joinToString(".").takeIf(::realDay)
}
return null
}
private fun part(p: String, max: Int): String? = when {
p.isEmpty() || p == "??" -> "??"
p.toInt() in 1..max -> p.padStart(2, '0')
else -> null
}
/// A day that the month has (31.02 is not one).
private fun realDay(date: String): Boolean {
val (y, m, d) = date.split('.').map { it.toIntOrNull() } + listOf(null, null, null)
if (y == null || m == null || d == null) return true
return runCatching { java.time.LocalDate.of(y, m, d) }.isSuccess
}
private val RESULTS = listOf("1-0", "1/2-1/2", "0-1", "*")
/// The game's data (android-play.md §30.5): players and ratings, event, place, date,
/// round, result. Nothing is required; `done` gets the tags (empty: removed) and result.
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun GameDataForm(game: GameData, doneLabel: String, onDone: (List<Tag>, String) -> Unit, onDismiss: () -> Unit) {
fun tag(name: String) = game.tags.firstOrNull { it.name == name }?.value?.takeIf { it != "?" && !it.startsWith("????") }.orEmpty()
var white by rememberSaveable { mutableStateOf(tag("White")) }
var whiteElo by rememberSaveable { mutableStateOf(tag("WhiteElo")) }
var black by rememberSaveable { mutableStateOf(tag("Black")) }
var blackElo by rememberSaveable { mutableStateOf(tag("BlackElo")) }
var event by rememberSaveable { mutableStateOf(tag("Event")) }
var site by rememberSaveable { mutableStateOf(tag("Site")) }
var date by rememberSaveable { mutableStateOf(tag("Date")) }
var round by rememberSaveable { mutableStateOf(tag("Round")) }
var result by rememberSaveable { mutableStateOf(game.result.takeIf { it in RESULTS } ?: "*") }
val start = listOf(white, whiteElo, black, blackElo, event, site, date, round, result)
val initial = rememberSaveable { start.joinToString("\u0000") }
val changed = start.joinToString("\u0000") != initial
var asking by rememberSaveable { mutableStateOf(false) }
val pgnDate = pgnDateOf(date)
fun close() = if (changed) asking = true else onDismiss()
Dialog(onDismissRequest = ::close, properties = DialogProperties(usePlatformDefaultWidth = false, decorFitsSystemWindows = false)) {
Scaffold(
topBar = {
TopAppBar(
navigationIcon = { IconButton(onClick = ::close) { Icon(Icons.Rounded.Close, stringResource(R.string.close)) } },
title = { Text(stringResource(R.string.game_data)) },
actions = {
TextButton(enabled = pgnDate != null, onClick = {
onDone(
listOf(
Tag("White", white.trim()), Tag("WhiteElo", whiteElo.trim()),
Tag("Black", black.trim()), Tag("BlackElo", blackElo.trim()),
Tag("Event", event.trim()), Tag("Site", site.trim()),
Tag("Date", pgnDate ?: ""), Tag("Round", round.trim()),
),
result,
)
}) { Text(doneLabel) }
},
)
},
) { padding ->
Column(
Modifier.fillMaxSize().padding(padding).imePadding().verticalScroll(rememberScrollState()).padding(horizontal = 16.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
val digits = KeyboardOptions(keyboardType = KeyboardType.Number)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
OutlinedTextField(white, { white = it }, Modifier.weight(1f), label = { Text(stringResource(R.string.tag_white)) }, singleLine = true)
OutlinedTextField(whiteElo, { v -> whiteElo = v.filter(Char::isDigit).take(4) }, Modifier.width(88.dp), label = { Text(stringResource(R.string.elo)) }, singleLine = true, keyboardOptions = digits)
}
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
OutlinedTextField(black, { black = it }, Modifier.weight(1f), label = { Text(stringResource(R.string.tag_black)) }, singleLine = true)
OutlinedTextField(blackElo, { v -> blackElo = v.filter(Char::isDigit).take(4) }, Modifier.width(88.dp), label = { Text(stringResource(R.string.elo)) }, singleLine = true, keyboardOptions = digits)
}
OutlinedTextField(event, { event = it }, Modifier.fillMaxWidth(), label = { Text(stringResource(R.string.tag_event)) }, singleLine = true)
OutlinedTextField(site, { site = it }, Modifier.fillMaxWidth(), label = { Text(stringResource(R.string.tag_site)) }, singleLine = true)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
OutlinedTextField(
date, { date = it }, Modifier.weight(1f),
label = { Text(stringResource(R.string.tag_date)) },
placeholder = { Text(stringResource(R.string.date_hint)) },
singleLine = true,
isError = pgnDate == null,
supportingText = if (pgnDate == null) { { Text(stringResource(R.string.date_wrong)) } } else null,
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Phone),
)
OutlinedTextField(round, { round = it }, Modifier.width(88.dp), label = { Text(stringResource(R.string.tag_round)) }, singleLine = true)
}
Text(stringResource(R.string.tag_result), style = MaterialTheme.typography.labelLarge, modifier = Modifier.padding(top = 8.dp))
SingleChoiceSegmentedButtonRow(Modifier.fillMaxWidth().padding(bottom = 24.dp)) {
RESULTS.forEachIndexed { i, r ->
SegmentedButton(
selected = result == r,
onClick = { result = r },
shape = SegmentedButtonDefaults.itemShape(i, RESULTS.size),
) { Text(if (r == "1/2-1/2") "½-½" else r) }
}
}
}
}
if (asking) {
AlertDialog(
onDismissRequest = { asking = false },
title = { Text(stringResource(R.string.discard_changes)) },
confirmButton = {
TextButton(onClick = {
asking = false
onDismiss()
}) { Text(stringResource(R.string.discard)) }
},
dismissButton = { TextButton(onClick = { asking = false }) { Text(stringResource(R.string.keep_editing)) } },
)
}
}
}

View file

@ -1,7 +1,15 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.foundation.layout.heightIn
import kotlinx.coroutines.flow.first
import androidx.compose.runtime.snapshotFlow
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@ -65,6 +73,7 @@ import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material.icons.rounded.Download
import androidx.compose.material.icons.rounded.Groups
import io.github.vrubelroman.chesspenguin.theme.Tabular
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
@ -78,7 +87,12 @@ private const val CHUNK = 100
/// The games of a database, with a search (android-ui.md §6).
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun GamesScreen(db: String, onBack: () -> Unit, onGame: (place: Int, query: String) -> Unit) {
fun GamesScreen(
db: String,
onBack: () -> Unit,
onGame: (place: Int, query: String) -> Unit,
onPlayers: () -> Unit = {},
) {
val app = app()
val entries by app.library.entries.collectAsState()
val entry = entries.firstOrNull { it.id == db }
@ -99,8 +113,18 @@ fun GamesScreen(db: String, onBack: () -> Unit, onGame: (place: Int, query: Stri
val found = withContext(Dispatchers.Default) { app.library.listed(db, d, query) }
rows.clear()
shown = found
// New results start at the top.
list.scrollToItem(0)
// Once the new list is laid out (else the list keeps its place by a row's key).
snapshotFlow { list.layoutInfo.totalItemsCount }.first { it == found.size }
// Back from a game: it in sight; new results start at the top.
val last = app.lastOpened[db]?.takeIf { it.first == query }?.second?.takeIf { it < found.size }
val first = list.firstVisibleItemIndex
val seen = list.layoutInfo.visibleItemsInfo.size.takeIf { it > 0 } ?: 6
when {
last == null -> list.scrollToItem(0)
// Already on the screen (the list kept its place): it stays where it is.
last in first until first + seen - 1 -> {}
else -> list.scrollToItem((last - 3).coerceAtLeast(0))
}
app.shown[db] = found
}
val scroll = TopAppBarDefaults.pinnedScrollBehavior()
@ -178,6 +202,7 @@ fun GamesScreen(db: String, onBack: () -> Unit, onGame: (place: Int, query: Stri
if (query.isEmpty()) searching = false else query = ""
}) { Icon(Icons.Rounded.Close, stringResource(R.string.clear)) }
} else if (database != null) {
IconButton(onClick = onPlayers) { Icon(Icons.Rounded.Groups, stringResource(R.string.players)) }
IconButton(onClick = { searching = true }) { Icon(Icons.Rounded.Search, stringResource(R.string.search)) }
// A downloaded database: its new games from here, where they are
// looked for (android-ui.md §23.3); ✕ while they come.
@ -219,6 +244,7 @@ fun GamesScreen(db: String, onBack: () -> Unit, onGame: (place: Int, query: Stri
else -> {
// Wide enough for the database's largest number.
val numberWidth = numberWidth(database?.len()?.toInt() ?: games.size)
val last = app.lastOpened[db]?.takeIf { it.first == query }?.second
LazyColumn(Modifier.fillMaxSize(), state = list) {
items(games.size, key = { games[it].toLong() }) { place ->
val chunk = place / CHUNK
@ -227,10 +253,19 @@ fun GamesScreen(db: String, onBack: () -> Unit, onGame: (place: Int, query: Stri
if (rows[chunk] == null) {
val d = database ?: return@LaunchedEffect
val part = games.subList(chunk * CHUNK, minOf(games.size, (chunk + 1) * CHUNK))
rows[chunk] = withContext(Dispatchers.Default) { d.rowsOf(part) }
val read = withContext(Dispatchers.Default) { d.rowsOf(part) }
// Rows of a list replaced meanwhile (a new search) are not this one's.
if (shown === games) rows[chunk] = read
}
}
GameRowView(games[place].toInt() + 1, numberWidth, loaded?.getOrNull(place % CHUNK)) { onGame(place, query) }
GameRowView(
games[place].toInt() + 1,
numberWidth,
loaded?.getOrNull(place % CHUNK),
lastOpened = place == last,
divider = place < games.size - 1,
query = query,
) { onGame(place, query) }
}
}
}
@ -277,67 +312,158 @@ private fun numberWidth(count: Int): androidx.compose.ui.unit.Dp {
}
}
/// One game (§6.2): its number, White and Black each on a line of their own (with the
/// rating and the share of the result), then event · year · ECO. The row is read as one
/// sentence by TalkBack.
/// One game (§6.2, android-lists.md §3): its number, White and Black each on a line of
/// their own (a disc of the side, the rating, the share of the result), then event · year
/// and the ECO on a tag. A thin line under it; the game last opened is marked. The row
/// is read as one sentence by TalkBack.
@Composable
private fun GameRowView(number: Int, numberWidth: androidx.compose.ui.unit.Dp, row: GameRow?, onClick: () -> Unit) {
private fun GameRowView(
number: Int,
numberWidth: androidx.compose.ui.unit.Dp,
row: GameRow?,
lastOpened: Boolean,
divider: Boolean,
query: String,
onClick: () -> Unit,
) {
// 6 + 24 + 24 + 20 + 6 = 80 dp at the normal font size; the lines grow with a larger font.
val nameLine = lineHeight(MaterialTheme.typography.bodyLarge, 24.dp)
val detailsLine = lineHeight(MaterialTheme.typography.bodyMedium, 20.dp)
val said = row?.let { rowDescription(number, it) } ?: ""
Row(
val lastText = stringResource(R.string.last_opened)
val said = row?.let { rowDescription(number, it) + if (lastOpened) ". $lastText" else "" } ?: ""
val colors = MaterialTheme.colorScheme
Box(
Modifier
.fillMaxWidth()
.height(12.dp + nameLine * 2 + detailsLine)
.background(if (lastOpened) colors.surfaceContainer else Color.Transparent)
.clickable(enabled = row != null, onClick = onClick)
.clearAndSetSemantics { if (row != null) contentDescription = said }
.padding(horizontal = 16.dp, vertical = 6.dp),
verticalAlignment = Alignment.Top,
.clearAndSetSemantics { if (row != null) contentDescription = said },
) {
// Level with White's line.
Box(Modifier.width(numberWidth).height(nameLine), contentAlignment = Alignment.CenterEnd) {
Text(
groupDigits(number),
style = MaterialTheme.typography.bodySmall.merge(Tabular),
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 1,
Row(Modifier.fillMaxSize().padding(horizontal = 16.dp, vertical = 6.dp), verticalAlignment = Alignment.Top) {
// Level with White's line.
Box(Modifier.width(numberWidth).height(nameLine), contentAlignment = Alignment.CenterEnd) {
Text(
groupDigits(number),
style = MaterialTheme.typography.bodySmall.merge(Tabular),
color = colors.onSurfaceVariant,
maxLines = 1,
)
}
Spacer(Modifier.width(12.dp))
GameRowText(row, nameLine, detailsLine, query, Modifier.weight(1f))
}
if (lastOpened) {
Box(
Modifier.align(Alignment.CenterStart).width(3.dp).fillMaxHeight()
.background(colors.primary, RoundedCornerShape(topEnd = 2.dp, bottomEnd = 2.dp)),
)
}
// From the discs to 16 dp before the edge; the number stays in the margin.
if (divider) {
Box(
Modifier.align(Alignment.BottomStart).padding(start = 16.dp + numberWidth + 12.dp, end = 16.dp)
.fillMaxWidth().height(1.dp).background(colors.outlineVariant),
)
}
Spacer(Modifier.width(12.dp))
GameRowText(row, nameLine, detailsLine, Modifier.weight(1f))
}
}
@Composable
private fun GameRowText(row: GameRow?, nameLine: androidx.compose.ui.unit.Dp, detailsLine: androidx.compose.ui.unit.Dp, modifier: Modifier) {
private fun GameRowText(row: GameRow?, nameLine: androidx.compose.ui.unit.Dp, detailsLine: androidx.compose.ui.unit.Dp, query: String, modifier: Modifier) {
Column(modifier) {
if (row == null) return@Column
val style = MaterialTheme.typography.bodyLarge
val muted = MaterialTheme.colorScheme.onSurfaceVariant
val white = row.white.trim().takeIf { it.isNotEmpty() && it != "?" }
val black = row.black.trim().takeIf { it.isNotEmpty() && it != "?" }
if (white != null && black == null) {
val study = white != null && black == null
if (study) {
// A study or a book position: a title for White and no Black — two lines of it.
// From the top, level with the number, not centred in the two lines.
// From the top, level with the number, not centred in the two lines; no discs:
// these are not players.
Box(Modifier.height(nameLine * 2)) {
PlayerLine(white, elo(row.whiteElo), null, style, maxLines = 2, abbreviate = false)
PlayerName(white, style, maxLines = 2, abbreviate = false, highlight = query)
}
} else {
PlayerLine(white ?: "?", elo(row.whiteElo), sideResult(row.result, true), style, Modifier.height(nameLine), nameColor = if (white == null) muted else androidx.compose.ui.graphics.Color.Unspecified)
PlayerLine(black ?: "?", elo(row.blackElo), sideResult(row.result, false), style, Modifier.height(nameLine), nameColor = if (black == null) muted else androidx.compose.ui.graphics.Color.Unspecified)
ListPlayer(white, elo(row.whiteElo), sideResult(row.result, true), true, style, nameLine, query)
ListPlayer(black, elo(row.blackElo), sideResult(row.result, false), false, style, nameLine, query)
}
val details = joinKnown(row.event, year(row.date), row.eco)
if (details.isNotEmpty()) {
Text(
details,
style = MaterialTheme.typography.bodyMedium,
color = muted,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.height(detailsLine),
val details = joinKnown(row.event, year(row.date))
val eco = row.eco.trim().takeIf { it.isNotEmpty() && it != "?" }
if (details.isNotEmpty() || eco != null) {
// Under the names (past the discs); the ECO tag never gives way, the event does.
Row(Modifier.height(detailsLine).padding(start = if (study) 0.dp else 16.dp), verticalAlignment = Alignment.CenterVertically) {
Text(
highlighted(details, query),
style = MaterialTheme.typography.bodyMedium,
color = muted,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f),
)
if (eco != null) {
Spacer(Modifier.width(8.dp))
EcoTag(eco, marked = query.split(' ').any { it.isNotBlank() && eco.startsWith(it.trim(), ignoreCase = true) })
}
}
}
}
}
/// One player in the list: the disc of the side, the name (the winner's a little
/// heavier), the rating, the share of the result on its tile.
@Composable
private fun ListPlayer(
name: String?,
rating: String,
result: String?,
white: Boolean,
style: androidx.compose.ui.text.TextStyle,
height: androidx.compose.ui.unit.Dp,
query: String,
) {
val won = result == "1"
Row(Modifier.height(height), verticalAlignment = Alignment.CenterVertically) {
SideDisc(white, 8.dp)
Spacer(Modifier.width(8.dp))
Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) {
PlayerName(
name ?: "?",
if (won) style.copy(fontWeight = androidx.compose.ui.text.font.FontWeight.Medium) else style,
Modifier.weight(1f, fill = false),
if (name == null) MaterialTheme.colorScheme.onSurfaceVariant else Color.Unspecified,
highlight = query,
)
if (rating.isNotEmpty()) {
Spacer(Modifier.width(8.dp))
Text(rating, style = MaterialTheme.typography.bodyMedium.merge(Tabular), color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 1)
}
}
Spacer(Modifier.width(8.dp))
ResultTile(result)
}
}
/// The opening's code on a small outlined tag at the right of the details line; filled
/// like the other matches when it is what was searched for.
@Composable
private fun EcoTag(eco: String, marked: Boolean) {
val shape = RoundedCornerShape(4.dp)
val colors = MaterialTheme.colorScheme
Box(
Modifier.heightIn(min = 16.dp).widthIn(min = 32.dp)
.background(if (marked) colors.primaryContainer else Color.Transparent, shape)
.border(1.dp, if (marked) colors.primaryContainer else colors.outline, shape)
.padding(horizontal = 4.dp),
contentAlignment = Alignment.Center,
) {
Text(
eco,
style = MaterialTheme.typography.labelSmall.merge(Tabular),
color = if (marked) colors.onPrimaryContainer else colors.onSurfaceVariant,
maxLines = 1,
)
}
}

View file

@ -1,7 +1,13 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.foundation.background
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.clickable
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.gestures.awaitEachGesture
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.ui.input.pointer.PointerEventPass
import kotlinx.coroutines.withTimeoutOrNull
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
@ -19,7 +25,10 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
@ -27,6 +36,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextLayoutResult
import androidx.compose.ui.text.TextLinkStyles
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontStyle
@ -38,6 +48,8 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.onClick
import androidx.compose.ui.semantics.onLongClick
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.selected
import androidx.compose.ui.semantics.stateDescription
@ -215,6 +227,7 @@ fun Notation(
onMove: (Int) -> Unit,
modifier: Modifier = Modifier,
marks: Map<Int, MoveJudgement> = emptyMap(),
onLongMove: ((Int) -> Unit)? = null,
) {
val chess = LocalChessColors.current
LaunchedEffect(current) {
@ -241,7 +254,7 @@ fun Notation(
.background(MaterialTheme.colorScheme.surfaceContainerLow)
.padding(horizontal = 12.dp, vertical = 8.dp),
)
is Item.Moves -> MovesRow(game, item, current, chess, san, onMove, marks)
is Item.Moves -> MovesRow(game, item, current, chess, san, onMove, marks, onLongMove)
is Item.Variation -> Box(
Modifier
.fillMaxWidth()
@ -249,11 +262,45 @@ fun Notation(
) {
Row(Modifier.height(androidx.compose.foundation.layout.IntrinsicSize.Min)) {
Box(Modifier.width(2.dp).fillMaxHeight().background(MaterialTheme.colorScheme.outlineVariant))
val text = variationText(game, item.start, current, chess, san, onMove)
var layout by remember { mutableStateOf<TextLayoutResult?>(null) }
Text(
variationText(game, item.start, current, chess, san, onMove),
text,
fontSize = 15.sp,
lineHeight = 28.sp,
modifier = Modifier.padding(start = 12.dp, end = 4.dp),
onTextLayout = { layout = it },
modifier = Modifier
.padding(start = 12.dp, end = 4.dp)
.then(
if (onLongMove == null) Modifier else Modifier.pointerInput(text) {
// A long press on a move of the variation: the move it is
// on. Seen before the links (the first pass), and the rest
// of the press is taken, so that the link does not also
// take it as a tap; a short tap stays the link's.
awaitEachGesture {
val down = awaitFirstDown(requireUnconsumed = false, pass = PointerEventPass.Initial)
val released = withTimeoutOrNull(viewConfiguration.longPressTimeoutMillis) {
while (true) {
val e = awaitPointerEvent(PointerEventPass.Initial)
val c = e.changes.firstOrNull { it.id == down.id } ?: return@withTimeoutOrNull true
if (!c.pressed || (c.position - down.position).getDistance() > viewConfiguration.touchSlop) return@withTimeoutOrNull true
}
@Suppress("UNREACHABLE_CODE") true
}
if (released != null) return@awaitEachGesture
val offset = layout?.getOffsetForPosition(down.position) ?: return@awaitEachGesture
val id = text.getLinkAnnotations(offset, offset + 1).firstOrNull()
?.let { (it.item as? LinkAnnotation.Clickable)?.tag?.removePrefix("m")?.toIntOrNull() }
?: return@awaitEachGesture
onLongMove(id)
while (true) {
val e = awaitPointerEvent(PointerEventPass.Initial)
e.changes.forEach { it.consume() }
if (e.changes.none { it.pressed }) break
}
}
},
),
)
}
}
@ -281,6 +328,7 @@ private fun MovesRow(
san: (String) -> AnnotatedString,
onMove: (Int) -> Unit,
marks: Map<Int, MoveJudgement>,
onLongMove: ((Int) -> Unit)?,
) {
Row(Modifier.fillMaxWidth().height(48.dp), verticalAlignment = Alignment.CenterVertically) {
Text(
@ -290,8 +338,8 @@ private fun MovesRow(
modifier = Modifier.width(40.dp).padding(end = 8.dp),
textAlign = androidx.compose.ui.text.style.TextAlign.End,
)
MoveCell(game, row.white, true, current, chess, san, onMove, Modifier.weight(1f), row.white?.let { marks[it] })
MoveCell(game, row.black, false, current, chess, san, onMove, Modifier.weight(1f), row.black?.let { marks[it] })
MoveCell(game, row.white, true, current, chess, san, onMove, Modifier.weight(1f), row.white?.let { marks[it] }, onLongMove)
MoveCell(game, row.black, false, current, chess, san, onMove, Modifier.weight(1f), row.black?.let { marks[it] }, onLongMove)
}
}
@ -306,11 +354,12 @@ private fun MoveCell(
onMove: (Int) -> Unit,
modifier: Modifier,
mark: MoveJudgement?,
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) }
@ -320,11 +369,18 @@ private fun MoveCell(
(markName?.let { m -> ", $m" } ?: "")
}
val currentLabel = stringResource(R.string.current_move)
val actionsLabel = stringResource(R.string.move_actions)
// The whole cell takes the tap; the fill only hugs the move.
Box(
modifier
.fillMaxHeight()
.then(if (id != null) Modifier.clickable { onMove(id) } else Modifier)
.then(
when {
id == null -> Modifier
onLongMove != null -> Modifier.combinedClickable(onLongClick = { onLongMove(id) }) { onMove(id) }
else -> Modifier.clickable { onMove(id) }
},
)
.then(
if (spoken != null) {
Modifier.clearAndSetSemantics {
@ -333,6 +389,7 @@ private fun MoveCell(
this.selected = selected
if (selected) stateDescription = currentLabel
onClick { onMove(id); true }
if (onLongMove != null) onLongClick(actionsLabel) { onLongMove(id); true }
}
} else {
Modifier
@ -354,12 +411,16 @@ 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.Bold, color = markColor ?: MaterialTheme.colorScheme.onSurface)
if (mark != null) {
Text(judgementSymbol(mark), fontSize = 17.sp, fontWeight = FontWeight.Bold, color = markColor ?: MaterialTheme.colorScheme.onSurface)
}
if (n.nagSymbols.isNotEmpty()) {
Text(
n.nagSymbols,
fontSize = 17.sp,
fontWeight = FontWeight.Medium,
fontWeight = FontWeight.Bold,
color = if (selected) {
MaterialTheme.colorScheme.onSurface
} else {
@ -368,7 +429,6 @@ private fun MoveCell(
)
}
}
if (mark != null) ReviewBadge(mark, Modifier.padding(start = 2.dp))
}
}
}

View file

@ -0,0 +1,340 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.clickable
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.Undo
import androidx.compose.material.icons.rounded.Close
import androidx.compose.material.icons.rounded.Flag
import androidx.compose.material.icons.rounded.Handshake
import androidx.compose.material.icons.rounded.PlayArrow
import androidx.compose.material.icons.rounded.SwapVert
import androidx.compose.material3.Button
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Alignment
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.scale
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import io.github.vrubelroman.chesspenguin.R
import io.github.vrubelroman.chesspenguin.data.Opponent
import io.github.vrubelroman.chesspenguin.data.PlayMeta
import uniffi.mobile_api.GameData
import uniffi.mobile_api.GameEnding
import uniffi.mobile_api.MaiaPlayer
import uniffi.mobile_api.ResignJudge
import uniffi.mobile_api.Rival
import uniffi.mobile_api.RodentPlayer
/// The key of the game against the computer in hand (a game screen without a database).
const val PLAY_GAME = "play"
/// How a game against the computer ended: the result and what the strip says.
data class PlayOver(val result: String, val heading: Int, val detail: Int?)
/// The opponent of a game for the core.
fun PlayMeta.rivalOf(): Rival = when (rival) {
Opponent.Maia -> Rival.Maia
Opponent.Rodent -> Rival.Rodent(style)
}
/// «Maia 1500», «Rodent IV 1800» (android-rodent.md §6.1): the title, the card, the question.
fun PlayMeta.label(): String = uniffi.mobile_api.rivalLabel(rivalOf(), strength.toUInt())
/// A character's name in the app's language (the English one, should the app not know it).
@Composable
fun styleTitle(id: String): String =
RODENT_TEXTS[id]?.let { stringResource(it.first) }
?: uniffi.mobile_api.rodentStyles().firstOrNull { it.id == id }?.title ?: id
/// Rodent's character after its name (none for Maia): «Таль».
@Composable
fun PlayMeta.styleShown(): String? = if (rival == Opponent.Rodent) styleTitle(style) else null
/// A text of either opponent: Maia's, or Rodent's (their own sentences: in Russian and
/// other languages the words agree with her or him, rodent-opponent.md §7).
fun PlayMeta.said(maia: Int, rodent: Int): Int = if (rival == Opponent.Rodent) rodent else maia
/// Why the opponent does not play: it did not start (`detail`: the words of the error),
/// or it stopped during the game (Rodent's process gone, android-rodent.md §6.6).
data class PlayFailure(val detail: String, val stopped: Boolean = false)
/// A game against the computer being played (android-play.md §31), kept while the phone
/// turns: Maia (her network) or Rodent IV (its process).
class PlayRun(val meta: PlayMeta) {
var player: MaiaPlayer? = null
var rodent: RodentPlayer? = null
var judge: ResignJudge? = null
val thinking = mutableStateOf(false)
/// The opponent offers to resign (its position hopeless two turns in a row).
val offer = mutableStateOf(false)
val over = mutableStateOf<PlayOver?>(null)
/// The opponent does not play: why.
val failure = mutableStateOf<PlayFailure?>(null)
/// «Play to the end»: no more offers in this game.
var playOn = false
var hopeless = 0u
/// Bumped by a take-back: the answer for the old position is dropped.
var generation = 0
fun close() {
player?.close()
rodent?.close()
judge?.close()
player = null
rodent = null
judge = null
}
}
/// The last node of the main line.
fun lineEnd(g: GameData): Int {
var n = 0
while (true) n = g.nodes[n].children.firstOrNull()?.toInt() ?: return n
}
/// Half-moves from the start to node `id`.
fun depth(g: GameData, id: Int): Int {
var d = 0
var n = g.nodes.getOrNull(id) ?: return 0
while (true) {
n = g.nodes.getOrNull(n.parent?.toInt() ?: return d) ?: return d
d++
}
}
fun whiteToMove(fen: String) = fen.substringAfter(' ').startsWith("w")
/// The end of a game by the rules, from the user's side.
fun overBy(ending: GameEnding, userWhite: Boolean): PlayOver = when (ending) {
is GameEnding.Checkmate -> PlayOver(
if (ending.whiteWon) "1-0" else "0-1",
if (ending.whiteWon == userWhite) R.string.play_won else R.string.play_lost,
R.string.end_mate,
)
GameEnding.Stalemate -> PlayOver("1/2-1/2", R.string.play_draw, R.string.end_stalemate)
GameEnding.InsufficientMaterial -> PlayOver("1/2-1/2", R.string.play_draw, R.string.end_material)
GameEnding.Threefold -> PlayOver("1/2-1/2", R.string.play_draw, R.string.end_threefold)
GameEnding.FiftyMoves -> PlayOver("1/2-1/2", R.string.play_draw, R.string.end_fifty)
}
/// The bottom bar during a game (§31.3): take back, resign (abort before the first
/// moves), flip, a move back and forward.
@Composable
fun PlayControls(
canTakeBack: Boolean,
started: Boolean,
canBack: Boolean,
canForward: Boolean,
onTakeBack: () -> Unit,
onResign: () -> Unit,
onDraw: () -> Unit,
onAbort: () -> Unit,
onFlip: () -> Unit,
onBack: () -> Unit,
onForward: () -> Unit,
) {
Column {
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant)
Surface(color = MaterialTheme.colorScheme.surfaceContainer) {
Row(Modifier.fillMaxWidth().navigationBarsPadding().height(72.dp), verticalAlignment = Alignment.CenterVertically) {
LabeledButton(Icons.AutoMirrored.Rounded.Undo, stringResource(R.string.play_take_back).removePrefix("↶ "), canTakeBack, Modifier.weight(1f), onTakeBack)
if (started) {
LabeledButton(Icons.Rounded.Flag, stringResource(R.string.play_resign).removePrefix("⚑ "), true, Modifier.weight(1f), onResign)
LabeledButton(Icons.Rounded.Handshake, stringResource(R.string.play_offer_draw), true, Modifier.weight(1f), onDraw)
} else {
LabeledButton(Icons.Rounded.Close, stringResource(R.string.play_abort), true, Modifier.weight(1f), onAbort)
}
IconButton(onClick = onFlip, modifier = Modifier.weight(0.8f)) { Icon(Icons.Rounded.SwapVert, stringResource(R.string.flip)) }
IconButton(onClick = onBack, enabled = canBack, modifier = Modifier.weight(1f)) {
// The forward arrow turned round, as the game screen's.
Icon(Icons.Rounded.PlayArrow, stringResource(R.string.move_back), Modifier.scale(-1f, 1f))
}
IconButton(onClick = onForward, enabled = canForward, modifier = Modifier.weight(1f)) { Icon(Icons.Rounded.PlayArrow, stringResource(R.string.move_forward)) }
}
}
}
}
@Composable
private fun LabeledButton(icon: androidx.compose.ui.graphics.vector.ImageVector, label: String, enabled: Boolean, modifier: Modifier, onClick: () -> Unit) {
androidx.compose.material3.TextButton(onClick = onClick, enabled = enabled, modifier = modifier.height(64.dp), contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 2.dp)) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Icon(icon, null)
// Six buttons in a row: a long word goes to a second line, not cut.
Text(label, style = MaterialTheme.typography.labelSmall, maxLines = 2, overflow = TextOverflow.Ellipsis, textAlign = androidx.compose.ui.text.style.TextAlign.Center)
}
}
}
/// The opponent offers to resign (§31.3): accept the win, or play on.
@Composable
fun OfferCard(meta: PlayMeta, onAccept: () -> Unit, onPlayOn: () -> Unit) {
Card {
Text(stringResource(meta.said(R.string.play_maia_resigns, R.string.rodent_resigns)), style = MaterialTheme.typography.titleMedium)
Text(stringResource(meta.said(R.string.play_her_position_lost, R.string.rodent_position_lost)), style = MaterialTheme.typography.bodyMedium)
Row(Modifier.fillMaxWidth().padding(top = 8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Button(onClick = onAccept, modifier = Modifier.weight(1f)) { Text(stringResource(R.string.play_accept_win)) }
OutlinedButton(onClick = onPlayOn, modifier = Modifier.weight(1f)) { Text(stringResource(R.string.play_on_short)) }
}
}
}
/// The end of the game (§31.4): the result, then analyse, rematch, save.
@Composable
fun ResultCard(
over: PlayOver,
saved: Boolean,
recorded: io.github.vrubelroman.chesspenguin.data.Written?,
recordError: String?,
onOpenRecorded: (String) -> Unit,
onAnalyse: () -> Unit,
onRematch: () -> Unit,
onSave: () -> Unit,
onClose: () -> Unit,
) {
Card {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
(if (over.result == "1/2-1/2") "½-½" else over.result) + " · " + stringResource(over.heading) + (over.detail?.let { " · " + stringResource(it) } ?: ""),
Modifier.weight(1f),
style = MaterialTheme.typography.titleMedium,
)
IconButton(onClick = onClose) { Icon(Icons.Rounded.Close, stringResource(R.string.close)) }
}
// Where the game went by itself: its player's database, opened by a tap.
// A new database says so here, once (no snackbar over the buttons).
recorded?.let { w ->
Text(
stringResource(if (w.created) R.string.player_written_new else R.string.player_written, w.name, (w.index + 1u).toString()),
Modifier.fillMaxWidth().heightIn(min = 40.dp).clickable { onOpenRecorded(w.id) }.wrapContentHeight(Alignment.CenterVertically),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.primary,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
)
}
recordError?.let {
Text(it, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.error, maxLines = 3)
}
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
val pad = androidx.compose.foundation.layout.PaddingValues(horizontal = 8.dp)
Button(onClick = onAnalyse, modifier = Modifier.weight(1f), contentPadding = pad) { Text(stringResource(R.string.play_analyse_short), maxLines = 1, overflow = TextOverflow.Ellipsis) }
OutlinedButton(onClick = onRematch, modifier = Modifier.weight(1f), contentPadding = pad) {
Text(stringResource(R.string.play_rematch).removePrefix("↻ "), maxLines = 1, overflow = TextOverflow.Ellipsis)
}
// Written by itself: the line above says where; no third button.
if (recorded == null) {
OutlinedButton(onClick = onSave, enabled = !saved, modifier = Modifier.weight(1f), contentPadding = pad) {
Text(stringResource(if (saved) R.string.play_saved else R.string.play_save), maxLines = 1, overflow = TextOverflow.Ellipsis)
}
}
}
}
}
@Composable
private fun Card(content: @Composable () -> Unit) {
Column(
Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 8.dp)
.background(MaterialTheme.colorScheme.surfaceContainerHigh, RoundedCornerShape(12.dp))
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(4.dp),
) { content() }
}
/// Puts a new game against the computer in hand (android-play.md §31): `session` holds
/// its moves so far (none, or those of the game it goes on from: `meta.floor`
/// half-moves); its tags are set, and after the moves of another game a note says where
/// it comes from.
fun beginComputerGame(
app: io.github.vrubelroman.chesspenguin.ChessPenguinApp,
session: uniffi.mobile_api.GameSession,
meta: PlayMeta,
event: String,
note: String?,
) {
val date = java.text.SimpleDateFormat("yyyy.MM.dd", java.util.Locale.ROOT).format(java.util.Date())
val tags = uniffi.mobile_api.computerGameTags(event, meta.userWhite, meta.name, meta.rivalOf(), meta.strength.toUInt()) +
uniffi.mobile_api.Tag("Date", date)
session.setData(tags, "*")
if (meta.floor > 0 && note != null) {
val data = session.data()
runCatching { session.addComment(lineEnd(data).toUInt(), note) }
}
session.markSaved()
// The game it replaces, if left unfinished, is kept in its player's database.
app.playerGames.keepUnfinished(app.maiaGames, app.settings.prefs.value.recordGames, app.scope)
app.playerGames.remember(meta.name)
app.maiaGames.begin(session.pgn(), meta)
}
/// The note in a game played on from another one: «From here on, a game against Maia
/// 1500.», «… Rodent IV 1800 · Tal.» (in the app's language).
fun playNote(resources: android.content.res.Resources, meta: PlayMeta, style: String?): String =
if (meta.rival == Opponent.Rodent && style != null) {
resources.getString(R.string.play_note_from_rodent, meta.strength.toString(), style)
} else {
resources.getString(R.string.play_note_from, meta.strength.toString())
}
/// The opponent did not start (§31.3, android-rodent.md §6.6): Maia's file again, or
/// Rodent started again (it is in the APK: nothing to download); or leave the game.
@Composable
fun FailureCard(meta: PlayMeta, failure: PlayFailure, onRetry: () -> Unit, onAbort: () -> Unit) {
val text = when {
meta.rival != Opponent.Rodent -> R.string.play_maia_stopped
failure.stopped -> R.string.rodent_stopped_playing
else -> R.string.rodent_stopped
}
Card {
Text(stringResource(text), style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.error)
Row(Modifier.fillMaxWidth().padding(top = 8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Button(onClick = onRetry, modifier = Modifier.weight(1f)) {
Text(stringResource(meta.said(R.string.play_maia_reload, R.string.rodent_restart)), maxLines = 1, overflow = TextOverflow.Ellipsis)
}
OutlinedButton(onClick = onAbort, modifier = Modifier.weight(1f)) { Text(stringResource(R.string.play_abort), maxLines = 1) }
}
}
}
/// A new game while one is put aside (§31.7): go on with that one, or begin anew (it is
/// replaced).
@Composable
fun AdjournedQuestion(meta: PlayMeta, onContinue: () -> Unit, onNew: () -> Unit, onDismiss: () -> Unit) {
val app = app()
// Said only when the game will be kept (moves of both sides, writing on).
val kept = remember { app.playerGames.wouldKeep(app.maiaGames, app.settings.prefs.value.recordGames) }
androidx.compose.material3.AlertDialog(
onDismissRequest = onDismiss,
title = { Text(stringResource(R.string.play_adjourned_q, meta.label())) },
text = { Text(stringResource(if (kept) R.string.play_adjourned_new_text else R.string.play_adjourned_replaced)) },
confirmButton = { androidx.compose.material3.TextButton(onClick = onContinue) { Text(stringResource(R.string.play_continue_it)) } },
dismissButton = { androidx.compose.material3.TextButton(onClick = onNew) { Text(stringResource(R.string.play_start_new)) } },
)
}

View file

@ -0,0 +1,620 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.selection.selectableGroup
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material.icons.automirrored.rounded.KeyboardArrowRight
import androidx.compose.material.icons.rounded.Check
import androidx.compose.material.icons.rounded.Close
import androidx.compose.material.icons.rounded.Person
import androidx.compose.material3.Button
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExposedDropdownMenuAnchorType
import androidx.compose.material3.ExposedDropdownMenuBox
import androidx.compose.material3.ExposedDropdownMenuDefaults
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.OutlinedCard
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.SegmentedButton
import androidx.compose.material3.SegmentedButtonDefaults
import androidx.compose.material3.SingleChoiceSegmentedButtonRow
import androidx.compose.material3.Slider
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.ScaffoldDefaults
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.ui.draw.clip
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalWindowInfo
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.LiveRegionMode
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.heading
import androidx.compose.ui.semantics.liveRegion
import androidx.compose.ui.semantics.onClick
import androidx.compose.ui.semantics.progressBarRangeInfo
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.selected
import androidx.compose.ui.semantics.stateDescription
import androidx.compose.ui.semantics.ProgressBarRangeInfo
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import io.github.vrubelroman.chesspenguin.R
import io.github.vrubelroman.chesspenguin.data.NetProblem
import io.github.vrubelroman.chesspenguin.data.NetState
import io.github.vrubelroman.chesspenguin.data.Opponent
import io.github.vrubelroman.chesspenguin.data.PlayMeta
import io.github.vrubelroman.chesspenguin.theme.Tabular
import uniffi.mobile_api.RodentStyle
import uniffi.mobile_api.maiaRange
import uniffi.mobile_api.rodentRange
import uniffi.mobile_api.rodentStyles
/// The position a game against the computer starts from (android-play.md §31.6): drawn
/// small, with where it comes from; the side to move plays by default.
data class PlayFrom(val fen: String, val label: String, val whiteToMove: Boolean)
/// What the sheet starts: the opponent (Rodent in `style`), its strength, the user's
/// colour and name.
data class PlayChoice(val rival: Opponent, val strength: Int, val style: String, val userWhite: Boolean, val name: String) {
/// The game's description; `floor`: the half-moves it goes on from.
fun meta(floor: Int) = PlayMeta(strength, userWhite, name, floor, rival = rival, style = if (rival == Opponent.Rodent) style else "")
}
/// «Play against the computer» (android-play.md §31.1, android-rodent.md §2): the
/// opponent — Maia or Rodent IV with its character — its strength on its own scale, the
/// colour, the name. What the opponent needs is downloaded here the first time (Maia's
/// file; Rodent's opening books, or «Without book»). The state line and the button stay
/// at the bottom; the rest scrolls.
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun PlaySheet(from: PlayFrom?, onPlay: (PlayChoice) -> Unit, onDismiss: () -> Unit) {
val app = app()
val prefs by app.settings.prefs.collectAsState()
val maiaFiles = app.maiaFiles.download
val maiaState by maiaFiles.state.collectAsState()
val books = app.rodentFiles.books
val booksState by books.state.collectAsState()
val styles = remember { rodentStyles() }
var rival by remember { mutableStateOf(prefs.opponent) }
val rodent = rival == Opponent.Rodent
// Each opponent's strength on its own scale, remembered apart (§4).
val maiaRange = remember { maiaRange().map { it.toInt() } }
val rodentRange = remember { rodentRange().map { it.toInt() } }
var maiaLevel by remember { mutableFloatStateOf(prefs.maiaStrength.coerceIn(maiaRange[0], maiaRange[1]).toFloat()) }
var rodentLevel by remember { mutableFloatStateOf(prefs.rodentStrength.coerceIn(rodentRange[0], rodentRange[1]).toFloat()) }
// The character: kept at once when chosen (§7.1); an unknown one is Tal.
val style = prefs.rodentPersonality.takeIf { id -> styles.any { it.id == id } } ?: DEFAULT_RODENT_STYLE
var picking by remember { mutableStateOf(false) }
// From a position: the side to move by default, not remembered (play-from-position.md §2).
var color by remember { mutableIntStateOf(if (from != null) (if (from.whiteToMove) 1 else -1) else prefs.playColor) }
var name by remember { mutableStateOf(prefs.yourName) }
// «Download and play»: the game starts once the files are checked, if this opponent
// is still the one chosen.
var playAfter by remember { mutableStateOf(false) }
val range = if (rodent) rodentRange else maiaRange
val strength = if (rodent) rodentLevel else maiaLevel
val level = (strength / 50f).toInt() * 50
// From a position Rodent needs no book (§1.5); Maia always needs her file.
val state = if (rodent) booksState else maiaState
// From a position Rodent plays at once, whatever its books (§1.5, question 4).
val noBookNeeded = rodent && from != null
val ready = state == NetState.Ready || noBookNeeded
fun play() {
val white = when (color) {
1 -> true
-1 -> false
else -> kotlin.random.Random.nextBoolean()
}
app.settings.update { p ->
val q = p.copy(opponent = rival, yourName = name.trim(), playColor = if (from != null) p.playColor else color)
if (rodent) q.copy(rodentStrength = level) else q.copy(maiaStrength = level)
}
onPlay(PlayChoice(rival, level, style, white, name.trim()))
}
// A failure of an earlier attempt is not this sheet's: the download is offered anew.
LaunchedEffect(Unit) { books.forgetFailure() }
LaunchedEffect(state, rival) {
if (playAfter && state == NetState.Ready) {
playAfter = false
play()
}
}
ModalBottomSheet(onDismissRequest = onDismiss, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)) {
val scroll = rememberScrollState()
Column(Modifier.fillMaxWidth()) {
Column(Modifier.weight(1f, fill = false).verticalScroll(scroll).padding(horizontal = 24.dp)) {
Text(stringResource(R.string.play_title), style = MaterialTheme.typography.titleLarge)
if (from != null) {
Row(Modifier.padding(top = 12.dp), verticalAlignment = Alignment.CenterVertically) {
MiniBoard(from.fen, flipped = color == -1, size = 96.dp)
Text(from.label, Modifier.padding(start = 16.dp), style = MaterialTheme.typography.bodyMedium, maxLines = 4, overflow = TextOverflow.Ellipsis)
}
}
Spacer(Modifier.height(16.dp))
// Who first, then how strong: the scale is the opponent's (§2.1).
Row(Modifier.fillMaxWidth().selectableGroup(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
OpponentCard("Maia", stringResource(R.string.opp_maia_sub), !rodent, Modifier.weight(1f)) {
if (rodent) playAfter = false
rival = Opponent.Maia
}
OpponentCard("Rodent IV", stringResource(R.string.opp_rodent_sub), rodent, Modifier.weight(1f)) {
if (!rodent) playAfter = false
rival = Opponent.Rodent
// The first time, the list opens by itself with Tal suggested (§3.4).
if (prefs.rodentPersonality.isEmpty()) picking = true
}
}
Spacer(Modifier.height(8.dp))
CharacterRow(if (rodent) styles.firstOrNull { it.id == style } else null) { picking = true }
Spacer(Modifier.height(8.dp))
Text(
stringResource(R.string.strength_n, level.toString()),
style = MaterialTheme.typography.titleMedium.merge(Tabular),
fontWeight = FontWeight.Medium,
)
val strengthLabel = stringResource(R.string.strength)
val strengthState = stringResource(R.string.strength_range, level.toString(), range[0].toString(), range[1].toString())
Row(verticalAlignment = Alignment.CenterVertically) {
Text("${range[0]}", style = MaterialTheme.typography.bodySmall.merge(Tabular), color = MaterialTheme.colorScheme.onSurfaceVariant)
Slider(
value = strength,
onValueChange = { if (rodent) rodentLevel = it else maiaLevel = it },
valueRange = range[0].toFloat()..range[1].toFloat(),
modifier = Modifier.weight(1f).padding(horizontal = 8.dp).semantics {
contentDescription = strengthLabel
stateDescription = strengthState
},
)
Text("${range[1]}", style = MaterialTheme.typography.bodySmall.merge(Tabular), color = MaterialTheme.colorScheme.onSurfaceVariant)
}
// Always two lines: the sheet does not jump when the opponent changes. It
// changes only with the opponent: TalkBack says it then, not at each step of
// the slider.
Text(
stringResource(if (rodent) R.string.rodent_measured else R.string.play_measured),
Modifier.semantics { liveRegion = LiveRegionMode.Polite },
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
minLines = 2,
)
Spacer(Modifier.height(16.dp))
Text(stringResource(R.string.play_colour), style = MaterialTheme.typography.titleSmall)
Spacer(Modifier.height(8.dp))
val options = listOf(1 to R.string.color_white, 0 to R.string.color_random, -1 to R.string.color_black)
SingleChoiceSegmentedButtonRow(Modifier.fillMaxWidth()) {
options.forEachIndexed { i, (v, label) ->
SegmentedButton(selected = color == v, onClick = { color = v }, shape = SegmentedButtonDefaults.itemShape(i, options.size)) {
Text(stringResource(label))
}
}
}
Spacer(Modifier.height(12.dp))
NameField(name, prefs.recordGames) { name = it }
Spacer(Modifier.height(12.dp))
}
// The footer: what the chosen opponent needs, and the button (§2.4). A line
// over it while the content goes on under it.
HorizontalDivider(color = if (scroll.canScrollForward) MaterialTheme.colorScheme.outlineVariant else Color.Transparent)
Column(Modifier.padding(start = 24.dp, end = 24.dp, top = 8.dp, bottom = 24.dp)) {
// At least 40 dp (it grows with a large font). Only the lines that change with
// the kind of state are read out, not every step of the progress.
Row(Modifier.fillMaxWidth().heightIn(min = 40.dp), verticalAlignment = Alignment.CenterVertically) {
val noBookText = stringResource(R.string.books_without_cd)
val noBook = @Composable {
TextButton(onClick = {
playAfter = false
play()
}, modifier = Modifier.heightIn(min = 48.dp).semantics { contentDescription = noBookText }) {
Text(stringResource(R.string.books_without), maxLines = 1)
}
}
// What is left to download (the books checked so far stay).
val booksLeft = remember(booksState) { books.remaining() }
val left = if (rodent) booksLeft else maiaFiles.size
when (val s = state) {
NetState.Ready -> StateText(stringResource(if (rodent) R.string.books_ready else R.string.play_maia_ready))
NetState.Missing -> if (noBookNeeded) {
StateText(stringResource(R.string.books_not_needed))
} else if (rodent) {
StateText(stringResource(R.string.books_offer, megabytes(left)), Modifier.weight(1f))
noBook()
} else {
StateText(stringResource(R.string.play_download_note, megabytes(left)))
}
is NetState.Loading -> {
val what = stringResource(R.string.online_downloading, if (rodent) stringResource(R.string.books_notification) else "Maia")
Column(
Modifier.weight(1f).clearAndSetSemantics {
contentDescription = what
progressBarRangeInfo = ProgressBarRangeInfo(s.done.toFloat() / s.total.coerceAtLeast(1), 0f..1f)
},
) {
LinearProgressIndicator(progress = { s.done.toFloat() / s.total.coerceAtLeast(1) }, modifier = Modifier.fillMaxWidth())
Text(stringResource(R.string.downloaded_of, megabytes(s.done), megabytes(s.total)), style = MaterialTheme.typography.bodySmall.merge(Tabular))
}
IconButton(onClick = {
playAfter = false
if (rodent) books.cancel() else maiaFiles.cancel()
}) { Icon(Icons.Rounded.Close, stringResource(R.string.cancel_download)) }
}
// From a position a failed download does not matter to Rodent.
is NetState.Failed -> if (noBookNeeded) {
StateText(stringResource(R.string.books_not_needed))
} else {
Text(
when (s.problem) {
NetProblem.NoInternet -> stringResource(R.string.no_internet)
NetProblem.Interrupted -> stringResource(R.string.interrupted)
NetProblem.NoSpace -> stringResource(R.string.no_space, megabytes(left))
NetProblem.Corrupt -> stringResource(R.string.corrupt)
},
Modifier.weight(1f).semantics { liveRegion = LiveRegionMode.Polite },
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.error,
)
// Rodent plays without its books (§5.5); from a position it needs none.
if (rodent) noBook()
}
}
}
Spacer(Modifier.height(8.dp))
val loading = state is NetState.Loading
Button(
onClick = {
if (ready) {
play()
} else {
playAfter = true
if (rodent) books.download() else maiaFiles.download()
}
},
enabled = !loading || noBookNeeded,
modifier = Modifier.fillMaxWidth().height(56.dp),
) {
Text(
stringResource(
when {
ready || loading -> R.string.play_play
state is NetState.Failed -> R.string.play_retry
else -> R.string.play_download_and_play
},
),
)
}
}
}
}
if (picking) {
// Closed without a choice the first time: Tal stays, and the list does not open
// by itself again (§3.4).
StylePicker(styles, style, onPick = { id ->
picking = false
app.settings.update { it.copy(rodentPersonality = id) }
}, onDismiss = {
picking = false
if (prefs.rodentPersonality.isEmpty()) app.settings.update { it.copy(rodentPersonality = style) }
})
}
}
@Composable
private fun StateText(text: String, modifier: Modifier = Modifier) {
// Not cut: with a large font the footer grows (§8.2).
Text(text, modifier.semantics { liveRegion = LiveRegionMode.Polite }, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
/// One of the two opponents (§2.2): chosen, it is filled and ticked (not by colour alone).
@Composable
private fun OpponentCard(title: String, sub: String, selected: Boolean, modifier: Modifier, onClick: () -> Unit) {
OutlinedCard(
modifier = modifier.heightIn(min = 64.dp).selectable(selected = selected, role = Role.RadioButton, onClick = onClick),
shape = RoundedCornerShape(12.dp),
colors = CardDefaults.outlinedCardColors(
containerColor = if (selected) MaterialTheme.colorScheme.secondaryContainer else MaterialTheme.colorScheme.surface,
),
border = BorderStroke(if (selected) 2.dp else 1.dp, if (selected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.outlineVariant),
) {
Column(Modifier.padding(12.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
if (selected) {
Icon(Icons.Rounded.Check, null, Modifier.size(18.dp), tint = MaterialTheme.colorScheme.primary)
Spacer(Modifier.width(4.dp))
}
Text(title, style = MaterialTheme.typography.titleSmall, fontWeight = FontWeight.Medium, maxLines = 1)
}
Text(sub, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, minLines = 2, maxLines = 2, overflow = TextOverflow.Ellipsis)
}
}
}
/// The character's line (§2.3): Rodent's character, a tap opens the list; for Maia the
/// same line, inactive («Like a human»), so that the sheet keeps its height.
@Composable
private fun CharacterRow(style: RodentStyle?, onClick: () -> Unit) {
val title = style?.let { styleTitle(it.id) } ?: stringResource(R.string.like_human)
val about = style?.let { s -> RODENT_TEXTS[s.id]?.let { stringResource(it.second) } ?: s.about } ?: stringResource(R.string.maia_no_style)
val active = style != null
val described = if (active) stringResource(R.string.character_cd, title) + ". " + about else "$title. $about"
val change = stringResource(R.string.pick_change)
Row(
Modifier
.fillMaxWidth()
.heightIn(min = 80.dp)
.background(MaterialTheme.colorScheme.surfaceContainerHigh, RoundedCornerShape(12.dp))
.then(if (active) Modifier.clickable(onClickLabel = change, role = Role.Button, onClick = onClick) else Modifier)
.clearAndSetSemantics { contentDescription = described }
.padding(horizontal = 12.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
val dim = if (active) 1f else 0.38f
if (style != null) {
Initial(title, style.player)
} else {
Box(Modifier.size(40.dp).background(MaterialTheme.colorScheme.surfaceContainerHighest, CircleShape), contentAlignment = Alignment.Center) {
Icon(Icons.Rounded.Person, null, Modifier.size(24.dp), tint = MaterialTheme.colorScheme.onSurface.copy(alpha = dim))
}
}
Spacer(Modifier.width(12.dp))
Column(Modifier.weight(1f)) {
Text(title, style = MaterialTheme.typography.bodyLarge, fontWeight = FontWeight.Medium, color = MaterialTheme.colorScheme.onSurface.copy(alpha = dim), maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(about, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = dim), minLines = 2, maxLines = 2, overflow = TextOverflow.Ellipsis)
}
if (active) Icon(Icons.AutoMirrored.Rounded.KeyboardArrowRight, null, tint = MaterialTheme.colorScheme.onSurfaceVariant)
}
}
/// A character's initial in a circle (§3.2): the players in one colour, the characters
/// in another. Decoration: not read out.
@Composable
private fun Initial(title: String, player: Boolean) {
val (back, fore) = if (player) {
MaterialTheme.colorScheme.tertiaryContainer to MaterialTheme.colorScheme.onTertiaryContainer
} else {
MaterialTheme.colorScheme.secondaryContainer to MaterialTheme.colorScheme.onSecondaryContainer
}
Box(Modifier.size(40.dp).background(back, CircleShape), contentAlignment = Alignment.Center) {
Text(title.take(1), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Medium, color = fore)
}
}
/// «Who to play» (§3): Rodent IV's characters in two groups, each in the alphabet of the
/// app's language; a tap chooses and closes. Full screen on a phone, a dialog on a tablet.
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
@Composable
private fun StylePicker(styles: List<RodentStyle>, selected: String, onPick: (String) -> Unit, onDismiss: () -> Unit) {
val wide = with(LocalDensity.current) { LocalWindowInfo.current.containerSize.width.toDp() } >= 600.dp
val locale = LocalConfiguration.current.locales[0]
val titled = styles.map { it to styleTitle(it.id) }
val collator = remember(locale) { java.text.Collator.getInstance(locale) }
val groups = listOf(R.string.pick_players to true, R.string.pick_characters to false).map { (heading, player) ->
heading to titled.filter { it.first.player == player }.sortedWith { a, b -> collator.compare(a.second, b.second) }
}
// Opened with the chosen one in sight: the row above it just under the group's heading
// (which stays on top of the list), so that neither is cut.
val index = run {
var i = 0
for ((_, rows) in groups) {
i++ // the group's heading
val at = rows.indexOfFirst { it.first.id == selected }
if (at >= 0) return@run i + at
i += rows.size
}
0
}
val list = rememberLazyListState()
val headerPx = with(LocalDensity.current) { 48.dp.roundToPx() }
LaunchedEffect(Unit) {
// A negative offset: the row above starts below the sticky heading.
if (index >= 2) list.scrollToItem(index - 1, -headerPx)
}
// Full screen: edge to edge, the bars' insets inside. A dialog: in the window between
// the system bars, clipped to its corners, no insets of its own.
Dialog(onDismissRequest = onDismiss, properties = DialogProperties(usePlatformDefaultWidth = false, decorFitsSystemWindows = wide)) {
val frame = if (wide) {
Modifier.widthIn(max = 560.dp).fillMaxWidth().fillMaxHeight(0.9f).clip(RoundedCornerShape(28.dp))
} else {
Modifier.fillMaxSize()
}
val insets = if (wide) WindowInsets(0) else ScaffoldDefaults.contentWindowInsets
Scaffold(
modifier = frame,
containerColor = MaterialTheme.colorScheme.surface,
contentWindowInsets = insets,
topBar = {
Column {
TopAppBar(
windowInsets = if (wide) WindowInsets(0) else TopAppBarDefaults.windowInsets,
navigationIcon = { IconButton(onClick = onDismiss) { Icon(Icons.AutoMirrored.Rounded.ArrowBack, stringResource(R.string.back)) } },
title = { Text(stringResource(R.string.pick_title)) },
)
// Fixed under the bar: what the list is for, wherever it is scrolled.
Text(
stringResource(R.string.pick_intro),
Modifier.padding(horizontal = 16.dp, vertical = 8.dp),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
)
}
},
) { padding ->
LazyColumn(Modifier.fillMaxSize().padding(padding), state = list) {
groups.forEach { (heading, rows) ->
stickyHeader(key = heading) {
Surface(color = MaterialTheme.colorScheme.surface) {
Text(
stringResource(heading),
Modifier.fillMaxWidth().heightIn(min = 48.dp).padding(horizontal = 16.dp, vertical = 14.dp).semantics { heading() },
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.primary,
)
}
}
items(rows, key = { it.first.id }) { (st, title) ->
val on = st.id == selected
val about = RODENT_TEXTS[st.id]?.let { stringResource(it.second) } ?: st.about
val described = stringResource(if (st.player) R.string.pick_player_cd else R.string.pick_character_cd, title) + ". " + about
Row(
Modifier
.fillMaxWidth()
.heightIn(min = 72.dp)
.background(if (on) MaterialTheme.colorScheme.secondaryContainer else Color.Transparent)
.selectable(selected = on, role = Role.RadioButton) { onPick(st.id) }
// One reading: the name, the group, what it does; not the texts again.
.clearAndSetSemantics {
contentDescription = described
this.selected = on
role = Role.RadioButton
onClick { onPick(st.id); true }
}
.padding(horizontal = 16.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Initial(title, st.player)
Spacer(Modifier.width(16.dp))
Column(Modifier.weight(1f)) {
Text(title, style = MaterialTheme.typography.bodyLarge)
Text(about, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
if (on) Icon(Icons.Rounded.Check, null, Modifier.padding(start = 8.dp), tint = MaterialTheme.colorScheme.primary)
}
}
}
}
}
}
}
/// The name, with the players of this phone to pick from; under it, where the games go
/// (player-games.md §6).
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun NameField(name: String, record: Boolean, onName: (String) -> Unit) {
val app = app()
val players = remember { app.playerGames.players() }
var picking by remember { mutableStateOf(false) }
val line = if (!record) {
stringResource(R.string.player_line_off)
} else {
val db = app.playerGames.database(name)
when {
app.playerGames.tidy(name).isEmpty() -> stringResource(R.string.player_line_noname, db?.name ?: app.playerGames.dbName(""))
db != null -> stringResource(R.string.player_line_existing, db.name) + " · " +
androidx.compose.ui.res.pluralStringResource(R.plurals.games_count, db.games ?: 0, groupDigits(db.games ?: 0))
else -> stringResource(R.string.player_line_new, app.playerGames.dbName(name))
}
}
// The players whose names begin with what is typed (none once it is one of them).
val typed = app.playerGames.tidy(name).lowercase()
val matching = players.filter { it.lowercase().startsWith(typed) && it.lowercase() != typed }
// Opened by typing or by its arrow, not by a tap in the field (it would cover «Play»).
ExposedDropdownMenuBox(expanded = picking && matching.isNotEmpty(), onExpandedChange = { if (!it) picking = false }) {
OutlinedTextField(
name,
{
onName(it)
picking = it.isNotBlank()
},
Modifier.fillMaxWidth().menuAnchor(ExposedDropdownMenuAnchorType.PrimaryEditable),
label = { Text(stringResource(R.string.play_your_name)) },
supportingText = { Text(line) },
trailingIcon = {
if (matching.isNotEmpty()) {
IconButton(onClick = { picking = !picking }) { ExposedDropdownMenuDefaults.TrailingIcon(expanded = picking) }
}
},
singleLine = true,
)
ExposedDropdownMenu(expanded = picking && matching.isNotEmpty(), onDismissRequest = { picking = false }) {
matching.forEach { p ->
DropdownMenuItem(text = { Text(p) }, onClick = {
onName(p)
picking = false
})
}
}
}
}
/// A small board of a position (no touches, no coordinates).
@Composable
fun MiniBoard(fen: String, flipped: Boolean, size: androidx.compose.ui.unit.Dp) {
val app = app()
val prefs by app.settings.prefs.collectAsState()
val context = androidx.compose.ui.platform.LocalContext.current
val pieces = remember { Pieces(context) }
Board(
fen = fen,
flipped = flipped,
lastFrom = null,
lastTo = null,
pieces = pieces,
theme = prefs.board,
set = prefs.pieces,
description = "",
animated = false,
modifier = Modifier.width(size),
coordinates = false,
)
}
private fun megabytes(bytes: Long) = ((bytes + 999_999) / 1_000_000).toInt()

View file

@ -0,0 +1,444 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material.icons.automirrored.rounded.KeyboardArrowRight
import androidx.compose.material.icons.rounded.Close
import androidx.compose.material.icons.rounded.Search
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.disabled
import androidx.compose.ui.semantics.onClick
import androidx.compose.ui.semantics.role
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import io.github.vrubelroman.chesspenguin.R
import io.github.vrubelroman.chesspenguin.data.PrepBackends
import io.github.vrubelroman.chesspenguin.theme.Tabular
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext
import uniffi.mobile_api.Database
import java.text.Collator
import java.util.Locale
private const val PLAYER_PAGE = 100
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun PlayersScreen(
db: String,
onBack: () -> Unit,
onPrepare: (player: PlayerSummary, white: Boolean) -> Unit,
) {
val app = app()
val entries by app.library.entries.collectAsState()
val entry = entries.firstOrNull { it.id == db }
var database by remember { mutableStateOf<Database?>(null) }
var openFailure by remember { mutableStateOf<Throwable?>(null) }
val backend = remember(database) { database?.let(PrepBackends::open) }
DisposableEffect(backend) { onDispose { backend?.close() } }
var searching by rememberSaveable { mutableStateOf(false) }
var query by rememberSaveable { mutableStateOf("") }
var colorChoice by remember { mutableStateOf<PlayerSummary?>(null) }
var players by remember { mutableStateOf<List<PlayerSummary>?>(null) }
var nextOffset by remember { mutableStateOf<Int?>(null) }
var failure by remember { mutableStateOf<Throwable?>(null) }
var loadingMore by remember { mutableStateOf(false) }
var generation by remember { mutableIntStateOf(0) }
var retry by rememberSaveable { mutableIntStateOf(0) }
LaunchedEffect(db, entry?.games, entry?.updated, retry) {
database = null
openFailure = null
app.library.database(db).onSuccess { database = it }.onFailure { openFailure = it }
}
val list = rememberLazyListState()
val focus = remember { FocusRequester() }
val keyboard = LocalSoftwareKeyboardController.current
BackHandler(searching) {
searching = false
query = ""
}
LaunchedEffect(backend, query, retry) {
val source = backend ?: return@LaunchedEffect
val expected = ++generation
players = null
nextOffset = null
failure = null
loadingMore = false
if (query.isNotEmpty()) delay(250)
try {
val page = withContext(Dispatchers.IO) { source.players(query, 0, PLAYER_PAGE) }
if (expected != generation) return@LaunchedEffect
players = sortPlayers(page.players)
nextOffset = page.nextOffset
} catch (e: kotlinx.coroutines.CancellationException) {
throw e
} catch (e: Throwable) {
if (expected == generation) failure = e
}
}
Scaffold(
topBar = {
TopAppBar(
navigationIcon = {
IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Rounded.ArrowBack, stringResource(R.string.back)) }
},
title = {
if (searching) {
TextField(
value = query,
onValueChange = { query = it },
placeholder = { Text(stringResource(R.string.player_name_hint)) },
singleLine = true,
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
keyboardActions = KeyboardActions(onSearch = { keyboard?.hide() }),
colors = TextFieldDefaults.colors(
focusedContainerColor = Color.Transparent,
unfocusedContainerColor = Color.Transparent,
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
),
modifier = Modifier.fillMaxWidth().focusRequester(focus),
)
LaunchedEffect(Unit) { focus.requestFocus() }
} else {
Column {
Text(stringResource(R.string.players), maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(
entry?.let { displayName(it) } ?: "",
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
}
},
actions = {
if (searching) {
IconButton(onClick = { if (query.isEmpty()) searching = false else query = "" }) {
Icon(Icons.Rounded.Close, stringResource(R.string.clear))
}
} else if (database != null) {
IconButton(onClick = { searching = true }) { Icon(Icons.Rounded.Search, stringResource(R.string.search)) }
}
},
)
},
) { padding ->
Box(Modifier.fillMaxSize().padding(padding)) {
val shownPlayers = players
when {
openFailure != null -> PrepMessage(stringResource(R.string.players_read_failed), openProblem(openFailure!!)) {
TextButton(onClick = { database = null; openFailure = null; retry += 1 }) { Text(stringResource(R.string.retry)) }
}
failure != null -> PrepMessage(stringResource(R.string.players_read_failed), openProblem(failure!!).ifEmpty { failure!!.message ?: "" }) {
TextButton(onClick = { retry += 1 }) { Text(stringResource(R.string.retry)) }
}
shownPlayers == null -> LoadingPlayers()
shownPlayers.isEmpty() && query.isEmpty() -> PrepMessage(stringResource(R.string.no_named_players), "") {
TextButton(onClick = onBack) { Text(stringResource(R.string.to_games)) }
}
shownPlayers.isEmpty() -> PrepMessage(stringResource(R.string.player_not_found), "") {
TextButton(onClick = { query = "" }) { Text(stringResource(R.string.reset_search)) }
}
else -> LazyColumn(Modifier.fillMaxSize(), state = list) {
val shown = shownPlayers
val expectedGeneration = generation
items(shown.size, key = { shown[it].id }) { index ->
val player = shown[index]
PlayerPrepRow(
player = player,
divider = index < shown.lastIndex || nextOffset != null,
onPlayerClick = { chosen ->
keyboard?.hide()
val onlyColor = solePlayerColor(chosen)
when {
playerNeedsColorChoice(chosen) -> colorChoice = chosen
onlyColor != null -> onPrepare(chosen, onlyColor)
}
},
)
if (index == shown.lastIndex && nextOffset != null) {
LaunchedEffect(nextOffset, generation) {
val source = backend ?: return@LaunchedEffect
val offset = nextOffset ?: return@LaunchedEffect
loadingMore = true
try {
val page = withContext(Dispatchers.IO) { source.players(query, offset, PLAYER_PAGE) }
if (expectedGeneration == generation) {
players = sortPlayers((shown + page.players).distinctBy { it.id })
nextOffset = page.nextOffset
}
} catch (e: kotlinx.coroutines.CancellationException) {
throw e
} catch (e: Throwable) {
if (expectedGeneration == generation) failure = e
} finally {
if (expectedGeneration == generation) loadingMore = false
}
}
}
}
if (loadingMore) {
items(3, key = { "loading-$it" }) { PlayerPrepPlaceholder() }
}
}
}
}
}
colorChoice?.let { player ->
PlayerColorSheet(
player = player,
onDismiss = { colorChoice = null },
onPrepare = { chosen, white ->
colorChoice = null
onPrepare(chosen, white)
},
)
}
}
private fun sortPlayers(players: List<PlayerSummary>): List<PlayerSummary> {
val collator = Collator.getInstance(Locale.getDefault()).apply { strength = Collator.PRIMARY }
return players.sortedWith(compareBy(collator) { it.name })
}
internal fun playerNeedsColorChoice(player: PlayerSummary): Boolean = player.whiteGames > 0 && player.blackGames > 0
internal fun solePlayerColor(player: PlayerSummary): Boolean? = when {
player.whiteGames > 0 && player.blackGames == 0 -> true
player.blackGames > 0 && player.whiteGames == 0 -> false
else -> null
}
@OptIn(ExperimentalLayoutApi::class)
@Composable
internal fun PlayerPrepRow(
player: PlayerSummary,
divider: Boolean = false,
onPlayerClick: (PlayerSummary) -> Unit,
) {
val games = pluralStringResource(R.plurals.games_count, player.total, groupDigits(player.total))
val whiteSide = stringResource(R.string.prep_as_white)
val blackSide = stringResource(R.string.prep_as_black)
val chooseColor = stringResource(R.string.prep_choose_color)
val prepare = stringResource(R.string.prepare_action)
val onlyColor = solePlayerColor(player)
val hasAction = playerNeedsColorChoice(player) || onlyColor != null
val action = when {
playerNeedsColorChoice(player) -> chooseColor
onlyColor == true -> "$prepare $whiteSide"
onlyColor == false -> "$prepare $blackSide"
else -> prepare
}
val description = "${player.name}, $games. $whiteSide ${groupDigits(player.whiteGames)}, $blackSide ${groupDigits(player.blackGames)}. $action"
BoxWithConstraints(Modifier.fillMaxWidth()) {
val grows = maxWidth < 320.dp || LocalDensity.current.fontScale > 1f
val height = if (grows) Modifier.heightIn(min = 72.dp) else Modifier.height(72.dp)
Box(
Modifier.fillMaxWidth().then(height)
.clearAndSetSemantics {
contentDescription = description
role = Role.Button
if (hasAction) onClick(action) { onPlayerClick(player); true } else disabled()
}
.clickable(enabled = hasAction, role = Role.Button, onClickLabel = action) { onPlayerClick(player) },
) {
Row(
Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Column(Modifier.weight(1f)) {
Row(Modifier.fillMaxWidth().heightIn(min = 24.dp), verticalAlignment = Alignment.CenterVertically) {
PlayerName(player.name, MaterialTheme.typography.bodyLarge, Modifier.weight(1f))
Spacer(Modifier.width(8.dp))
Text(games, style = MaterialTheme.typography.bodyMedium.merge(Tabular), color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 1)
}
Spacer(Modifier.height(4.dp))
FlowRow(
Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(16.dp),
verticalArrangement = Arrangement.spacedBy(4.dp),
) {
PlayerColorText(true, whiteSide, player.whiteGames)
PlayerColorText(false, blackSide, player.blackGames)
}
}
Spacer(Modifier.width(8.dp))
Icon(
Icons.AutoMirrored.Rounded.KeyboardArrowRight,
contentDescription = null,
tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(24.dp),
)
}
if (divider) HorizontalDivider(Modifier.align(Alignment.BottomCenter), color = MaterialTheme.colorScheme.outlineVariant)
}
}
}
@Composable
private fun PlayerColorText(white: Boolean, side: String, count: Int) {
Row(Modifier.heightIn(min = 20.dp), verticalAlignment = Alignment.CenterVertically) {
SideDisc(white)
Spacer(Modifier.width(8.dp))
Text("$side · ${groupDigits(count)}", style = MaterialTheme.typography.bodyMedium.merge(Tabular), color = MaterialTheme.colorScheme.onSurfaceVariant)
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun PlayerColorSheet(player: PlayerSummary, onDismiss: () -> Unit, onPrepare: (PlayerSummary, Boolean) -> Unit) {
val games = pluralStringResource(R.plurals.games_count, player.total, groupDigits(player.total))
ModalBottomSheet(onDismissRequest = onDismiss) {
Column(Modifier.fillMaxWidth().verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {
Column(Modifier.fillMaxWidth().padding(horizontal = 24.dp, vertical = 8.dp)) {
Text(
stringResource(R.string.prep_against_player, player.name),
Modifier.fillMaxWidth(),
style = MaterialTheme.typography.titleLarge,
)
Spacer(Modifier.height(4.dp))
Text(
games,
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
PlayerColorAction(player, true, onPrepare)
PlayerColorAction(player, false, onPrepare)
}
}
}
@Composable
private fun PlayerColorAction(player: PlayerSummary, white: Boolean, onPrepare: (PlayerSummary, Boolean) -> Unit) {
val count = if (white) player.whiteGames else player.blackGames
val side = stringResource(if (white) R.string.prep_against_white else R.string.prep_against_black)
val games = pluralStringResource(R.plurals.games_count, count, groupDigits(count))
val prepare = stringResource(R.string.prepare_action)
Row(
Modifier.fillMaxWidth().heightIn(min = 64.dp)
.clearAndSetSemantics {
contentDescription = "${player.name}, $side, $games. $prepare"
role = Role.Button
onClick(prepare) { onPrepare(player, white); true }
}
.clickable(role = Role.Button, onClickLabel = prepare) { onPrepare(player, white) }
.padding(horizontal = 24.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
SideDisc(white)
Spacer(Modifier.width(12.dp))
Text(side, Modifier.weight(1f), style = MaterialTheme.typography.bodyLarge)
Spacer(Modifier.width(8.dp))
Text(groupDigits(count), style = MaterialTheme.typography.bodyMedium.merge(Tabular), color = MaterialTheme.colorScheme.onSurfaceVariant)
Spacer(Modifier.width(8.dp))
Icon(Icons.AutoMirrored.Rounded.KeyboardArrowRight, null, tint = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.size(24.dp))
}
}
@Composable
private fun PlayerPrepPlaceholder() {
Box(Modifier.fillMaxWidth().height(72.dp)) {
Column(Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 12.dp)) {
Row(Modifier.fillMaxWidth().height(24.dp)) {
Box(Modifier.weight(1f).height(24.dp).background(MaterialTheme.colorScheme.surfaceContainerLow, RoundedCornerShape(4.dp)))
Spacer(Modifier.width(8.dp))
Box(Modifier.width(64.dp).height(24.dp).background(MaterialTheme.colorScheme.surfaceContainerLow, RoundedCornerShape(4.dp)))
}
Spacer(Modifier.height(4.dp))
Box(Modifier.fillMaxWidth(0.65f).height(20.dp).background(MaterialTheme.colorScheme.surfaceContainerLow, RoundedCornerShape(4.dp)))
}
HorizontalDivider(Modifier.align(Alignment.BottomCenter), color = MaterialTheme.colorScheme.outlineVariant)
}
}
@Composable
private fun LoadingPlayers() {
Column(Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
CircularProgressIndicator()
Spacer(Modifier.height(16.dp))
Text(stringResource(R.string.reading_players), color = MaterialTheme.colorScheme.onSurfaceVariant)
}
}
@Composable
internal fun PrepMessage(title: String, detail: String, action: (@Composable () -> Unit)? = null) {
Column(Modifier.fillMaxSize().padding(32.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
Text(title, style = MaterialTheme.typography.titleLarge, textAlign = TextAlign.Center)
if (detail.isNotEmpty()) {
Spacer(Modifier.height(8.dp))
Text(detail, color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.Center)
}
if (action != null) {
Spacer(Modifier.height(16.dp))
action()
}
}
}

View file

@ -0,0 +1,161 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import io.github.vrubelroman.chesspenguin.data.PrepBackend
import io.github.vrubelroman.chesspenguin.data.PrepQuery
import io.github.vrubelroman.chesspenguin.data.query
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import uniffi.mobile_api.GameData
import uniffi.mobile_api.GameSession
internal class PrepController(val request: PrepStart) : ViewModel() {
var line by mutableStateOf(PrepLineState(request.startFen, request.startFen))
private set
var data by mutableStateOf<GameData?>(null)
private set
var position by mutableStateOf<PrepPosition?>(null)
private set
var failure by mutableStateOf<Throwable?>(null)
private set
var loading by mutableStateOf(false)
private set
var initialised by mutableStateOf(false)
private set
var moveFailed by mutableStateOf(false)
var retry by mutableIntStateOf(0)
private set
private var session: GameSession? = null
private var search: Job? = null
private var generation = 0L
suspend fun initialise() {
if (session != null) return
failure = null
val loaded = withContext(Dispatchers.Default) {
runCatching {
val fen = request.startFen
val s = GameSession.fromPgn("[SetUp \"1\"]\n[FEN \"$fen\"]\n\n*")
try {
var edited = s.data() to 0
for (uci in request.moves) {
val next = s.play(edited.second.toUInt(), uci)
edited = next.data to next.cursor.toInt()
}
Triple(s, edited.first, edited.second)
} catch (e: Throwable) {
s.close()
throw e
}
}
}
if (session != null) {
loaded.getOrNull()?.first?.close()
return
}
val (s, game, cursor) = loaded.getOrElse {
failure = it
initialised = false
return
}
session = s
data = game
line = prepLine(game, cursor, request.startFen)
initialised = true
}
private fun invalidate() {
generation += 1
search?.cancel()
position = null
failure = null
loading = false
}
fun back() {
if (!line.canBack) return
line = line.back()
invalidate()
}
fun forward() {
if (!line.canForward) return
line = line.forward()
invalidate()
}
fun start() {
if (!line.canBack) return
line = line.start()
invalidate()
}
fun end() {
if (!line.canForward) return
line = line.end()
invalidate()
}
fun legalMoves(): List<String> = session?.legalMoves(line.currentNode.toUInt()).orEmpty()
fun play(uci: String): String? {
val s = session ?: return null
if (s.legalMoves(line.currentNode.toUInt()).none { it == uci }) return null
val edited = runCatching { s.play(line.currentNode.toUInt(), uci) }.getOrElse {
moveFailed = true
return null
}
val visible = prepLine(edited.data, edited.cursor.toInt(), request.startFen)
line = visible
data = edited.data
invalidate()
return visible.last?.san
}
fun repeat() {
retry += 1
invalidate()
}
fun search(backend: PrepBackend) {
if (!initialised || failure != null) return
invalidate()
backend.cancel()
val query: PrepQuery = request.query(line.fen)
val expected = generation
search = viewModelScope.launch {
val delayed = launch {
delay(300)
if (generation == expected) loading = true
}
try {
val answer = withContext(Dispatchers.IO) { backend.position(query) }
if (generation == expected && query == request.query(line.fen)) position = answer
} catch (e: CancellationException) {
throw e
} catch (e: Throwable) {
if (generation == expected && query == request.query(line.fen)) failure = e
} finally {
delayed.cancel()
if (generation == expected) loading = false
}
}
}
override fun onCleared() {
generation += 1
search?.cancel()
session?.close()
session = null
}
}

View file

@ -0,0 +1,187 @@
package io.github.vrubelroman.chesspenguin.ui
import kotlinx.serialization.Serializable
import uniffi.mobile_api.GameData
import kotlin.math.roundToInt
internal const val STANDARD_START = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
/// The position and history of a preparation request. The game document is not part of it.
@Serializable
data class PrepStart(
val db: String,
val player: String,
val white: Boolean,
val startFen: String = STANDARD_START,
val moves: List<String> = emptyList(),
val fromGame: Boolean = false,
)
/// One move of the temporary line. `node` belongs only to this preparation session.
@Serializable
data class PrepLineStep(
val node: Int,
val uci: String,
val san: String,
val moveNumber: Int,
val white: Boolean,
val fen: String,
val from: String?,
val to: String?,
) {
val label: String get() = "$moveNumber${if (white) "." else "…"}$san"
}
/// A linear, read-only exploration. Going back never chooses a different continuation;
/// making a move after going back drops only this temporary future.
@Serializable
data class PrepLineState(
val startFen: String,
val rootFen: String,
val rootNode: Int = 0,
val steps: List<PrepLineStep> = emptyList(),
val cursor: Int = 0,
) {
init {
require(cursor in 0..steps.size) { "line cursor is outside the line" }
}
val fen: String get() = steps.getOrNull(cursor - 1)?.fen ?: rootFen
val currentNode: Int get() = steps.getOrNull(cursor - 1)?.node ?: rootNode
val last: PrepLineStep? get() = steps.getOrNull(cursor - 1)
val moves: List<String> get() = steps.map { it.uci }
val canBack: Boolean get() = cursor > 0
val canForward: Boolean get() = cursor < steps.size
fun back(): PrepLineState = if (canBack) copy(cursor = cursor - 1) else this
fun forward(): PrepLineState = if (canForward) copy(cursor = cursor + 1) else this
fun start(): PrepLineState = if (canBack) copy(cursor = 0) else this
fun end(): PrepLineState = if (canForward) copy(cursor = steps.size) else this
fun replaceVisibleLine(visible: List<PrepLineStep>, currentNode: Int): PrepLineState {
val at = visible.indexOfLast { it.node == currentNode }
require(at >= 0 && at + 1 == visible.size) { "the played move must end the visible line" }
return copy(steps = visible, cursor = visible.size)
}
}
internal fun prepLine(data: GameData, cursor: Int, startFen: String): PrepLineState {
val path = ArrayList<Int>()
var at: Int? = cursor
while (at != null) {
if (at !in data.nodes.indices || at in path) break
path += at
at = data.nodes[at].parent?.toInt()
}
path.reverse()
val root = path.firstOrNull() ?: 0
val steps = path.drop(1).mapNotNull { id ->
val n = data.nodes[id]
if (n.uci.isEmpty()) return@mapNotNull null
PrepLineStep(id, n.uci, n.san, n.moveNumber.toInt(), n.white, n.fen, n.fromSquare, n.toSquare)
}
return PrepLineState(startFen, data.nodes.getOrNull(root)?.fen ?: startFen, root, steps, steps.size)
}
/// A null move cannot be represented by the normal-move position search.
internal fun prepStartFromGame(data: GameData, at: Int, db: String, player: String, white: Boolean): PrepStart? {
if (at !in data.nodes.indices) return null
val path = ArrayList<Int>()
var node: Int? = at
while (node != null) {
if (node !in data.nodes.indices || node in path) return null
path += node
node = data.nodes[node].parent?.toInt()
}
path.reverse()
if (path.any { data.nodes[it].nullMove }) return null
val moves = path.drop(1).map { data.nodes[it].uci }
if (moves.any { it.isEmpty() }) return null
return PrepStart(
db = db,
player = player,
white = white,
startFen = data.nodes[path.first()].fen,
moves = moves,
fromGame = true,
)
}
/// Preparation shows the user's side at the bottom, opposite to the selected opponent.
internal fun prepBoardStartsFlipped(opponentWhite: Boolean): Boolean = opponentWhite
internal fun prepWhiteToMove(fen: String): Boolean? = fen.split(' ').getOrNull(1)?.let {
when (it) {
"w" -> true
"b" -> false
else -> null
}
}
internal fun moveLabel(fen: String, san: String): String {
val fields = fen.split(' ')
val number = fields.getOrNull(5)?.toIntOrNull()?.coerceAtLeast(0) ?: 1
val white = prepWhiteToMove(fen) ?: true
return "$number${if (white) "." else "…"}$san"
}
data class PlayerSummary(
val id: Int,
val name: String,
val total: Int,
val whiteGames: Int,
val blackGames: Int,
)
data class PlayerPage(
val players: List<PlayerSummary>,
val total: Int,
val nextOffset: Int?,
)
data class PrepContinuation(
val uci: String,
val san: String,
val games: Int,
val wins: Int,
val draws: Int,
val losses: Int,
val unknown: Int = 0,
) {
val from: String? get() = uci.takeIf { it.length >= 4 }?.substring(0, 2)
val to: String? get() = uci.takeIf { it.length >= 4 }?.substring(2, 4)
}
/// A matching game is part of the result contract even though its list is outside this MVP.
data class PrepGameMatch(val index: UInt, val ply: UInt)
data class PrepPosition(
val games: Int,
val continuations: List<PrepContinuation>,
val endedHere: Int = 0,
val noNormalContinuation: Int = 0,
val unknownResults: Int = 0,
val playerToMove: Boolean? = null,
val matches: List<PrepGameMatch> = emptyList(),
val matchesTotal: Int = 0,
)
internal fun sortedContinuations(position: PrepPosition): List<PrepContinuation> =
position.continuations.sortedWith(compareByDescending<PrepContinuation> { it.games }.thenBy { it.san })
internal fun frequencyPercent(games: Int, total: Int): String = when {
games <= 0 || total <= 0 -> "0"
games * 100L < total -> "<1"
else -> (games * 100.0 / total).roundToInt().toString()
}
internal fun outcomePercents(move: PrepContinuation): Triple<String, String, String> {
val known = move.wins + move.draws + move.losses
if (known <= 0) return Triple("—", "—", "—")
fun percent(n: Int) = (n * 100.0 / known).roundToInt().toString()
return Triple(percent(move.wins), percent(move.draws), percent(move.losses))
}
internal class PrepOutOfMemory : IllegalStateException("Not enough memory for the position index")
internal class PrepSearchFailed(message: String) : IllegalStateException(message)
internal class PrepPlayerNotFound(name: String) : IllegalStateException("Player is not in this database: $name")

View file

@ -0,0 +1,469 @@
package io.github.vrubelroman.chesspenguin.ui
import android.content.res.Configuration
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material.icons.rounded.PlayArrow
import androidx.compose.material.icons.rounded.SwapVert
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.foundation.focusable
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.LiveRegionMode
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.liveRegion
import androidx.compose.ui.semantics.onClick
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import io.github.vrubelroman.chesspenguin.R
import io.github.vrubelroman.chesspenguin.data.PrepBackends
import io.github.vrubelroman.chesspenguin.theme.Tabular
import uniffi.mobile_api.Database
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun PrepScreen(request: PrepStart, onBack: () -> Unit) {
val app = app()
val context = LocalContext.current
val controller: PrepController = viewModel(key = "prep") { PrepController(request) }
val entries by app.library.entries.collectAsState()
val entry = entries.firstOrNull { it.id == request.db }
var database by remember { mutableStateOf<Database?>(null) }
var openFailure by remember { mutableStateOf<Throwable?>(null) }
var openRetry by rememberSaveable { mutableIntStateOf(0) }
LaunchedEffect(request.db, entry?.games, entry?.updated, openRetry) {
database = null
openFailure = null
controller.repeat()
app.library.database(request.db).onSuccess { database = it }.onFailure { openFailure = it }
}
val backend = remember(database) { database?.let(PrepBackends::open) }
DisposableEffect(backend) { onDispose { backend?.cancel(); backend?.close() } }
LaunchedEffect(controller.retry) { controller.initialise() }
LaunchedEffect(backend, controller.initialised, controller.line, controller.retry) {
if (backend != null && controller.initialised) controller.search(backend)
}
val prefs by app.settings.prefs.collectAsState()
val lang = uiLanguage()
val san = remember(prefs.notation, lang) { { value: String -> displaySan(value, prefs.notation, lang) } }
val pieces = remember { Pieces(context) }
var flipped by rememberSaveable { mutableStateOf(prepBoardStartsFlipped(request.white)) }
var conflicts by remember { mutableStateOf<List<String>>(emptyList()) }
val list = rememberLazyListState()
val contextFocus = remember { FocusRequester() }
val snackbar = remember { SnackbarHostState() }
val moveFailed = stringResource(R.string.prep_move_failed)
LaunchedEffect(controller.moveFailed) {
if (controller.moveFailed) {
snackbar.showSnackbar(moveFailed)
controller.moveFailed = false
}
}
fun play(uci: String) {
val played = controller.play(uci) ?: return
conflicts = emptyList()
app.sounds.move(played)
contextFocus.requestFocus()
}
fun arrowsChosen(moves: List<String>) {
when (moves.size) {
0 -> {}
1 -> play(moves[0])
else -> conflicts = moves
}
}
val position = controller.position
val continuations = position?.let(::sortedContinuations).orEmpty()
val arrowContinuations = continuations.distinctBy { it.from to it.to }.take(3)
val arrows = arrowContinuations.mapIndexedNotNull { index, move ->
val from = move.from ?: return@mapIndexedNotNull null
val to = move.to ?: return@mapIndexedNotNull null
val weight = if (index == 0) 1f else if (index == 1) 0.85f else 0.70f
val alpha = if (index == 0) 0.63f else if (index == 1) 0.45f else 0.35f
BoardArrow(from, to, EngineArrow.copy(alpha = alpha), weight)
}
val arrowMoves = continuations.filter { move -> arrowContinuations.any { it.from == move.from && it.to == move.to } }
.mapNotNull { move ->
val from = move.from ?: return@mapNotNull null
val to = move.to ?: return@mapNotNull null
val label = moveLabel(controller.line.fen, move.san)
val games = pluralStringResource(R.plurals.games_count, move.games, groupDigits(move.games))
val action = stringResource(R.string.prep_play_continuation, label, games, frequencyPercent(move.games, position?.games ?: 0))
BoardArrowMove(move.uci, from, to, action)
}
val last = controller.line.last
val boardDescription = if (last == null) {
stringResource(R.string.prep_board_start, if (flipped) stringResource(R.string.color_black) else stringResource(R.string.color_white))
} else {
stringResource(R.string.prep_board_after, last.label, if (flipped) stringResource(R.string.color_black) else stringResource(R.string.color_white))
}
val board: @Composable (Modifier) -> Unit = { modifier ->
Board(
fen = controller.line.fen,
flipped = flipped,
lastFrom = last?.from,
lastTo = last?.to,
pieces = pieces,
theme = prefs.board,
set = prefs.pieces,
description = boardDescription,
modifier = modifier,
arrows = arrows,
arrowMoves = arrowMoves,
onArrowMoves = ::arrowsChosen,
check = last?.san?.let { it.endsWith("+") || it.endsWith("#") } == true,
animated = prefs.animation,
input = if (controller.initialised && controller.data != null) {
BoardInput(controller.legalMoves(), onMove = ::play)
} else {
null
},
)
}
val turnWhite = prepWhiteToMove(controller.line.fen)
val opponentPlays = position?.playerToMove ?: (turnWhite == request.white)
val sideToMove = when (turnWhite) {
true -> stringResource(R.string.turn_white)
false -> stringResource(R.string.turn_black)
null -> ""
}
val who = stringResource(if (opponentPlays) R.string.prep_opponent_plays else R.string.prep_opponents_play)
val where = last?.let { stringResource(R.string.prep_after, it.label) } ?: stringResource(R.string.prep_beginning)
val gamesCount = position?.games
val gamesText = if (gamesCount == null) "…" else pluralStringResource(R.plurals.games_count, gamesCount, groupDigits(gamesCount))
val contextDescription = stringResource(R.string.prep_context_description, who, sideToMove, where, gamesText)
val contextRow: @Composable () -> Unit = {
Row(
Modifier.fillMaxWidth().heightIn(min = 32.dp).focusRequester(contextFocus).focusable()
.semantics(mergeDescendants = true) {
contentDescription = contextDescription
liveRegion = LiveRegionMode.Polite
}
.padding(horizontal = 16.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
"$who · $where",
Modifier.weight(1f),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
)
Spacer(Modifier.width(8.dp))
Text(gamesText, style = MaterialTheme.typography.bodyMedium.merge(Tabular), color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 1)
}
}
val results: @Composable (Modifier) -> Unit = { modifier ->
Box(modifier) {
when {
openFailure != null -> PrepMessage(stringResource(R.string.prep_failed), openProblem(openFailure!!)) {
TextButton(onClick = { openRetry += 1 }) { Text(stringResource(R.string.retry)) }
}
controller.failure != null -> {
val memory = controller.failure is PrepOutOfMemory
val problem = openProblem(controller.failure!!).ifEmpty { controller.failure!!.message ?: "" }
PrepMessage(stringResource(if (memory) R.string.prep_no_memory else R.string.prep_failed), problem) {
TextButton(onClick = { controller.repeat() }) { Text(stringResource(R.string.retry)) }
}
}
position == null && controller.loading -> {
LinearProgressIndicator(Modifier.fillMaxWidth().height(2.dp).align(Alignment.TopStart))
Column(Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
CircularProgressIndicator()
Spacer(Modifier.height(16.dp))
Text(stringResource(R.string.prep_calculating), color = MaterialTheme.colorScheme.onSurfaceVariant)
}
}
position == null -> PrepPlaceholders()
position.games == 0 -> PrepMessage(
stringResource(R.string.prep_position_absent, request.player),
stringResource(R.string.prep_position_absent_hint),
)
continuations.isEmpty() && position.endedHere == position.games -> PrepMessage(stringResource(R.string.prep_all_ended), "")
else -> LazyColumn(Modifier.fillMaxSize(), state = list) {
items(continuations.size, key = { continuations[it].uci }) { index ->
ContinuationRow(
continuation = continuations[index],
total = position.games,
fen = controller.line.fen,
player = request.player,
san = san,
divider = index < continuations.lastIndex,
onClick = { play(continuations[index].uci) },
)
}
if (position.endedHere > 0 && continuations.isNotEmpty()) {
item(key = "ended") { PrepDisabledRow(stringResource(R.string.prep_ended_here, groupDigits(position.endedHere))) }
}
if (position.noNormalContinuation > 0) {
item(key = "no-normal") { PrepDisabledRow(stringResource(R.string.prep_no_normal, groupDigits(position.noNormalContinuation))) }
}
}
}
}
}
val controls: @Composable () -> Unit = {
PrepControls(
canBack = controller.line.canBack,
canForward = controller.line.canForward,
onFlip = { flipped = !flipped },
onBack = controller::back,
onForward = controller::forward,
onStart = controller::start,
onEnd = controller::end,
)
}
val landscape = LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE
Scaffold(
topBar = {
TopAppBar(
navigationIcon = {
IconButton(onClick = onBack) {
Icon(Icons.AutoMirrored.Rounded.ArrowBack, stringResource(if (request.fromGame) R.string.to_game else R.string.to_players))
}
},
title = {
Column {
PlayerName(request.player, MaterialTheme.typography.titleMedium)
Text(
stringResource(if (request.white) R.string.prep_as_white else R.string.prep_as_black) + " · " + (entry?.let { displayName(it) } ?: ""),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
},
)
},
snackbarHost = { SnackbarHost(snackbar) },
bottomBar = { if (!landscape) controls() },
) { padding ->
val inner = Modifier.fillMaxSize().padding(padding)
if (landscape) {
Row(inner.windowInsetsPadding(WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal))) {
board(Modifier.fillMaxHeight())
Column(Modifier.weight(1f).fillMaxHeight()) {
contextRow()
results(Modifier.weight(1f).fillMaxWidth())
controls()
}
}
} else {
Column(inner, horizontalAlignment = Alignment.CenterHorizontally) {
board(Modifier.widthIn(max = 480.dp).fillMaxWidth())
Column(Modifier.widthIn(max = 480.dp).fillMaxWidth().weight(1f)) {
contextRow()
results(Modifier.weight(1f).fillMaxWidth())
}
}
}
}
if (conflicts.isNotEmpty()) {
ModalBottomSheet(onDismissRequest = { conflicts = emptyList() }) {
Column(Modifier.fillMaxWidth().padding(bottom = 24.dp)) {
Text(stringResource(R.string.prep_choose_move), style = MaterialTheme.typography.titleLarge, modifier = Modifier.padding(horizontal = 24.dp, vertical = 8.dp))
conflicts.mapNotNull { uci -> continuations.firstOrNull { it.uci == uci } }.forEach { move ->
Row(
Modifier.fillMaxWidth().heightIn(min = 56.dp).clickable { play(move.uci) }.padding(horizontal = 24.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(san(moveLabel(controller.line.fen, move.san)), style = MaterialTheme.typography.bodyLarge)
}
}
}
}
}
}
@Composable
internal fun ContinuationRow(
continuation: PrepContinuation,
total: Int,
fen: String,
player: String,
san: (String) -> AnnotatedString,
divider: Boolean,
onClick: () -> Unit,
) {
val label = moveLabel(fen, continuation.san)
val frequency = frequencyPercent(continuation.games, total)
val (wins, draws, losses) = outcomePercents(continuation)
val games = pluralStringResource(R.plurals.games_count, total, groupDigits(total))
val winsText = pluralStringResource(R.plurals.prep_wins, continuation.wins, groupDigits(continuation.wins))
val drawsText = pluralStringResource(R.plurals.prep_draws, continuation.draws, groupDigits(continuation.draws))
val lossesText = pluralStringResource(R.plurals.prep_losses, continuation.losses, groupDigits(continuation.losses))
val unknown = if (continuation.unknown > 0) stringResource(R.string.prep_unknown_accessibility, continuation.unknown) else ""
val description = stringResource(
R.string.prep_continuation_description,
continuation.san,
continuation.games,
games,
frequency,
player,
winsText,
drawsText,
lossesText,
wins,
draws,
losses,
unknown,
)
Column(
Modifier.fillMaxWidth().heightIn(min = 56.dp).clickable(onClickLabel = stringResource(R.string.prep_play), role = Role.Button, onClick = onClick)
.clearAndSetSemantics {
contentDescription = description
role = Role.Button
onClick { onClick(); true }
}
.padding(start = 16.dp, top = 5.dp, end = 16.dp, bottom = 5.dp),
) {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(san(label), Modifier.weight(1f), style = MaterialTheme.typography.bodyLarge.copy(fontSize = androidx.compose.ui.unit.TextUnit(17f, androidx.compose.ui.unit.TextUnitType.Sp)), maxLines = 1, overflow = TextOverflow.Ellipsis)
Spacer(Modifier.width(8.dp))
Text(
"${groupDigits(continuation.games)}/${groupDigits(total)} · $frequency %",
style = MaterialTheme.typography.bodyMedium.merge(Tabular),
maxLines = 1,
softWrap = false,
)
}
val raw = buildString {
if (continuation.unknown > 0) append(stringResource(R.string.prep_unknown_short, groupDigits(continuation.unknown))).append(' ')
append(stringResource(R.string.prep_wdl_counts, groupDigits(continuation.wins), groupDigits(continuation.draws), groupDigits(continuation.losses), wins, draws, losses))
}
Text(raw, style = MaterialTheme.typography.labelSmall.merge(Tabular), color = MaterialTheme.colorScheme.onSurfaceVariant)
if (divider) HorizontalDivider(Modifier.padding(top = 5.dp), color = MaterialTheme.colorScheme.outlineVariant)
}
}
@Composable
private fun PrepDisabledRow(text: String) {
Text(
text,
Modifier.fillMaxWidth().heightIn(min = 48.dp).padding(horizontal = 16.dp, vertical = 12.dp),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
@Composable
private fun PrepPlaceholders() {
Column(Modifier.fillMaxWidth()) {
repeat(4) {
Column(Modifier.fillMaxWidth().height(56.dp).padding(horizontal = 16.dp, vertical = 8.dp)) {
Box(Modifier.fillMaxWidth().height(20.dp).background(MaterialTheme.colorScheme.surfaceContainerLow))
Spacer(Modifier.height(4.dp))
Box(Modifier.fillMaxWidth().height(16.dp).background(MaterialTheme.colorScheme.surfaceContainerLow))
}
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant)
}
}
}
@Composable
internal fun PrepControls(
canBack: Boolean,
canForward: Boolean,
onFlip: () -> Unit,
onBack: () -> Unit,
onForward: () -> Unit,
onStart: () -> Unit,
onEnd: () -> Unit,
) {
Surface(color = MaterialTheme.colorScheme.surfaceContainer) {
Row(Modifier.fillMaxWidth().navigationBarsPadding().height(72.dp)) {
BarButton(Icons.Rounded.SwapVert, stringResource(R.string.flip), true, Modifier.width(72.dp), onClick = onFlip)
BarButton(
icon = Icons.Rounded.PlayArrow,
label = stringResource(R.string.move_back),
description = stringResource(R.string.move_back_hint),
enabled = canBack,
modifier = Modifier.weight(1f),
iconSize = 32,
mirrored = true,
onLongClickLabel = stringResource(R.string.to_start),
onLongClick = onStart,
onClick = onBack,
)
BarButton(
icon = Icons.Rounded.PlayArrow,
label = stringResource(R.string.move_forward),
description = stringResource(R.string.move_forward_hint),
enabled = canForward,
modifier = Modifier.weight(1f),
iconSize = 32,
onLongClickLabel = stringResource(R.string.to_end),
onLongClick = onEnd,
onClick = onForward,
)
}
}
}

View file

@ -35,9 +35,6 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.SegmentedButton
import androidx.compose.material3.SegmentedButtonDefaults
import androidx.compose.material3.SingleChoiceSegmentedButtonRow
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
@ -70,8 +67,7 @@ import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import io.github.vrubelroman.chesspenguin.R
import io.github.vrubelroman.chesspenguin.data.GUESS_NPS_PER_THREAD
import io.github.vrubelroman.chesspenguin.data.REVIEW_NODES
import io.github.vrubelroman.chesspenguin.data.GUESS_NPS
import io.github.vrubelroman.chesspenguin.theme.LocalChessColors
import io.github.vrubelroman.chesspenguin.theme.Tabular
import io.github.vrubelroman.chesspenguin.theme.nagColor
@ -80,23 +76,37 @@ import uniffi.mobile_api.MoveJudgement
import uniffi.mobile_api.ReviewMove
import uniffi.mobile_api.ReviewState
import uniffi.mobile_api.SideReview
import kotlin.math.ceil
import kotlin.math.roundToInt
/// The NAG of the same sign: $6 ?!, $2 ?, $4 ??.
/// The NAG of the same sign: $3 !!, $1 !, $6 ?!, $2 ?, $4 ??.
fun judgementNag(j: MoveJudgement): Int = when (j) {
MoveJudgement.INACCURACY -> 6
MoveJudgement.MISTAKE -> 2
MoveJudgement.BLUNDER -> 4
MoveJudgement.GREAT -> 1
MoveJudgement.BRILLIANT -> 3
}
/// The colors of the NAGs ?!, ? and ?? (§21.4).
/// The colors of the NAGs !!, !, ?!, ? and ?? (§21.4).
fun judgementColor(j: MoveJudgement, dark: Boolean): Color = nagColor(judgementNag(j), dark) ?: Color.Unspecified
/// The sign of a move assessment NAG ($1–$6), `null` for others.
fun assessmentSymbol(nag: Int): String? = when (nag) {
1 -> "!"
2 -> "?"
3 -> "!!"
4 -> "??"
5 -> "!?"
6 -> "?!"
else -> null
}
fun judgementSymbol(j: MoveJudgement): String = when (j) {
MoveJudgement.INACCURACY -> "?!"
MoveJudgement.MISTAKE -> "?"
MoveJudgement.BLUNDER -> "??"
MoveJudgement.GREAT -> "!"
MoveJudgement.BRILLIANT -> "!!"
}
@Composable
@ -105,6 +115,8 @@ fun judgementName(j: MoveJudgement): String = stringResource(
MoveJudgement.INACCURACY -> R.string.review_inaccuracy
MoveJudgement.MISTAKE -> R.string.review_mistake
MoveJudgement.BLUNDER -> R.string.review_blunder
MoveJudgement.GREAT -> R.string.review_great
MoveJudgement.BRILLIANT -> R.string.review_brilliant
},
)
@ -114,26 +126,11 @@ private fun judgementPlural(j: MoveJudgement): String = stringResource(
MoveJudgement.INACCURACY -> R.string.review_inaccuracies
MoveJudgement.MISTAKE -> R.string.review_mistakes
MoveJudgement.BLUNDER -> R.string.review_blunders
MoveJudgement.GREAT -> R.string.review_greats
MoveJudgement.BRILLIANT -> R.string.review_brilliants
},
)
/// 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? {
@ -225,9 +222,23 @@ fun ReviewPanel(
TextButton(onClick = onResume) { Text(stringResource(R.string.review_resume)) }
report()
}
state.missing > 0u -> {
// Made with other engine settings (before the fixed search): made again.
state.stale -> {
Text(
stringResource(R.string.review_missing, state.missing.toInt()),
stringResource(R.string.review_stale),
style = textStyle,
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f),
)
TextButton(onClick = onResume) { Text(stringResource(R.string.review_update)) }
report()
}
state.missing > 0u || state.secondsMissing > 0u -> {
Text(
// An analysis from before !! and !: filling in looks for them only.
if (state.missing > 0u) stringResource(R.string.review_missing, state.missing.toInt()) else stringResource(R.string.review_no_seconds),
style = textStyle.merge(Tabular),
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.weight(1f),
@ -408,15 +419,13 @@ fun EvalGraph(state: ReviewState, cursor: Int?, cursorLabel: String?, onIndex: (
}
}
/// The sheet that starts the analysis (§21.2).
/// The sheet that starts the analysis (§21.2): what it does and how long it takes. The
/// engine search is fixed, the same on every phone and computer: nothing to choose.
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ReviewStartSheet(
state: ReviewState?,
quality: Int,
threads: Int,
npsPerThread: Long,
onQuality: (Int) -> Unit,
npsPerProcess: Long,
onStart: (full: Boolean) -> Unit,
onDismiss: () -> Unit,
) {
@ -425,29 +434,17 @@ fun ReviewStartSheet(
Text(stringResource(R.string.review_menu), style = MaterialTheme.typography.titleLarge)
Spacer(Modifier.height(12.dp))
Text(stringResource(R.string.review_text), style = MaterialTheme.typography.bodyLarge)
Spacer(Modifier.height(20.dp))
Text(stringResource(R.string.review_quality), style = MaterialTheme.typography.labelLarge)
Spacer(Modifier.height(8.dp))
val names = listOf(R.string.review_fast, R.string.review_normal, R.string.review_deep)
SingleChoiceSegmentedButtonRow(Modifier.fillMaxWidth()) {
names.forEachIndexed { i, res ->
SegmentedButton(
selected = quality == i,
onClick = { onQuality(i) },
shape = SegmentedButtonDefaults.itemShape(i, names.size),
) { Text(stringResource(res), maxLines = 1) }
}
}
Spacer(Modifier.height(12.dp))
val total = state?.positions?.toInt() ?: 0
val missing = state?.missing?.toInt() ?: total
// Some positions already have an engine evaluation: fill in, or start over.
val partial = state != null && state.hasData && state.nodes > 0UL && missing in 1 until total
// Evaluations from the PGN: the engine makes its own, all of them.
val pgn = state != null && state.hasData && state.nodes == 0UL
// Some positions already have an engine evaluation of today's search: filled in.
val partial = state != null && state.hasData && !pgn && !state.stale && missing in 1 until total
val positions = if (partial) missing else total
// "Fill in" keeps the quality of the first run; the choice is for starting over.
val nodes = (if (partial) state.nodes else REVIEW_NODES[quality.coerceIn(0, REVIEW_NODES.size - 1)]).toDouble()
val nps = (if (npsPerThread > 0) npsPerThread else GUESS_NPS_PER_THREAD).toDouble() * threads.coerceAtLeast(1)
val secs = ceil(positions * nodes / nps).toInt().coerceAtLeast(1)
// A full run also searches again for moves that could be !! or ! (about a third more).
val searches = if (partial) positions else (state?.searches?.toInt() ?: positions)
val secs = uniffi.mobile_api.reviewEstimateSecs(searches.toUInt(), (if (npsPerProcess > 0) npsPerProcess else GUESS_NPS).toULong()).toInt().coerceAtLeast(1)
val time = if (secs < 60) stringResource(R.string.review_seconds, secs) else stringResource(R.string.review_minutes, (secs + 59) / 60)
Text(
pluralStringResource(R.plurals.review_estimate, positions, positions, time),
@ -464,14 +461,10 @@ fun ReviewStartSheet(
}
Spacer(Modifier.height(24.dp))
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {
if (partial) {
TextButton(onClick = { onStart(true) }) { Text(stringResource(R.string.review_restart)) }
Button(onClick = { onStart(false) }) { Text(stringResource(R.string.review_fill)) }
} else {
TextButton(onClick = onDismiss) { Text(stringResource(R.string.cancel)) }
// Everything evaluated already: analysing again starts over.
Button(onClick = { onStart(state?.hasData == true) }) { Text(stringResource(R.string.review_start)) }
}
TextButton(onClick = onDismiss) { Text(stringResource(R.string.cancel)) }
// The same search again would give the same evaluations: only the missing
// ones are made, or all of them over the PGN's (or a stale analysis).
Button(onClick = { onStart(pgn) }) { Text(stringResource(if (partial) R.string.review_fill else R.string.review_start)) }
}
}
}
@ -510,11 +503,20 @@ fun ReviewSheet(
black = { ReportNumber(percent(state.black.accuracy), MaterialTheme.typography.headlineSmall) },
)
val next = stringResource(R.string.review_next)
listOf(MoveJudgement.INACCURACY, MoveJudgement.MISTAKE, MoveJudgement.BLUNDER).forEach { j ->
listOf(
MoveJudgement.BRILLIANT,
MoveJudgement.GREAT,
MoveJudgement.INACCURACY,
MoveJudgement.MISTAKE,
MoveJudgement.BLUNDER,
).forEach { j ->
val c = judgementColor(j, dark)
val label = judgementPlural(j)
// From the PGN's evaluations alone !! and ! are not known: a dash, not a zero.
val unknown = state.nodes == 0UL && (j == MoveJudgement.BRILLIANT || j == MoveJudgement.GREAT)
val cell: @Composable (Boolean, UInt, String) -> Unit = { isWhite, count, side ->
val active = count > 0u
val active = count > 0u && !unknown
val shown = if (unknown) "\u2014" else count.toString()
Row(
Modifier
.fillMaxWidth()
@ -528,14 +530,14 @@ fun ReviewSheet(
contentDescription = "$label, $side, $count"
}
} else {
Modifier.clearAndSetSemantics { contentDescription = "$label, $side, $count" }
Modifier.clearAndSetSemantics { contentDescription = "$label, $side, $shown" }
},
),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.End,
) {
Text(
count.toString(),
shown,
style = MaterialTheme.typography.titleMedium.merge(Tabular),
color = if (active) c else variant,
)
@ -585,11 +587,21 @@ fun ReviewSheet(
style = MaterialTheme.typography.bodySmall,
color = variant,
)
if (state.nodes == 0UL) {
Text(stringResource(R.string.review_no_notes), style = MaterialTheme.typography.bodySmall, color = variant)
}
if (state.stale) {
Text(stringResource(R.string.review_stale), style = MaterialTheme.typography.bodySmall, color = variant)
}
Spacer(Modifier.height(20.dp))
// With a large font the two buttons go on two lines instead of breaking words.
FlowRow(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {
TextButton(onClick = onHide) { Text(stringResource(R.string.review_hide)) }
OutlinedButton(onClick = onAgain, enabled = !state.running) { Text(stringResource(R.string.review_again)) }
// Over evaluations of the PGN the engine can make its own; an engine
// analysis made again would only repeat itself.
if (state.nodes == 0UL) {
OutlinedButton(onClick = onAgain, enabled = !state.running) { Text(stringResource(R.string.review_engine)) }
}
}
}
}
@ -599,6 +611,8 @@ private fun SideReview.inaccuraciesOf(j: MoveJudgement): UInt = when (j) {
MoveJudgement.INACCURACY -> inaccuracies
MoveJudgement.MISTAKE -> mistakes
MoveJudgement.BLUNDER -> blunders
MoveJudgement.GREAT -> great
MoveJudgement.BRILLIANT -> brilliant
}
/// A row of the report: its label, then White's and Black's cells, 96 dp each.

View file

@ -0,0 +1,48 @@
package io.github.vrubelroman.chesspenguin.ui
import io.github.vrubelroman.chesspenguin.R
/// Rodent IV's characters in the app's language (android-rodent.md §3.3): their names and
/// what they do, as the desktop app says them (apps/desktop/src/i18n.rs), by the ids of
/// the shared list (`play::rodent::STYLES`, given by `rodentStyles()`).
val RODENT_TEXTS: Map<String, Pair<Int, Int>> = mapOf(
"iv_amanda" to (R.string.rodent_iv_amanda to R.string.rodent_iv_amanda_about),
"iv_cloe" to (R.string.rodent_iv_cloe to R.string.rodent_iv_cloe_about),
"iv_deborah" to (R.string.rodent_iv_deborah to R.string.rodent_iv_deborah_about),
"iv_defender" to (R.string.rodent_iv_defender to R.string.rodent_iv_defender_about),
"iv_dynamic" to (R.string.rodent_iv_dynamic to R.string.rodent_iv_dynamic_about),
"iv_grumpy" to (R.string.rodent_iv_grumpy to R.string.rodent_iv_grumpy_about),
"iv_partisan" to (R.string.rodent_iv_partisan to R.string.rodent_iv_partisan_about),
"iv_pawnsacker" to (R.string.rodent_iv_pawnsacker to R.string.rodent_iv_pawnsacker_about),
"iv_pedrita" to (R.string.rodent_iv_pedrita to R.string.rodent_iv_pedrita_about),
"iv_preston" to (R.string.rodent_iv_preston to R.string.rodent_iv_preston_about),
"iv_simple" to (R.string.rodent_iv_simple to R.string.rodent_iv_simple_about),
"iv_spitfire" to (R.string.rodent_iv_spitfire to R.string.rodent_iv_spitfire_about),
"iv_strangler" to (R.string.rodent_iv_strangler to R.string.rodent_iv_strangler_about),
"iv_alekhine" to (R.string.rodent_iv_alekhine to R.string.rodent_iv_alekhine_about),
"iv_anand" to (R.string.rodent_iv_anand to R.string.rodent_iv_anand_about),
"iv_anderssen" to (R.string.rodent_iv_anderssen to R.string.rodent_iv_anderssen_about),
"iv_bosboom" to (R.string.rodent_iv_bosboom to R.string.rodent_iv_bosboom_about),
"iv_botvinnik" to (R.string.rodent_iv_botvinnik to R.string.rodent_iv_botvinnik_about),
"iv_fischer" to (R.string.rodent_iv_fischer to R.string.rodent_iv_fischer_about),
"iv_karpov" to (R.string.rodent_iv_karpov to R.string.rodent_iv_karpov_about),
"iv_kasparov" to (R.string.rodent_iv_kasparov to R.string.rodent_iv_kasparov_about),
"iv_kortchnoi" to (R.string.rodent_iv_kortchnoi to R.string.rodent_iv_kortchnoi_about),
"iv_larsen" to (R.string.rodent_iv_larsen to R.string.rodent_iv_larsen_about),
"iv_lasker" to (R.string.rodent_iv_lasker to R.string.rodent_iv_lasker_about),
"iv_marshall" to (R.string.rodent_iv_marshall to R.string.rodent_iv_marshall_about),
"iv_morphy" to (R.string.rodent_iv_morphy to R.string.rodent_iv_morphy_about),
"iv_nimzowitsch" to (R.string.rodent_iv_nimzowitsch to R.string.rodent_iv_nimzowitsch_about),
"iv_petrosian" to (R.string.rodent_iv_petrosian to R.string.rodent_iv_petrosian_about),
"iv_reti" to (R.string.rodent_iv_reti to R.string.rodent_iv_reti_about),
"iv_rubinstein" to (R.string.rodent_iv_rubinstein to R.string.rodent_iv_rubinstein_about),
"iv_spassky" to (R.string.rodent_iv_spassky to R.string.rodent_iv_spassky_about),
"iv_steinitz" to (R.string.rodent_iv_steinitz to R.string.rodent_iv_steinitz_about),
"iv_tal" to (R.string.rodent_iv_tal to R.string.rodent_iv_tal_about),
"iv_tarrasch" to (R.string.rodent_iv_tarrasch to R.string.rodent_iv_tarrasch_about),
"iv_topalov" to (R.string.rodent_iv_topalov to R.string.rodent_iv_topalov_about),
)
/// The character suggested first (android-rodent.md §3.4), and the one an unknown id
/// (of a later version) falls back to.
const val DEFAULT_RODENT_STYLE = "iv_tal"

View file

@ -0,0 +1,138 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.selection.selectableGroup
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Add
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.RadioButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.lifecycle.ViewModel
import io.github.vrubelroman.chesspenguin.R
import io.github.vrubelroman.chesspenguin.data.DbEntry
import uniffi.mobile_api.GameData
import uniffi.mobile_api.GameSession
/// The game of a game screen as it is being changed (android-play.md §29–30), kept while
/// the phone turns: the screen is made again, the moves stay.
class GameEdit : ViewModel() {
/// Which game: "database/index", or [NEW_GAME].
var key: String? = null
val session = mutableStateOf<GameSession?>(null)
val data = mutableStateOf<GameData?>(null)
/// What reading the game noticed: kept when the game is changed.
var notes: List<String> = emptyList()
/// Where a new game or a copy was saved: saving again replaces it there.
var savedTo: Pair<String, UInt>? = null
/// Where the game against Maia went by itself (its player's database), if it did.
val recorded = mutableStateOf<io.github.vrubelroman.chesspenguin.data.Written?>(null)
/// Why it did not (the card says so; «Save…» stays).
val recordError = mutableStateOf<String?>(null)
/// An opening being learned over the game (android-play.md §32), how far, the board's side.
val trainer = mutableStateOf<uniffi.mobile_api.Trainer?>(null)
/// The game against Maia, when this screen plays one (§31).
val play = mutableStateOf<PlayRun?>(null)
/// Bumped to read the game in hand again (a rematch).
val reloads = androidx.compose.runtime.mutableIntStateOf(0)
var trainPly = 0
var trainFlipped = false
/// The move the trainer was opened from: the game shows it again after.
var trainReturn: Int? = null
override fun onCleared() {
trainer.value?.close()
play.value?.close()
session.value?.close()
}
}
/// The key of a new game (a game screen without a database).
const val NEW_GAME = "new"
/// «Save to a database» (android-play.md §30.6): the own databases to choose from (the
/// last one used first), or a new one named here.
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SaveSheet(own: List<DbEntry>, last: String?, onSave: (DbEntry) -> Unit, onCreate: (String) -> Unit, onDismiss: () -> Unit) {
var chosen by remember { mutableStateOf(own.firstOrNull { it.id == last }?.id ?: own.firstOrNull()?.id) }
var creating by remember { mutableStateOf(own.isEmpty()) }
val defaultName = stringResource(R.string.own_default_name)
var name by remember { mutableStateOf(freeName(defaultName, own.map { it.name })) }
ModalBottomSheet(onDismissRequest = onDismiss) {
Column(Modifier.fillMaxWidth().padding(bottom = 24.dp)) {
Text(stringResource(R.string.save_to_db), style = MaterialTheme.typography.titleLarge, modifier = Modifier.padding(horizontal = 24.dp, vertical = 8.dp))
Column(Modifier.selectableGroup()) {
for (e in own) {
val n = e.games ?: 0
Row(
Modifier
.fillMaxWidth()
.height(56.dp)
.selectable(selected = !creating && chosen == e.id, role = Role.RadioButton) {
creating = false
chosen = e.id
}
.padding(horizontal = 16.dp),
verticalAlignment = Alignment.CenterVertically,
) {
RadioButton(selected = !creating && chosen == e.id, onClick = null)
Text(displayName(e), Modifier.weight(1f).padding(start = 16.dp), maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(pluralStringResource(R.plurals.games_count, n, groupDigits(n)), color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodyMedium)
}
}
}
if (own.isNotEmpty() && !creating) {
Row(
Modifier.fillMaxWidth().height(56.dp).clickable { creating = true }.padding(horizontal = 24.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(Icons.Rounded.Add, null, tint = MaterialTheme.colorScheme.onSurfaceVariant)
Text(stringResource(R.string.own_new_ellipsis), Modifier.padding(start = 16.dp))
}
}
if (creating) {
OutlinedTextField(
value = name,
onValueChange = { name = it },
singleLine = true,
label = { Text(stringResource(R.string.own_name)) },
modifier = Modifier.fillMaxWidth().padding(horizontal = 24.dp, vertical = 8.dp),
)
}
Spacer(Modifier.size(8.dp))
Row(Modifier.fillMaxWidth().padding(horizontal = 24.dp), horizontalArrangement = Arrangement.End) {
if (creating) {
Button(onClick = { onCreate(name.trim()) }, enabled = name.isNotBlank()) { Text(stringResource(R.string.create_and_save)) }
} else {
Button(onClick = { own.firstOrNull { it.id == chosen }?.let(onSave) }, enabled = chosen != null) { Text(stringResource(R.string.save)) }
}
}
}
}
}

View file

@ -1,5 +1,29 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.material.icons.rounded.Info
import androidx.compose.material.icons.rounded.SdCard
import androidx.compose.material.icons.rounded.DeveloperBoard
import androidx.compose.material.icons.rounded.Timer
import androidx.compose.material.icons.rounded.Delete
import androidx.compose.material.icons.rounded.Close
import androidx.compose.material.icons.automirrored.rounded.MenuBook
import kotlinx.coroutines.launch
import androidx.compose.material.icons.rounded.Memory
import androidx.compose.material.icons.rounded.Translate
import androidx.compose.material.icons.rounded.Palette
import androidx.compose.material.icons.rounded.GridOn
import androidx.compose.material.icons.rounded.Save
import androidx.compose.material.icons.rounded.Vibration
import androidx.compose.material.icons.automirrored.rounded.FormatListBulleted
import androidx.compose.material.icons.automirrored.rounded.Notes
import androidx.compose.material.icons.automirrored.rounded.VolumeUp
import androidx.compose.material.icons.automirrored.rounded.ArrowRightAlt
import androidx.compose.material.icons.rounded.Animation
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.size
import androidx.compose.ui.draw.clip
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.background
import android.app.Activity
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
@ -42,11 +66,14 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import java.util.Locale
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import io.github.vrubelroman.chesspenguin.BuildConfig
import io.github.vrubelroman.chesspenguin.R
import io.github.vrubelroman.chesspenguin.data.LANGUAGES
import io.github.vrubelroman.chesspenguin.data.Language
import io.github.vrubelroman.chesspenguin.data.NetProblem
import io.github.vrubelroman.chesspenguin.data.NetState
import io.github.vrubelroman.chesspenguin.data.Notation
import io.github.vrubelroman.chesspenguin.data.Theme
@ -104,8 +131,9 @@ fun SettingsScreen(onBack: () -> Unit, onAbout: () -> Unit, onBoardStyle: () ->
) { padding ->
Column(Modifier.fillMaxSize().padding(padding).verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {
Group(stringResource(R.string.group_game))
Cards {
val notationNow = notationNames.firstOrNull { it.first == prefs.notation } ?: notationNames.first()
Item(stringResource(R.string.notation), notationNow.second) {
Item(stringResource(R.string.notation), notationNow.second, icon = Icons.AutoMirrored.Rounded.Notes) {
choice = Choice(
R.string.notation,
notationNames.map { it.second },
@ -114,13 +142,17 @@ fun SettingsScreen(onBack: () -> Unit, onAbout: () -> Unit, onBoardStyle: () ->
) { i -> set { it.copy(notation = notationNames[i].first) } }
}
Toggle(stringResource(R.string.animation), prefs.animation) { v -> set { it.copy(animation = v) } }
Toggle(stringResource(R.string.best_arrow), prefs.bestArrow) { v -> set { it.copy(bestArrow = v) } }
Toggle(stringResource(R.string.vibration), prefs.vibration) { v -> set { it.copy(vibration = v) } }
Toggle(stringResource(R.string.animation), prefs.animation, Icons.Rounded.Animation) { v -> set { it.copy(animation = v) } }
Toggle(stringResource(R.string.best_arrow), prefs.bestArrow, Icons.AutoMirrored.Rounded.ArrowRightAlt) { v -> set { it.copy(bestArrow = v) } }
Toggle(stringResource(R.string.sound), prefs.sound, Icons.AutoMirrored.Rounded.VolumeUp) { v -> set { it.copy(sound = v) } }
Toggle(stringResource(R.string.vibration), prefs.vibration, Icons.Rounded.Vibration) { v -> set { it.copy(vibration = v) } }
Toggle(stringResource(R.string.record_games), prefs.recordGames, Icons.Rounded.Save) { v -> set { it.copy(recordGames = v) } }
}
Group(stringResource(R.string.group_look))
Item(stringResource(R.string.board_and_pieces), boardLabel(prefs.board) + " · " + prefs.pieces.dir, onClick = onBoardStyle)
Item(stringResource(R.string.theme), themeNames.first { it.first == prefs.theme }.second) {
Cards {
Item(stringResource(R.string.board_and_pieces), boardLabel(prefs.board) + " · " + prefs.pieces.dir, icon = Icons.Rounded.GridOn, onClick = onBoardStyle)
Item(stringResource(R.string.theme), themeNames.first { it.first == prefs.theme }.second, icon = Icons.Rounded.Palette) {
choice = Choice(R.string.theme, themeNames.map { it.second }, themeNames.indexOfFirst { it.first == prefs.theme }) { i ->
set { it.copy(theme = themeNames[i].first) }
}
@ -130,42 +162,47 @@ fun SettingsScreen(onBack: () -> Unit, onAbout: () -> Unit, onBoardStyle: () ->
if (it.isEmpty()) stringResource(R.string.theme_system) else Locale.forLanguageTag(it).let { l -> l.getDisplayLanguage(l).replaceFirstChar(Char::uppercase) }
}
val language = remember { Language.get(context) }
Item(stringResource(R.string.language), languageNames[LANGUAGES.indexOf(language).coerceAtLeast(0)]) {
Item(stringResource(R.string.language), languageNames[LANGUAGES.indexOf(language).coerceAtLeast(0)], icon = Icons.Rounded.Translate) {
choice = Choice(R.string.language, languageNames, LANGUAGES.indexOf(language).coerceAtLeast(0)) { i ->
if (Language.set(context, LANGUAGES[i])) (context as? Activity)?.recreate()
}
}
}
Group(stringResource(R.string.group_engine))
Cards {
when {
files.builtIn -> Status(stringResource(R.string.engine_built_in))
files.builtIn -> Status(stringResource(R.string.engine_built_in), Icons.Rounded.Memory)
net == NetState.Ready -> {
Status(stringResource(R.string.engine_downloaded))
Item(stringResource(R.string.engine_delete, size), null) { deleting = true }
Status(stringResource(R.string.engine_downloaded), Icons.Rounded.Memory)
Item(stringResource(R.string.engine_delete, size), null, icon = Icons.Rounded.Delete) { deleting = true }
}
net is NetState.Loading -> {
val l = net as NetState.Loading
Item(stringResource(R.string.engine_downloading, (l.done / 1_000_000).toInt(), (l.total / 1_000_000).toInt()), null) { sheet = true }
Item(stringResource(R.string.engine_downloading, (l.done / 1_000_000).toInt(), (l.total / 1_000_000).toInt()), null, icon = Icons.Rounded.Memory) { sheet = true }
}
// The same sheet as in a game: the size, mobile data, cancel (§9).
else -> Item(stringResource(R.string.engine_missing, size), null) { sheet = true }
else -> Item(stringResource(R.string.engine_missing, size), null, icon = Icons.Rounded.Memory) { sheet = true }
}
Item(stringResource(R.string.lines), "${prefs.engineLines}") {
// Rodent IV's opening books (android-rodent.md §7.2): the engine itself is in the app.
RodentBooks(snackbar)
Item(stringResource(R.string.lines), "${prefs.engineLines}", icon = Icons.AutoMirrored.Rounded.FormatListBulleted) {
choice = Choice(R.string.lines, listOf("1", "2", "3"), prefs.engineLines - 1) { i -> set { it.copy(engineLines = i + 1) } }
}
Item(stringResource(R.string.time_per_position), secondsNames.firstOrNull { it.first == prefs.engineSeconds }?.second ?: "") {
Item(stringResource(R.string.time_per_position), secondsNames.firstOrNull { it.first == prefs.engineSeconds }?.second ?: "", icon = Icons.Rounded.Timer) {
choice = Choice(R.string.time_per_position, secondsNames.map { it.second }, secondsNames.indexOfFirst { it.first == prefs.engineSeconds }) { i ->
set { it.copy(engineSeconds = secondsNames[i].first) }
}
}
Item(stringResource(R.string.threads), "${prefs.engineThreads}") {
Item(stringResource(R.string.threads), "${prefs.engineThreads}", icon = Icons.Rounded.DeveloperBoard) {
choice = Choice(R.string.threads, (1..cores).map { "$it" }, prefs.engineThreads - 1) { i -> set { it.copy(engineThreads = i + 1) } }
}
val hashes = listOf(16, 32, 64, 128, 256)
val hashNames = hashes.map { stringResource(R.string.megabytes, it) }
Item(stringResource(R.string.memory), stringResource(R.string.megabytes, prefs.engineHashMb)) {
Item(stringResource(R.string.memory), stringResource(R.string.megabytes, prefs.engineHashMb), icon = Icons.Rounded.SdCard) {
choice = Choice(R.string.memory, hashNames, hashes.indexOf(prefs.engineHashMb)) { i -> set { it.copy(engineHashMb = hashes[i]) } }
}
}
Text(
stringResource(R.string.engine_battery),
style = MaterialTheme.typography.bodyMedium,
@ -174,7 +211,9 @@ fun SettingsScreen(onBack: () -> Unit, onAbout: () -> Unit, onBoardStyle: () ->
)
Spacer(Modifier.height(16.dp))
// A newer version of the app, even with its card hidden (android-ui.md §25.5).
Item(stringResource(R.string.about), aboutUpdateLine(), valueColor = MaterialTheme.colorScheme.primary, onClick = onAbout)
Cards {
Item(stringResource(R.string.about), aboutUpdateLine(), valueColor = MaterialTheme.colorScheme.primary, icon = Icons.Rounded.Info, onClick = onAbout)
}
}
}
@ -236,6 +275,84 @@ fun SettingsScreen(onBack: () -> Unit, onAbout: () -> Unit, onBoardStyle: () ->
}
}
/// «Rodent IV — opening books»: downloaded or not, with what is left to download;
/// download, or delete (not while a game against Rodent goes on); the progress and ✕
/// while downloading; why it failed, and «Try again».
@Composable
private fun RodentBooks(snackbar: androidx.compose.material3.SnackbarHostState) {
val app = app()
val books = app.rodentFiles.books
val state by books.state.collectAsState()
val game by app.maiaGames.current.collectAsState()
val playing = game?.let { !it.over && it.rival == io.github.vrubelroman.chesspenguin.data.Opponent.Rodent } == true
val scope = androidx.compose.runtime.rememberCoroutineScope()
val deletedText = stringResource(R.string.books_deleted)
val deleteText = stringResource(R.string.books_delete_cd)
fun mb(bytes: Long) = ((bytes + 999_999) / 1_000_000).toInt()
// The books checked so far stay: what is left is offered.
val left = remember(state) { books.remaining() }
Row(
Modifier.card().heightIn(min = 56.dp).padding(start = 16.dp, end = 4.dp, top = 8.dp, bottom = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
ItemIcon(Icons.AutoMirrored.Rounded.MenuBook)
Column(Modifier.weight(1f)) {
Text(stringResource(R.string.books_settings), style = MaterialTheme.typography.bodyLarge)
when (val s = state) {
is NetState.Loading -> {
androidx.compose.material3.LinearProgressIndicator(
progress = { s.done.toFloat() / s.total.coerceAtLeast(1) },
modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp),
)
Text(
stringResource(R.string.downloaded_of, mb(s.done), mb(s.total)),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
is NetState.Failed -> Text(
when (s.problem) {
NetProblem.NoInternet -> stringResource(R.string.no_internet)
NetProblem.Interrupted -> stringResource(R.string.interrupted)
NetProblem.NoSpace -> stringResource(R.string.no_space, mb(left))
NetProblem.Corrupt -> stringResource(R.string.corrupt)
},
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.error,
)
NetState.Ready -> Text(
stringResource(R.string.books_downloaded_mb, mb(books.size)),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
NetState.Missing -> Text(
stringResource(R.string.books_missing_mb, mb(left)),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
}
when (state) {
is NetState.Loading -> IconButton(onClick = { books.cancel() }) {
Icon(Icons.Rounded.Close, stringResource(R.string.cancel_download))
}
NetState.Ready -> TextButton(
enabled = !playing,
modifier = Modifier.semantics { contentDescription = deleteText },
onClick = {
books.delete()
scope.launch {
snackbar.currentSnackbarData?.dismiss()
snackbar.showSnackbar(deletedText)
}
},
) { Text(stringResource(R.string.delete)) }
is NetState.Failed -> TextButton(onClick = { books.download() }) { Text(stringResource(R.string.play_retry)) }
NetState.Missing -> TextButton(onClick = { books.download() }) { Text(stringResource(R.string.download)) }
}
}
}
private class Choice(val title: Int, val options: List<String>, val selected: Int, val hint: Int? = null, val pick: (Int) -> Unit)
@Composable
@ -248,44 +365,75 @@ private fun Group(title: String) {
)
}
/// A group's items as cards (android-lists.md §6): 16 dp corners outside, 4 dp between
/// them, 2 dp of the background between cards.
@Composable
private fun Item(title: String, value: String?, valueColor: androidx.compose.ui.graphics.Color = androidx.compose.ui.graphics.Color.Unspecified, onClick: (() -> Unit)?) {
private fun Cards(content: @Composable androidx.compose.foundation.layout.ColumnScope.() -> Unit) {
Column(
Modifier.padding(horizontal = 12.dp).clip(RoundedCornerShape(16.dp)),
verticalArrangement = androidx.compose.foundation.layout.Arrangement.spacedBy(2.dp),
content = content,
)
}
/// One card of a group.
@Composable
private fun Modifier.card(): Modifier = fillMaxWidth().clip(RoundedCornerShape(4.dp)).background(MaterialTheme.colorScheme.surfaceContainerLow)
/// An item's icon: 24 dp, then 16 dp to its text.
@Composable
private fun ItemIcon(icon: androidx.compose.ui.graphics.vector.ImageVector?) {
if (icon == null) return
Icon(icon, null, tint = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.size(24.dp))
Spacer(Modifier.width(16.dp))
}
@Composable
private fun Item(
title: String,
value: String?,
valueColor: androidx.compose.ui.graphics.Color = androidx.compose.ui.graphics.Color.Unspecified,
icon: androidx.compose.ui.graphics.vector.ImageVector? = null,
onClick: (() -> Unit)?,
) {
Row(
Modifier
.fillMaxWidth()
.card()
.heightIn(min = 56.dp)
.then(if (onClick != null) Modifier.clickable(onClick = onClick) else Modifier)
.padding(horizontal = 16.dp, vertical = 8.dp),
verticalArrangement = androidx.compose.foundation.layout.Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
) {
Text(title, style = MaterialTheme.typography.bodyLarge)
if (value != null) {
Text(value, style = MaterialTheme.typography.bodyMedium, color = valueColor.takeOrElse { MaterialTheme.colorScheme.onSurfaceVariant })
ItemIcon(icon)
Column(Modifier.weight(1f)) {
Text(title, style = MaterialTheme.typography.bodyLarge)
if (value != null) {
Text(value, style = MaterialTheme.typography.bodyMedium, color = valueColor.takeOrElse { MaterialTheme.colorScheme.onSurfaceVariant })
}
}
}
}
/// A line that tells, not a button.
@Composable
private fun Status(text: String) {
Text(
text,
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp),
)
private fun Status(text: String, icon: androidx.compose.ui.graphics.vector.ImageVector? = null) {
Row(Modifier.card().heightIn(min = 56.dp).padding(horizontal = 16.dp, vertical = 8.dp), verticalAlignment = Alignment.CenterVertically) {
ItemIcon(icon)
Text(text, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
}
@Composable
private fun Toggle(title: String, value: Boolean, onChange: (Boolean) -> Unit) {
private fun Toggle(title: String, value: Boolean, icon: androidx.compose.ui.graphics.vector.ImageVector? = null, onChange: (Boolean) -> Unit) {
Row(
Modifier
.fillMaxWidth()
.card()
.heightIn(min = 56.dp)
.selectable(selected = value, role = Role.Switch) { onChange(!value) }
.padding(horizontal = 16.dp),
.padding(horizontal = 16.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
ItemIcon(icon)
Text(title, style = MaterialTheme.typography.bodyLarge, modifier = Modifier.weight(1f))
Switch(checked = value, onCheckedChange = null)
}

View file

@ -0,0 +1,306 @@
package io.github.vrubelroman.chesspenguin.ui
import android.view.HapticFeedbackConstants
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material.icons.rounded.Replay
import androidx.compose.material.icons.rounded.SwapVert
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import io.github.vrubelroman.chesspenguin.R
import kotlinx.coroutines.delay
import uniffi.mobile_api.TrainVerdict
import uniffi.mobile_api.Trainer
/// A wrong move of the trainer, on the board for a moment (§32.2).
private data class Wrong(val fen: String, val from: String, val to: String)
/// Learning an opening (android-play.md §32): the user plays the moves of both sides
/// of the line from memory; a wrong move shows for 400 ms and is taken back.
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TrainScreen(trainer: Trainer, ply0: Int, startFlipped: Boolean, onPly: (Int) -> Unit, onExit: () -> Unit) {
val app = app()
val prefs by app.settings.prefs.collectAsState()
val context = androidx.compose.ui.platform.LocalContext.current
val pieces = remember { Pieces(context) }
val view = LocalView.current
val lang = uiLanguage()
val san = remember(prefs.notation, lang) { { s: String -> displaySan(s, prefs.notation, lang) } }
var ply by remember { mutableIntStateOf(ply0) }
var flipped by remember { mutableStateOf(startFlipped) }
var wrong by remember { mutableStateOf<Wrong?>(null) }
// Said after a wrong move until the right one.
var missed by remember { mutableStateOf(false) }
var changes by remember { mutableIntStateOf(0) }
val st = remember(ply, changes) { trainer.state(ply.toUInt()) }
BackHandler(onBack = onExit)
LaunchedEffect(wrong) {
if (wrong != null) {
delay(400)
wrong = null
}
}
fun buzz(reject: Boolean) {
if (prefs.vibration) view.performHapticFeedback(if (reject) HapticFeedbackConstants.REJECT else HapticFeedbackConstants.CLOCK_TICK)
}
fun move(uci: String) {
when (trainer.judge(ply.toUInt(), uci)) {
TrainVerdict.RIGHT -> {
missed = false
ply += 1
onPly(ply)
buzz(false)
trainer.state(ply.toUInt()).played.lastOrNull()?.let { app.sounds.move(it) }
}
TrainVerdict.FINISHED -> {
missed = false
ply += 1
onPly(ply)
buzz(false)
app.sounds.play(io.github.vrubelroman.chesspenguin.data.Sound.Success)
}
TrainVerdict.WRONG -> {
trainer.fenAfter(ply.toUInt(), uci)?.let { wrong = Wrong(it, uci.substring(0, 2), uci.substring(2, 4)) }
missed = true
changes++
buzz(true)
app.sounds.play(io.github.vrubelroman.chesspenguin.data.Sound.Wrong)
}
TrainVerdict.DONE -> {}
}
}
val sub = listOfNotNull(trainer.game(), stringResource(R.string.train_up_to, san(trainer.upTo()).text)).joinToString(" · ")
Scaffold(
topBar = {
TopAppBar(
navigationIcon = { IconButton(onClick = onExit) { Icon(Icons.AutoMirrored.Rounded.ArrowBack, stringResource(R.string.back)) } },
title = {
Column {
Text(stringResource(R.string.train_title), style = MaterialTheme.typography.titleMedium)
Text(sub, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
},
)
},
bottomBar = {
Column {
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant)
Surface(color = MaterialTheme.colorScheme.surfaceContainer) {
Row(Modifier.fillMaxWidth().navigationBarsPadding().height(72.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.SpaceEvenly) {
IconButton(onClick = { flipped = !flipped }) { Icon(Icons.Rounded.SwapVert, stringResource(R.string.flip)) }
TextButton(enabled = ply > 0 || st.done, onClick = {
trainer.again()
ply = 0
onPly(0)
missed = false
wrong = null
changes++
}) {
Icon(Icons.Rounded.Replay, null)
Spacer(Modifier.width(8.dp))
Text(stringResource(R.string.train_restart))
}
}
}
}
},
) { padding ->
val landscape = androidx.compose.ui.platform.LocalConfiguration.current.orientation == android.content.res.Configuration.ORIENTATION_LANDSCAPE
val task: @Composable () -> Unit = {
if (!st.done) {
// The task: which move, whose turn, how far.
val whiteToMove = st.fen.substringAfter(' ').startsWith("w")
Column(Modifier.fillMaxWidth().height(48.dp).padding(horizontal = 16.dp), verticalArrangement = Arrangement.Center) {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(stringResource(R.string.train_move_of, (ply + 1).toString(), st.length.toString()), Modifier.weight(1f), style = MaterialTheme.typography.bodyLarge)
Text(stringResource(if (whiteToMove) R.string.train_white else R.string.train_black), style = MaterialTheme.typography.titleSmall, fontWeight = FontWeight.Medium)
}
LinearProgressIndicator(progress = { ply.toFloat() / st.length.toInt().coerceAtLeast(1) }, modifier = Modifier.fillMaxWidth().padding(top = 4.dp))
}
}
}
val boardBox: @Composable (Modifier) -> Unit = { m ->
val w = wrong
Board(
fen = w?.fen ?: st.fen,
flipped = flipped,
lastFrom = w?.from ?: st.fromSquare,
lastTo = w?.to ?: st.toSquare,
pieces = pieces,
theme = prefs.board,
set = prefs.pieces,
description = stringResource(R.string.train_title),
arrows = st.hint?.let { listOf(BoardArrow(it[0], it[1], EngineArrow)) } ?: emptyList(),
animated = prefs.animation,
modifier = m,
input = if (st.done || w != null) null else BoardInput(
remember(ply, changes) { trainer.legalMoves(ply.toUInt()) },
onMove = ::move,
// The line's own piece where it promotes; a queen otherwise (§29.4).
promotion = { pair -> trainer.promotionAt(ply.toUInt())?.takeIf { it.startsWith(pair) }?.last() },
),
alert = w?.let { it.from to it.to },
)
}
val you: @Composable () -> Unit = {
if (!st.done) {
// You: the mistakes of this run, or before the first move what was before.
Row(Modifier.fillMaxWidth().height(48.dp).padding(start = 16.dp, end = 4.dp), verticalAlignment = Alignment.CenterVertically) {
val text = when {
st.hint != null -> stringResource(R.string.train_arrow)
missed -> stringResource(R.string.train_wrong)
ply == 0 && st.mistakes == 0u -> history(st.before)
else -> stringResource(R.string.train_mistakes, st.mistakes.toString())
}
Text(
text,
Modifier.weight(1f),
color = if (missed && st.hint == null) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.onSurface,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
if (st.mayShow && st.hint == null) {
TextButton(onClick = {
trainer.show(ply.toUInt())
changes++
}) { Text(stringResource(R.string.train_show)) }
} else if (ply > 0 || st.mistakes > 0u) {
// With the message of a wrong move, the count stays in sight.
Text(
if (missed && st.hint == null) stringResource(R.string.train_mistakes, st.mistakes.toString())
else stringResource(R.string.train_run, (st.before.runs + 1u).toString()),
Modifier.padding(end = 12.dp),
color = MaterialTheme.colorScheme.onSurfaceVariant,
style = MaterialTheme.typography.bodyMedium,
)
}
}
}
}
val notes: @Composable androidx.compose.foundation.layout.ColumnScope.() -> Unit = {
Column(Modifier.weight(1f).fillMaxWidth().verticalScroll(rememberScrollState())) {
if (st.done) Result(st, onAgain = {
trainer.again()
ply = 0
onPly(0)
missed = false
changes++
}, onExit = onExit)
// The moves played so far, two to a row.
st.played.chunked(2).forEachIndexed { i, pair ->
Row(Modifier.fillMaxWidth().height(40.dp).padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically) {
Text("${i + 1}", Modifier.width(32.dp), color = MaterialTheme.colorScheme.onSurfaceVariant)
Text(san(pair[0]), Modifier.weight(1f), fontWeight = FontWeight.Medium)
Text(pair.getOrNull(1)?.let { san(it) } ?: androidx.compose.ui.text.AnnotatedString(""), Modifier.weight(1f), fontWeight = FontWeight.Medium)
}
}
}
}
// A phone on its side: the board at full height, the rest beside it.
if (landscape) {
Row(Modifier.fillMaxSize().padding(padding)) {
boardBox(Modifier.fillMaxHeight())
Column(Modifier.weight(1f).fillMaxHeight()) {
task()
you()
notes()
}
}
} else {
Column(Modifier.fillMaxSize().padding(padding)) {
task()
boardBox(Modifier.fillMaxWidth())
you()
notes()
}
}
}
}
/// «Last time: 2 · best: 0», «Not done before».
@Composable
private fun history(s: uniffi.mobile_api.TrainStats): String = when {
s.runs == 0u -> stringResource(R.string.train_not_done)
s.cleanStreak >= 2u -> stringResource(R.string.train_last_streak, (s.last ?: 0u).toString(), s.cleanStreak.toString())
else -> stringResource(R.string.train_last_best, (s.last ?: 0u).toString(), s.best?.toString() ?: "–")
}
/// The end of a run (§32.3): how it went, the line's runs, again or back to the game.
@Composable
private fun Result(st: uniffi.mobile_api.TrainState, onAgain: () -> Unit, onExit: () -> Unit) {
val after = st.after ?: st.before
Column(
Modifier
.fillMaxWidth()
.padding(16.dp)
.background(MaterialTheme.colorScheme.surfaceContainerHigh, RoundedCornerShape(16.dp))
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(4.dp),
) {
Text(
when {
st.hinted -> stringResource(R.string.train_done_hint, st.mistakes.toString())
st.mistakes == 0u -> stringResource(R.string.train_done_clean)
else -> stringResource(R.string.train_done, st.mistakes.toString())
},
style = MaterialTheme.typography.titleMedium,
)
val line = buildList {
add(stringResource(R.string.train_run_best, after.runs.toString(), after.best?.toString() ?: "–"))
if (after.cleanStreak >= 2u) add(stringResource(R.string.train_streak, after.cleanStreak.toString()))
}.joinToString(" · ")
Text(line, style = MaterialTheme.typography.bodyMedium)
if (after.recentMistakes.size > 1) {
val runs = after.recentMistakes.zip(after.recentHinted).joinToString(" · ") { (m, h) -> if (h) "$m*" else "$m" }
Text(stringResource(R.string.train_recent, runs), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
Row(Modifier.fillMaxWidth().padding(top = 8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
// The desktop's texts carry their signs; here the buttons are the signs.
Button(onClick = onAgain, modifier = Modifier.weight(1f).height(48.dp)) { Text(stringResource(R.string.train_again).removePrefix("↻ "), maxLines = 1) }
OutlinedButton(onClick = onExit, modifier = Modifier.weight(1f).height(48.dp)) { Text(stringResource(R.string.train_back).removePrefix("⬅ "), maxLines = 1) }
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Before After
Before After

View file

@ -36,9 +36,10 @@
<string name="to_start">Zum Anfang</string>
<string name="move_back">Zug zurück</string>
<string name="move_forward">Zug vor</string>
<string name="move_back_hint">Vorheriger Zug. Gedrückt halten: zum Anfang</string>
<string name="move_forward_hint">Nächster Zug. Gedrückt halten: zum Ende der Variante</string>
<string name="to_end">Zum Ende der Variante</string>
<string name="next_moves">Weiter:</string>
<string name="board_hint">Dies ist ein Partiebetrachter. Blättern Sie mit ◀ ▶ unten durch die Züge.</string>
<string name="board_description">Brett, Stellung nach %1$s</string>
<string name="board_start">Brett, Ausgangsstellung</string>
<string name="white_won">Weiß hat gewonnen</string>
@ -112,8 +113,7 @@
<string name="about">Über</string>
<string name="build_full">Stockfish eingebaut</string>
<string name="build_light">Stockfish wird in der App geladen</string>
<string name="alpha">Alpha</string>
<string name="about_text">Ein Betrachter für Schachdatenbanken: PGN, ChessBase, Archive. Dateien werden nur gelesen, nie geändert.</string>
<string name="about_text">Schachdatenbanken, Partieanalyse und Spiel gegen den Computer. Ihre Dateien werden nur gelesen, nie geändert.</string>
<string name="licenses">Lizenzen und Autoren</string>
<string name="website">Website und Quellcode</string>
@ -215,6 +215,14 @@
<string name="add_paste_hint">In einer anderen App kopierte Partien</string>
<string name="paste_none">Keine PGN-Partien in der Zwischenablage</string>
<string name="paste_db">Eingefügt am %1$s</string>
<plurals name="clipboard_open_title">
<item quantity="one">Partie in der Zwischenablage</item>
<item quantity="other">Partien in der Zwischenablage</item>
</plurals>
<string name="clipboard_open_one">Diese PGN-Partie speichern und auf dem Brett öffnen?</string>
<string name="clipboard_open_many">%1$s speichern und die erste Partie auf dem Brett öffnen? Alle Partien bleiben in der lokalen Kopie.</string>
<string name="clipboard_open">Öffnen</string>
<string name="clipboard_database_name">Zwischenablage</string>
<string name="opening_file">Datei wird geöffnet…</string>
<string name="file_failed">Die Datei ließ sich nicht öffnen</string>
<string name="file_no_games">Diese Datei enthält keine Schachpartien.</string>
@ -227,15 +235,10 @@
<string name="review_menu">Partieanalyse</string>
<string name="review_report_menu">Partiebericht</string>
<string name="review_text">Die Engine bewertet jede Stellung der Hauptvariante. Die Partie selbst wird nicht verändert.</string>
<string name="review_quality">Qualität</string>
<string name="review_fast">Schnell</string>
<string name="review_normal">Normal</string>
<string name="review_deep">Gründlich</string>
<string name="review_seconds">%d s</string>
<string name="review_minutes">%d Min.</string>
<string name="review_start">Analysieren</string>
<string name="review_fill">Ergänzen</string>
<string name="review_again">Erneut analysieren</string>
<string name="review_partial">%1$d von %2$d Stellungen sind schon bewertet.</string>
<string name="review_progress">Partieanalyse · %1$d von %2$d</string>
<string name="review_stop">Analyse anhalten</string>
@ -249,6 +252,10 @@
<string name="review_inaccuracies">Ungenauigkeiten</string>
<string name="review_mistakes">Fehler</string>
<string name="review_blunders">Grobe Fehler</string>
<string name="review_great">Starker Zug</string>
<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_missing">Ohne Bewertung: %d</string>
<string name="review_failed">Die Analyse wurde unterbrochen</string>
<string name="review_resume">Fortsetzen</string>
@ -258,13 +265,17 @@
<string name="review_endgame">Endspiel</string>
<string name="review_source">%1$s · %2$s Knoten pro Zug</string>
<string name="review_source_pgn" formatted="false">Bewertungen aus der PGN ([%eval])</string>
<string name="review_no_notes">!! und ! braucht die Engine: die PGN enthält nur Bewertungen</string>
<string name="review_no_seconds">In dieser Analyse wurde noch nicht nach !! und ! gesucht</string>
<string name="review_stale">Analyse mit anderen Engine-Einstellungen gemacht</string>
<string name="review_update">Aktualisieren</string>
<string name="review_engine">Mit der Engine analysieren</string>
<string name="review_hide">Analyse ausblenden</string>
<string name="review_graph">Bewertungsgrafik</string>
<string name="review_engine_paused">Pausiert: Partie wird analysiert</string>
<string name="review_best_preview">Bessere Variante · Zug %1$d von %2$d</string>
<string name="review_next">Zum nächsten solchen Zug</string>
<string name="review_show_best">Die bessere Variante auf dem Brett zeigen</string>
<string name="review_restart">Von vorn</string>
<string name="review_graph_state">%1$s, Bewertung %2$s</string>
<string name="review_start_position">Ausgangsstellung</string>
<plurals name="review_estimate">
@ -389,4 +400,325 @@
<string name="s_about_ready">Version %1$s ist heruntergeladen</string>
<string name="upd_card_downloading">Update auf %1$s, %2$d von %3$d Megabyte heruntergeladen</string>
<string name="upd_short_release">Datei lässt sich nicht prüfen</string>
<string name="undo_action">Rückgängig</string>
<string name="moves_deleted">Züge gelöscht</string>
<string name="make_main">Zur Hauptvariante machen</string>
<string name="delete_move">Zug und Fortsetzung löschen</string>
<string name="move_actions">Aktionen zum Zug</string>
<string name="new_game">Neue Partie</string>
<string name="own_databases">Meine Datenbanken</string>
<string name="own_new">+ Neue Datenbank</string>
<string name="own_empty">Hier stehen die Partien, die Sie eingeben oder gegen den Computer spielen</string>
<string name="files_add">+ Hinzufügen</string>
<string name="files_empty">Hier stehen PGN- und ChessBase-Dateien, Ordner und Partien aus dem Internet, die Sie hinzufügen</string>
<string name="files">Dateien</string>
<string name="own_default_name">Meine Partien</string>
<string name="own_new_title">Neue Datenbank</string>
<string name="own_name">Name</string>
<string name="own_new_hint">Wird auf dem Telefon in ChessPenguin gespeichert. Die Datei lässt sich im Menü der Datenbank exportieren.</string>
<string name="create">Erstellen</string>
<string name="own_on_phone">auf dem Telefon</string>
<string name="own_export">Datei exportieren…</string>
<string name="own_delete">Datenbank löschen</string>
<string name="own_exported">Datei gespeichert</string>
<string name="own_export_failed">Die Datei konnte nicht gespeichert werden</string>
<string name="own_removed">Datenbank gelöscht</string>
<string name="own_delete_title">„%1$s“ löschen?</string>
<plurals name="own_delete_text">
<item quantity="one">%1$s Partie wird vom Telefon gelöscht. Wenn Sie sie brauchen, exportieren Sie zuerst die Datei.</item>
<item quantity="other">%1$s Partien werden vom Telefon gelöscht. Wenn Sie sie brauchen, exportieren Sie zuerst die Datei.</item>
</plurals>
<string name="saved_to">In „%1$s“ gespeichert, Nr. %2$s</string>
<string name="save_failed">Die Partie konnte nicht gespeichert werden</string>
<string name="save_in">In „%1$s“ speichern</string>
<string name="save_to_mine">In meiner Datenbank speichern…</string>
<string name="save_to_db">In einer Datenbank speichern</string>
<string name="save_to_db_ellipsis">In einer Datenbank speichern…</string>
<string name="own_new_ellipsis">Neue Datenbank…</string>
<string name="create_and_save">Erstellen und speichern</string>
<string name="save_changes_in">Änderungen in „%1$s“ speichern?</string>
<string name="save_game_question">Partie speichern?</string>
<string name="dont_save">Nicht speichern</string>
<string name="game_data">Partiedaten</string>
<string name="date_hint">JJJJ.MM.TT</string>
<string name="date_wrong">Kein Datum: 2026.10.26, 2026 oder 26.10.2026</string>
<string name="discard_changes">Änderungen verwerfen?</string>
<string name="discard">Verwerfen</string>
<string name="keep_editing">Weiter bearbeiten</string>
<string name="edit">Bearbeiten</string>
<string name="next">Weiter</string>
<string name="train_title">Eröffnung lernen</string>
<string name="train_up_to">bis %1$s</string>
<string name="train_learn">Eröffnung bis zu diesem Zug lernen</string>
<string name="train_move_of">Zug %1$s von %2$s</string>
<string name="train_white">♔ Weiß am Zug</string>
<string name="train_black">♚ Schwarz am Zug</string>
<string name="train_mistakes">Fehler: %1$s</string>
<string name="train_run">Durchgang %1$s</string>
<string name="train_wrong">× In der Partie folgt hier ein anderer Zug</string>
<string name="train_show">Zug zeigen</string>
<string name="train_not_done">Diese Linie noch nicht geübt</string>
<string name="train_last_streak">Zuletzt: %1$s · fehlerfrei in Folge: %2$s</string>
<string name="train_last_best">Zuletzt: %1$s · Bestwert: %2$s</string>
<string name="train_done_clean">Fehlerfrei geschafft</string>
<string name="train_done_hint">Mit Hinweis geschafft · Fehler: %1$s</string>
<string name="train_done">Geschafft · Fehler: %1$s</string>
<string name="train_run_best">Durchgang %1$s · Bestwert: %2$s</string>
<string name="train_streak">fehlerfrei in Folge: %1$s</string>
<string name="train_recent">Letzte: %1$s</string>
<string name="train_arrow">Spielen Sie den Zug des Pfeils</string>
<string name="train_again">↻ Noch einmal</string>
<string name="train_back">⬅ Zurück zur Partie</string>
<string name="train_restart">Von vorn</string>
<plurals name="train_runs">
<item quantity="one">%1$d Durchgang</item>
<item quantity="other">%1$d Durchgänge</item>
</plurals>
<string name="maia_download_title">Maia für ChessPenguin</string>
<string name="play_won">Sie haben gewonnen</string>
<string name="play_lost">Sie haben verloren</string>
<string name="play_you_resigned">Sie haben aufgegeben</string>
<string name="play_draw">Remis</string>
<string name="end_mate">Schachmatt</string>
<string name="end_stalemate">Patt</string>
<string name="end_threefold">die Stellung ist dreimal aufgetreten</string>
<string name="end_fifty">50 Züge ohne Schlagen oder Bauernzug</string>
<string name="end_material">keine Seite kann mattsetzen</string>
<string name="end_maia_resigned">Maia hat aufgegeben</string>
<string name="play_resign_q">Aufgeben?</string>
<string name="play_resign">⚑ Aufgeben</string>
<string name="play_take_back">↶ Zurücknehmen</string>
<string name="play_title">Gegen den Computer spielen</string>
<string name="play_colour">Ihre Farbe</string>
<string name="color_white">Weiß</string>
<string name="color_black">Schwarz</string>
<string name="color_random">Zufällig</string>
<string name="play_measured">Die eigene Wertung von Maia: sie entspricht nicht der Elo eines Menschen.</string>
<string name="play_download_note">Maia wird einmalig heruntergeladen (%1$s MB, von huggingface.co, die Datei der Autoren selbst).</string>
<string name="play_download_and_play">Herunterladen und spielen</string>
<string name="play_play">Spielen</string>
<string name="play_thinking">denkt nach…</string>
<string name="play_event">Partie gegen den Computer</string>
<string name="play_analyse">Analysieren</string>
<string name="play_rematch">↻ Revanche</string>
<string name="play_from_here">Von hier aus spielen…</string>
<string name="play_checking">Wird geprüft…</string>
<string name="play_maia_failed">Maia ist nicht gestartet: %1$s</string>
<string name="play_accept_win">Sieg annehmen</string>
<string name="play_to_end">Zu Ende spielen</string>
<string name="play_maia_resigns">Maia gibt auf</string>
<string name="play_note_from">Ab hier eine Partie gegen Maia %1$s.</string>
<string name="play_abort">Abbrechen</string>
<string name="play_your_name">Ihr Name</string>
<string name="play_maia_ready">Maia ist heruntergeladen</string>
<string name="play_retry">Erneut versuchen</string>
<string name="play_her_position_lost">Ihre Stellung ist verloren. Sieg annehmen oder weiterspielen?</string>
<string name="play_continue">Fortsetzen</string>
<string name="play_adjourned">Partie gegen Maia %1$s · Sie spielen %2$s</string>
<string name="play_as_white">Weiß</string>
<string name="play_as_black">Schwarz</string>
<string name="play_removed">Partie entfernt</string>
<string name="play_untimed">ohne Uhr</string>
<string name="play_you">Sie</string>
<string name="play_saved">✓ Gespeichert</string>
<string name="play_save">Speichern…</string>
<string name="play_adjourned_sub">Sie spielen %1$s · %2$s</string>
<string name="play_from_label">Nach %1$s</string>
<string name="sound">Ton</string>
<string name="undo_menu">Rückgängig</string>
<string name="made_main">Jetzt die Hauptvariante</string>
<string name="elo">Elo</string>
<string name="play_analyse_short">Analyse</string>
<string name="play_on_short">Weiterspielen</string>
<string name="play_viewing">Ansicht %1$s · zurück zur Partie ›</string>
<string name="start_position">die Ausgangsstellung</string>
<string name="play_maia_stopped">Maia ist nicht gestartet.</string>
<string name="play_maia_reload">Maia neu herunterladen</string>
<string name="play_adjourned_q">Eine Partie gegen %1$s ist zurückgestellt</string>
<string name="play_continue_it">Fortsetzen</string>
<string name="play_start_new">Neue beginnen</string>
<string name="play_adjourned_new_text">Eine neue Partie ersetzt sie; das Gespielte kommt unvollendet in die Datenbank des Spielers.</string>
<string name="play_offer_draw">Remis</string>
<string name="end_agreement">durch Einigung</string>
<string name="play_draw_declined">Maia lehnt das Remis ab</string>
<string name="play_draw_later">Maia hat abgelehnt; nach zwei ihrer Züge wieder anbieten</string>
<string name="play_draw_no_engine">Maia beantwortet Remis mit Stockfish: über „Engine“ herunterladen</string>
<string name="player_db_name">%1$s — Partien gegen den Computer</string>
<string name="player_db_shared">Partien gegen den Computer</string>
<string name="player_written">✓ In „%1$s“, Nr. %2$s ›</string>
<string name="player_kept_unfinished">Partie unvollendet in „%1$s“ gespeichert</string>
<string name="player_db_row">werden selbst gespeichert</string>
<string name="record_games">Partien gegen den Computer in die Datenbank des Spielers schreiben</string>
<string name="player_line_existing">Partien werden in „%1$s“ gespeichert</string>
<string name="player_line_new">Die Partien werden in eine neue Datenbank „%1$s“ gespeichert.</string>
<string name="player_line_noname">Ohne Namen gehen die Partien in „%1$s“. Geben Sie einen Namen ein, um eine eigene Datenbank zu bekommen.</string>
<string name="player_line_off">Partien werden nicht von selbst gespeichert (Einstellungen).</string>
<string name="player_written_new">✓ Neue Datenbank „%1$s“, Nr. %2$s ›</string>
<string name="player_write_failed">Konnte nicht in „%1$s“ schreiben: %2$s</string>
<string name="play_adjourned_replaced">Eine neue Partie ersetzt sie.</string>
<string name="last_opened">Zuletzt geöffnet</string>
<string name="play_adjourned_title">Partie gegen %1$s</string>
<string name="play_move_n">Zug %1$d</string>
<!-- Rodent IV on the phone (android-rodent.md §9); the characters and the desktop's sentences come from apps/desktop/src/i18n.rs. -->
<string name="rodent_iv_amanda">Amanda</string>
<string name="rodent_iv_amanda_about">Greift zuerst an, spielt dann auf aktive Figuren.</string>
<string name="rodent_iv_cloe">Cloe</string>
<string name="rodent_iv_cloe_about">Mag geschlossene Stellungen.</string>
<string name="rodent_iv_deborah">Deborah</string>
<string name="rodent_iv_deborah_about">Verteidigt gut und mag ihre Läufer.</string>
<string name="rodent_iv_defender">Verteidiger</string>
<string name="rodent_iv_defender_about">Solide und vorsichtig; mit Remis zufrieden.</string>
<string name="rodent_iv_dynamic">Dynamiker</string>
<string name="rodent_iv_dynamic_about">Greift an, mag Läufer, opfert ab und zu.</string>
<string name="rodent_iv_grumpy">Brummbär</string>
<string name="rodent_iv_grumpy_about">Angriff und Einengung; mag blockierte Stellungen, meidet Remis.</string>
<string name="rodent_iv_partisan">Partisan</string>
<string name="rodent_iv_partisan_about">Greift nach ruhigen, unauffälligen Eröffnungen an.</string>
<string name="rodent_iv_pawnsacker">Bauernopferer</string>
<string name="rodent_iv_pawnsacker_about">Ausgewogen, gibt aber eher Bauern her.</string>
<string name="rodent_iv_pedrita">Pedrita</string>
<string name="rodent_iv_pedrita_about">Bauern, Verteidigung und Einengung.</string>
<string name="rodent_iv_preston">Preston</string>
<string name="rodent_iv_preston_about">Ein materialistischer, maßvoller Angreifer.</string>
<string name="rodent_iv_simple">Schlicht</string>
<string name="rodent_iv_simple_about">Am computerhaftesten: schlichtes, solides Schach.</string>
<string name="rodent_iv_spitfire">Hitzkopf</string>
<string name="rodent_iv_spitfire_about">Scharf und aggressiv.</string>
<string name="rodent_iv_strangler">Würger</string>
<string name="rodent_iv_strangler_about">Eine Würgeschlange: würgt langsam, sehr menschlich.</string>
<string name="rodent_iv_alekhine">Aljechin</string>
<string name="rodent_iv_alekhine_about">Dynamische Angriffe und tiefe Kombinationen.</string>
<string name="rodent_iv_anand">Anand</string>
<string name="rodent_iv_anand_about">Schnelles, universelles Spiel mit scharfen Eröffnungen.</string>
<string name="rodent_iv_anderssen">Anderssen</string>
<string name="rodent_iv_anderssen_about">Ein romantischer Angreifer des 19. Jahrhunderts: Opfer.</string>
<string name="rodent_iv_bosboom">Bosboom</string>
<string name="rodent_iv_bosboom_about">Ausgefallene Eröffnungen und kreatives Blitzspiel.</string>
<string name="rodent_iv_botvinnik">Botvinnik</string>
<string name="rodent_iv_botvinnik_about">Wissenschaftliches, strategisches Spiel aus tiefer Vorbereitung.</string>
<string name="rodent_iv_fischer">Fischer</string>
<string name="rodent_iv_fischer_about">Klar, klassisch und präzise.</string>
<string name="rodent_iv_karpov">Karpov</string>
<string name="rodent_iv_karpov_about">Positioneller Druck, Prophylaxe und Technik.</string>
<string name="rodent_iv_kasparov">Kasparov</string>
<string name="rodent_iv_kasparov_about">Initiative und kraftvoller Angriff.</string>
<string name="rodent_iv_kortchnoi">Kortchnoi</string>
<string name="rodent_iv_kortchnoi_about">Ein zäher Verteidiger und Konterspieler.</string>
<string name="rodent_iv_larsen">Larsen</string>
<string name="rodent_iv_larsen_about">Originell und riskant, mit ausgefallenen Eröffnungen.</string>
<string name="rodent_iv_lasker">Lasker</string>
<string name="rodent_iv_lasker_about">Ein praktischer, psychologischer Kämpfer.</string>
<string name="rodent_iv_marshall">Marshall</string>
<string name="rodent_iv_marshall_about">Ein verwegener Angreifer mit Gambits.</string>
<string name="rodent_iv_morphy">Morphy</string>
<string name="rodent_iv_morphy_about">Schnelle Entwicklung und offene Linien.</string>
<string name="rodent_iv_nimzowitsch">Nimzowitsch</string>
<string name="rodent_iv_nimzowitsch_about">Einengung, Blockade und Überdeckung.</string>
<string name="rodent_iv_petrosian">Petrosian</string>
<string name="rodent_iv_petrosian_about">Prophylaxe und Sicherheit zuerst.</string>
<string name="rodent_iv_reti">Reti</string>
<string name="rodent_iv_reti_about">Hypermodern: kontrolliert das Zentrum aus der Ferne.</string>
<string name="rodent_iv_rubinstein">Rubinstein</string>
<string name="rodent_iv_rubinstein_about">Klassisches Positionsspiel, stark im Endspiel.</string>
<string name="rodent_iv_spassky">Spassky</string>
<string name="rodent_iv_spassky_about">Ein Universalspieler, in jeder Stellung zu Hause.</string>
<string name="rodent_iv_steinitz">Steinitz</string>
<string name="rodent_iv_steinitz_about">Der Begründer des Positionsspiels, ein hartnäckiger Verteidiger.</string>
<string name="rodent_iv_tal">Tal</string>
<string name="rodent_iv_tal_about">Der Zauberer aus Riga: Opfer und Angriff.</string>
<string name="rodent_iv_tarrasch">Tarrasch</string>
<string name="rodent_iv_tarrasch_about">Klassische Regeln: Raum, Entwicklung, aktive Figuren.</string>
<string name="rodent_iv_topalov">Topalov</string>
<string name="rodent_iv_topalov_about">Aggressiv und dynamisch, opfert die Qualität.</string>
<string name="opp_maia_sub">spielt wie ein Mensch</string>
<string name="opp_rodent_sub">stark, mit Stil</string>
<string name="like_human">Wie ein Mensch</string>
<string name="maia_no_style">Maia wählt keinen Stil: Sie spielt wie Menschen ihrer Wertung.</string>
<string name="rodent_measured">Die eigene Wertung von Rodent (UCI_Elo): sie entspricht nicht der Elo eines Menschen.</string>
<string name="rodent_resigns">Rodent gibt auf</string>
<string name="end_rodent_resigned">Rodent hat aufgegeben</string>
<string name="rodent_draw_declined">Rodent lehnt das Remis ab</string>
<string name="rodent_draw_later">Rodent hat abgelehnt; nach zwei seiner Züge wieder anbieten</string>
<string name="rodent_position_lost">Seine Stellung ist verloren. Sieg annehmen oder zu Ende spielen?</string>
<string name="play_button">Spielen</string>
<string name="play_button_cd">Gegen den Computer spielen</string>
<string name="strength_n">Spielstärke: %1$s</string>
<string name="pick_title">Gegen wen spielen</string>
<string name="pick_intro">Ein Charakter ist ein Stil mit seinen Eröffnungen; die Spielstärke stellt der Schieberegler ein.</string>
<string name="pick_players">Große Spieler</string>
<string name="pick_characters">Charaktere</string>
<string name="pick_change">Ändern</string>
<string name="pick_player_cd">%1$s, großer Spieler</string>
<string name="pick_character_cd">%1$s, Charakter</string>
<string name="character_cd">Charakter: %1$s</string>
<string name="books_ready">Rodent IV und seine Eröffnungsbücher sind auf dem Telefon</string>
<string name="books_offer">Eröffnungsbücher von Rodent IV: %1$s MB, einmalig von github.com</string>
<string name="books_not_needed">Aus einer Stellung heraus ist kein Eröffnungsbuch nötig: Rodent IV spielt sofort</string>
<string name="books_without">Ohne Buch</string>
<string name="books_without_cd">Ohne Buch: ohne Eröffnungsbuch spielen</string>
<string name="books_notification">Eröffnungsbücher von Rodent IV</string>
<string name="books_settings">Rodent IV — Eröffnungsbücher</string>
<string name="books_downloaded_mb">heruntergeladen · %1$s MB</string>
<string name="books_missing_mb">nicht heruntergeladen · %1$s MB</string>
<string name="books_deleted">Eröffnungsbücher gelöscht</string>
<string name="rodent_draw_no_engine">Rodent beantwortet Remis mit Stockfish: über „Engine“ herunterladen</string>
<string name="rodent_stopped">Rodent ist nicht gestartet.</string>
<string name="rodent_restart">Neu starten</string>
<string name="play_note_from_rodent">Ab hier eine Partie gegen Rodent IV %1$s · %2$s.</string>
<string name="rodent_stopped_playing">Rodent hat während der Partie aufgehört.</string>
<string name="strength_range">%1$s, von %2$s bis %3$s</string>
<string name="strength">Spielstärke</string>
<string name="books_delete_cd">Eröffnungsbücher löschen</string>
<!-- Vorbereitung auf den Gegner (Aufgabe 48). -->
<string name="players">Spieler</string>
<string name="player_name_hint">Spielername</string>
<string name="players_read_failed">Spieler konnten nicht gelesen werden</string>
<string name="reading_players">Spieler werden gelesen…</string>
<string name="no_named_players">Diese Datenbank enthält keine benannten Spieler</string>
<string name="player_not_found">Spieler nicht gefunden</string>
<string name="to_games">Zu den Partien</string>
<string name="reset_search">Suche zurücksetzen</string>
<string name="prepare_action">Vorbereiten</string>
<string name="prep_choose_color">Farbe wählen</string>
<string name="prep_against_player">Vorbereiten gegen %1$s</string>
<string name="prep_against_white">Gegen Weiß</string>
<string name="prep_against_black">Gegen Schwarz</string>
<string name="prep_opponent">Auf Gegner vorbereiten…</string>
<string name="prep_title">Vorbereitung auf den Gegner</string>
<string name="prep_close_engine_line">Schließen Sie zuerst die Engine-Variante</string>
<!--suppress TypographyDashes: literal PGN null move -->
<string name="prep_null_move_unavailable">Suche nach einem Lehrzug -- ist nicht verfügbar</string>
<string name="prep_as_white">Weiß</string>
<string name="prep_as_black">Schwarz</string>
<string name="prep_move_failed">Dieser Zug konnte nicht ausgeführt werden</string>
<string name="prep_play_continuation">%1$s spielen, %2$s, %3$s Prozent</string>
<string name="prep_board_start">Brett, Ausgangsstellung. %1$s unten.</string>
<string name="prep_board_after">Brett, Stellung nach %1$s. %2$s unten.</string>
<string name="turn_white">Weiß am Zug</string>
<string name="turn_black">Schwarz am Zug</string>
<string name="prep_opponent_plays">Gegner spielt</string>
<string name="prep_opponents_play">Seine Gegner spielen</string>
<string name="prep_after">nach %1$s</string>
<string name="prep_beginning">Anfang</string>
<string name="prep_context_description">%1$s, %2$s, %3$s, %4$s</string>
<string name="prep_failed">Fortsetzungen konnten nicht berechnet werden</string>
<string name="prep_no_memory">Nicht genügend Speicher für die Suche in dieser Datenbank</string>
<string name="prep_calculating">Fortsetzungen werden berechnet…</string>
<string name="prep_position_absent">Diese Stellung kommt in Partien von %1$s nicht vor</string>
<string name="prep_position_absent_hint">Sie können auf dem Brett fortsetzen oder zurückgehen</string>
<string name="prep_all_ended">Alle Partien endeten hier</string>
<string name="prep_ended_here">Hier beendet: %1$s</string>
<string name="prep_no_normal">Keine normale Fortsetzung: %1$s</string>
<string name="to_game">Zur Partie</string>
<string name="to_players">Zu den Spielern</string>
<string name="prep_choose_move">Zug auswählen</string>
<plurals name="prep_wins"><item quantity="one">%1$s Sieg</item><item quantity="other">%1$s Siege</item></plurals>
<plurals name="prep_draws"><item quantity="one">%1$s Remis</item><item quantity="other">%1$s Remis</item></plurals>
<plurals name="prep_losses"><item quantity="one">%1$s Niederlage</item><item quantity="other">%1$s Niederlagen</item></plurals>
<string name="prep_unknown_accessibility">Unbekannte Ergebnisse: %1$d; nicht in den Prozentwerten enthalten.</string>
<string name="prep_continuation_description">%1$s. %2$d von %3$s, %4$s Prozent. Ergebnisse für %5$s: %6$s, %7$s, %8$s; %9$s, %10$s und %11$s Prozent. %12$s Spielen.</string>
<string name="prep_play">Spielen</string>
<string name="prep_unknown_short">weitere %1$s</string>
<string name="prep_wdl_counts">+%1$s =%2$s −%3$s · W/D/L %4$s/%5$s/%6$s %%</string>
</resources>

View file

@ -37,9 +37,10 @@
<string name="to_start">Al inicio</string>
<string name="move_back">Jugada atrás</string>
<string name="move_forward">Jugada adelante</string>
<string name="move_back_hint">Jugada anterior. Mantén pulsado para ir al inicio</string>
<string name="move_forward_hint">Jugada siguiente. Mantén pulsado para ir al final de la línea</string>
<string name="to_end">Al final de la línea</string>
<string name="next_moves">Siguiente:</string>
<string name="board_hint">Es un visor de partidas. Recorre las jugadas con ◀ ▶ abajo.</string>
<string name="board_description">Tablero, posición tras %1$s</string>
<string name="board_start">Tablero, posición inicial</string>
<string name="white_won">Ganaron las blancas</string>
@ -113,8 +114,7 @@
<string name="about">Acerca de</string>
<string name="build_full">Stockfish incluido</string>
<string name="build_light">Stockfish se descarga en la aplicación</string>
<string name="alpha">alfa</string>
<string name="about_text">Un visor de bases de ajedrez: PGN, ChessBase, archivos comprimidos. Los archivos solo se leen, nunca se modifican.</string>
<string name="about_text">Bases de ajedrez, análisis de partidas y juego contra el ordenador. Tus archivos solo se leen, nunca se modifican.</string>
<string name="licenses">Licencias y autores</string>
<string name="website">Sitio web y código fuente</string>
@ -219,6 +219,15 @@
<string name="add_paste_hint">Partidas copiadas en otra aplicación</string>
<string name="paste_none">No hay partidas PGN en el portapapeles</string>
<string name="paste_db">Pegado el %1$s</string>
<plurals name="clipboard_open_title">
<item quantity="one">Partida en el portapapeles</item>
<item quantity="many">Partidas en el portapapeles</item>
<item quantity="other">Partidas en el portapapeles</item>
</plurals>
<string name="clipboard_open_one">Guardar esta partida PGN y abrirla en el tablero?</string>
<string name="clipboard_open_many">Guardar %1$s y abrir la primera partida en el tablero? Todas las partidas se conservarán en la copia local.</string>
<string name="clipboard_open">Abrir</string>
<string name="clipboard_database_name">Portapapeles</string>
<string name="opening_file">Abriendo el archivo…</string>
<string name="file_failed">No se pudo abrir el archivo</string>
<string name="file_no_games">Este archivo no contiene partidas de ajedrez.</string>
@ -231,15 +240,10 @@
<string name="review_menu">Análisis de la partida</string>
<string name="review_report_menu">Informe de la partida</string>
<string name="review_text">El motor evalúa cada posición de la línea principal. La partida en sí no cambia.</string>
<string name="review_quality">Calidad</string>
<string name="review_fast">Rápido</string>
<string name="review_normal">Normal</string>
<string name="review_deep">Profundo</string>
<string name="review_seconds">%d s</string>
<string name="review_minutes">%d min</string>
<string name="review_start">Analizar</string>
<string name="review_fill">Completar</string>
<string name="review_again">Analizar de nuevo</string>
<string name="review_partial">Ya hay %1$d de %2$d posiciones evaluadas.</string>
<string name="review_progress">Análisis · %1$d de %2$d</string>
<string name="review_stop">Detener el análisis</string>
@ -253,6 +257,10 @@
<string name="review_inaccuracies">Imprecisiones</string>
<string name="review_mistakes">Errores</string>
<string name="review_blunders">Errores graves</string>
<string name="review_great">Gran jugada</string>
<string name="review_brilliant">Jugada brillante</string>
<string name="review_greats">Grandes jugadas</string>
<string name="review_brilliants">Jugadas brillantes</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>
@ -262,13 +270,17 @@
<string name="review_endgame">Final</string>
<string name="review_source">%1$s · %2$s nodos por jugada</string>
<string name="review_source_pgn" formatted="false">Evaluaciones del PGN ([%eval])</string>
<string name="review_no_notes">!! y ! requieren el motor: el PGN solo trae evaluaciones</string>
<string name="review_no_seconds">Este análisis aún no buscó !! ni !</string>
<string name="review_stale">Análisis hecho con otros ajustes del motor</string>
<string name="review_update">Actualizar</string>
<string name="review_engine">Analizar con el motor</string>
<string name="review_hide">Ocultar el análisis</string>
<string name="review_graph">Gráfico de evaluación</string>
<string name="review_engine_paused">En pausa: se está analizando la partida</string>
<string name="review_best_preview">Mejor línea · jugada %1$d de %2$d</string>
<string name="review_next">Ir a la siguiente jugada así</string>
<string name="review_show_best">Mostrar la mejor línea en el tablero</string>
<string name="review_restart">Empezar de nuevo</string>
<string name="review_graph_state">%1$s, evaluación %2$s</string>
<string name="review_start_position">Posición inicial</string>
<plurals name="review_estimate">
@ -395,4 +407,327 @@
<string name="s_about_ready">La versión %1$s está descargada</string>
<string name="upd_card_downloading">Actualización a %1$s, %2$d de %3$d megabytes descargados</string>
<string name="upd_short_release">No se puede comprobar el archivo</string>
<string name="undo_action">Deshacer</string>
<string name="moves_deleted">Jugadas eliminadas</string>
<string name="make_main">Convertir en línea principal</string>
<string name="delete_move">Eliminar la jugada y lo que sigue</string>
<string name="move_actions">Acciones de la jugada</string>
<string name="new_game">Nueva partida</string>
<string name="own_databases">Mis bases</string>
<string name="own_new">+ Nueva base</string>
<string name="own_empty">Aquí estarán las partidas que introduzcas o juegues contra el ordenador</string>
<string name="files_add">+ Añadir</string>
<string name="files_empty">Aquí estarán los archivos PGN y ChessBase, las carpetas y las partidas de internet que añadas</string>
<string name="files">Archivos</string>
<string name="own_default_name">Mis partidas</string>
<string name="own_new_title">Nueva base</string>
<string name="own_name">Nombre</string>
<string name="own_new_hint">Se guarda en el teléfono, en ChessPenguin. El archivo se exporta desde el menú de la base.</string>
<string name="create">Crear</string>
<string name="own_on_phone">en el teléfono</string>
<string name="own_export">Exportar el archivo…</string>
<string name="own_delete">Eliminar la base</string>
<string name="own_exported">Archivo guardado</string>
<string name="own_export_failed">No se pudo guardar el archivo</string>
<string name="own_removed">Base eliminada</string>
<string name="own_delete_title">¿Eliminar «%1$s»?</string>
<plurals name="own_delete_text">
<item quantity="one">Se eliminará %1$s partida del teléfono. Si la necesitas, exporta antes el archivo.</item>
<item quantity="many">Se eliminarán %1$s partidas del teléfono. Si las necesitas, exporta antes el archivo.</item>
<item quantity="other">Se eliminarán %1$s partidas del teléfono. Si las necesitas, exporta antes el archivo.</item>
</plurals>
<string name="saved_to">Guardada en «%1$s», n.º %2$s</string>
<string name="save_failed">No se pudo guardar la partida</string>
<string name="save_in">Guardar en «%1$s»</string>
<string name="save_to_mine">Guardar en mi base…</string>
<string name="save_to_db">Guardar en una base</string>
<string name="save_to_db_ellipsis">Guardar en una base…</string>
<string name="own_new_ellipsis">Nueva base…</string>
<string name="create_and_save">Crear y guardar</string>
<string name="save_changes_in">¿Guardar los cambios en «%1$s»?</string>
<string name="save_game_question">¿Guardar la partida?</string>
<string name="dont_save">No guardar</string>
<string name="game_data">Datos de la partida</string>
<string name="date_hint">AAAA.MM.DD</string>
<string name="date_wrong">No es una fecha: 2026.10.26, 2026 o 26.10.2026</string>
<string name="discard_changes">¿Descartar los cambios?</string>
<string name="discard">Descartar</string>
<string name="keep_editing">Seguir editando</string>
<string name="edit">Editar</string>
<string name="next">Siguiente</string>
<string name="train_title">Aprendiendo la apertura</string>
<string name="train_up_to">hasta %1$s</string>
<string name="train_learn">Aprender la apertura hasta esta jugada</string>
<string name="train_move_of">Jugada %1$s de %2$s</string>
<string name="train_white">♔ Juegan blancas</string>
<string name="train_black">♚ Juegan negras</string>
<string name="train_mistakes">Errores: %1$s</string>
<string name="train_run">Repaso %1$s</string>
<string name="train_wrong">× En la partida hay otra jugada aquí</string>
<string name="train_show">Mostrar la jugada</string>
<string name="train_not_done">Línea aún no repasada</string>
<string name="train_last_streak">La última vez: %1$s · sin errores seguidos: %2$s</string>
<string name="train_last_best">La última vez: %1$s · mejor: %2$s</string>
<string name="train_done_clean">Completado sin errores</string>
<string name="train_done_hint">Completado con pista · errores: %1$s</string>
<string name="train_done">Completado · errores: %1$s</string>
<string name="train_run_best">Repaso %1$s · mejor: %2$s</string>
<string name="train_streak">sin errores seguidos: %1$s</string>
<string name="train_recent">Recientes: %1$s</string>
<string name="train_arrow">Juega la jugada de la flecha</string>
<string name="train_again">↻ Otra vez</string>
<string name="train_back">⬅ Volver a la partida</string>
<string name="train_restart">Desde el principio</string>
<plurals name="train_runs">
<item quantity="one">%1$d repaso</item>
<item quantity="many">%1$d repasos</item>
<item quantity="other">%1$d repasos</item>
</plurals>
<string name="maia_download_title">Maia para ChessPenguin</string>
<string name="play_won">Has ganado</string>
<string name="play_lost">Has perdido</string>
<string name="play_you_resigned">Has abandonado</string>
<string name="play_draw">Tablas</string>
<string name="end_mate">jaque mate</string>
<string name="end_stalemate">rey ahogado</string>
<string name="end_threefold">la posición se repitió tres veces</string>
<string name="end_fifty">50 jugadas sin capturas ni movimientos de peón</string>
<string name="end_material">ningún bando puede dar mate</string>
<string name="end_maia_resigned">Maia se rindió</string>
<string name="play_resign_q">¿Abandonar?</string>
<string name="play_resign">⚑ Abandonar</string>
<string name="play_take_back">↶ Deshacer jugada</string>
<string name="play_title">Jugar contra el ordenador</string>
<string name="play_colour">Tu color</string>
<string name="color_white">Blancas</string>
<string name="color_black">Negras</string>
<string name="color_random">Al azar</string>
<string name="play_measured">El rating propio de Maia: no equivale al Elo de una persona.</string>
<string name="play_download_note">Maia se descarga una sola vez (%1$s MB, desde huggingface.co, el archivo de los propios autores).</string>
<string name="play_download_and_play">Descargar y jugar</string>
<string name="play_play">Jugar</string>
<string name="play_thinking">pensando…</string>
<string name="play_event">Partida contra el ordenador</string>
<string name="play_analyse">Analizar</string>
<string name="play_rematch">↻ Revancha</string>
<string name="play_from_here">Jugar desde aquí…</string>
<string name="play_checking">Comprobando…</string>
<string name="play_maia_failed">Maia no se inició: %1$s</string>
<string name="play_accept_win">Aceptar la victoria</string>
<string name="play_to_end">Jugar hasta el final</string>
<string name="play_maia_resigns">Maia se rinde</string>
<string name="play_note_from">A partir de aquí, una partida contra Maia %1$s.</string>
<string name="play_abort">Abortar</string>
<string name="play_your_name">Tu nombre</string>
<string name="play_maia_ready">Maia está descargada</string>
<string name="play_retry">Reintentar</string>
<string name="play_her_position_lost">Su posición está perdida. ¿Aceptar la victoria o seguir?</string>
<string name="play_continue">Continuar</string>
<string name="play_adjourned">Partida contra Maia %1$s · juegas con %2$s</string>
<string name="play_as_white">blancas</string>
<string name="play_as_black">negras</string>
<string name="play_removed">Partida eliminada</string>
<string name="play_untimed">sin reloj</string>
<string name="play_you">Tú</string>
<string name="play_saved">✓ Guardada</string>
<string name="play_save">Guardar…</string>
<string name="play_adjourned_sub">juegas con %1$s · %2$s</string>
<string name="play_from_label">Tras %1$s</string>
<string name="sound">Sonido</string>
<string name="undo_menu">Deshacer</string>
<string name="made_main">Ahora es la línea principal</string>
<string name="elo">Elo</string>
<string name="play_analyse_short">Analizar</string>
<string name="play_on_short">Seguir</string>
<string name="play_viewing">Viendo %1$s · volver a la partida ›</string>
<string name="start_position">la posición inicial</string>
<string name="play_maia_stopped">Maia no se inició.</string>
<string name="play_maia_reload">Volver a descargar Maia</string>
<string name="play_adjourned_q">Hay una partida aplazada contra %1$s</string>
<string name="play_continue_it">Continuarla</string>
<string name="play_start_new">Empezar una nueva</string>
<string name="play_adjourned_new_text">Una partida nueva la sustituye; lo jugado va sin terminar a la base del jugador.</string>
<string name="play_offer_draw">Tablas</string>
<string name="end_agreement">por acuerdo</string>
<string name="play_draw_declined">Maia rechaza las tablas</string>
<string name="play_draw_later">Maia lo rechazó; ofrece de nuevo tras dos de sus jugadas</string>
<string name="play_draw_no_engine">Maia responde a las tablas con Stockfish: descárgalo con «Motor»</string>
<string name="player_db_name">%1$s — partidas contra el ordenador</string>
<string name="player_db_shared">Partidas contra el ordenador</string>
<string name="player_written">✓ En «%1$s», n.º %2$s ›</string>
<string name="player_kept_unfinished">Partida guardada sin terminar en «%1$s»</string>
<string name="player_db_row">se guardan solas</string>
<string name="record_games">Guardar las partidas contra el ordenador en la base del jugador</string>
<string name="player_line_existing">Las partidas se guardan en «%1$s»</string>
<string name="player_line_new">Las partidas se guardarán en una base nueva «%1$s».</string>
<string name="player_line_noname">Sin nombre, las partidas van a «%1$s». Escribe un nombre para tener tu propia base.</string>
<string name="player_line_off">Las partidas no se guardan solas (Ajustes).</string>
<string name="player_written_new">✓ Base nueva «%1$s», n.º %2$s ›</string>
<string name="player_write_failed">No se pudo escribir en «%1$s»: %2$s</string>
<string name="play_adjourned_replaced">Una partida nueva la sustituye.</string>
<string name="last_opened">Abierta por última vez</string>
<string name="play_adjourned_title">Partida contra %1$s</string>
<string name="play_move_n">jugada %1$d</string>
<!-- Rodent IV on the phone (android-rodent.md §9); the characters and the desktop's sentences come from apps/desktop/src/i18n.rs. -->
<string name="rodent_iv_amanda">Amanda</string>
<string name="rodent_iv_amanda_about">Primero ataca, luego busca piezas activas.</string>
<string name="rodent_iv_cloe">Cloe</string>
<string name="rodent_iv_cloe_about">Le gustan las posiciones cerradas.</string>
<string name="rodent_iv_deborah">Débora</string>
<string name="rodent_iv_deborah_about">Defiende bien y le gustan sus alfiles.</string>
<string name="rodent_iv_defender">Defensor</string>
<string name="rodent_iv_defender_about">Sólido y prudente; se conforma con tablas.</string>
<string name="rodent_iv_dynamic">Dinámico</string>
<string name="rodent_iv_dynamic_about">Ataca, le gustan los alfiles, sacrifica de vez en cuando.</string>
<string name="rodent_iv_grumpy">Gruñón</string>
<string name="rodent_iv_grumpy_about">Ataque y restricción; le gustan las posiciones bloqueadas, evita las tablas.</string>
<string name="rodent_iv_partisan">Partisano</string>
<string name="rodent_iv_partisan_about">Ataca tras aperturas tranquilas y discretas.</string>
<string name="rodent_iv_pawnsacker">Gambitero</string>
<string name="rodent_iv_pawnsacker_about">Equilibrado, pero entrega peones con más facilidad.</string>
<string name="rodent_iv_pedrita">Pedrita</string>
<string name="rodent_iv_pedrita_about">Peones, defensa y restricción.</string>
<string name="rodent_iv_preston">Preston</string>
<string name="rodent_iv_preston_about">Un atacante materialista y moderado.</string>
<string name="rodent_iv_simple">Sencillo</string>
<string name="rodent_iv_simple_about">El más «computadora»: ajedrez sencillo y sólido.</string>
<string name="rodent_iv_spitfire">Fogoso</string>
<string name="rodent_iv_spitfire_about">Agudo y agresivo.</string>
<string name="rodent_iv_strangler">Estrangulador</string>
<string name="rodent_iv_strangler_about">Una boa: asfixia despacio, muy humano.</string>
<string name="rodent_iv_alekhine">Alekhine</string>
<string name="rodent_iv_alekhine_about">Ataques dinámicos y combinaciones profundas.</string>
<string name="rodent_iv_anand">Anand</string>
<string name="rodent_iv_anand_about">Juego rápido y universal con aperturas agudas.</string>
<string name="rodent_iv_anderssen">Anderssen</string>
<string name="rodent_iv_anderssen_about">Un atacante romántico del siglo XIX: sacrificios.</string>
<string name="rodent_iv_bosboom">Bosboom</string>
<string name="rodent_iv_bosboom_about">Aperturas poco habituales y blitz creativo.</string>
<string name="rodent_iv_botvinnik">Botvinnik</string>
<string name="rodent_iv_botvinnik_about">Juego estratégico y científico, preparación profunda.</string>
<string name="rodent_iv_fischer">Fischer</string>
<string name="rodent_iv_fischer_about">Claro, clásico y preciso.</string>
<string name="rodent_iv_karpov">Karpov</string>
<string name="rodent_iv_karpov_about">Presión posicional, profilaxis y técnica.</string>
<string name="rodent_iv_kasparov">Kasparov</string>
<string name="rodent_iv_kasparov_about">Iniciativa y ataque poderoso.</string>
<string name="rodent_iv_kortchnoi">Kortchnoi</string>
<string name="rodent_iv_kortchnoi_about">Un defensor tenaz y contraatacante.</string>
<string name="rodent_iv_larsen">Larsen</string>
<string name="rodent_iv_larsen_about">Original y arriesgado, con aperturas inusuales.</string>
<string name="rodent_iv_lasker">Lasker</string>
<string name="rodent_iv_lasker_about">Un luchador práctico y psicológico.</string>
<string name="rodent_iv_marshall">Marshall</string>
<string name="rodent_iv_marshall_about">Un atacante audaz, amigo de los gambitos.</string>
<string name="rodent_iv_morphy">Morphy</string>
<string name="rodent_iv_morphy_about">Desarrollo rápido y líneas abiertas.</string>
<string name="rodent_iv_nimzowitsch">Nimzowitsch</string>
<string name="rodent_iv_nimzowitsch_about">Restricción, bloqueo y sobreprotección.</string>
<string name="rodent_iv_petrosian">Petrosian</string>
<string name="rodent_iv_petrosian_about">Profilaxis y seguridad ante todo.</string>
<string name="rodent_iv_reti">Reti</string>
<string name="rodent_iv_reti_about">Hipermoderno: controla el centro a distancia.</string>
<string name="rodent_iv_rubinstein">Rubinstein</string>
<string name="rodent_iv_rubinstein_about">Juego posicional clásico, gran finalista.</string>
<string name="rodent_iv_spassky">Spassky</string>
<string name="rodent_iv_spassky_about">Un jugador universal, cómodo en cualquier posición.</string>
<string name="rodent_iv_steinitz">Steinitz</string>
<string name="rodent_iv_steinitz_about">El fundador del juego posicional, un defensor obstinado.</string>
<string name="rodent_iv_tal">Tal</string>
<string name="rodent_iv_tal_about">El mago de Riga: sacrificios y ataque.</string>
<string name="rodent_iv_tarrasch">Tarrasch</string>
<string name="rodent_iv_tarrasch_about">Reglas clásicas: espacio, desarrollo, piezas activas.</string>
<string name="rodent_iv_topalov">Topalov</string>
<string name="rodent_iv_topalov_about">Agresivo y dinámico, sacrifica la calidad.</string>
<string name="opp_maia_sub">juega como una persona</string>
<string name="opp_rodent_sub">fuerte, con estilo</string>
<string name="like_human">Como una persona</string>
<string name="maia_no_style">Maia no elige estilo: juega como la gente de su nivel.</string>
<string name="rodent_measured">El rating propio de Rodent (UCI_Elo): no equivale al Elo de una persona.</string>
<string name="rodent_resigns">Rodent se rinde</string>
<string name="end_rodent_resigned">Rodent se rindió</string>
<string name="rodent_draw_declined">Rodent rechaza las tablas</string>
<string name="rodent_draw_later">Rodent lo rechazó; ofrece de nuevo tras dos de sus jugadas</string>
<string name="rodent_position_lost">Su posición está perdida. ¿Aceptar la victoria o jugar hasta el final?</string>
<string name="play_button">Jugar</string>
<string name="play_button_cd">Jugar contra el ordenador</string>
<string name="strength_n">Fuerza: %1$s</string>
<string name="pick_title">Contra quién jugar</string>
<string name="pick_intro">Un carácter es un estilo y unas aperturas; la fuerza la marca el control deslizante.</string>
<string name="pick_players">Grandes jugadores</string>
<string name="pick_characters">Caracteres</string>
<string name="pick_change">Cambiar</string>
<string name="pick_player_cd">%1$s, gran jugador</string>
<string name="pick_character_cd">%1$s, carácter</string>
<string name="character_cd">Carácter: %1$s</string>
<string name="books_ready">Rodent IV y sus libros de aperturas están en el teléfono</string>
<string name="books_offer">Libros de aperturas de Rodent IV: %1$s MB, una sola vez de github.com</string>
<string name="books_not_needed">Desde una posición no hace falta libro de aperturas: Rodent IV juega enseguida</string>
<string name="books_without">Sin libro</string>
<string name="books_without_cd">Sin libro: jugar sin libro de aperturas</string>
<string name="books_notification">Libros de aperturas de Rodent IV</string>
<string name="books_settings">Rodent IV — libros de aperturas</string>
<string name="books_downloaded_mb">descargados · %1$s MB</string>
<string name="books_missing_mb">no descargados · %1$s MB</string>
<string name="books_deleted">Libros de aperturas eliminados</string>
<string name="rodent_draw_no_engine">Rodent responde a las tablas con Stockfish: descárgalo con «Motor»</string>
<string name="rodent_stopped">Rodent no se inició.</string>
<string name="rodent_restart">Reiniciar</string>
<string name="play_note_from_rodent">A partir de aquí, una partida contra Rodent IV %1$s · %2$s.</string>
<string name="rodent_stopped_playing">Rodent se detuvo durante la partida.</string>
<string name="strength_range">%1$s, de %2$s a %3$s</string>
<string name="strength">Fuerza</string>
<string name="books_delete_cd">Eliminar los libros de aperturas</string>
<!-- Preparación contra el rival (tarea 48). -->
<string name="players">Jugadores</string>
<string name="player_name_hint">Nombre del jugador</string>
<string name="players_read_failed">No se pudieron leer los jugadores</string>
<string name="reading_players">Leyendo jugadores…</string>
<string name="no_named_players">No hay jugadores con nombre en esta base</string>
<string name="player_not_found">Jugador no encontrado</string>
<string name="to_games">Volver a las partidas</string>
<string name="reset_search">Borrar búsqueda</string>
<string name="prepare_action">Preparar</string>
<string name="prep_choose_color">Elige un color</string>
<string name="prep_against_player">Prepararse contra %1$s</string>
<string name="prep_against_white">Contra las blancas</string>
<string name="prep_against_black">Contra las negras</string>
<string name="prep_opponent">Prepararse contra el rival…</string>
<string name="prep_title">Preparación contra el rival</string>
<string name="prep_close_engine_line">Cierra primero la línea del motor</string>
<!--suppress TypographyDashes: literal PGN null move -->
<string name="prep_null_move_unavailable">La búsqueda después de un -- didáctico no está disponible</string>
<string name="prep_as_white">Blancas</string>
<string name="prep_as_black">Negras</string>
<string name="prep_move_failed">No se pudo jugar este movimiento</string>
<string name="prep_play_continuation">Jugar %1$s, %2$s, %3$s por ciento</string>
<string name="prep_board_start">Tablero, posición inicial. %1$s abajo.</string>
<string name="prep_board_after">Tablero, posición después de %1$s. %2$s abajo.</string>
<string name="turn_white">Juegan las blancas</string>
<string name="turn_black">Juegan las negras</string>
<string name="prep_opponent_plays">Juega el rival</string>
<string name="prep_opponents_play">Juegan sus rivales</string>
<string name="prep_after">después de %1$s</string>
<string name="prep_beginning">inicio</string>
<string name="prep_context_description">%1$s, %2$s, %3$s, %4$s</string>
<string name="prep_failed">No se pudieron calcular las continuaciones</string>
<string name="prep_no_memory">No hay memoria suficiente para buscar en esta base</string>
<string name="prep_calculating">Calculando continuaciones…</string>
<string name="prep_position_absent">Esta posición no aparece en las partidas de %1$s</string>
<string name="prep_position_absent_hint">Puedes continuar en el tablero o retroceder</string>
<string name="prep_all_ended">Todas las partidas terminaron aquí</string>
<string name="prep_ended_here">Terminaron aquí: %1$s</string>
<string name="prep_no_normal">Sin continuación normal: %1$s</string>
<string name="to_game">Volver a la partida</string>
<string name="to_players">Volver a los jugadores</string>
<string name="prep_choose_move">Elige un movimiento</string>
<plurals name="prep_wins"><item quantity="one">%1$s victoria</item><item quantity="many">%1$s victorias</item><item quantity="other">%1$s victorias</item></plurals>
<plurals name="prep_draws"><item quantity="one">%1$s tabla</item><item quantity="many">%1$s tablas</item><item quantity="other">%1$s tablas</item></plurals>
<plurals name="prep_losses"><item quantity="one">%1$s derrota</item><item quantity="many">%1$s derrotas</item><item quantity="other">%1$s derrotas</item></plurals>
<string name="prep_unknown_accessibility">Resultados desconocidos: %1$d; excluidos de los porcentajes.</string>
<string name="prep_continuation_description">%1$s. %2$d de %3$s, %4$s por ciento. Resultados de %5$s: %6$s, %7$s, %8$s; %9$s, %10$s y %11$s por ciento. %12$s Jugar.</string>
<string name="prep_play">Jugar</string>
<string name="prep_unknown_short">%1$s más</string>
<string name="prep_wdl_counts">+%1$s =%2$s −%3$s · W/D/L %4$s/%5$s/%6$s %%</string>
</resources>

View file

@ -37,9 +37,10 @@
<string name="to_start">Au début</string>
<string name="move_back">Coup précédent</string>
<string name="move_forward">Coup suivant</string>
<string name="move_back_hint">Coup précédent. Maintenez pour aller au début</string>
<string name="move_forward_hint">Coup suivant. Maintenez pour aller à la fin de la ligne</string>
<string name="to_end">À la fin de la ligne</string>
<string name="next_moves">Suite :</string>
<string name="board_hint">Ceci est une visionneuse de parties. Parcourez les coups avec ◀ ▶ en bas.</string>
<string name="board_description">Échiquier, position après %1$s</string>
<string name="board_start">Échiquier, position initiale</string>
<string name="white_won">Les Blancs ont gagné</string>
@ -113,8 +114,7 @@
<string name="about">À propos</string>
<string name="build_full">Stockfish intégré</string>
<string name="build_light">Stockfish téléchargé dans l’application</string>
<string name="alpha">alpha</string>
<string name="about_text">Une visionneuse de bases d’échecs : PGN, ChessBase, archives. Les fichiers sont seulement lus, jamais modifiés.</string>
<string name="about_text">Bases d’échecs, analyse des parties et jeu contre l’ordinateur. Vos fichiers sont seulement lus, jamais modifiés.</string>
<string name="licenses">Licences et auteurs</string>
<string name="website">Site web et code source</string>
@ -219,6 +219,15 @@
<string name="add_paste_hint">Parties copiées dans une autre application</string>
<string name="paste_none">Aucune partie PGN dans le presse-papiers</string>
<string name="paste_db">Collé le %1$s</string>
<plurals name="clipboard_open_title">
<item quantity="one">%1$s partie dans le presse-papiers</item>
<item quantity="many">%1$s parties dans le presse-papiers</item>
<item quantity="other">%1$s parties dans le presse-papiers</item>
</plurals>
<string name="clipboard_open_one">Enregistrer cette partie PGN et l’ouvrir sur l’échiquier ?</string>
<string name="clipboard_open_many">Enregistrer %1$s et ouvrir la première partie sur l’échiquier ? Toutes les parties seront conservées dans la copie locale.</string>
<string name="clipboard_open">Ouvrir</string>
<string name="clipboard_database_name">Presse-papiers</string>
<string name="opening_file">Ouverture du fichier…</string>
<string name="file_failed">Impossible d’ouvrir le fichier</string>
<string name="file_no_games">Ce fichier ne contient aucune partie d’échecs.</string>
@ -231,15 +240,10 @@
<string name="review_menu">Analyse de la partie</string>
<string name="review_report_menu">Rapport de la partie</string>
<string name="review_text">Le moteur évalue chaque position de la ligne principale. La partie elle-même n\'est pas modifiée.</string>
<string name="review_quality">Qualité</string>
<string name="review_fast">Rapide</string>
<string name="review_normal">Normal</string>
<string name="review_deep">Approfondi</string>
<string name="review_seconds">%d s</string>
<string name="review_minutes">%d min</string>
<string name="review_start">Analyser</string>
<string name="review_fill">Compléter</string>
<string name="review_again">Analyser de nouveau</string>
<string name="review_partial">%1$d positions sur %2$d sont déjà évaluées.</string>
<string name="review_progress">Analyse · %1$d sur %2$d</string>
<string name="review_stop">Arrêter l\'analyse</string>
@ -253,6 +257,10 @@
<string name="review_inaccuracies">Imprécisions</string>
<string name="review_mistakes">Erreurs</string>
<string name="review_blunders">Gaffes</string>
<string name="review_great">Excellent coup</string>
<string name="review_brilliant">Coup brillant</string>
<string name="review_greats">Excellents coups</string>
<string name="review_brilliants">Coups brillants</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>
@ -262,13 +270,17 @@
<string name="review_endgame">Finale</string>
<string name="review_source">%1$s · %2$s nœuds par coup</string>
<string name="review_source_pgn" formatted="false">Évaluations issues du PGN ([%eval])</string>
<string name="review_no_notes">!! et ! demandent le moteur : le PGN ne contient que des évaluations</string>
<string name="review_no_seconds">Cette analyse n’a pas encore cherché les !! et !</string>
<string name="review_stale">Analyse faite avec d’autres réglages du moteur</string>
<string name="review_update">Mettre à jour</string>
<string name="review_engine">Analyser avec le moteur</string>
<string name="review_hide">Masquer l\'analyse</string>
<string name="review_graph">Graphique d\'évaluation</string>
<string name="review_engine_paused">En pause : analyse de la partie en cours</string>
<string name="review_best_preview">Meilleure ligne · coup %1$d sur %2$d</string>
<string name="review_next">Aller au coup suivant de ce type</string>
<string name="review_show_best">Afficher la meilleure ligne sur l\'échiquier</string>
<string name="review_restart">Recommencer</string>
<string name="review_graph_state">%1$s, évaluation %2$s</string>
<string name="review_start_position">Position de départ</string>
<plurals name="review_estimate">
@ -395,4 +407,327 @@
<string name="s_about_ready">La version %1$s est téléchargée</string>
<string name="upd_card_downloading">Mise à jour vers %1$s, %2$d sur %3$d mégaoctets téléchargés</string>
<string name="upd_short_release">Fichier impossible à vérifier</string>
<string name="undo_action">Annuler</string>
<string name="moves_deleted">Coups supprimés</string>
<string name="make_main">En faire la ligne principale</string>
<string name="delete_move">Supprimer le coup et la suite</string>
<string name="move_actions">Actions sur le coup</string>
<string name="new_game">Nouvelle partie</string>
<string name="own_databases">Mes bases</string>
<string name="own_new">+ Nouvelle base</string>
<string name="own_empty">Ici seront les parties que vous saisirez ou jouerez contre l’ordinateur</string>
<string name="files_add">+ Ajouter</string>
<string name="files_empty">Ici seront les fichiers PGN et ChessBase, les dossiers et les parties d’Internet que vous ajouterez</string>
<string name="files">Fichiers</string>
<string name="own_default_name">Mes parties</string>
<string name="own_new_title">Nouvelle base</string>
<string name="own_name">Nom</string>
<string name="own_new_hint">Conservée sur le téléphone, dans ChessPenguin. Le fichier s’exporte depuis le menu de la base.</string>
<string name="create">Créer</string>
<string name="own_on_phone">sur le téléphone</string>
<string name="own_export">Exporter le fichier…</string>
<string name="own_delete">Supprimer la base</string>
<string name="own_exported">Fichier enregistré</string>
<string name="own_export_failed">Impossible d’enregistrer le fichier</string>
<string name="own_removed">Base supprimée</string>
<string name="own_delete_title">Supprimer « %1$s » ?</string>
<plurals name="own_delete_text">
<item quantity="one">%1$s partie sera supprimée du téléphone. Si vous en avez besoin, exportez d’abord le fichier.</item>
<item quantity="many">%1$s parties seront supprimées du téléphone. Si vous en avez besoin, exportez d’abord le fichier.</item>
<item quantity="other">%1$s parties seront supprimées du téléphone. Si vous en avez besoin, exportez d’abord le fichier.</item>
</plurals>
<string name="saved_to">Enregistrée dans « %1$s », n° %2$s</string>
<string name="save_failed">Impossible d’enregistrer la partie</string>
<string name="save_in">Enregistrer dans « %1$s »</string>
<string name="save_to_mine">Enregistrer dans ma base…</string>
<string name="save_to_db">Enregistrer dans une base</string>
<string name="save_to_db_ellipsis">Enregistrer dans une base…</string>
<string name="own_new_ellipsis">Nouvelle base…</string>
<string name="create_and_save">Créer et enregistrer</string>
<string name="save_changes_in">Enregistrer les modifications dans « %1$s » ?</string>
<string name="save_game_question">Enregistrer la partie ?</string>
<string name="dont_save">Ne pas enregistrer</string>
<string name="game_data">Données de la partie</string>
<string name="date_hint">AAAA.MM.JJ</string>
<string name="date_wrong">Pas une date : 2026.10.26, 2026 ou 26.10.2026</string>
<string name="discard_changes">Annuler les modifications ?</string>
<string name="discard">Annuler</string>
<string name="keep_editing">Continuer</string>
<string name="edit">Modifier</string>
<string name="next">Suivant</string>
<string name="train_title">Apprentissage de l\'ouverture</string>
<string name="train_up_to">jusqu\'à %1$s</string>
<string name="train_learn">Apprendre l\'ouverture jusqu\'à ce coup</string>
<string name="train_move_of">Coup %1$s sur %2$s</string>
<string name="train_white">♔ Trait aux Blancs</string>
<string name="train_black">♚ Trait aux Noirs</string>
<string name="train_mistakes">Erreurs : %1$s</string>
<string name="train_run">Passage %1$s</string>
<string name="train_wrong">× La partie a un autre coup ici</string>
<string name="train_show">Montrer le coup</string>
<string name="train_not_done">Ligne jamais parcourue</string>
<string name="train_last_streak">La dernière fois : %1$s · sans erreur d\'affilée : %2$s</string>
<string name="train_last_best">La dernière fois : %1$s · meilleur : %2$s</string>
<string name="train_done_clean">Terminé sans erreur</string>
<string name="train_done_hint">Terminé avec un indice · erreurs : %1$s</string>
<string name="train_done">Terminé · erreurs : %1$s</string>
<string name="train_run_best">Passage %1$s · meilleur : %2$s</string>
<string name="train_streak">sans erreur d\'affilée : %1$s</string>
<string name="train_recent">Récents : %1$s</string>
<string name="train_arrow">Jouez le coup indiqué par la flèche</string>
<string name="train_again">↻ Encore</string>
<string name="train_back">⬅ Retour à la partie</string>
<string name="train_restart">Recommencer</string>
<plurals name="train_runs">
<item quantity="one">%1$d passage</item>
<item quantity="many">%1$d passages</item>
<item quantity="other">%1$d passages</item>
</plurals>
<string name="maia_download_title">Maia pour ChessPenguin</string>
<string name="play_won">Vous avez gagné</string>
<string name="play_lost">Vous avez perdu</string>
<string name="play_you_resigned">Vous avez abandonné</string>
<string name="play_draw">Nulle</string>
<string name="end_mate">échec et mat</string>
<string name="end_stalemate">pat</string>
<string name="end_threefold">la position s’est répétée trois fois</string>
<string name="end_fifty">50 coups sans prise ni coup de pion</string>
<string name="end_material">aucun camp ne peut mater</string>
<string name="end_maia_resigned">Maia a abandonné</string>
<string name="play_resign_q">Abandonner ?</string>
<string name="play_resign">⚑ Abandonner</string>
<string name="play_take_back">↶ Reprendre</string>
<string name="play_title">Jouer contre l’ordinateur</string>
<string name="play_colour">Votre couleur</string>
<string name="color_white">Blancs</string>
<string name="color_black">Noirs</string>
<string name="color_random">Au hasard</string>
<string name="play_measured">Le classement propre de Maia : il ne correspond pas à l’Elo d’une personne.</string>
<string name="play_download_note">Maia est téléchargée une seule fois (%1$s Mo, depuis huggingface.co, le fichier des auteurs eux-mêmes).</string>
<string name="play_download_and_play">Télécharger et jouer</string>
<string name="play_play">Jouer</string>
<string name="play_thinking">réfléchit…</string>
<string name="play_event">Partie contre l’ordinateur</string>
<string name="play_analyse">Analyser</string>
<string name="play_rematch">↻ Revanche</string>
<string name="play_from_here">Jouer à partir d’ici…</string>
<string name="play_checking">Vérification…</string>
<string name="play_maia_failed">Maia n’a pas démarré : %1$s</string>
<string name="play_accept_win">Accepter la victoire</string>
<string name="play_to_end">Jouer jusqu’au bout</string>
<string name="play_maia_resigns">Maia abandonne</string>
<string name="play_note_from">À partir d’ici, une partie contre Maia %1$s.</string>
<string name="play_abort">Abandonner</string>
<string name="play_your_name">Votre nom</string>
<string name="play_maia_ready">Maia est téléchargée</string>
<string name="play_retry">Réessayer</string>
<string name="play_her_position_lost">Sa position est perdue. Accepter la victoire ou continuer ?</string>
<string name="play_continue">Continuer</string>
<string name="play_adjourned">Partie contre Maia %1$s · vous jouez %2$s</string>
<string name="play_as_white">les Blancs</string>
<string name="play_as_black">les Noirs</string>
<string name="play_removed">Partie supprimée</string>
<string name="play_untimed">sans pendule</string>
<string name="play_you">Vous</string>
<string name="play_saved">✓ Enregistrée</string>
<string name="play_save">Enregistrer…</string>
<string name="play_adjourned_sub">vous jouez %1$s · %2$s</string>
<string name="play_from_label">Après %1$s</string>
<string name="sound">Son</string>
<string name="undo_menu">Annuler</string>
<string name="made_main">Ligne principale désormais</string>
<string name="elo">Elo</string>
<string name="play_analyse_short">Analyser</string>
<string name="play_on_short">Continuer</string>
<string name="play_viewing">Consultation %1$s · retour à la partie ›</string>
<string name="start_position">la position initiale</string>
<string name="play_maia_stopped">Maia n’a pas démarré.</string>
<string name="play_maia_reload">Retélécharger Maia</string>
<string name="play_adjourned_q">Une partie contre %1$s est en attente</string>
<string name="play_continue_it">La continuer</string>
<string name="play_start_new">En commencer une nouvelle</string>
<string name="play_adjourned_new_text">Une nouvelle partie la remplace ; ce qui a été joué va, inachevé, dans la base du joueur.</string>
<string name="play_offer_draw">Nulle</string>
<string name="end_agreement">par accord mutuel</string>
<string name="play_draw_declined">Maia refuse la nulle</string>
<string name="play_draw_later">Maia a refusé ; reproposez après deux de ses coups</string>
<string name="play_draw_no_engine">Maia répond à la nulle avec Stockfish : téléchargez-le avec « Moteur »</string>
<string name="player_db_name">%1$s — parties contre l’ordinateur</string>
<string name="player_db_shared">Parties contre l’ordinateur</string>
<string name="player_written">✓ Dans « %1$s », n° %2$s ›</string>
<string name="player_kept_unfinished">Partie enregistrée inachevée dans « %1$s »</string>
<string name="player_db_row">enregistrées d’elles-mêmes</string>
<string name="record_games">Enregistrer les parties contre l’ordinateur dans la base du joueur</string>
<string name="player_line_existing">Les parties sont enregistrées dans « %1$s »</string>
<string name="player_line_new">Les parties seront enregistrées dans une nouvelle base « %1$s ».</string>
<string name="player_line_noname">Sans nom, les parties vont dans « %1$s ». Saisissez un nom pour avoir votre propre base.</string>
<string name="player_line_off">Les parties ne sont pas enregistrées d’elles-mêmes (Réglages).</string>
<string name="player_written_new">✓ Nouvelle base « %1$s », n° %2$s ›</string>
<string name="player_write_failed">Impossible d’écrire dans « %1$s » : %2$s</string>
<string name="play_adjourned_replaced">Une nouvelle partie la remplace.</string>
<string name="last_opened">Ouverte en dernier</string>
<string name="play_adjourned_title">Partie contre %1$s</string>
<string name="play_move_n">coup %1$d</string>
<!-- Rodent IV on the phone (android-rodent.md §9); the characters and the desktop's sentences come from apps/desktop/src/i18n.rs. -->
<string name="rodent_iv_amanda">Amanda</string>
<string name="rodent_iv_amanda_about">Attaque d’abord, puis joue pour l’activité des pièces.</string>
<string name="rodent_iv_cloe">Cloé</string>
<string name="rodent_iv_cloe_about">Aime les positions fermées.</string>
<string name="rodent_iv_deborah">Déborah</string>
<string name="rodent_iv_deborah_about">Défend bien et aime ses fous.</string>
<string name="rodent_iv_defender">Défenseur</string>
<string name="rodent_iv_defender_about">Solide et prudent ; se contente de la nulle.</string>
<string name="rodent_iv_dynamic">Dynamique</string>
<string name="rodent_iv_dynamic_about">Attaque, aime les fous, sacrifie de temps en temps.</string>
<string name="rodent_iv_grumpy">Grincheux</string>
<string name="rodent_iv_grumpy_about">Attaque et restriction ; aime les positions bloquées, évite la nulle.</string>
<string name="rodent_iv_partisan">Partisan</string>
<string name="rodent_iv_partisan_about">Attaque après des ouvertures calmes et discrètes.</string>
<string name="rodent_iv_pawnsacker">Gambiteur</string>
<string name="rodent_iv_pawnsacker_about">Équilibré, mais cède plus volontiers des pions.</string>
<string name="rodent_iv_pedrita">Pedrita</string>
<string name="rodent_iv_pedrita_about">Pions, défense et restriction.</string>
<string name="rodent_iv_preston">Preston</string>
<string name="rodent_iv_preston_about">Un attaquant matérialiste et modéré.</string>
<string name="rodent_iv_simple">Simplet</string>
<string name="rodent_iv_simple_about">Le plus « ordinateur » : un jeu simple et sain.</string>
<string name="rodent_iv_spitfire">Boutefeu</string>
<string name="rodent_iv_spitfire_about">Tranchant et agressif.</string>
<string name="rodent_iv_strangler">Étrangleur</string>
<string name="rodent_iv_strangler_about">Un boa : étouffe lentement, très humain.</string>
<string name="rodent_iv_alekhine">Alekhine</string>
<string name="rodent_iv_alekhine_about">Attaques dynamiques et combinaisons profondes.</string>
<string name="rodent_iv_anand">Anand</string>
<string name="rodent_iv_anand_about">Jeu rapide et universel, ouvertures tranchantes.</string>
<string name="rodent_iv_anderssen">Anderssen</string>
<string name="rodent_iv_anderssen_about">Un attaquant romantique du XIXe siècle : sacrifices.</string>
<string name="rodent_iv_bosboom">Bosboom</string>
<string name="rodent_iv_bosboom_about">Ouvertures originales et blitz créatif.</string>
<string name="rodent_iv_botvinnik">Botvinnik</string>
<string name="rodent_iv_botvinnik_about">Jeu stratégique et scientifique, préparation profonde.</string>
<string name="rodent_iv_fischer">Fischer</string>
<string name="rodent_iv_fischer_about">Clair, classique et précis.</string>
<string name="rodent_iv_karpov">Karpov</string>
<string name="rodent_iv_karpov_about">Étau positionnel, prophylaxie et technique.</string>
<string name="rodent_iv_kasparov">Kasparov</string>
<string name="rodent_iv_kasparov_about">Initiative et attaque puissante.</string>
<string name="rodent_iv_kortchnoi">Kortchnoi</string>
<string name="rodent_iv_kortchnoi_about">Un défenseur tenace et contre-attaquant.</string>
<string name="rodent_iv_larsen">Larsen</string>
<string name="rodent_iv_larsen_about">Original et risqué, aux ouvertures insolites.</string>
<string name="rodent_iv_lasker">Lasker</string>
<string name="rodent_iv_lasker_about">Un combattant pratique et psychologue.</string>
<string name="rodent_iv_marshall">Marshall</string>
<string name="rodent_iv_marshall_about">Un attaquant fougueux, amateur de gambits.</string>
<string name="rodent_iv_morphy">Morphy</string>
<string name="rodent_iv_morphy_about">Développement rapide et lignes ouvertes.</string>
<string name="rodent_iv_nimzowitsch">Nimzowitsch</string>
<string name="rodent_iv_nimzowitsch_about">Restriction, blocus et surprotection.</string>
<string name="rodent_iv_petrosian">Petrosian</string>
<string name="rodent_iv_petrosian_about">Prophylaxie et sécurité avant tout.</string>
<string name="rodent_iv_reti">Reti</string>
<string name="rodent_iv_reti_about">Hypermoderne : contrôle le centre à distance.</string>
<string name="rodent_iv_rubinstein">Rubinstein</string>
<string name="rodent_iv_rubinstein_about">Jeu positionnel classique, excellent en finale.</string>
<string name="rodent_iv_spassky">Spassky</string>
<string name="rodent_iv_spassky_about">Un joueur universel, à l’aise partout.</string>
<string name="rodent_iv_steinitz">Steinitz</string>
<string name="rodent_iv_steinitz_about">Le fondateur du jeu positionnel, défenseur obstiné.</string>
<string name="rodent_iv_tal">Tal</string>
<string name="rodent_iv_tal_about">Le magicien de Riga : sacrifices et attaque.</string>
<string name="rodent_iv_tarrasch">Tarrasch</string>
<string name="rodent_iv_tarrasch_about">Règles classiques : espace, développement, pièces actives.</string>
<string name="rodent_iv_topalov">Topalov</string>
<string name="rodent_iv_topalov_about">Agressif et dynamique, sacrifie la qualité.</string>
<string name="opp_maia_sub">joue comme un humain</string>
<string name="opp_rodent_sub">fort, avec un style</string>
<string name="like_human">Comme un humain</string>
<string name="maia_no_style">Maia ne choisit pas de style : elle joue comme les gens de son niveau.</string>
<string name="rodent_measured">Le classement propre de Rodent (UCI_Elo) : il ne correspond pas à l’Elo d’une personne.</string>
<string name="rodent_resigns">Rodent abandonne</string>
<string name="end_rodent_resigned">Rodent a abandonné</string>
<string name="rodent_draw_declined">Rodent refuse la nulle</string>
<string name="rodent_draw_later">Rodent a refusé ; reproposez après deux de ses coups</string>
<string name="rodent_position_lost">Sa position est perdue. Accepter la victoire ou jouer jusqu’au bout ?</string>
<string name="play_button">Jouer</string>
<string name="play_button_cd">Jouer contre l’ordinateur</string>
<string name="strength_n">Force : %1$s</string>
<string name="pick_title">Contre qui jouer</string>
<string name="pick_intro">Un caractère, c’est un style et des ouvertures ; le curseur règle la force.</string>
<string name="pick_players">Grands joueurs</string>
<string name="pick_characters">Caractères</string>
<string name="pick_change">Changer</string>
<string name="pick_player_cd">%1$s, grand joueur</string>
<string name="pick_character_cd">%1$s, caractère</string>
<string name="character_cd">Caractère : %1$s</string>
<string name="books_ready">Rodent IV et ses livres d’ouvertures sont sur le téléphone</string>
<string name="books_offer">Livres d’ouvertures de Rodent IV : %1$s Mo, une seule fois depuis github.com</string>
<string name="books_not_needed">Depuis une position, pas besoin de livre d’ouvertures : Rodent IV joue tout de suite</string>
<string name="books_without">Sans livre</string>
<string name="books_without_cd">Sans livre : jouer sans livre d’ouvertures</string>
<string name="books_notification">Livres d’ouvertures de Rodent IV</string>
<string name="books_settings">Rodent IV — livres d’ouvertures</string>
<string name="books_downloaded_mb">téléchargés · %1$s Mo</string>
<string name="books_missing_mb">non téléchargés · %1$s Mo</string>
<string name="books_deleted">Livres d’ouvertures supprimés</string>
<string name="rodent_draw_no_engine">Rodent répond à la nulle avec Stockfish : téléchargez-le avec « Moteur »</string>
<string name="rodent_stopped">Rodent n’a pas démarré.</string>
<string name="rodent_restart">Redémarrer</string>
<string name="play_note_from_rodent">À partir d’ici, une partie contre Rodent IV %1$s · %2$s.</string>
<string name="rodent_stopped_playing">Rodent s’est arrêté pendant la partie.</string>
<string name="strength_range">%1$s, de %2$s à %3$s</string>
<string name="strength">Force</string>
<string name="books_delete_cd">Supprimer les livres d’ouvertures</string>
<!-- Préparation contre l’adversaire (tâche 48). -->
<string name="players">Joueurs</string>
<string name="player_name_hint">Nom du joueur</string>
<string name="players_read_failed">Impossible de lire les joueurs</string>
<string name="reading_players">Lecture des joueurs…</string>
<string name="no_named_players">Cette base ne contient aucun joueur nommé</string>
<string name="player_not_found">Joueur introuvable</string>
<string name="to_games">Retour aux parties</string>
<string name="reset_search">Effacer la recherche</string>
<string name="prepare_action">Préparer</string>
<string name="prep_choose_color">Choisissez la couleur</string>
<string name="prep_against_player">Préparer contre %1$s</string>
<string name="prep_against_white">Contre les Blancs</string>
<string name="prep_against_black">Contre les Noirs</string>
<string name="prep_opponent">Préparer contre l’adversaire…</string>
<string name="prep_title">Préparation contre l’adversaire</string>
<string name="prep_close_engine_line">Fermez d’abord la ligne du moteur</string>
<!--suppress TypographyDashes: literal PGN null move -->
<string name="prep_null_move_unavailable">La recherche après un -- pédagogique est indisponible</string>
<string name="prep_as_white">Blancs</string>
<string name="prep_as_black">Noirs</string>
<string name="prep_move_failed">Impossible de jouer ce coup</string>
<string name="prep_play_continuation">Jouer %1$s, %2$s, %3$s pour cent</string>
<string name="prep_board_start">Échiquier, position initiale. %1$s en bas.</string>
<string name="prep_board_after">Échiquier, position après %1$s. %2$s en bas.</string>
<string name="turn_white">Trait aux blancs</string>
<string name="turn_black">Trait aux noirs</string>
<string name="prep_opponent_plays">L’adversaire joue</string>
<string name="prep_opponents_play">Ses adversaires jouent</string>
<string name="prep_after">après %1$s</string>
<string name="prep_beginning">début</string>
<string name="prep_context_description">%1$s, %2$s, %3$s, %4$s</string>
<string name="prep_failed">Impossible de calculer les continuations</string>
<string name="prep_no_memory">Mémoire insuffisante pour rechercher dans cette base</string>
<string name="prep_calculating">Calcul des continuations…</string>
<string name="prep_position_absent">Cette position n’apparaît pas dans les parties de %1$s</string>
<string name="prep_position_absent_hint">Vous pouvez continuer sur l’échiquier ou revenir en arrière</string>
<string name="prep_all_ended">Toutes les parties se terminent ici</string>
<string name="prep_ended_here">Terminées ici : %1$s</string>
<string name="prep_no_normal">Aucune continuation normale : %1$s</string>
<string name="to_game">Retour à la partie</string>
<string name="to_players">Retour aux joueurs</string>
<string name="prep_choose_move">Choisir un coup</string>
<plurals name="prep_wins"><item quantity="one">%1$s victoire</item><item quantity="many">%1$s victoires</item><item quantity="other">%1$s victoires</item></plurals>
<plurals name="prep_draws"><item quantity="one">%1$s nulle</item><item quantity="many">%1$s nulles</item><item quantity="other">%1$s nulles</item></plurals>
<plurals name="prep_losses"><item quantity="one">%1$s défaite</item><item quantity="many">%1$s défaites</item><item quantity="other">%1$s défaites</item></plurals>
<string name="prep_unknown_accessibility">Résultats inconnus : %1$d ; exclus des pourcentages.</string>
<string name="prep_continuation_description">%1$s. %2$d sur %3$s, %4$s pour cent. Résultats de %5$s : %6$s, %7$s, %8$s ; %9$s, %10$s et %11$s pour cent. %12$s Jouer.</string>
<string name="prep_play">Jouer</string>
<string name="prep_unknown_short">plus %1$s</string>
<string name="prep_wdl_counts">+%1$s =%2$s −%3$s · W/D/L %4$s/%5$s/%6$s %%</string>
</resources>

View file

@ -37,9 +37,10 @@
<string name="to_start">All\'inizio</string>
<string name="move_back">Mossa indietro</string>
<string name="move_forward">Mossa avanti</string>
<string name="move_back_hint">Mossa precedente. Tieni premuto per andare all\'inizio</string>
<string name="move_forward_hint">Mossa successiva. Tieni premuto per andare alla fine della linea</string>
<string name="to_end">Alla fine della linea</string>
<string name="next_moves">Seguito:</string>
<string name="board_hint">Questo è un visualizzatore di partite. Scorri le mosse con ◀ ▶ in basso.</string>
<string name="board_description">Scacchiera, posizione dopo %1$s</string>
<string name="board_start">Scacchiera, posizione iniziale</string>
<string name="white_won">Hanno vinto i bianchi</string>
@ -113,8 +114,7 @@
<string name="about">Informazioni</string>
<string name="build_full">Stockfish incluso</string>
<string name="build_light">Stockfish si scarica nell\'app</string>
<string name="alpha">alfa</string>
<string name="about_text">Un visualizzatore di database scacchistici: PGN, ChessBase, archivi. I file vengono solo letti, mai modificati.</string>
<string name="about_text">Database scacchistici, analisi delle partite e gioco contro il computer. I tuoi file vengono solo letti, mai modificati.</string>
<string name="licenses">Licenze e autori</string>
<string name="website">Sito web e codice sorgente</string>
@ -219,6 +219,15 @@
<string name="add_paste_hint">Partite copiate in un’altra app</string>
<string name="paste_none">Nessuna partita PGN negli appunti</string>
<string name="paste_db">Incollato il %1$s</string>
<plurals name="clipboard_open_title">
<item quantity="one">Partita negli appunti</item>
<item quantity="many">Partite negli appunti</item>
<item quantity="other">Partite negli appunti</item>
</plurals>
<string name="clipboard_open_one">Salvare questa partita PGN e aprirla sulla scacchiera?</string>
<string name="clipboard_open_many">Salvare %1$s e aprire la prima partita sulla scacchiera? Tutte le partite saranno conservate nella copia locale.</string>
<string name="clipboard_open">Apri</string>
<string name="clipboard_database_name">Appunti</string>
<string name="opening_file">Apertura del file…</string>
<string name="file_failed">Impossibile aprire il file</string>
<string name="file_no_games">Questo file non contiene partite a scacchi.</string>
@ -231,15 +240,10 @@
<string name="review_menu">Analisi della partita</string>
<string name="review_report_menu">Resoconto della partita</string>
<string name="review_text">Il motore valuta ogni posizione della linea principale. La partita non viene modificata.</string>
<string name="review_quality">Qualità</string>
<string name="review_fast">Veloce</string>
<string name="review_normal">Normale</string>
<string name="review_deep">Approfondito</string>
<string name="review_seconds">%d s</string>
<string name="review_minutes">%d min</string>
<string name="review_start">Analizza</string>
<string name="review_fill">Completa</string>
<string name="review_again">Analizza di nuovo</string>
<string name="review_partial">%1$d posizioni su %2$d sono già valutate.</string>
<string name="review_progress">Analisi · %1$d di %2$d</string>
<string name="review_stop">Interrompi l\'analisi</string>
@ -253,6 +257,10 @@
<string name="review_inaccuracies">Imprecisioni</string>
<string name="review_mistakes">Errori</string>
<string name="review_blunders">Svarioni</string>
<string name="review_great">Ottima mossa</string>
<string name="review_brilliant">Mossa brillante</string>
<string name="review_greats">Ottime mosse</string>
<string name="review_brilliants">Mosse brillanti</string>
<string name="review_missing">Non valutate: %d</string>
<string name="review_failed">L\'analisi si è interrotta</string>
<string name="review_resume">Continua</string>
@ -262,13 +270,17 @@
<string name="review_endgame">Finale</string>
<string name="review_source">%1$s · %2$s nodi per mossa</string>
<string name="review_source_pgn" formatted="false">Valutazioni dal PGN ([%eval])</string>
<string name="review_no_notes">!! e ! richiedono il motore: il PGN contiene solo valutazioni</string>
<string name="review_no_seconds">Questa analisi non ha ancora cercato !! e !</string>
<string name="review_stale">Analisi fatta con altre impostazioni del motore</string>
<string name="review_update">Aggiorna</string>
<string name="review_engine">Analizza con il motore</string>
<string name="review_hide">Nascondi l\'analisi</string>
<string name="review_graph">Grafico di valutazione</string>
<string name="review_engine_paused">In pausa: analisi della partita in corso</string>
<string name="review_best_preview">Linea migliore · mossa %1$d di %2$d</string>
<string name="review_next">Vai alla prossima mossa di questo tipo</string>
<string name="review_show_best">Mostra la linea migliore sulla scacchiera</string>
<string name="review_restart">Ricomincia</string>
<string name="review_graph_state">%1$s, valutazione %2$s</string>
<string name="review_start_position">Posizione iniziale</string>
<plurals name="review_estimate">
@ -395,4 +407,327 @@
<string name="s_about_ready">La versione %1$s è scaricata</string>
<string name="upd_card_downloading">Aggiornamento a %1$s, %2$d di %3$d megabyte scaricati</string>
<string name="upd_short_release">File non verificabile</string>
<string name="undo_action">Annulla</string>
<string name="moves_deleted">Mosse eliminate</string>
<string name="make_main">Rendi linea principale</string>
<string name="delete_move">Elimina la mossa e il seguito</string>
<string name="move_actions">Azioni sulla mossa</string>
<string name="new_game">Nuova partita</string>
<string name="own_databases">I miei database</string>
<string name="own_new">+ Nuovo database</string>
<string name="own_empty">Qui ci saranno le partite che inserisci o giochi contro il computer</string>
<string name="files_add">+ Aggiungi</string>
<string name="files_empty">Qui ci saranno i file PGN e ChessBase, le cartelle e le partite da internet che aggiungi</string>
<string name="files">File</string>
<string name="own_default_name">Le mie partite</string>
<string name="own_new_title">Nuovo database</string>
<string name="own_name">Nome</string>
<string name="own_new_hint">Conservato sul telefono, in ChessPenguin. Il file si esporta dal menu del database.</string>
<string name="create">Crea</string>
<string name="own_on_phone">sul telefono</string>
<string name="own_export">Esporta il file…</string>
<string name="own_delete">Elimina il database</string>
<string name="own_exported">File salvato</string>
<string name="own_export_failed">Impossibile salvare il file</string>
<string name="own_removed">Database eliminato</string>
<string name="own_delete_title">Eliminare «%1$s»?</string>
<plurals name="own_delete_text">
<item quantity="one">%1$s partita sarà eliminata dal telefono. Se ti serve, esporta prima il file.</item>
<item quantity="many">%1$s partite saranno eliminate dal telefono. Se ti servono, esporta prima il file.</item>
<item quantity="other">%1$s partite saranno eliminate dal telefono. Se ti servono, esporta prima il file.</item>
</plurals>
<string name="saved_to">Salvata in «%1$s», n. %2$s</string>
<string name="save_failed">Impossibile salvare la partita</string>
<string name="save_in">Salva in «%1$s»</string>
<string name="save_to_mine">Salva nel mio database…</string>
<string name="save_to_db">Salva in un database</string>
<string name="save_to_db_ellipsis">Salva in un database…</string>
<string name="own_new_ellipsis">Nuovo database…</string>
<string name="create_and_save">Crea e salva</string>
<string name="save_changes_in">Salvare le modifiche in «%1$s»?</string>
<string name="save_game_question">Salvare la partita?</string>
<string name="dont_save">Non salvare</string>
<string name="game_data">Dati della partita</string>
<string name="date_hint">AAAA.MM.GG</string>
<string name="date_wrong">Non è una data: 2026.10.26, 2026 o 26.10.2026</string>
<string name="discard_changes">Annullare le modifiche?</string>
<string name="discard">Annulla</string>
<string name="keep_editing">Continua a modificare</string>
<string name="edit">Modifica</string>
<string name="next">Avanti</string>
<string name="train_title">Studio dell\'apertura</string>
<string name="train_up_to">fino a %1$s</string>
<string name="train_learn">Studia l\'apertura fino a questa mossa</string>
<string name="train_move_of">Mossa %1$s di %2$s</string>
<string name="train_white">♔ Muove il Bianco</string>
<string name="train_black">♚ Muove il Nero</string>
<string name="train_mistakes">Errori: %1$s</string>
<string name="train_run">Giro %1$s</string>
<string name="train_wrong">× Nella partita qui c\'è un\'altra mossa</string>
<string name="train_show">Mostra la mossa</string>
<string name="train_not_done">Linea mai ripassata</string>
<string name="train_last_streak">L\'ultima volta: %1$s · senza errori di fila: %2$s</string>
<string name="train_last_best">L\'ultima volta: %1$s · migliore: %2$s</string>
<string name="train_done_clean">Completato senza errori</string>
<string name="train_done_hint">Completato con un aiuto · errori: %1$s</string>
<string name="train_done">Completato · errori: %1$s</string>
<string name="train_run_best">Giro %1$s · migliore: %2$s</string>
<string name="train_streak">senza errori di fila: %1$s</string>
<string name="train_recent">Recenti: %1$s</string>
<string name="train_arrow">Gioca la mossa indicata dalla freccia</string>
<string name="train_again">↻ Ancora</string>
<string name="train_back">⬅ Torna alla partita</string>
<string name="train_restart">Da capo</string>
<plurals name="train_runs">
<item quantity="one">%1$d ripasso</item>
<item quantity="many">%1$d ripassi</item>
<item quantity="other">%1$d ripassi</item>
</plurals>
<string name="maia_download_title">Maia per ChessPenguin</string>
<string name="play_won">Hai vinto</string>
<string name="play_lost">Hai perso</string>
<string name="play_you_resigned">Hai abbandonato</string>
<string name="play_draw">Patta</string>
<string name="end_mate">scacco matto</string>
<string name="end_stalemate">stallo</string>
<string name="end_threefold">la posizione si è ripetuta tre volte</string>
<string name="end_fifty">50 mosse senza catture né mosse di pedone</string>
<string name="end_material">nessuno dei due può dare matto</string>
<string name="end_maia_resigned">Maia ha abbandonato</string>
<string name="play_resign_q">Abbandonare?</string>
<string name="play_resign">⚑ Abbandona</string>
<string name="play_take_back">↶ Ritira mossa</string>
<string name="play_title">Gioca contro il computer</string>
<string name="play_colour">Il tuo colore</string>
<string name="color_white">Bianco</string>
<string name="color_black">Nero</string>
<string name="color_random">Casuale</string>
<string name="play_measured">Il rating proprio di Maia: non corrisponde all’Elo di una persona.</string>
<string name="play_download_note">Maia si scarica una sola volta (%1$s MB, da huggingface.co, il file degli autori stessi).</string>
<string name="play_download_and_play">Scarica e gioca</string>
<string name="play_play">Gioca</string>
<string name="play_thinking">sta pensando…</string>
<string name="play_event">Partita contro il computer</string>
<string name="play_analyse">Analizza</string>
<string name="play_rematch">↻ Rivincita</string>
<string name="play_from_here">Gioca da qui…</string>
<string name="play_checking">Controllo…</string>
<string name="play_maia_failed">Maia non si è avviata: %1$s</string>
<string name="play_accept_win">Accetta la vittoria</string>
<string name="play_to_end">Gioca fino alla fine</string>
<string name="play_maia_resigns">Maia abbandona</string>
<string name="play_note_from">Da qui, una partita contro Maia %1$s.</string>
<string name="play_abort">Annulla</string>
<string name="play_your_name">Il tuo nome</string>
<string name="play_maia_ready">Maia è scaricata</string>
<string name="play_retry">Riprova</string>
<string name="play_her_position_lost">La sua posizione è persa. Accettare la vittoria o continuare?</string>
<string name="play_continue">Continua</string>
<string name="play_adjourned">Partita contro Maia %1$s · giochi con %2$s</string>
<string name="play_as_white">il Bianco</string>
<string name="play_as_black">il Nero</string>
<string name="play_removed">Partita rimossa</string>
<string name="play_untimed">senza orologio</string>
<string name="play_you">Tu</string>
<string name="play_saved">✓ Salvata</string>
<string name="play_save">Salva…</string>
<string name="play_adjourned_sub">giochi con %1$s · %2$s</string>
<string name="play_from_label">Dopo %1$s</string>
<string name="sound">Suono</string>
<string name="undo_menu">Annulla</string>
<string name="made_main">Ora è la linea principale</string>
<string name="elo">Elo</string>
<string name="play_analyse_short">Analizza</string>
<string name="play_on_short">Continua</string>
<string name="play_viewing">Visione %1$s · torna alla partita ›</string>
<string name="start_position">la posizione iniziale</string>
<string name="play_maia_stopped">Maia non si è avviata.</string>
<string name="play_maia_reload">Riscarica Maia</string>
<string name="play_adjourned_q">C’è una partita sospesa contro %1$s</string>
<string name="play_continue_it">Continuala</string>
<string name="play_start_new">Iniziarne una nuova</string>
<string name="play_adjourned_new_text">Una nuova partita la sostituisce; quanto giocato va, non finito, nel database del giocatore.</string>
<string name="play_offer_draw">Patta</string>
<string name="end_agreement">per accordo</string>
<string name="play_draw_declined">Maia rifiuta la patta</string>
<string name="play_draw_later">Maia ha rifiutato; riproponi dopo due sue mosse</string>
<string name="play_draw_no_engine">Maia risponde alla patta con Stockfish: scaricalo con «Motore»</string>
<string name="player_db_name">%1$s — partite contro il computer</string>
<string name="player_db_shared">Partite contro il computer</string>
<string name="player_written">✓ In «%1$s», n. %2$s ›</string>
<string name="player_kept_unfinished">Partita salvata non finita in «%1$s»</string>
<string name="player_db_row">salvate da sole</string>
<string name="record_games">Salvare le partite contro il computer nel database del giocatore</string>
<string name="player_line_existing">Le partite vengono salvate in «%1$s»</string>
<string name="player_line_new">Le partite saranno salvate in un nuovo database «%1$s».</string>
<string name="player_line_noname">Senza nome le partite vanno in «%1$s». Inserisci un nome per avere un database tuo.</string>
<string name="player_line_off">Le partite non vengono salvate da sole (Impostazioni).</string>
<string name="player_written_new">✓ Nuovo database «%1$s», n. %2$s ›</string>
<string name="player_write_failed">Impossibile scrivere in «%1$s»: %2$s</string>
<string name="play_adjourned_replaced">Una nuova partita la sostituisce.</string>
<string name="last_opened">Aperta per ultima</string>
<string name="play_adjourned_title">Partita contro %1$s</string>
<string name="play_move_n">mossa %1$d</string>
<!-- Rodent IV on the phone (android-rodent.md §9); the characters and the desktop's sentences come from apps/desktop/src/i18n.rs. -->
<string name="rodent_iv_amanda">Amanda</string>
<string name="rodent_iv_amanda_about">Prima attacca, poi gioca per l’attività dei pezzi.</string>
<string name="rodent_iv_cloe">Cloe</string>
<string name="rodent_iv_cloe_about">Ama le posizioni chiuse.</string>
<string name="rodent_iv_deborah">Debora</string>
<string name="rodent_iv_deborah_about">Difende bene e ama i suoi alfieri.</string>
<string name="rodent_iv_defender">Difensore</string>
<string name="rodent_iv_defender_about">Solido e prudente; si accontenta della patta.</string>
<string name="rodent_iv_dynamic">Dinamico</string>
<string name="rodent_iv_dynamic_about">Attacca, ama gli alfieri, sacrifica di tanto in tanto.</string>
<string name="rodent_iv_grumpy">Brontolo</string>
<string name="rodent_iv_grumpy_about">Attacco e restrizione; ama le posizioni bloccate, evita la patta.</string>
<string name="rodent_iv_partisan">Partigiano</string>
<string name="rodent_iv_partisan_about">Attacca dopo aperture tranquille e discrete.</string>
<string name="rodent_iv_pawnsacker">Gambettista</string>
<string name="rodent_iv_pawnsacker_about">Equilibrato, ma cede pedoni più volentieri.</string>
<string name="rodent_iv_pedrita">Pedrita</string>
<string name="rodent_iv_pedrita_about">Pedoni, difesa e restrizione.</string>
<string name="rodent_iv_preston">Preston</string>
<string name="rodent_iv_preston_about">Un attaccante materialista e moderato.</string>
<string name="rodent_iv_simple">Semplice</string>
<string name="rodent_iv_simple_about">Il più «computer»: scacchi semplici e solidi.</string>
<string name="rodent_iv_spitfire">Testa calda</string>
<string name="rodent_iv_spitfire_about">Tagliente e aggressivo.</string>
<string name="rodent_iv_strangler">Strangolatore</string>
<string name="rodent_iv_strangler_about">Un boa: stringe lentamente, molto umano.</string>
<string name="rodent_iv_alekhine">Aljechin</string>
<string name="rodent_iv_alekhine_about">Attacchi dinamici e combinazioni profonde.</string>
<string name="rodent_iv_anand">Anand</string>
<string name="rodent_iv_anand_about">Gioco rapido e universale con aperture taglienti.</string>
<string name="rodent_iv_anderssen">Anderssen</string>
<string name="rodent_iv_anderssen_about">Un attaccante romantico dell’Ottocento: sacrifici.</string>
<string name="rodent_iv_bosboom">Bosboom</string>
<string name="rodent_iv_bosboom_about">Aperture insolite e blitz creativo.</string>
<string name="rodent_iv_botvinnik">Botvinnik</string>
<string name="rodent_iv_botvinnik_about">Gioco strategico e scientifico, preparazione profonda.</string>
<string name="rodent_iv_fischer">Fischer</string>
<string name="rodent_iv_fischer_about">Chiaro, classico e preciso.</string>
<string name="rodent_iv_karpov">Karpov</string>
<string name="rodent_iv_karpov_about">Morsa posizionale, profilassi e tecnica.</string>
<string name="rodent_iv_kasparov">Kasparov</string>
<string name="rodent_iv_kasparov_about">Iniziativa e attacco potente.</string>
<string name="rodent_iv_kortchnoi">Kortchnoi</string>
<string name="rodent_iv_kortchnoi_about">Un difensore tenace e contrattaccante.</string>
<string name="rodent_iv_larsen">Larsen</string>
<string name="rodent_iv_larsen_about">Originale e rischioso, con aperture insolite.</string>
<string name="rodent_iv_lasker">Lasker</string>
<string name="rodent_iv_lasker_about">Un combattente pratico e psicologico.</string>
<string name="rodent_iv_marshall">Marshall</string>
<string name="rodent_iv_marshall_about">Un attaccante spavaldo con i gambetti.</string>
<string name="rodent_iv_morphy">Morphy</string>
<string name="rodent_iv_morphy_about">Sviluppo rapido e linee aperte.</string>
<string name="rodent_iv_nimzowitsch">Nimzowitsch</string>
<string name="rodent_iv_nimzowitsch_about">Restrizione, blocco e sovraprotezione.</string>
<string name="rodent_iv_petrosian">Petrosian</string>
<string name="rodent_iv_petrosian_about">Profilassi e sicurezza prima di tutto.</string>
<string name="rodent_iv_reti">Reti</string>
<string name="rodent_iv_reti_about">Ipermoderno: controlla il centro da lontano.</string>
<string name="rodent_iv_rubinstein">Rubinstein</string>
<string name="rodent_iv_rubinstein_about">Gioco posizionale classico, ottimo nei finali.</string>
<string name="rodent_iv_spassky">Spassky</string>
<string name="rodent_iv_spassky_about">Un giocatore universale, a suo agio ovunque.</string>
<string name="rodent_iv_steinitz">Steinitz</string>
<string name="rodent_iv_steinitz_about">Il fondatore del gioco posizionale, difensore ostinato.</string>
<string name="rodent_iv_tal">Tal</string>
<string name="rodent_iv_tal_about">Il mago di Riga: sacrifici e attacco.</string>
<string name="rodent_iv_tarrasch">Tarrasch</string>
<string name="rodent_iv_tarrasch_about">Regole classiche: spazio, sviluppo, pezzi attivi.</string>
<string name="rodent_iv_topalov">Topalov</string>
<string name="rodent_iv_topalov_about">Aggressivo e dinamico, sacrifica la qualità.</string>
<string name="opp_maia_sub">gioca come un umano</string>
<string name="opp_rodent_sub">forte, con uno stile</string>
<string name="like_human">Come un umano</string>
<string name="maia_no_style">Maia non sceglie uno stile: gioca come le persone del suo livello.</string>
<string name="rodent_measured">Il rating proprio di Rodent (UCI_Elo): non corrisponde all’Elo di una persona.</string>
<string name="rodent_resigns">Rodent abbandona</string>
<string name="end_rodent_resigned">Rodent ha abbandonato</string>
<string name="rodent_draw_declined">Rodent rifiuta la patta</string>
<string name="rodent_draw_later">Rodent ha rifiutato; riproponi dopo due sue mosse</string>
<string name="rodent_position_lost">La sua posizione è persa. Accettare la vittoria o giocare fino in fondo?</string>
<string name="play_button">Gioca</string>
<string name="play_button_cd">Gioca contro il computer</string>
<string name="strength_n">Forza: %1$s</string>
<string name="pick_title">Contro chi giocare</string>
<string name="pick_intro">Un carattere è uno stile con le sue aperture; la forza la regola il cursore.</string>
<string name="pick_players">Grandi giocatori</string>
<string name="pick_characters">Caratteri</string>
<string name="pick_change">Cambia</string>
<string name="pick_player_cd">%1$s, grande giocatore</string>
<string name="pick_character_cd">%1$s, carattere</string>
<string name="character_cd">Carattere: %1$s</string>
<string name="books_ready">Rodent IV e i suoi libri di aperture sono sul telefono</string>
<string name="books_offer">Libri di aperture di Rodent IV: %1$s MB, una sola volta da github.com</string>
<string name="books_not_needed">Da una posizione non serve il libro di aperture: Rodent IV gioca subito</string>
<string name="books_without">Senza libro</string>
<string name="books_without_cd">Senza libro: gioca senza libro di aperture</string>
<string name="books_notification">Libri di aperture di Rodent IV</string>
<string name="books_settings">Rodent IV — libri di aperture</string>
<string name="books_downloaded_mb">scaricati · %1$s MB</string>
<string name="books_missing_mb">non scaricati · %1$s MB</string>
<string name="books_deleted">Libri di aperture eliminati</string>
<string name="rodent_draw_no_engine">Rodent risponde alla patta con Stockfish: scaricalo con «Motore»</string>
<string name="rodent_stopped">Rodent non si è avviato.</string>
<string name="rodent_restart">Riavvia</string>
<string name="play_note_from_rodent">Da qui, una partita contro Rodent IV %1$s · %2$s.</string>
<string name="rodent_stopped_playing">Rodent si è fermato durante la partita.</string>
<string name="strength_range">%1$s, da %2$s a %3$s</string>
<string name="strength">Forza</string>
<string name="books_delete_cd">Elimina i libri di aperture</string>
<!-- Preparazione contro l\'avversario (attività 48). -->
<string name="players">Giocatori</string>
<string name="player_name_hint">Nome del giocatore</string>
<string name="players_read_failed">Impossibile leggere i giocatori</string>
<string name="reading_players">Lettura dei giocatori…</string>
<string name="no_named_players">Questo database non contiene giocatori con nome</string>
<string name="player_not_found">Giocatore non trovato</string>
<string name="to_games">Torna alle partite</string>
<string name="reset_search">Cancella ricerca</string>
<string name="prepare_action">Prepara</string>
<string name="prep_choose_color">Scegli un colore</string>
<string name="prep_against_player">Preparati contro %1$s</string>
<string name="prep_against_white">Contro il Bianco</string>
<string name="prep_against_black">Contro il Nero</string>
<string name="prep_opponent">Preparati contro l\'avversario…</string>
<string name="prep_title">Preparazione contro l\'avversario</string>
<string name="prep_close_engine_line">Chiudi prima la linea del motore</string>
<!--suppress TypographyDashes: literal PGN null move -->
<string name="prep_null_move_unavailable">La ricerca dopo un -- didattico non è disponibile</string>
<string name="prep_as_white">Bianco</string>
<string name="prep_as_black">Nero</string>
<string name="prep_move_failed">Impossibile giocare questa mossa</string>
<string name="prep_play_continuation">Gioca %1$s, %2$s, %3$s per cento</string>
<string name="prep_board_start">Scacchiera, posizione iniziale. %1$s in basso.</string>
<string name="prep_board_after">Scacchiera, posizione dopo %1$s. %2$s in basso.</string>
<string name="turn_white">Tocca al bianco</string>
<string name="turn_black">Tocca al nero</string>
<string name="prep_opponent_plays">Gioca l\'avversario</string>
<string name="prep_opponents_play">Giocano i suoi avversari</string>
<string name="prep_after">dopo %1$s</string>
<string name="prep_beginning">inizio</string>
<string name="prep_context_description">%1$s, %2$s, %3$s, %4$s</string>
<string name="prep_failed">Impossibile calcolare le continuazioni</string>
<string name="prep_no_memory">Memoria insufficiente per cercare in questo database</string>
<string name="prep_calculating">Calcolo delle continuazioni…</string>
<string name="prep_position_absent">Questa posizione non compare nelle partite di %1$s</string>
<string name="prep_position_absent_hint">Puoi continuare sulla scacchiera o tornare indietro</string>
<string name="prep_all_ended">Tutte le partite sono terminate qui</string>
<string name="prep_ended_here">Terminate qui: %1$s</string>
<string name="prep_no_normal">Nessuna continuazione normale: %1$s</string>
<string name="to_game">Torna alla partita</string>
<string name="to_players">Torna ai giocatori</string>
<string name="prep_choose_move">Scegli una mossa</string>
<plurals name="prep_wins"><item quantity="one">%1$s vittoria</item><item quantity="many">%1$s vittorie</item><item quantity="other">%1$s vittorie</item></plurals>
<plurals name="prep_draws"><item quantity="one">%1$s patta</item><item quantity="many">%1$s patte</item><item quantity="other">%1$s patte</item></plurals>
<plurals name="prep_losses"><item quantity="one">%1$s sconfitta</item><item quantity="many">%1$s sconfitte</item><item quantity="other">%1$s sconfitte</item></plurals>
<string name="prep_unknown_accessibility">Risultati sconosciuti: %1$d; esclusi dalle percentuali.</string>
<string name="prep_continuation_description">%1$s. %2$d di %3$s, %4$s per cento. Risultati di %5$s: %6$s, %7$s, %8$s; %9$s, %10$s e %11$s per cento. %12$s Gioca.</string>
<string name="prep_play">Gioca</string>
<string name="prep_unknown_short">altri %1$s</string>
<string name="prep_wdl_counts">+%1$s =%2$s −%3$s · W/D/L %4$s/%5$s/%6$s %%</string>
</resources>

View file

@ -36,9 +36,10 @@
<string name="to_start">Басына</string>
<string name="move_back">Бір жүріс артқа</string>
<string name="move_forward">Бір жүріс алға</string>
<string name="move_back_hint">Алдыңғы жүріс. Басына өту үшін басып тұрыңыз</string>
<string name="move_forward_hint">Келесі жүріс. Варианттың соңына өту үшін басып тұрыңыз</string>
<string name="to_end">Варианттың соңына</string>
<string name="next_moves">Келесі:</string>
<string name="board_hint">Бұл партияларды қарау құралы. Жүрістерді төмендегі ◀ ▶ арқылы ауыстырыңыз.</string>
<string name="board_description">Тақта, %1$s кейінгі позиция</string>
<string name="board_start">Тақта, бастапқы позиция</string>
<string name="white_won">Ақтар жеңді</string>
@ -112,8 +113,7 @@
<string name="about">Бағдарлама туралы</string>
<string name="build_full">Stockfish кіріктірілген</string>
<string name="build_light">Stockfish бағдарлама ішінде жүктеледі</string>
<string name="alpha">альфа</string>
<string name="about_text">Шахмат базаларын қарау құралы: PGN, ChessBase, мұрағаттар. Файлдар тек оқылады, ешқашан өзгертілмейді.</string>
<string name="about_text">Шахмат базалары, партияларды талдау және компьютермен ойын. Файлдарыңыз тек оқылады, ешқашан өзгертілмейді.</string>
<string name="licenses">Лицензиялар мен авторлар</string>
<string name="website">Сайт және бастапқы код</string>
@ -215,6 +215,14 @@
<string name="add_paste_hint">Басқа бағдарламада көшірілген партиялар</string>
<string name="paste_none">Алмасу буферінде PGN партиясы жоқ</string>
<string name="paste_db">Қойылды: %1$s</string>
<plurals name="clipboard_open_title">
<item quantity="one">Алмасу буферіндегі партия</item>
<item quantity="other">Алмасу буферіндегі партиялар</item>
</plurals>
<string name="clipboard_open_one">Осы PGN партиясын сақтап, тақтада ашу керек пе?</string>
<string name="clipboard_open_many">%1$s сақтап, бірінші партияны тақтада ашу керек пе? Барлық партиялар жергілікті көшірмеде сақталады.</string>
<string name="clipboard_open">Ашу</string>
<string name="clipboard_database_name">Алмасу буфері</string>
<string name="opening_file">Файл ашылуда…</string>
<string name="file_failed">Файлды ашу мүмкін болмады</string>
<string name="file_no_games">Бұл файлда шахмат партиялары жоқ.</string>
@ -227,15 +235,10 @@
<string name="review_menu">Партияны талдау</string>
<string name="review_report_menu">Партия есебі</string>
<string name="review_text">Қозғалтқыш негізгі варианттың әр позициясын бағалайды. Партияның өзі өзгермейді.</string>
<string name="review_quality">Сапа</string>
<string name="review_fast">Жылдам</string>
<string name="review_normal">Қалыпты</string>
<string name="review_deep">Терең</string>
<string name="review_seconds">%d с</string>
<string name="review_minutes">%d мин</string>
<string name="review_start">Талдау</string>
<string name="review_fill">Толықтыру</string>
<string name="review_again">Қайта талдау</string>
<string name="review_partial">%2$d позицияның %1$d бағаланып қойған.</string>
<string name="review_progress">Партияны талдау · %1$d / %2$d</string>
<string name="review_stop">Талдауды тоқтату</string>
@ -249,6 +252,10 @@
<string name="review_inaccuracies">Дәлсіздіктер</string>
<string name="review_mistakes">Қателер</string>
<string name="review_blunders">Өрескел қателер</string>
<string name="review_great">Мықты жүріс</string>
<string name="review_brilliant">Тамаша жүріс</string>
<string name="review_greats">Мықты жүрістер</string>
<string name="review_brilliants">Тамаша жүрістер</string>
<string name="review_missing">Бағаланбаған: %d</string>
<string name="review_failed">Талдау тоқтап қалды</string>
<string name="review_resume">Жалғастыру</string>
@ -258,13 +265,17 @@
<string name="review_endgame">Эндшпиль</string>
<string name="review_source">%1$s · жүріске %2$s түйін</string>
<string name="review_source_pgn" formatted="false">PGN-дағы бағалар ([%eval])</string>
<string name="review_no_notes">!! және ! тек қозғалтқышпен: PGN-да тек бағалар бар</string>
<string name="review_no_seconds">Бұл талдауда !! мен ! әлі ізделмеген</string>
<string name="review_stale">Талдау қозғалтқыштың басқа баптауларымен жасалған</string>
<string name="review_update">Жаңарту</string>
<string name="review_engine">Қозғалтқышпен талдау</string>
<string name="review_hide">Талдауды жасыру</string>
<string name="review_graph">Бағалау графигі</string>
<string name="review_engine_paused">Кідіртілді: партия талдануда</string>
<string name="review_best_preview">Жақсырақ вариант · жүріс %1$d / %2$d</string>
<string name="review_next">Келесі осындай жүріске өту</string>
<string name="review_show_best">Жақсырақ вариантты тақтада көрсету</string>
<string name="review_restart">Басынан бастау</string>
<string name="review_graph_state">%1$s, баға %2$s</string>
<string name="review_start_position">Бастапқы позиция</string>
<plurals name="review_estimate">
@ -390,4 +401,325 @@
<string name="upd_card_downloading">%1$s нұсқасына жаңарту, %3$d мегабайттың %2$d жүктелді</string>
<!-- Shown only when the interface is not in English. -->
<string name="upd_short_release">Файлды тексеру мүмкін емес</string>
<string name="undo_action">Қайтару</string>
<string name="moves_deleted">Жүрістер жойылды</string>
<string name="make_main">Негізгі ету</string>
<string name="delete_move">Жүрісті және жалғасын жою</string>
<string name="move_actions">Жүріспен әрекеттер</string>
<string name="new_game">Жаңа ойын</string>
<string name="own_databases">Менің базаларым</string>
<string name="own_new">+ Жаңа база</string>
<string name="own_empty">Мұнда сіз енгізген немесе компьютермен ойнаған ойындар болады</string>
<string name="files_add">+ Қосу</string>
<string name="files_empty">Мұнда сіз қосқан PGN және ChessBase файлдары, қалталар және интернеттегі ойындар болады</string>
<string name="files">Файлдар</string>
<string name="own_default_name">Менің ойындарым</string>
<string name="own_new_title">Жаңа база</string>
<string name="own_name">Атауы</string>
<string name="own_new_hint">Телефонда, ChessPenguin ішінде сақталады. Файлды база мәзірінен экспорттауға болады.</string>
<string name="create">Құру</string>
<string name="own_on_phone">телефонда</string>
<string name="own_export">Файлды экспорттау…</string>
<string name="own_delete">Базаны жою</string>
<string name="own_exported">Файл сақталды</string>
<string name="own_export_failed">Файлды сақтау мүмкін болмады</string>
<string name="own_removed">База жойылды</string>
<string name="own_delete_title">«%1$s» жойылсын ба?</string>
<plurals name="own_delete_text">
<item quantity="one">Телефоннан %1$s ойын жойылады. Керек болса, алдымен файлды экспорттаңыз.</item>
<item quantity="other">Телефоннан %1$s ойын жойылады. Керек болса, алдымен файлды экспорттаңыз.</item>
</plurals>
<string name="saved_to">«%1$s» ішіне сақталды, № %2$s</string>
<string name="save_failed">Ойынды сақтау мүмкін болмады</string>
<string name="save_in">«%1$s» ішіне сақтау</string>
<string name="save_to_mine">Менің базама сақтау…</string>
<string name="save_to_db">Базаға сақтау</string>
<string name="save_to_db_ellipsis">Базаға сақтау…</string>
<string name="own_new_ellipsis">Жаңа база…</string>
<string name="create_and_save">Құру және сақтау</string>
<string name="save_changes_in">Өзгерістер «%1$s» ішіне сақталсын ба?</string>
<string name="save_game_question">Ойын сақталсын ба?</string>
<string name="dont_save">Сақтамау</string>
<string name="game_data">Ойын деректері</string>
<string name="date_hint">ЖЖЖЖ.АА.КК</string>
<string name="date_wrong">Күн емес: 2026.10.26, 2026 немесе 26.10.2026</string>
<string name="discard_changes">Өзгерістер болдырылмасын ба?</string>
<string name="discard">Болдырмау</string>
<string name="keep_editing">Өңдеуді жалғастыру</string>
<string name="edit">Өзгерту</string>
<string name="next">Келесі</string>
<string name="train_title">Дебютті үйрену</string>
<string name="train_up_to">%1$s дейін</string>
<string name="train_learn">Дебютті осы жүріске дейін үйрену</string>
<string name="train_move_of">Жүріс %1$s / %2$s</string>
<string name="train_white">♔ Ақтар жүреді</string>
<string name="train_black">♚ Қаралар жүреді</string>
<string name="train_mistakes">Қателер: %1$s</string>
<string name="train_run">Әрекет %1$s</string>
<string name="train_wrong">× Партияда мұнда басқа жүріс</string>
<string name="train_show">Жүрісті көрсету</string>
<string name="train_not_done">Бұл линия әлі өтілмеген</string>
<string name="train_last_streak">Соңғы рет: %1$s · қатарынан қатесіз: %2$s</string>
<string name="train_last_best">Соңғы рет: %1$s · ең үздігі: %2$s</string>
<string name="train_done_clean">Қатесіз өтілді</string>
<string name="train_done_hint">Көмекпен өтілді · қателер: %1$s</string>
<string name="train_done">Өтілді · қателер: %1$s</string>
<string name="train_run_best">Әрекет %1$s · ең үздігі: %2$s</string>
<string name="train_streak">қатарынан қатесіз: %1$s</string>
<string name="train_recent">Соңғылары: %1$s</string>
<string name="train_arrow">Көрсеткідегі жүрісті жасаңыз</string>
<string name="train_again">↻ Қайталау</string>
<string name="train_back">⬅ Партияға оралу</string>
<string name="train_restart">Басынан</string>
<plurals name="train_runs">
<item quantity="one">%1$d рет</item>
<item quantity="other">%1$d рет</item>
</plurals>
<string name="maia_download_title">ChessPenguin үшін Maia</string>
<string name="play_won">Сіз жеңдіңіз</string>
<string name="play_lost">Сіз жеңілдіңіз</string>
<string name="play_you_resigned">Сіз берілдіңіз</string>
<string name="play_draw">Тең ойын</string>
<string name="end_mate">мат</string>
<string name="end_stalemate">пат</string>
<string name="end_threefold">позиция үш рет қайталанды</string>
<string name="end_fifty">50 жүріс бойы алу да, пешка жүрісі де жоқ</string>
<string name="end_material">ешбір жақ мат қоя алмайды</string>
<string name="end_maia_resigned">Maia берілді</string>
<string name="play_resign_q">Берілесіз бе?</string>
<string name="play_resign">⚑ Берілу</string>
<string name="play_take_back">↶ Жүрісті қайтару</string>
<string name="play_title">Компьютермен ойнау</string>
<string name="play_colour">Түсіңіз</string>
<string name="color_white">Ақтар</string>
<string name="color_black">Қаралар</string>
<string name="color_random">Кездейсоқ</string>
<string name="play_measured">Maia-ның өз рейтингі: ол адамның Эло рейтингіне сәйкес келмейді.</string>
<string name="play_download_note">Maia бір рет жүктеледі (%1$s МБ, huggingface.co сайтынан — авторлардың өз файлы).</string>
<string name="play_download_and_play">Жүктеп алып ойнау</string>
<string name="play_play">Ойнау</string>
<string name="play_thinking">ойлануда…</string>
<string name="play_event">Компьютермен партия</string>
<string name="play_analyse">Талдау</string>
<string name="play_rematch">↻ Реванш</string>
<string name="play_from_here">Осы жерден ойнау…</string>
<string name="play_checking">Тексерілуде…</string>
<string name="play_maia_failed">Maia іске қосылмады: %1$s</string>
<string name="play_accept_win">Жеңісті қабылдау</string>
<string name="play_to_end">Соңына дейін ойнау</string>
<string name="play_maia_resigns">Maia беріледі</string>
<string name="play_note_from">Бұдан әрі — Maia %1$s-мен ойын.</string>
<string name="play_abort">Тоқтату</string>
<string name="play_your_name">Атыңыз</string>
<string name="play_maia_ready">Maia жүктелді</string>
<string name="play_retry">Қайталау</string>
<string name="play_her_position_lost">Оның позициясы ұтылды. Жеңісті қабылдайсыз ба, әлде жалғастырасыз ба?</string>
<string name="play_continue">Жалғастыру</string>
<string name="play_adjourned">Maia %1$s-мен ойын · сіз %2$s</string>
<string name="play_as_white">ақпен</string>
<string name="play_as_black">қарамен</string>
<string name="play_removed">Ойын жойылды</string>
<string name="play_untimed">сағатсыз</string>
<string name="play_you">Сіз</string>
<string name="play_saved">✓ Сақталды</string>
<string name="play_save">Сақтау…</string>
<string name="play_adjourned_sub">сіз %1$s · %2$s</string>
<string name="play_from_label">%1$s кейін</string>
<string name="sound">Дыбыс</string>
<string name="undo_menu">Болдырмау</string>
<string name="made_main">Енді негізгі нұсқа</string>
<string name="elo">Эло</string>
<string name="play_analyse_short">Талдау</string>
<string name="play_on_short">Жалғастыру</string>
<string name="play_viewing">Қарау %1$s · ойынға оралу ›</string>
<string name="start_position">бастапқы позиция</string>
<string name="play_maia_stopped">Maia іске қосылмады.</string>
<string name="play_maia_reload">Maia-ны қайта жүктеу</string>
<string name="play_adjourned_q">%1$s-мен кейінге қалдырылған ойын бар</string>
<string name="play_continue_it">Жалғастыру</string>
<string name="play_start_new">Жаңасын бастау</string>
<string name="play_adjourned_new_text">Жаңа ойын оның орнын басады; ойналғаны аяқталмаған күйде ойыншы базасына жазылады.</string>
<string name="play_offer_draw">Тең</string>
<string name="end_agreement">келісім бойынша</string>
<string name="play_draw_declined">Maia тең ойыннан бас тартады</string>
<string name="play_draw_later">Maia бас тартты; оның екі жүрісінен кейін қайта ұсыныңыз</string>
<string name="play_draw_no_engine">Maia тең ойынға Stockfish арқылы жауап береді: оны «Қозғалтқыш» батырмасымен жүктеңіз</string>
<string name="player_db_name">%1$s — компьютермен ойындар</string>
<string name="player_db_shared">Компьютермен ойындар</string>
<string name="player_written">✓ «%1$s» базасында, № %2$s ›</string>
<string name="player_kept_unfinished">Ойын аяқталмаған күйде «%1$s» базасына жазылды</string>
<string name="player_db_row">өзі жазылады</string>
<string name="record_games">Компьютермен ойындарды ойыншы базасына жазу</string>
<string name="player_line_existing">Ойындар «%1$s» базасына жазылады</string>
<string name="player_line_new">Ойындар жаңа «%1$s» базасына жазылады.</string>
<string name="player_line_noname">Атсыз ойындар «%1$s» базасына түседі. Өз базаңыз болуы үшін атыңызды жазыңыз.</string>
<string name="player_line_off">Ойындар өзі жазылмайды (Баптаулар).</string>
<string name="player_written_new">✓ Жаңа база «%1$s», № %2$s ›</string>
<string name="player_write_failed">«%1$s» базасына жазу мүмкін болмады: %2$s</string>
<string name="play_adjourned_replaced">Жаңа ойын оның орнын басады.</string>
<string name="last_opened">Соңғы ашылған</string>
<string name="play_adjourned_title">%1$s-мен ойын</string>
<string name="play_move_n">%1$d-жүріс</string>
<!-- Rodent IV on the phone (android-rodent.md §9); the characters and the desktop's sentences come from apps/desktop/src/i18n.rs. -->
<string name="rodent_iv_amanda">Аманда</string>
<string name="rodent_iv_amanda_about">Алдымен шабуылдайды, кейін фигуралар белсенділігіне ойнайды.</string>
<string name="rodent_iv_cloe">Клои</string>
<string name="rodent_iv_cloe_about">Жабық позицияларды ұнатады.</string>
<string name="rodent_iv_deborah">Дебора</string>
<string name="rodent_iv_deborah_about">Жақсы қорғанады және пілдерін ұнатады.</string>
<string name="rodent_iv_defender">Қорғаушы</string>
<string name="rodent_iv_defender_about">Сенімді әрі сақ; тең ойынға келіседі.</string>
<string name="rodent_iv_dynamic">Динамик</string>
<string name="rodent_iv_dynamic_about">Шабуылдайды, пілдерді ұнатады, анда-санда құрбан етеді.</string>
<string name="rodent_iv_grumpy">Күңкілдек</string>
<string name="rodent_iv_grumpy_about">Шабуыл мен қысу; бітелген позицияларды ұнатады, тең ойыннан қашады.</string>
<string name="rodent_iv_partisan">Партизан</string>
<string name="rodent_iv_partisan_about">Тыныш, байқалмайтын дебюттерден кейін шабуылдайды.</string>
<string name="rodent_iv_pawnsacker">Гамбитші</string>
<string name="rodent_iv_pawnsacker_about">Теңгерімді, бірақ пешкаларды оңай береді.</string>
<string name="rodent_iv_pedrita">Педрита</string>
<string name="rodent_iv_pedrita_about">Пешкалар, қорғаныс және қысу.</string>
<string name="rodent_iv_preston">Престон</string>
<string name="rodent_iv_preston_about">Материалист, қалыпты шабуылшы.</string>
<string name="rodent_iv_simple">Қарапайым</string>
<string name="rodent_iv_simple_about">Ең «компьютерлік»: қарапайым, дұрыс шахмат.</string>
<string name="rodent_iv_spitfire">Қызба</string>
<string name="rodent_iv_spitfire_about">Өткір және агрессивті.</string>
<string name="rodent_iv_strangler">Тұншықтырушы</string>
<string name="rodent_iv_strangler_about">Айдаһар-жылан: баяу қысады, өте адамға ұқсас.</string>
<string name="rodent_iv_alekhine">Алехин</string>
<string name="rodent_iv_alekhine_about">Серпінді шабуылдар мен терең комбинациялар.</string>
<string name="rodent_iv_anand">Ананд</string>
<string name="rodent_iv_anand_about">Жылдам, әмбебап ойын, өткір дебюттермен.</string>
<string name="rodent_iv_anderssen">Андерсен</string>
<string name="rodent_iv_anderssen_about">XIX ғасырдың романтик шабуылшысы: құрбандар.</string>
<string name="rodent_iv_bosboom">Босбум</string>
<string name="rodent_iv_bosboom_about">Әдеттен тыс дебюттер және шығармашыл блиц.</string>
<string name="rodent_iv_botvinnik">Ботвинник</string>
<string name="rodent_iv_botvinnik_about">Терең дайындыққа негізделген ғылыми, стратегиялық ойын.</string>
<string name="rodent_iv_fischer">Фишер</string>
<string name="rodent_iv_fischer_about">Анық, классикалық және дәл.</string>
<string name="rodent_iv_karpov">Карпов</string>
<string name="rodent_iv_karpov_about">Позициялық қысым, профилактика және техника.</string>
<string name="rodent_iv_kasparov">Каспаров</string>
<string name="rodent_iv_kasparov_about">Бастама және қуатты шабуыл.</string>
<string name="rodent_iv_kortchnoi">Корчной</string>
<string name="rodent_iv_kortchnoi_about">Табанды қорғаушы және қарсы шабуылшы.</string>
<string name="rodent_iv_larsen">Ларсен</string>
<string name="rodent_iv_larsen_about">Өзгеше және тәуекелшіл, әдеттен тыс дебюттермен.</string>
<string name="rodent_iv_lasker">Ласкер</string>
<string name="rodent_iv_lasker_about">Практикалық, психолог күрескер.</string>
<string name="rodent_iv_marshall">Маршалл</string>
<string name="rodent_iv_marshall_about">Гамбиттері бар батыл шабуылшы.</string>
<string name="rodent_iv_morphy">Морфи</string>
<string name="rodent_iv_morphy_about">Жылдам дамыту және ашық сызықтар.</string>
<string name="rodent_iv_nimzowitsch">Нимцович</string>
<string name="rodent_iv_nimzowitsch_about">Қысу, блокада және артық қорғау.</string>
<string name="rodent_iv_petrosian">Петросян</string>
<string name="rodent_iv_petrosian_about">Профилактика және қауіпсіздік бірінші.</string>
<string name="rodent_iv_reti">Рети</string>
<string name="rodent_iv_reti_about">Гиперзаманауи: орталықты алыстан бақылайды.</string>
<string name="rodent_iv_rubinstein">Рубинштейн</string>
<string name="rodent_iv_rubinstein_about">Классикалық позициялық ойын, эндшпильде мықты.</string>
<string name="rodent_iv_spassky">Спасский</string>
<string name="rodent_iv_spassky_about">Әмбебап ойыншы, кез келген позицияда өзін үйдегідей сезінеді.</string>
<string name="rodent_iv_steinitz">Стейниц</string>
<string name="rodent_iv_steinitz_about">Позициялық ойынның негізін салушы, қыңыр қорғаушы.</string>
<string name="rodent_iv_tal">Таль</string>
<string name="rodent_iv_tal_about">Ригалық сиқыршы: құрбандар мен шабуыл.</string>
<string name="rodent_iv_tarrasch">Тарраш</string>
<string name="rodent_iv_tarrasch_about">Классикалық ережелер: кеңістік, дамыту, белсенді фигуралар.</string>
<string name="rodent_iv_topalov">Топалов</string>
<string name="rodent_iv_topalov_about">Агрессивті және серпінді, сапаны құрбан етеді.</string>
<string name="opp_maia_sub">адам сияқты ойнайды</string>
<string name="opp_rodent_sub">күшті, стилімен</string>
<string name="like_human">Адам сияқты</string>
<string name="maia_no_style">Maia стиль таңдамайды: ол өз рейтингіндегі адамдар сияқты ойнайды.</string>
<string name="rodent_measured">Rodent-тің өз рейтингі (UCI_Elo): ол адамның Эло рейтингіне сәйкес келмейді.</string>
<string name="rodent_resigns">Rodent беріледі</string>
<string name="end_rodent_resigned">Rodent берілді</string>
<string name="rodent_draw_declined">Rodent тең ойыннан бас тартады</string>
<string name="rodent_draw_later">Rodent бас тартты; оның екі жүрісінен кейін қайта ұсыныңыз</string>
<string name="rodent_position_lost">Оның позициясы ұтылды. Жеңісті қабылдайсыз ба, әлде соңына дейін ойнайсыз ба?</string>
<string name="play_button">Ойнау</string>
<string name="play_button_cd">Компьютермен ойнау</string>
<string name="strength_n">Күші: %1$s</string>
<string name="pick_title">Кіммен ойнау</string>
<string name="pick_intro">Мінез — бұл стиль мен дебюттер, күшті жүгірткі белгілейді.</string>
<string name="pick_players">Ұлы шахматшылар</string>
<string name="pick_characters">Мінездер</string>
<string name="pick_change">Өзгерту</string>
<string name="pick_player_cd">%1$s, ұлы шахматшы</string>
<string name="pick_character_cd">%1$s, мінез</string>
<string name="character_cd">Мінез: %1$s</string>
<string name="books_ready">Rodent IV және оның дебют кітаптары телефонда</string>
<string name="books_offer">Rodent IV дебют кітаптары: %1$s МБ, github.com сайтынан бір рет</string>
<string name="books_not_needed">Позициядан ойнағанда дебют кітабы керек емес — Rodent IV бірден ойнайды</string>
<string name="books_without">Кітапсыз</string>
<string name="books_without_cd">Кітапсыз: дебют кітабысыз ойнау</string>
<string name="books_notification">Rodent IV дебют кітаптары</string>
<string name="books_settings">Rodent IV — дебют кітаптары</string>
<string name="books_downloaded_mb">жүктелген · %1$s МБ</string>
<string name="books_missing_mb">жүктелмеген · %1$s МБ</string>
<string name="books_deleted">Дебют кітаптары жойылды</string>
<string name="rodent_draw_no_engine">Rodent тең ойынға Stockfish арқылы жауап береді: оны «Қозғалтқыш» батырмасымен жүктеңіз</string>
<string name="rodent_stopped">Rodent іске қосылмады.</string>
<string name="rodent_restart">Қайта іске қосу</string>
<string name="play_note_from_rodent">Бұдан әрі — Rodent IV %1$s-мен ойын (%2$s).</string>
<string name="rodent_stopped_playing">Rodent ойын кезінде тоқтады.</string>
<string name="strength_range">%1$s, %2$s-ден %3$s-ге дейін</string>
<string name="strength">Күші</string>
<string name="books_delete_cd">Дебют кітаптарын жою</string>
<!-- Қарсыласқа дайындық (48-тапсырма). -->
<string name="players">Ойыншылар</string>
<string name="player_name_hint">Ойыншының аты</string>
<string name="players_read_failed">Ойыншыларды оқу мүмкін болмады</string>
<string name="reading_players">Ойыншылар оқылуда…</string>
<string name="no_named_players">Бұл базада аты көрсетілген ойыншылар жоқ</string>
<string name="player_not_found">Ойыншы табылмады</string>
<string name="to_games">Партияларға оралу</string>
<string name="reset_search">Іздеуді тазалау</string>
<string name="prepare_action">Дайындалу</string>
<string name="prep_choose_color">Түсті таңдаңыз</string>
<string name="prep_against_player">Қарсыласқа дайындалу %1$s</string>
<string name="prep_against_white">Ақтарға қарсы</string>
<string name="prep_against_black">Қараларға қарсы</string>
<string name="prep_opponent">Қарсыласқа дайындалу…</string>
<string name="prep_title">Қарсыласқа дайындық</string>
<string name="prep_close_engine_line">Алдымен қозғалтқыш желісін жабыңыз</string>
<!--suppress TypographyDashes: literal PGN null move -->
<string name="prep_null_move_unavailable">Оқу -- кейін іздеу қолжетімсіз</string>
<string name="prep_as_white">Ақтар</string>
<string name="prep_as_black">Қаралар</string>
<string name="prep_move_failed">Бұл жүрісті жасау мүмкін болмады</string>
<string name="prep_play_continuation">%1$s жүру, %2$s, %3$s пайыз</string>
<string name="prep_board_start">Тақта, бастапқы позиция. Төменде %1$s.</string>
<string name="prep_board_after">Тақта, %1$s кейінгі позиция. Төменде %2$s.</string>
<string name="turn_white">Ақтардың жүрісі</string>
<string name="turn_black">Қаралардың жүрісі</string>
<string name="prep_opponent_plays">Қарсылас жүреді</string>
<string name="prep_opponents_play">Оның қарсыластары жүреді</string>
<string name="prep_after">%1$s кейін</string>
<string name="prep_beginning">басы</string>
<string name="prep_context_description">%1$s, %2$s, %3$s, %4$s</string>
<string name="prep_failed">Жалғастарды есептеу мүмкін болмады</string>
<string name="prep_no_memory">Бұл базадан іздеуге жад жеткіліксіз</string>
<string name="prep_calculating">Жалғастар есептелуде…</string>
<string name="prep_position_absent">%1$s партияларында бұл позиция жоқ</string>
<string name="prep_position_absent_hint">Тақтада жалғастыруға немесе артқа оралуға болады</string>
<string name="prep_all_ended">Барлық партия осы жерде аяқталды</string>
<string name="prep_ended_here">Осы жерде аяқталды: %1$s</string>
<string name="prep_no_normal">Қалыпты жалғас жоқ: %1$s</string>
<string name="to_game">Партияға оралу</string>
<string name="to_players">Ойыншыларға оралу</string>
<string name="prep_choose_move">Жүрісті таңдаңыз</string>
<plurals name="prep_wins"><item quantity="one">%1$s жеңіс</item><item quantity="other">%1$s жеңіс</item></plurals>
<plurals name="prep_draws"><item quantity="one">%1$s тең ойын</item><item quantity="other">%1$s тең ойын</item></plurals>
<plurals name="prep_losses"><item quantity="one">%1$s жеңіліс</item><item quantity="other">%1$s жеңіліс</item></plurals>
<string name="prep_unknown_accessibility">Белгісіз нәтижелер: %1$d; олар пайызға кірмейді.</string>
<string name="prep_continuation_description">%1$s. %3$s ішінен %2$d, %4$s пайыз. %5$s нәтижелері: %6$s, %7$s, %8$s; %9$s, %10$s және %11$s пайыз. %12$s Жүру.</string>
<string name="prep_play">Жүру</string>
<string name="prep_unknown_short">тағы %1$s</string>
<string name="prep_wdl_counts">+%1$s =%2$s −%3$s · W/D/L %4$s/%5$s/%6$s %%</string>
</resources>

View file

@ -37,9 +37,10 @@
<string name="to_start">Ao início</string>
<string name="move_back">Voltar um lance</string>
<string name="move_forward">Avançar um lance</string>
<string name="move_back_hint">Lance anterior. Mantenha premido para ir ao início</string>
<string name="move_forward_hint">Lance seguinte. Mantenha premido para ir ao fim da linha</string>
<string name="to_end">Ao fim da linha</string>
<string name="next_moves">Próximo:</string>
<string name="board_hint">Este é um visualizador de partidas. Percorra os lances com ◀ ▶ abaixo.</string>
<string name="board_description">Tabuleiro, posição após %1$s</string>
<string name="board_start">Tabuleiro, posição inicial</string>
<string name="white_won">Brancas venceram</string>
@ -113,8 +114,7 @@
<string name="about">Sobre</string>
<string name="build_full">Stockfish embutido</string>
<string name="build_light">Stockfish baixado no app</string>
<string name="alpha">alfa</string>
<string name="about_text">Um visualizador de bases de xadrez: PGN, ChessBase, arquivos compactados. Os arquivos são só lidos, nunca alterados.</string>
<string name="about_text">Bases de xadrez, análise de partidas e jogo contra o computador. Os seus arquivos são só lidos, nunca alterados.</string>
<string name="licenses">Licenças e autores</string>
<string name="website">Site e código-fonte</string>
@ -219,6 +219,15 @@
<string name="add_paste_hint">Partidas copiadas em outro app</string>
<string name="paste_none">Nenhuma partida PGN na área de transferência</string>
<string name="paste_db">Colado %1$s</string>
<plurals name="clipboard_open_title">
<item quantity="one">%1$s partida na área de transferência</item>
<item quantity="many">%1$s partidas na área de transferência</item>
<item quantity="other">%1$s partidas na área de transferência</item>
</plurals>
<string name="clipboard_open_one">Salvar esta partida PGN e abri-la no tabuleiro?</string>
<string name="clipboard_open_many">Salvar %1$s e abrir a primeira partida no tabuleiro? Todas as partidas serão mantidas na cópia local.</string>
<string name="clipboard_open">Abrir</string>
<string name="clipboard_database_name">Área de transferência</string>
<string name="opening_file">Abrindo o arquivo…</string>
<string name="file_failed">Não foi possível abrir o arquivo</string>
<string name="file_no_games">Não há partidas de xadrez neste arquivo.</string>
@ -231,15 +240,10 @@
<string name="review_menu">Análise da partida</string>
<string name="review_report_menu">Relatório da partida</string>
<string name="review_text">O motor avalia cada posição da linha principal. A partida em si não é alterada.</string>
<string name="review_quality">Qualidade</string>
<string name="review_fast">Rápida</string>
<string name="review_normal">Normal</string>
<string name="review_deep">Profunda</string>
<string name="review_seconds">%d s</string>
<string name="review_minutes">%d min</string>
<string name="review_start">Analisar</string>
<string name="review_fill">Completar</string>
<string name="review_again">Analisar de novo</string>
<string name="review_partial">%1$d de %2$d posições já estão avaliadas.</string>
<string name="review_progress">Análise da partida · %1$d de %2$d</string>
<string name="review_stop">Parar a análise</string>
@ -253,6 +257,10 @@
<string name="review_inaccuracies">Imprecisões</string>
<string name="review_mistakes">Erros</string>
<string name="review_blunders">Erros graves</string>
<string name="review_great">Ótimo lance</string>
<string name="review_brilliant">Lance brilhante</string>
<string name="review_greats">Ótimos lances</string>
<string name="review_brilliants">Lances brilhantes</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>
@ -262,13 +270,17 @@
<string name="review_endgame">Final</string>
<string name="review_source">%1$s · %2$s nós por lance</string>
<string name="review_source_pgn" formatted="false">Avaliações do PGN ([%eval])</string>
<string name="review_no_notes">!! e ! exigem o motor: o PGN traz só avaliações</string>
<string name="review_no_seconds">Esta análise ainda não procurou !! e !</string>
<string name="review_stale">Análise feita com outras definições do motor</string>
<string name="review_update">Atualizar</string>
<string name="review_engine">Analisar com o motor</string>
<string name="review_hide">Ocultar análise</string>
<string name="review_graph">Gráfico de avaliação</string>
<string name="review_engine_paused">Em pausa: a partida está sendo analisada</string>
<string name="review_best_preview">Linha melhor · lance %1$d de %2$d</string>
<string name="review_next">Ir para o próximo lance assim</string>
<string name="review_show_best">Mostrar a linha melhor no tabuleiro</string>
<string name="review_restart">Recomeçar</string>
<string name="review_graph_state">%1$s, avaliação %2$s</string>
<string name="review_start_position">Posição inicial</string>
<plurals name="review_estimate">
@ -396,4 +408,327 @@
<string name="upd_card_downloading">Atualização para %1$s, %2$d de %3$d megabytes baixados</string>
<!-- Shown only when the interface is not in English. -->
<string name="upd_short_release">O arquivo não pode ser verificado</string>
<string name="undo_action">Desfazer</string>
<string name="moves_deleted">Lances excluídos</string>
<string name="make_main">Tornar linha principal</string>
<string name="delete_move">Excluir o lance e a continuação</string>
<string name="move_actions">Ações do lance</string>
<string name="new_game">Nova partida</string>
<string name="own_databases">Minhas bases</string>
<string name="own_new">+ Nova base</string>
<string name="own_empty">Aqui ficarão as partidas que você inserir ou jogar contra o computador</string>
<string name="files_add">+ Adicionar</string>
<string name="files_empty">Aqui ficarão os arquivos PGN e ChessBase, as pastas e as partidas da internet que você adicionar</string>
<string name="files">Arquivos</string>
<string name="own_default_name">Minhas partidas</string>
<string name="own_new_title">Nova base</string>
<string name="own_name">Nome</string>
<string name="own_new_hint">Fica no telefone, no ChessPenguin. O arquivo pode ser exportado no menu da base.</string>
<string name="create">Criar</string>
<string name="own_on_phone">no telefone</string>
<string name="own_export">Exportar o arquivo…</string>
<string name="own_delete">Excluir a base</string>
<string name="own_exported">Arquivo salvo</string>
<string name="own_export_failed">Não foi possível salvar o arquivo</string>
<string name="own_removed">Base excluída</string>
<string name="own_delete_title">Excluir “%1$s”?</string>
<plurals name="own_delete_text">
<item quantity="one">%1$s partida será excluída do telefone. Se precisar dela, exporte o arquivo antes.</item>
<item quantity="many">%1$s partidas serão excluídas do telefone. Se precisar delas, exporte o arquivo antes.</item>
<item quantity="other">%1$s partidas serão excluídas do telefone. Se precisar delas, exporte o arquivo antes.</item>
</plurals>
<string name="saved_to">Salva em “%1$s”, nº %2$s</string>
<string name="save_failed">Não foi possível salvar a partida</string>
<string name="save_in">Salvar em “%1$s”</string>
<string name="save_to_mine">Salvar na minha base…</string>
<string name="save_to_db">Salvar numa base</string>
<string name="save_to_db_ellipsis">Salvar numa base…</string>
<string name="own_new_ellipsis">Nova base…</string>
<string name="create_and_save">Criar e salvar</string>
<string name="save_changes_in">Salvar as alterações em “%1$s”?</string>
<string name="save_game_question">Salvar a partida?</string>
<string name="dont_save">Não salvar</string>
<string name="game_data">Dados da partida</string>
<string name="date_hint">AAAA.MM.DD</string>
<string name="date_wrong">Não é uma data: 2026.10.26, 2026 ou 26.10.2026</string>
<string name="discard_changes">Descartar as alterações?</string>
<string name="discard">Descartar</string>
<string name="keep_editing">Continuar editando</string>
<string name="edit">Editar</string>
<string name="next">Avançar</string>
<string name="train_title">Aprendendo a abertura</string>
<string name="train_up_to">até %1$s</string>
<string name="train_learn">Aprender a abertura até este lance</string>
<string name="train_move_of">Lance %1$s de %2$s</string>
<string name="train_white">♔ Brancas jogam</string>
<string name="train_black">♚ Pretas jogam</string>
<string name="train_mistakes">Erros: %1$s</string>
<string name="train_run">Rodada %1$s</string>
<string name="train_wrong">× Na partida há outro lance aqui</string>
<string name="train_show">Mostrar o lance</string>
<string name="train_not_done">Linha ainda não treinada</string>
<string name="train_last_streak">Última vez: %1$s · sem erros seguidos: %2$s</string>
<string name="train_last_best">Última vez: %1$s · melhor: %2$s</string>
<string name="train_done_clean">Concluído sem erros</string>
<string name="train_done_hint">Concluído com dica · erros: %1$s</string>
<string name="train_done">Concluído · erros: %1$s</string>
<string name="train_run_best">Rodada %1$s · melhor: %2$s</string>
<string name="train_streak">sem erros seguidos: %1$s</string>
<string name="train_recent">Recentes: %1$s</string>
<string name="train_arrow">Jogue o lance da seta</string>
<string name="train_again">↻ De novo</string>
<string name="train_back">⬅ Voltar à partida</string>
<string name="train_restart">Do início</string>
<plurals name="train_runs">
<item quantity="one">%1$d passagem</item>
<item quantity="many">%1$d passagens</item>
<item quantity="other">%1$d passagens</item>
</plurals>
<string name="maia_download_title">Maia para o ChessPenguin</string>
<string name="play_won">Você venceu</string>
<string name="play_lost">Você perdeu</string>
<string name="play_you_resigned">Você abandonou</string>
<string name="play_draw">Empate</string>
<string name="end_mate">xeque-mate</string>
<string name="end_stalemate">afogamento</string>
<string name="end_threefold">a posição se repetiu três vezes</string>
<string name="end_fifty">50 lances sem captura nem lance de peão</string>
<string name="end_material">nenhum lado consegue dar mate</string>
<string name="end_maia_resigned">Maia desistiu</string>
<string name="play_resign_q">Abandonar?</string>
<string name="play_resign">⚑ Abandonar</string>
<string name="play_take_back">↶ Voltar lance</string>
<string name="play_title">Jogar contra o computador</string>
<string name="play_colour">Sua cor</string>
<string name="color_white">Brancas</string>
<string name="color_black">Pretas</string>
<string name="color_random">Aleatório</string>
<string name="play_measured">O rating próprio da Maia: não corresponde ao Elo de uma pessoa.</string>
<string name="play_download_note">A Maia é baixada uma única vez (%1$s MB, de huggingface.co, o arquivo dos próprios autores).</string>
<string name="play_download_and_play">Baixar e jogar</string>
<string name="play_play">Jogar</string>
<string name="play_thinking">pensando…</string>
<string name="play_event">Partida contra o computador</string>
<string name="play_analyse">Analisar</string>
<string name="play_rematch">↻ Revanche</string>
<string name="play_from_here">Jogar a partir daqui…</string>
<string name="play_checking">Verificando…</string>
<string name="play_maia_failed">A Maia não iniciou: %1$s</string>
<string name="play_accept_win">Aceitar a vitória</string>
<string name="play_to_end">Jogar até o fim</string>
<string name="play_maia_resigns">Maia desiste</string>
<string name="play_note_from">A partir daqui, uma partida contra Maia %1$s.</string>
<string name="play_abort">Abortar</string>
<string name="play_your_name">O seu nome</string>
<string name="play_maia_ready">A Maia foi baixada</string>
<string name="play_retry">Tentar de novo</string>
<string name="play_her_position_lost">A posição dela está perdida. Aceitar a vitória ou continuar?</string>
<string name="play_continue">Continuar</string>
<string name="play_adjourned">Partida contra a Maia %1$s · você joga de %2$s</string>
<string name="play_as_white">brancas</string>
<string name="play_as_black">pretas</string>
<string name="play_removed">Partida removida</string>
<string name="play_untimed">sem relógio</string>
<string name="play_you">Você</string>
<string name="play_saved">✓ Salva</string>
<string name="play_save">Salvar…</string>
<string name="play_adjourned_sub">você joga de %1$s · %2$s</string>
<string name="play_from_label">Depois de %1$s</string>
<string name="sound">Som</string>
<string name="undo_menu">Desfazer</string>
<string name="made_main">Agora é a linha principal</string>
<string name="elo">Elo</string>
<string name="play_analyse_short">Analisar</string>
<string name="play_on_short">Continuar</string>
<string name="play_viewing">Vendo %1$s · voltar à partida ›</string>
<string name="start_position">a posição inicial</string>
<string name="play_maia_stopped">A Maia não iniciou.</string>
<string name="play_maia_reload">Baixar a Maia de novo</string>
<string name="play_adjourned_q">Há uma partida adiada contra %1$s</string>
<string name="play_continue_it">Continuá-la</string>
<string name="play_start_new">Começar uma nova</string>
<string name="play_adjourned_new_text">Uma nova partida a substitui; o que foi jogado vai, inacabado, para a base do jogador.</string>
<string name="play_offer_draw">Empate</string>
<string name="end_agreement">por acordo</string>
<string name="play_draw_declined">A Maia recusa o empate</string>
<string name="play_draw_later">A Maia recusou; ofereça de novo após dois lances dela</string>
<string name="play_draw_no_engine">A Maia responde ao empate com o Stockfish: baixe-o com «Motor»</string>
<string name="player_db_name">%1$s — partidas contra o computador</string>
<string name="player_db_shared">Partidas contra o computador</string>
<string name="player_written">✓ Em «%1$s», n.º %2$s ›</string>
<string name="player_kept_unfinished">Partida gravada inacabada em «%1$s»</string>
<string name="player_db_row">gravadas sozinhas</string>
<string name="record_games">Gravar as partidas contra o computador na base do jogador</string>
<string name="player_line_existing">As partidas são gravadas em «%1$s»</string>
<string name="player_line_new">As partidas serão gravadas numa nova base «%1$s».</string>
<string name="player_line_noname">Sem nome, as partidas vão para «%1$s». Escreva um nome para ter a sua própria base.</string>
<string name="player_line_off">As partidas não são gravadas sozinhas (Definições).</string>
<string name="player_written_new">✓ Nova base «%1$s», n.º %2$s ›</string>
<string name="player_write_failed">Não foi possível gravar em «%1$s»: %2$s</string>
<string name="play_adjourned_replaced">Uma nova partida a substitui.</string>
<string name="last_opened">Aberta por último</string>
<string name="play_adjourned_title">Partida contra %1$s</string>
<string name="play_move_n">lance %1$d</string>
<!-- Rodent IV on the phone (android-rodent.md §9); the characters and the desktop's sentences come from apps/desktop/src/i18n.rs. -->
<string name="rodent_iv_amanda">Amanda</string>
<string name="rodent_iv_amanda_about">Primeiro ataca, depois joga pela atividade das peças.</string>
<string name="rodent_iv_cloe">Cloe</string>
<string name="rodent_iv_cloe_about">Gosta de posições fechadas.</string>
<string name="rodent_iv_deborah">Débora</string>
<string name="rodent_iv_deborah_about">Defende bem e gosta dos seus bispos.</string>
<string name="rodent_iv_defender">Defensor</string>
<string name="rodent_iv_defender_about">Sólido e cuidadoso; contenta-se com o empate.</string>
<string name="rodent_iv_dynamic">Dinâmico</string>
<string name="rodent_iv_dynamic_about">Ataca, gosta de bispos, sacrifica de vez em quando.</string>
<string name="rodent_iv_grumpy">Rabugento</string>
<string name="rodent_iv_grumpy_about">Ataque e restrição; gosta de posições bloqueadas, evita empates.</string>
<string name="rodent_iv_partisan">Partisano</string>
<string name="rodent_iv_partisan_about">Ataca depois de aberturas calmas e discretas.</string>
<string name="rodent_iv_pawnsacker">Gambiteiro</string>
<string name="rodent_iv_pawnsacker_about">Equilibrado, mas entrega peões com mais facilidade.</string>
<string name="rodent_iv_pedrita">Pedrita</string>
<string name="rodent_iv_pedrita_about">Peões, defesa e restrição.</string>
<string name="rodent_iv_preston">Preston</string>
<string name="rodent_iv_preston_about">Um atacante materialista e moderado.</string>
<string name="rodent_iv_simple">Simples</string>
<string name="rodent_iv_simple_about">O mais «computador»: xadrez simples e sólido.</string>
<string name="rodent_iv_spitfire">Esquentado</string>
<string name="rodent_iv_spitfire_about">Agudo e agressivo.</string>
<string name="rodent_iv_strangler">Estrangulador</string>
<string name="rodent_iv_strangler_about">Uma jiboia: aperta devagar, muito humano.</string>
<string name="rodent_iv_alekhine">Alekhine</string>
<string name="rodent_iv_alekhine_about">Ataques dinâmicos e combinações profundas.</string>
<string name="rodent_iv_anand">Anand</string>
<string name="rodent_iv_anand_about">Jogo rápido e universal com aberturas agudas.</string>
<string name="rodent_iv_anderssen">Anderssen</string>
<string name="rodent_iv_anderssen_about">Um atacante romântico do século XIX: sacrifícios.</string>
<string name="rodent_iv_bosboom">Bosboom</string>
<string name="rodent_iv_bosboom_about">Aberturas incomuns e blitz criativo.</string>
<string name="rodent_iv_botvinnik">Botvinnik</string>
<string name="rodent_iv_botvinnik_about">Jogo estratégico e científico, preparação profunda.</string>
<string name="rodent_iv_fischer">Fischer</string>
<string name="rodent_iv_fischer_about">Claro, clássico e preciso.</string>
<string name="rodent_iv_karpov">Karpov</string>
<string name="rodent_iv_karpov_about">Pressão posicional, profilaxia e técnica.</string>
<string name="rodent_iv_kasparov">Kasparov</string>
<string name="rodent_iv_kasparov_about">Iniciativa e ataque poderoso.</string>
<string name="rodent_iv_kortchnoi">Kortchnoi</string>
<string name="rodent_iv_kortchnoi_about">Um defensor tenaz e contra-atacante.</string>
<string name="rodent_iv_larsen">Larsen</string>
<string name="rodent_iv_larsen_about">Original e arriscado, com aberturas incomuns.</string>
<string name="rodent_iv_lasker">Lasker</string>
<string name="rodent_iv_lasker_about">Um lutador prático e psicológico.</string>
<string name="rodent_iv_marshall">Marshall</string>
<string name="rodent_iv_marshall_about">Um atacante ousado com gambitos.</string>
<string name="rodent_iv_morphy">Morphy</string>
<string name="rodent_iv_morphy_about">Desenvolvimento rápido e linhas abertas.</string>
<string name="rodent_iv_nimzowitsch">Nimzowitsch</string>
<string name="rodent_iv_nimzowitsch_about">Restrição, bloqueio e superproteção.</string>
<string name="rodent_iv_petrosian">Petrosian</string>
<string name="rodent_iv_petrosian_about">Profilaxia e segurança acima de tudo.</string>
<string name="rodent_iv_reti">Reti</string>
<string name="rodent_iv_reti_about">Hipermoderno: controla o centro à distância.</string>
<string name="rodent_iv_rubinstein">Rubinstein</string>
<string name="rodent_iv_rubinstein_about">Jogo posicional clássico, ótimo em finais.</string>
<string name="rodent_iv_spassky">Spassky</string>
<string name="rodent_iv_spassky_about">Um jogador universal, à vontade em qualquer posição.</string>
<string name="rodent_iv_steinitz">Steinitz</string>
<string name="rodent_iv_steinitz_about">O fundador do jogo posicional, um defensor obstinado.</string>
<string name="rodent_iv_tal">Tal</string>
<string name="rodent_iv_tal_about">O mágico de Riga: sacrifícios e ataque.</string>
<string name="rodent_iv_tarrasch">Tarrasch</string>
<string name="rodent_iv_tarrasch_about">Regras clássicas: espaço, desenvolvimento, peças ativas.</string>
<string name="rodent_iv_topalov">Topalov</string>
<string name="rodent_iv_topalov_about">Agressivo e dinâmico, sacrifica a qualidade.</string>
<string name="opp_maia_sub">joga como um humano</string>
<string name="opp_rodent_sub">forte, com estilo</string>
<string name="like_human">Como um humano</string>
<string name="maia_no_style">A Maia não escolhe estilo: joga como as pessoas do nível dela.</string>
<string name="rodent_measured">O rating próprio do Rodent (UCI_Elo): não corresponde ao Elo de uma pessoa.</string>
<string name="rodent_resigns">O Rodent desiste</string>
<string name="end_rodent_resigned">O Rodent desistiu</string>
<string name="rodent_draw_declined">O Rodent recusa o empate</string>
<string name="rodent_draw_later">O Rodent recusou; ofereça de novo após dois lances dele</string>
<string name="rodent_position_lost">A posição dele está perdida. Aceitar a vitória ou jogar até o fim?</string>
<string name="play_button">Jogar</string>
<string name="play_button_cd">Jogar contra o computador</string>
<string name="strength_n">Força: %1$s</string>
<string name="pick_title">Contra quem jogar</string>
<string name="pick_intro">Um caráter é um estilo e suas aberturas; a força é definida pelo controle deslizante.</string>
<string name="pick_players">Grandes jogadores</string>
<string name="pick_characters">Caracteres</string>
<string name="pick_change">Alterar</string>
<string name="pick_player_cd">%1$s, grande jogador</string>
<string name="pick_character_cd">%1$s, caráter</string>
<string name="character_cd">Caráter: %1$s</string>
<string name="books_ready">O Rodent IV e seus livros de aberturas estão no telefone</string>
<string name="books_offer">Livros de aberturas do Rodent IV: %1$s MB, baixados uma vez de github.com</string>
<string name="books_not_needed">A partir de uma posição não é preciso livro de aberturas: o Rodent IV joga na hora</string>
<string name="books_without">Sem livro</string>
<string name="books_without_cd">Sem livro: jogar sem livro de aberturas</string>
<string name="books_notification">Livros de aberturas do Rodent IV</string>
<string name="books_settings">Rodent IV — livros de aberturas</string>
<string name="books_downloaded_mb">baixados · %1$s MB</string>
<string name="books_missing_mb">não baixados · %1$s MB</string>
<string name="books_deleted">Livros de aberturas excluídos</string>
<string name="rodent_draw_no_engine">O Rodent responde ao empate com o Stockfish: baixe-o com «Motor»</string>
<string name="rodent_stopped">O Rodent não iniciou.</string>
<string name="rodent_restart">Reiniciar</string>
<string name="play_note_from_rodent">A partir daqui, uma partida contra Rodent IV %1$s · %2$s.</string>
<string name="rodent_stopped_playing">O Rodent parou durante a partida.</string>
<string name="strength_range">%1$s, de %2$s a %3$s</string>
<string name="strength">Força</string>
<string name="books_delete_cd">Excluir os livros de aberturas</string>
<!-- Preparação contra o adversário (tarefa 48). -->
<string name="players">Jogadores</string>
<string name="player_name_hint">Nome do jogador</string>
<string name="players_read_failed">Não foi possível ler os jogadores</string>
<string name="reading_players">A ler jogadores…</string>
<string name="no_named_players">Não há jogadores identificados nesta base</string>
<string name="player_not_found">Jogador não encontrado</string>
<string name="to_games">Voltar às partidas</string>
<string name="reset_search">Limpar pesquisa</string>
<string name="prepare_action">Preparar</string>
<string name="prep_choose_color">Escolha uma cor</string>
<string name="prep_against_player">Preparar contra %1$s</string>
<string name="prep_against_white">Contra as brancas</string>
<string name="prep_against_black">Contra as pretas</string>
<string name="prep_opponent">Preparar contra o adversário…</string>
<string name="prep_title">Preparação contra o adversário</string>
<string name="prep_close_engine_line">Feche primeiro a linha do motor</string>
<!--suppress TypographyDashes: literal PGN null move -->
<string name="prep_null_move_unavailable">A pesquisa depois de um -- didático não está disponível</string>
<string name="prep_as_white">Brancas</string>
<string name="prep_as_black">Pretas</string>
<string name="prep_move_failed">Não foi possível jogar este lance</string>
<string name="prep_play_continuation">Jogar %1$s, %2$s, %3$s por cento</string>
<string name="prep_board_start">Tabuleiro, posição inicial. %1$s em baixo.</string>
<string name="prep_board_after">Tabuleiro, posição depois de %1$s. %2$s em baixo.</string>
<string name="turn_white">Jogam as brancas</string>
<string name="turn_black">Jogam as pretas</string>
<string name="prep_opponent_plays">O adversário joga</string>
<string name="prep_opponents_play">Os seus adversários jogam</string>
<string name="prep_after">depois de %1$s</string>
<string name="prep_beginning">início</string>
<string name="prep_context_description">%1$s, %2$s, %3$s, %4$s</string>
<string name="prep_failed">Não foi possível calcular as continuações</string>
<string name="prep_no_memory">Memória insuficiente para pesquisar nesta base</string>
<string name="prep_calculating">A calcular continuações…</string>
<string name="prep_position_absent">Esta posição não ocorre nas partidas de %1$s</string>
<string name="prep_position_absent_hint">Pode continuar no tabuleiro ou retroceder</string>
<string name="prep_all_ended">Todas as partidas terminaram aqui</string>
<string name="prep_ended_here">Terminaram aqui: %1$s</string>
<string name="prep_no_normal">Sem continuação normal: %1$s</string>
<string name="to_game">Voltar à partida</string>
<string name="to_players">Voltar aos jogadores</string>
<string name="prep_choose_move">Escolha um lance</string>
<plurals name="prep_wins"><item quantity="one">%1$s vitória</item><item quantity="many">%1$s vitórias</item><item quantity="other">%1$s vitórias</item></plurals>
<plurals name="prep_draws"><item quantity="one">%1$s empate</item><item quantity="many">%1$s empates</item><item quantity="other">%1$s empates</item></plurals>
<plurals name="prep_losses"><item quantity="one">%1$s derrota</item><item quantity="many">%1$s derrotas</item><item quantity="other">%1$s derrotas</item></plurals>
<string name="prep_unknown_accessibility">Resultados desconhecidos: %1$d; excluídos das percentagens.</string>
<string name="prep_continuation_description">%1$s. %2$d de %3$s, %4$s por cento. Resultados de %5$s: %6$s, %7$s, %8$s; %9$s, %10$s e %11$s por cento. %12$s Jogar.</string>
<string name="prep_play">Jogar</string>
<string name="prep_unknown_short">mais %1$s</string>
<string name="prep_wdl_counts">+%1$s =%2$s −%3$s · W/D/L %4$s/%5$s/%6$s %%</string>
</resources>

View file

@ -38,9 +38,10 @@
<string name="to_start">В начало</string>
<string name="move_back">Ход назад</string>
<string name="move_forward">Ход вперёд</string>
<string name="move_back_hint">Предыдущий ход. Удерживайте для перехода в начало</string>
<string name="move_forward_hint">Следующий ход. Удерживайте для перехода в конец линии</string>
<string name="to_end">В конец линии</string>
<string name="next_moves">Дальше:</string>
<string name="board_hint">Это просмотр партии. Ходы листаются кнопками ◀ ▶ внизу.</string>
<string name="board_description">Доска, позиция после %1$s</string>
<string name="board_start">Доска, начальная позиция</string>
<string name="white_won">Победили белые</string>
@ -114,8 +115,7 @@
<string name="about">О программе</string>
<string name="build_full">Stockfish уже внутри</string>
<string name="build_light">Stockfish скачивается в приложении</string>
<string name="alpha">альфа</string>
<string name="about_text">Просмотр шахматных баз: PGN, ChessBase, архивы. Файлы только читаются и никогда не меняются.</string>
<string name="about_text">Шахматные базы, анализ партий и игра с компьютером. Ваши файлы только читаются и никогда не меняются.</string>
<string name="licenses">Лицензии и авторы</string>
<string name="website">Сайт и исходный код</string>
@ -223,6 +223,16 @@
<string name="add_paste_hint">Партии, скопированные в другом приложении</string>
<string name="paste_none">В буфере нет партий в формате PGN</string>
<string name="paste_db">Из буфера, %1$s</string>
<plurals name="clipboard_open_title">
<item quantity="one">%1$s партия в буфере обмена</item>
<item quantity="few">%1$s партии в буфере обмена</item>
<item quantity="many">%1$s партий в буфере обмена</item>
<item quantity="other">%1$s партии в буфере обмена</item>
</plurals>
<string name="clipboard_open_one">Сохранить PGN-партию и открыть её на доске?</string>
<string name="clipboard_open_many">Сохранить %1$s и открыть первую партию на доске? Все партии останутся в локальной копии.</string>
<string name="clipboard_open">Открыть</string>
<string name="clipboard_database_name">Буфер обмена</string>
<string name="opening_file">Открываю файл…</string>
<string name="file_failed">Файл не открылся</string>
<string name="file_no_games">В этом файле нет шахматных партий.</string>
@ -235,15 +245,10 @@
<string name="review_menu">Анализ партии</string>
<string name="review_report_menu">Отчёт по партии</string>
<string name="review_text">Движок оценит каждую позицию основной линии. Сама партия не изменится.</string>
<string name="review_quality">Качество</string>
<string name="review_fast">Быстро</string>
<string name="review_normal">Обычно</string>
<string name="review_deep">Глубоко</string>
<string name="review_seconds">%d с</string>
<string name="review_minutes">%d мин</string>
<string name="review_start">Анализировать</string>
<string name="review_fill">Дополнить</string>
<string name="review_again">Анализировать заново</string>
<string name="review_partial">Уже оценено позиций: %1$d из %2$d.</string>
<string name="review_progress">Анализ партии · %1$d из %2$d</string>
<string name="review_stop">Остановить анализ</string>
@ -257,6 +262,10 @@
<string name="review_inaccuracies">Неточности</string>
<string name="review_mistakes">Ошибки</string>
<string name="review_blunders">Зевки</string>
<string name="review_great">Замечательный ход</string>
<string name="review_brilliant">Блестящий ход</string>
<string name="review_greats">Замечательный</string>
<string name="review_brilliants">Блестящий</string>
<string name="review_missing">Без оценки: %d</string>
<string name="review_failed">Анализ прервался</string>
<string name="review_resume">Продолжить</string>
@ -266,13 +275,17 @@
<string name="review_endgame">Эндшпиль</string>
<string name="review_source">%1$s · %2$s узлов на ход</string>
<string name="review_source_pgn" formatted="false">Оценки из PGN ([%eval])</string>
<string name="review_no_notes">!! и ! ставит только движок: в PGN есть лишь оценки</string>
<string name="review_no_seconds">В этом анализе !! и ! ещё не искали</string>
<string name="review_stale">Анализ сделан с прежними настройками движка</string>
<string name="review_update">Обновить</string>
<string name="review_engine">Проанализировать движком</string>
<string name="review_hide">Скрыть анализ</string>
<string name="review_graph">График оценки</string>
<string name="review_engine_paused">Пауза: идёт анализ партии</string>
<string name="review_best_preview">Лучшая линия · ход %1$d из %2$d</string>
<string name="review_next">Перейти к следующему такому ходу</string>
<string name="review_show_best">Показать лучшую линию на доске</string>
<string name="review_restart">Заново</string>
<string name="review_graph_state">%1$s, оценка %2$s</string>
<string name="review_start_position">Начальная позиция</string>
<plurals name="review_estimate">
@ -401,4 +414,344 @@
<string name="s_about_ready">Версия %1$s скачана</string>
<string name="upd_card_downloading">Обновление до %1$s, скачано %2$d из %3$d мегабайт</string>
<string name="upd_short_release">Файл нельзя проверить</string>
<string name="undo_action">Вернуть</string>
<string name="moves_deleted">Ходы удалены</string>
<string name="make_main">Сделать основным</string>
<string name="delete_move">Удалить ход и продолжение</string>
<string name="move_actions">Действия с ходом</string>
<string name="new_game">Новая партия</string>
<string name="own_databases">Мои базы</string>
<string name="own_new">+ Новая база</string>
<string name="own_empty">Здесь будут партии, которые вы введёте или сыграете с компьютером</string>
<string name="files_add">+ Добавить</string>
<string name="files_empty">Здесь будут файлы PGN и ChessBase, папки и партии из интернета, которые вы добавите</string>
<string name="files">Файлы</string>
<string name="own_default_name">Мои партии</string>
<string name="own_new_title">Новая база</string>
<string name="own_name">Название</string>
<string name="own_new_hint">Хранится на телефоне, в ChessPenguin. Выгрузить файл можно в меню базы.</string>
<string name="create">Создать</string>
<string name="own_on_phone">на телефоне</string>
<string name="own_export">Выгрузить файл…</string>
<string name="own_delete">Удалить базу</string>
<string name="own_exported">Файл сохранён</string>
<string name="own_export_failed">Не удалось сохранить файл</string>
<string name="own_removed">База удалена</string>
<string name="own_delete_title">Удалить «%1$s»?</string>
<plurals name="own_delete_text">
<item quantity="one">%1$s партия будет удалена с телефона. Если она нужна, сначала выгрузите файл.</item>
<item quantity="few">%1$s партии будут удалены с телефона. Если они нужны, сначала выгрузите файл.</item>
<item quantity="many">%1$s партий будут удалены с телефона. Если они нужны, сначала выгрузите файл.</item>
<item quantity="other">%1$s партии будут удалены с телефона. Если они нужны, сначала выгрузите файл.</item>
</plurals>
<string name="saved_to">Сохранено в «%1$s», № %2$s</string>
<string name="save_failed">Не удалось сохранить партию</string>
<string name="save_in">Сохранить в «%1$s»</string>
<string name="save_to_mine">Сохранить в мою базу…</string>
<string name="save_to_db">Сохранить в базу</string>
<string name="save_to_db_ellipsis">Сохранить в базу…</string>
<string name="own_new_ellipsis">Новая база…</string>
<string name="create_and_save">Создать и сохранить</string>
<string name="save_changes_in">Сохранить изменения в «%1$s»?</string>
<string name="save_game_question">Сохранить партию?</string>
<string name="dont_save">Не сохранять</string>
<string name="game_data">Данные партии</string>
<string name="date_hint">ГГГГ.ММ.ДД</string>
<string name="date_wrong">Не дата: 2026.10.26, 2026 или 26.10.2026</string>
<string name="discard_changes">Отменить изменения?</string>
<string name="discard">Отменить</string>
<string name="keep_editing">Продолжить правку</string>
<string name="edit">Изменить</string>
<string name="next">Далее</string>
<string name="train_title">Учим дебют</string>
<string name="train_up_to">до %1$s</string>
<string name="train_learn">Учить дебют до этого хода</string>
<string name="train_move_of">Ход %1$s из %2$s</string>
<string name="train_white">♔ ход белых</string>
<string name="train_black">♚ ход чёрных</string>
<string name="train_mistakes">Ошибок: %1$s</string>
<string name="train_run">Прохождение %1$s</string>
<string name="train_wrong">× В партии — другой ход</string>
<string name="train_show">Показать ход</string>
<string name="train_not_done">Эту линию ещё не проходили</string>
<string name="train_last_streak">Прошлое: %1$s · без ошибок подряд: %2$s</string>
<string name="train_last_best">Прошлое: %1$s · лучшее: %2$s</string>
<string name="train_done_clean">Пройдено без ошибок</string>
<string name="train_done_hint">Пройдено с подсказкой · ошибок: %1$s</string>
<string name="train_done">Пройдено · ошибок: %1$s</string>
<string name="train_run_best">Прохождение %1$s · лучшее: %2$s</string>
<string name="train_streak">без ошибок подряд: %1$s</string>
<string name="train_recent">Последние: %1$s</string>
<string name="train_arrow">Сделайте ход со стрелки</string>
<string name="train_again">↻ Ещё раз</string>
<string name="train_back">⬅ К партии</string>
<string name="train_restart">Сначала</string>
<plurals name="train_runs">
<item quantity="one">прохождений: %1$d</item>
<item quantity="few">прохождений: %1$d</item>
<item quantity="many">прохождений: %1$d</item>
<item quantity="other">прохождений: %1$d</item>
</plurals>
<string name="maia_download_title">Maia для ChessPenguin</string>
<string name="play_won">Вы выиграли</string>
<string name="play_lost">Вы проиграли</string>
<string name="play_you_resigned">Вы сдались</string>
<string name="play_draw">Ничья</string>
<string name="end_mate">мат</string>
<string name="end_stalemate">пат</string>
<string name="end_threefold">позиция повторилась трижды</string>
<string name="end_fifty">50 ходов без взятий и ходов пешек</string>
<string name="end_material">ни у кого нет материала для мата</string>
<string name="end_maia_resigned">Maia сдалась</string>
<string name="play_resign_q">Сдаться?</string>
<string name="play_resign">⚑ Сдаться</string>
<string name="play_take_back">↶ Ход назад</string>
<string name="play_title">Игра с компьютером</string>
<string name="play_colour">Цвет</string>
<string name="color_white">Белые</string>
<string name="color_black">Чёрные</string>
<string name="color_random">Случайно</string>
<string name="play_measured">Собственный рейтинг Maia: он не равен Эло человека.</string>
<string name="play_download_note">Maia скачивается один раз (%1$s МБ, с huggingface.co — файл самих авторов).</string>
<string name="play_download_and_play">Скачать и играть</string>
<string name="play_play">Играть</string>
<string name="play_thinking">думает…</string>
<string name="play_event">Партия с компьютером</string>
<string name="play_analyse">Анализировать</string>
<string name="play_rematch">↻ Реванш</string>
<string name="play_from_here">Играть отсюда…</string>
<string name="play_checking">Проверяю…</string>
<string name="play_maia_failed">Maia не запустилась: %1$s</string>
<string name="play_accept_win">Принять победу</string>
<string name="play_to_end">Играть до конца</string>
<string name="play_maia_resigns">Maia сдаётся</string>
<string name="play_note_from">Дальше — игра с Maia %1$s.</string>
<string name="play_abort">Прервать</string>
<string name="play_your_name">Ваше имя</string>
<string name="play_maia_ready">Maia скачана</string>
<string name="play_retry">Повторить</string>
<string name="play_her_position_lost">Её позиция проиграна. Принять победу или доиграть?</string>
<string name="play_continue">Продолжить</string>
<string name="play_adjourned">Партия с Maia %1$s · вы %2$s</string>
<string name="play_as_white">белыми</string>
<string name="play_as_black">чёрными</string>
<string name="play_removed">Партия удалена</string>
<string name="play_untimed">без часов</string>
<string name="play_you">Вы</string>
<string name="play_saved">✓ Сохранено</string>
<string name="play_save">Сохранить…</string>
<string name="play_adjourned_sub">вы %1$s · %2$s</string>
<string name="play_from_label">После %1$s</string>
<string name="sound">Звук</string>
<string name="undo_menu">Отменить</string>
<string name="made_main">Теперь основной вариант</string>
<string name="elo">Эло</string>
<string name="play_analyse_short">Анализ</string>
<string name="play_on_short">Доиграть</string>
<string name="play_viewing">Просмотр: %1$s · к игре ›</string>
<string name="start_position">начальная позиция</string>
<string name="play_maia_stopped">Maia не запустилась.</string>
<string name="play_maia_reload">Скачать Maia заново</string>
<string name="play_adjourned_q">Есть отложенная партия с %1$s</string>
<string name="play_continue_it">Продолжить её</string>
<string name="play_start_new">Начать новую</string>
<string name="play_adjourned_new_text">Новая партия заменит её; сыгранное запишется в базу игрока неоконченным.</string>
<string name="play_offer_draw">Ничья</string>
<string name="end_agreement">по соглашению</string>
<string name="play_draw_declined">Maia отказывается от ничьей</string>
<string name="play_draw_later">Maia отказалась; снова можно предложить через два её хода</string>
<string name="play_draw_no_engine">Maia отвечает на ничью с помощью Stockfish: скачайте его кнопкой «Движок»</string>
<string name="player_db_name">%1$s — партии с компьютером</string>
<string name="player_db_shared">Партии с компьютером</string>
<string name="player_written">✓ В «%1$s», № %2$s ›</string>
<string name="player_kept_unfinished">Партия записана в «%1$s» неоконченной</string>
<string name="player_db_row">пишутся сами</string>
<string name="record_games">Записывать партии с компьютером в базу игрока</string>
<string name="player_line_existing">Партии записываются в «%1$s»</string>
<string name="player_line_new">Партии будут записываться в новую базу «%1$s».</string>
<string name="player_line_noname">Без имени партии идут в «%1$s». Впишите имя — заведём вашу базу.</string>
<string name="player_line_off">Партии сами не записываются (Настройки).</string>
<string name="player_written_new">✓ Создана база «%1$s», № %2$s ›</string>
<string name="player_write_failed">Не удалось записать в «%1$s»: %2$s</string>
<string name="play_adjourned_replaced">Новая партия заменит её.</string>
<string name="last_opened">Открыта последней</string>
<string name="play_adjourned_title">Партия с %1$s</string>
<string name="play_move_n">%1$d-й ход</string>
<!-- Rodent IV on the phone (android-rodent.md §9); the characters and the desktop's sentences come from apps/desktop/src/i18n.rs. -->
<string name="rodent_iv_amanda">Аманда</string>
<string name="rodent_iv_amanda_about">Сначала атакует, потом играет на активность фигур.</string>
<string name="rodent_iv_cloe">Клои</string>
<string name="rodent_iv_cloe_about">Любит закрытые позиции.</string>
<string name="rodent_iv_deborah">Дебора</string>
<string name="rodent_iv_deborah_about">Хорошо защищается и любит слонов.</string>
<string name="rodent_iv_defender">Защитник</string>
<string name="rodent_iv_defender_about">Надёжный и осторожный, согласен на ничью.</string>
<string name="rodent_iv_dynamic">Динамик</string>
<string name="rodent_iv_dynamic_about">Атакует, любит слонов, время от времени жертвует.</string>
<string name="rodent_iv_grumpy">Ворчун</string>
<string name="rodent_iv_grumpy_about">Атака и сковывание; любит запертые позиции, избегает ничьих.</string>
<string name="rodent_iv_partisan">Партизан</string>
<string name="rodent_iv_partisan_about">Атакует после тихих, неприметных дебютов.</string>
<string name="rodent_iv_pawnsacker">Гамбитист</string>
<string name="rodent_iv_pawnsacker_about">Сбалансированный, но охотнее отдаёт пешки.</string>
<string name="rodent_iv_pedrita">Педрита</string>
<string name="rodent_iv_pedrita_about">Пешки, защита и сковывание.</string>
<string name="rodent_iv_preston">Престон</string>
<string name="rodent_iv_preston_about">Материалист, атакует умеренно.</string>
<string name="rodent_iv_simple">Простак</string>
<string name="rodent_iv_simple_about">Самый «компьютерный»: простые, правильные шахматы.</string>
<string name="rodent_iv_spitfire">Задира</string>
<string name="rodent_iv_spitfire_about">Острый и агрессивный.</string>
<string name="rodent_iv_strangler">Удав</string>
<string name="rodent_iv_strangler_about">Удав: медленно душит, очень по-человечески.</string>
<string name="rodent_iv_alekhine">Алехин</string>
<string name="rodent_iv_alekhine_about">Динамичные атаки и глубокие комбинации.</string>
<string name="rodent_iv_anand">Ананд</string>
<string name="rodent_iv_anand_about">Быстрая, универсальная игра с острыми дебютами.</string>
<string name="rodent_iv_anderssen">Андерсен</string>
<string name="rodent_iv_anderssen_about">Романтик-атакёр XIX века: жертвы.</string>
<string name="rodent_iv_bosboom">Босбум</string>
<string name="rodent_iv_bosboom_about">Необычные дебюты и творческая блиц-игра.</string>
<string name="rodent_iv_botvinnik">Ботвинник</string>
<string name="rodent_iv_botvinnik_about">Научная стратегическая игра на глубокой подготовке.</string>
<string name="rodent_iv_fischer">Фишер</string>
<string name="rodent_iv_fischer_about">Ясная, классическая и точная игра.</string>
<string name="rodent_iv_karpov">Карпов</string>
<string name="rodent_iv_karpov_about">Позиционное давление, профилактика и техника.</string>
<string name="rodent_iv_kasparov">Каспаров</string>
<string name="rodent_iv_kasparov_about">Инициатива и мощная атака.</string>
<string name="rodent_iv_kortchnoi">Корчной</string>
<string name="rodent_iv_kortchnoi_about">Упорный защитник и мастер контратаки.</string>
<string name="rodent_iv_larsen">Ларсен</string>
<string name="rodent_iv_larsen_about">Оригинальный и рискованный, с необычными дебютами.</string>
<string name="rodent_iv_lasker">Ласкер</string>
<string name="rodent_iv_lasker_about">Практичный боец-психолог.</string>
<string name="rodent_iv_marshall">Маршалл</string>
<string name="rodent_iv_marshall_about">Лихой атакёр с гамбитами.</string>
<string name="rodent_iv_morphy">Морфи</string>
<string name="rodent_iv_morphy_about">Быстрое развитие и открытые линии.</string>
<string name="rodent_iv_nimzowitsch">Нимцович</string>
<string name="rodent_iv_nimzowitsch_about">Сковывание, блокада и сверхзащита.</string>
<string name="rodent_iv_petrosian">Петросян</string>
<string name="rodent_iv_petrosian_about">Профилактика и безопасность прежде всего.</string>
<string name="rodent_iv_reti">Рети</string>
<string name="rodent_iv_reti_about">Гиперсовременный: контролирует центр издалека.</string>
<string name="rodent_iv_rubinstein">Рубинштейн</string>
<string name="rodent_iv_rubinstein_about">Классическая позиционная игра, силён в эндшпиле.</string>
<string name="rodent_iv_spassky">Спасский</string>
<string name="rodent_iv_spassky_about">Универсал, в любой позиции как дома.</string>
<string name="rodent_iv_steinitz">Стейниц</string>
<string name="rodent_iv_steinitz_about">Основатель позиционной игры, упрямый защитник.</string>
<string name="rodent_iv_tal">Таль</string>
<string name="rodent_iv_tal_about">Рижский волшебник: жертвы и атака.</string>
<string name="rodent_iv_tarrasch">Тарраш</string>
<string name="rodent_iv_tarrasch_about">Классические правила: пространство, развитие, активные фигуры.</string>
<string name="rodent_iv_topalov">Топалов</string>
<string name="rodent_iv_topalov_about">Агрессивный и динамичный, жертвует качество.</string>
<string name="opp_maia_sub">играет как человек</string>
<string name="opp_rodent_sub">сильный, со стилем</string>
<string name="like_human">Как человек</string>
<string name="maia_no_style">Maia не выбирает стиль: она играет, как люди её рейтинга.</string>
<string name="rodent_measured">Собственный рейтинг Rodent (UCI_Elo): он не равен Эло человека.</string>
<string name="rodent_resigns">Rodent сдаётся</string>
<string name="end_rodent_resigned">Rodent сдался</string>
<string name="rodent_draw_declined">Rodent отказывается от ничьей</string>
<string name="rodent_draw_later">Rodent отказался; снова можно предложить через два его хода</string>
<string name="rodent_position_lost">Его позиция проиграна. Принять победу или доиграть?</string>
<string name="play_button">Играть</string>
<string name="play_button_cd">Играть с компьютером</string>
<string name="strength_n">Сила: %1$s</string>
<string name="pick_title">С кем играть</string>
<string name="pick_intro">Характер — это стиль и дебюты, силу задаёт ползунок.</string>
<string name="pick_players">Великие шахматисты</string>
<string name="pick_characters">Характеры</string>
<string name="pick_change">Изменить</string>
<string name="pick_player_cd">%1$s, великий шахматист</string>
<string name="pick_character_cd">%1$s, характер</string>
<string name="character_cd">Характер: %1$s</string>
<string name="books_ready">Rodent IV и его дебютные книги на телефоне</string>
<string name="books_offer">Дебютные книги Rodent IV: %1$s МБ, скачиваются один раз с github.com</string>
<string name="books_not_needed">С позиции дебютная книга не нужна — Rodent IV играет сразу</string>
<string name="books_without">Без книги</string>
<string name="books_without_cd">Без книги: играть без дебютной книги</string>
<string name="books_notification">Дебютные книги Rodent IV</string>
<string name="books_settings">Rodent IV — дебютные книги</string>
<string name="books_downloaded_mb">скачаны · %1$s МБ</string>
<string name="books_missing_mb">не скачаны · %1$s МБ</string>
<string name="books_deleted">Дебютные книги удалены</string>
<string name="rodent_draw_no_engine">Rodent отвечает на ничью с помощью Stockfish: скачайте его кнопкой «Движок»</string>
<string name="rodent_stopped">Rodent не запустился.</string>
<string name="rodent_restart">Перезапустить</string>
<string name="play_note_from_rodent">Дальше — игра с Rodent IV %1$s · %2$s.</string>
<string name="rodent_stopped_playing">Rodent остановился во время игры.</string>
<string name="strength_range">%1$s, от %2$s до %3$s</string>
<string name="strength">Сила</string>
<string name="books_delete_cd">Удалить дебютные книги</string>
<!-- Подготовка к сопернику (задача 48). -->
<string name="players">Игроки</string>
<string name="player_name_hint">Имя игрока</string>
<string name="players_read_failed">Не удалось прочитать игроков</string>
<string name="reading_players">Читаю игроков…</string>
<string name="no_named_players">В этой базе нет именованных игроков</string>
<string name="player_not_found">Игрок не найден</string>
<string name="to_games">К партиям</string>
<string name="reset_search">Сбросить поиск</string>
<string name="prepare_action">Подготовиться</string>
<string name="prep_choose_color">Выберите цвет</string>
<string name="prep_against_player">Подготовиться к %1$s</string>
<string name="prep_against_white">Против белых</string>
<string name="prep_against_black">Против чёрных</string>
<string name="prep_opponent">Подготовиться к сопернику…</string>
<string name="prep_title">Подготовка к сопернику</string>
<string name="prep_close_engine_line">Сначала закройте линию движка</string>
<!--suppress TypographyDashes: literal PGN null move -->
<string name="prep_null_move_unavailable">Поиск после учебного -- недоступен</string>
<string name="prep_as_white">Белыми</string>
<string name="prep_as_black">Чёрными</string>
<string name="prep_move_failed">Не удалось сделать ход</string>
<string name="prep_play_continuation">Сыграть %1$s, %2$s, %3$s процентов</string>
<string name="prep_board_start">Доска, начальная позиция. Внизу %1$s.</string>
<string name="prep_board_after">Доска, позиция после %1$s. Внизу %2$s.</string>
<string name="turn_white">ход белых</string>
<string name="turn_black">ход чёрных</string>
<string name="prep_opponent_plays">Соперник играет</string>
<string name="prep_opponents_play">Его оппоненты играют</string>
<string name="prep_after">после %1$s</string>
<string name="prep_beginning">начало</string>
<string name="prep_context_description">%1$s, %2$s, %3$s, %4$s</string>
<string name="prep_failed">Не удалось посчитать продолжения</string>
<string name="prep_no_memory">Недостаточно памяти для поиска по этой базе</string>
<string name="prep_calculating">Считаю продолжения…</string>
<string name="prep_position_absent">В партиях %1$s этой позиции нет</string>
<string name="prep_position_absent_hint">Можно продолжить на доске или вернуться назад</string>
<string name="prep_all_ended">Все партии здесь закончились</string>
<string name="prep_ended_here">Здесь закончились: %1$s</string>
<string name="prep_no_normal">Нет обычного продолжения: %1$s</string>
<string name="to_game">К партии</string>
<string name="to_players">К игрокам</string>
<string name="prep_choose_move">Выберите ход</string>
<plurals name="prep_wins">
<item quantity="one">%1$s победа</item>
<item quantity="few">%1$s победы</item>
<item quantity="many">%1$s побед</item>
<item quantity="other">%1$s победы</item>
</plurals>
<plurals name="prep_draws">
<item quantity="one">%1$s ничья</item>
<item quantity="few">%1$s ничьи</item>
<item quantity="many">%1$s ничьих</item>
<item quantity="other">%1$s ничьи</item>
</plurals>
<plurals name="prep_losses">
<item quantity="one">%1$s поражение</item>
<item quantity="few">%1$s поражения</item>
<item quantity="many">%1$s поражений</item>
<item quantity="other">%1$s поражения</item>
</plurals>
<string name="prep_unknown_accessibility">Неизвестных исходов: %1$d; они не входят в знаменатель процентов.</string>
<string name="prep_continuation_description">%1$s. %2$d из %3$s, %4$s процентов. Результаты %5$s: %6$s, %7$s, %8$s; %9$s, %10$s и %11$s процентов. %12$s Сыграть.</string>
<string name="prep_play">Сыграть</string>
<string name="prep_unknown_short">ещё %1$s</string>
<string name="prep_wdl_counts">+%1$s =%2$s −%3$s · W/D/L %4$s/%5$s/%6$s %%</string>
</resources>

View file

@ -37,9 +37,10 @@
<string name="to_start">Boshiga</string>
<string name="move_back">Bir yurish orqaga</string>
<string name="move_forward">Bir yurish oldinga</string>
<string name="move_back_hint">Oldingi yurish. Boshiga oʻtish uchun bosib turing</string>
<string name="move_forward_hint">Keyingi yurish. Liniya oxiriga oʻtish uchun bosib turing</string>
<string name="to_end">Liniya oxiriga</string>
<string name="next_moves">Keyin:</string>
<string name="board_hint">Bu partiyalarni koʻrish vositasi. Yurishlarni pastdagi ◀ ▶ bilan oʻtkazing.</string>
<string name="board_description">Taxta, %1$sdan keyingi pozitsiya</string>
<string name="board_start">Taxta, boshlangʻich pozitsiya</string>
<string name="white_won">Oqlar yutdi</string>
@ -113,8 +114,7 @@
<string name="about">Dastur haqida</string>
<string name="build_full">Stockfish ichki</string>
<string name="build_light">Stockfish ilovada yuklab olinadi</string>
<string name="alpha">alfa</string>
<string name="about_text">Shaxmat bazalarini koʻrish vositasi: PGN, ChessBase, arxivlar. Fayllar faqat oʻqiladi, hech qachon oʻzgartirilmaydi.</string>
<string name="about_text">Shaxmat bazalari, partiyalar tahlili va kompyuter bilan oʻyin. Fayllaringiz faqat oʻqiladi, hech qachon oʻzgartirilmaydi.</string>
<string name="licenses">Litsenziyalar va mualliflar</string>
<string name="website">Sayt va manba kodi</string>
@ -216,6 +216,14 @@
<string name="add_paste_hint">Boshqa ilovada nusxalangan partiyalar</string>
<string name="paste_none">Almashish buferida PGN partiyalar yoʻq</string>
<string name="paste_db">Qoʻyildi: %1$s</string>
<plurals name="clipboard_open_title">
<item quantity="one">Almashish buferida partiya</item>
<item quantity="other">Almashish buferida partiyalar</item>
</plurals>
<string name="clipboard_open_one">Bu PGN partiyani saqlab, doskada ochish?</string>
<string name="clipboard_open_many">%1$s saqlab, birinchi partiyani doskada ochish? Barcha partiyalar mahalliy nusxada saqlanadi.</string>
<string name="clipboard_open">Ochish</string>
<string name="clipboard_database_name">Almashish buferi</string>
<string name="opening_file">Fayl ochilmoqda…</string>
<string name="file_failed">Faylni ochib boʻlmadi</string>
<string name="file_no_games">Bu faylda shaxmat partiyalari yoʻq.</string>
@ -227,15 +235,10 @@
<string name="review_menu">Partiya tahlili</string>
<string name="review_report_menu">Partiya hisoboti</string>
<string name="review_text">Dvigatel asosiy liniyaning har bir pozitsiyasini baholaydi. Partiyaning oʻzi oʻzgarmaydi.</string>
<string name="review_quality">Sifat</string>
<string name="review_fast">Tez</string>
<string name="review_normal">Oddiy</string>
<string name="review_deep">Chuqur</string>
<string name="review_seconds">%d s</string>
<string name="review_minutes">%d daq.</string>
<string name="review_start">Tahlil qilish</string>
<string name="review_fill">Toʻldirish</string>
<string name="review_again">Qayta tahlil qilish</string>
<string name="review_partial">%2$d ta pozitsiyadan %1$d tasi allaqachon baholangan.</string>
<string name="review_progress">Partiya tahlili · %1$d / %2$d</string>
<string name="review_stop">Tahlilni toʻxtatish</string>
@ -249,6 +252,10 @@
<string name="review_inaccuracies">Noaniqliklar</string>
<string name="review_mistakes">Xatolar</string>
<string name="review_blunders">Qoʻpol xatolar</string>
<string name="review_great">Kuchli yurish</string>
<string name="review_brilliant">Ajoyib yurish</string>
<string name="review_greats">Kuchli yurishlar</string>
<string name="review_brilliants">Ajoyib yurishlar</string>
<string name="review_missing">Baholanmagan: %d</string>
<string name="review_failed">Tahlil toʻxtadi</string>
<string name="review_resume">Davom etish</string>
@ -258,13 +265,17 @@
<string name="review_endgame">Endshpil</string>
<string name="review_source">%1$s · har yurishga %2$s tugun</string>
<string name="review_source_pgn" formatted="false">PGNdagi baholar ([%eval])</string>
<string name="review_no_notes">!! va ! faqat dvigatel bilan: PGNda faqat baholar bor</string>
<string name="review_no_seconds">Bu tahlilda !! va ! hali qidirilmagan</string>
<string name="review_stale">Tahlil dvigatelning boshqa sozlamalari bilan qilingan</string>
<string name="review_update">Yangilash</string>
<string name="review_engine">Dvigatel bilan tahlil qilish</string>
<string name="review_hide">Tahlilni yashirish</string>
<string name="review_graph">Baho grafigi</string>
<string name="review_engine_paused">Pauza: partiya tahlil qilinmoqda</string>
<string name="review_best_preview">Yaxshiroq liniya · yurish %1$d / %2$d</string>
<string name="review_next">Keyingi shunday yurishga oʻtish</string>
<string name="review_show_best">Yaxshiroq liniyani taxtada koʻrsatish</string>
<string name="review_restart">Qaytadan boshlash</string>
<string name="review_graph_state">%1$s, baho %2$s</string>
<string name="review_start_position">Boshlangʻich pozitsiya</string>
<plurals name="review_estimate">
@ -388,4 +399,325 @@
<string name="s_about_ready">%1$s versiyasi yuklab olindi</string>
<string name="upd_card_downloading">%1$sga yangilash, %3$d megabaytdan %2$d tasi yuklab olindi</string>
<string name="upd_short_release">Faylni tekshirib boʻlmaydi</string>
<string name="undo_action">Qaytarish</string>
<string name="moves_deleted">Yurishlar o‘chirildi</string>
<string name="make_main">Asosiy qilish</string>
<string name="delete_move">Yurish va davomini o‘chirish</string>
<string name="move_actions">Yurish amallari</string>
<string name="new_game">Yangi o‘yin</string>
<string name="own_databases">Mening bazalarim</string>
<string name="own_new">+ Yangi baza</string>
<string name="own_empty">Bu yerda siz kiritgan yoki kompyuter bilan o‘ynagan o‘yinlar bo‘ladi</string>
<string name="files_add">+ Qo‘shish</string>
<string name="files_empty">Bu yerda siz qo‘shgan PGN va ChessBase fayllari, papkalar va internetdagi o‘yinlar bo‘ladi</string>
<string name="files">Fayllar</string>
<string name="own_default_name">Mening o‘yinlarim</string>
<string name="own_new_title">Yangi baza</string>
<string name="own_name">Nomi</string>
<string name="own_new_hint">Telefonda, ChessPenguin ichida saqlanadi. Faylni baza menyusidan eksport qilish mumkin.</string>
<string name="create">Yaratish</string>
<string name="own_on_phone">telefonda</string>
<string name="own_export">Faylni eksport qilish…</string>
<string name="own_delete">Bazani o‘chirish</string>
<string name="own_exported">Fayl saqlandi</string>
<string name="own_export_failed">Faylni saqlab bo‘lmadi</string>
<string name="own_removed">Baza o‘chirildi</string>
<string name="own_delete_title">“%1$s” o‘chirilsinmi?</string>
<plurals name="own_delete_text">
<item quantity="one">Telefondan %1$s ta o‘yin o‘chiriladi. Agar kerak bo‘lsa, avval faylni eksport qiling.</item>
<item quantity="other">Telefondan %1$s ta o‘yin o‘chiriladi. Agar kerak bo‘lsa, avval faylni eksport qiling.</item>
</plurals>
<string name="saved_to">“%1$s” ga saqlandi, № %2$s</string>
<string name="save_failed">O‘yinni saqlab bo‘lmadi</string>
<string name="save_in">“%1$s” ga saqlash</string>
<string name="save_to_mine">Mening bazamga saqlash…</string>
<string name="save_to_db">Bazaga saqlash</string>
<string name="save_to_db_ellipsis">Bazaga saqlash…</string>
<string name="own_new_ellipsis">Yangi baza…</string>
<string name="create_and_save">Yaratish va saqlash</string>
<string name="save_changes_in">O‘zgarishlar “%1$s” ga saqlansinmi?</string>
<string name="save_game_question">O‘yin saqlansinmi?</string>
<string name="dont_save">Saqlamaslik</string>
<string name="game_data">O‘yin ma’lumotlari</string>
<string name="date_hint">YYYY.OO.KK</string>
<string name="date_wrong">Sana emas: 2026.10.26, 2026 yoki 26.10.2026</string>
<string name="discard_changes">O‘zgarishlar bekor qilinsinmi?</string>
<string name="discard">Bekor qilish</string>
<string name="keep_editing">Tahrirlashni davom ettirish</string>
<string name="edit">Tahrirlash</string>
<string name="next">Keyingi</string>
<string name="train_title">Debyutni o‘rganish</string>
<string name="train_up_to">%1$s gacha</string>
<string name="train_learn">Debyutni shu yurishgacha o‘rganish</string>
<string name="train_move_of">Yurish %1$s / %2$s</string>
<string name="train_white">♔ Oqlar yuradi</string>
<string name="train_black">♚ Qoralar yuradi</string>
<string name="train_mistakes">Xatolar: %1$s</string>
<string name="train_run">Urinish %1$s</string>
<string name="train_wrong">× Partiyada bu yerda boshqa yurish</string>
<string name="train_show">Yurishni ko‘rsatish</string>
<string name="train_not_done">Bu liniya hali o‘tilmagan</string>
<string name="train_last_streak">Oxirgi marta: %1$s · ketma-ket xatosiz: %2$s</string>
<string name="train_last_best">Oxirgi marta: %1$s · eng yaxshi: %2$s</string>
<string name="train_done_clean">Xatosiz o‘tildi</string>
<string name="train_done_hint">Yordam bilan o‘tildi · xatolar: %1$s</string>
<string name="train_done">O‘tildi · xatolar: %1$s</string>
<string name="train_run_best">Urinish %1$s · eng yaxshi: %2$s</string>
<string name="train_streak">ketma-ket xatosiz: %1$s</string>
<string name="train_recent">So‘nggilari: %1$s</string>
<string name="train_arrow">Strelkadagi yurishni qiling</string>
<string name="train_again">↻ Yana</string>
<string name="train_back">⬅ Partiyaga qaytish</string>
<string name="train_restart">Boshidan</string>
<plurals name="train_runs">
<item quantity="one">%1$d marta</item>
<item quantity="other">%1$d marta</item>
</plurals>
<string name="maia_download_title">ChessPenguin uchun Maia</string>
<string name="play_won">Siz yutdingiz</string>
<string name="play_lost">Siz yutqazdingiz</string>
<string name="play_you_resigned">Siz taslim bo‘ldingiz</string>
<string name="play_draw">Durang</string>
<string name="end_mate">mat</string>
<string name="end_stalemate">pat</string>
<string name="end_threefold">pozitsiya uch marta takrorlandi</string>
<string name="end_fifty">50 yurish davomida olish ham, piyoda yurishi ham yo‘q</string>
<string name="end_material">hech bir tomon mat qila olmaydi</string>
<string name="end_maia_resigned">Maia taslim bo‘ldi</string>
<string name="play_resign_q">Taslim bo‘lasizmi?</string>
<string name="play_resign">⚑ Taslim bo‘lish</string>
<string name="play_take_back">↶ Yurishni qaytarish</string>
<string name="play_title">Kompyuter bilan o‘ynash</string>
<string name="play_colour">Rangingiz</string>
<string name="color_white">Oqlar</string>
<string name="color_black">Qoralar</string>
<string name="color_random">Tasodifiy</string>
<string name="play_measured">Maia ning o‘z reytingi: u odamning Elo reytingiga teng emas.</string>
<string name="play_download_note">Maia bir marta yuklab olinadi (%1$s MB, huggingface.co dan — mualliflarning o‘z fayli).</string>
<string name="play_download_and_play">Yuklab olish va o‘ynash</string>
<string name="play_play">O‘ynash</string>
<string name="play_thinking">o‘ylamoqda…</string>
<string name="play_event">Kompyuter bilan partiya</string>
<string name="play_analyse">Tahlil qilish</string>
<string name="play_rematch">↻ Revansh</string>
<string name="play_from_here">Shu yerdan o‘ynash…</string>
<string name="play_checking">Tekshirilmoqda…</string>
<string name="play_maia_failed">Maia ishga tushmadi: %1$s</string>
<string name="play_accept_win">G‘alabani qabul qilish</string>
<string name="play_to_end">Oxirigacha o‘ynash</string>
<string name="play_maia_resigns">Maia taslim bo‘lmoqda</string>
<string name="play_note_from">Bundan keyin — Maia %1$s bilan o‘yin.</string>
<string name="play_abort">To‘xtatish</string>
<string name="play_your_name">Ismingiz</string>
<string name="play_maia_ready">Maia yuklab olindi</string>
<string name="play_retry">Qayta urinish</string>
<string name="play_her_position_lost">Uning pozitsiyasi yutqazilgan. G‘alabani qabul qilasizmi yoki davom etasizmi?</string>
<string name="play_continue">Davom ettirish</string>
<string name="play_adjourned">Maia %1$s bilan o‘yin · siz %2$s</string>
<string name="play_as_white">oqlar bilan</string>
<string name="play_as_black">qoralar bilan</string>
<string name="play_removed">O‘yin o‘chirildi</string>
<string name="play_untimed">soatsiz</string>
<string name="play_you">Siz</string>
<string name="play_saved">✓ Saqlandi</string>
<string name="play_save">Saqlash…</string>
<string name="play_adjourned_sub">siz %1$s · %2$s</string>
<string name="play_from_label">%1$s dan keyin</string>
<string name="sound">Ovoz</string>
<string name="undo_menu">Bekor qilish</string>
<string name="made_main">Endi asosiy variant</string>
<string name="elo">Elo</string>
<string name="play_analyse_short">Tahlil</string>
<string name="play_on_short">Davom etish</string>
<string name="play_viewing">Ko‘rish %1$s · o‘yinga qaytish ›</string>
<string name="start_position">boshlang‘ich pozitsiya</string>
<string name="play_maia_stopped">Maia ishga tushmadi.</string>
<string name="play_maia_reload">Maia’ni qayta yuklab olish</string>
<string name="play_adjourned_q">%1$s bilan to‘xtatilgan o‘yin bor</string>
<string name="play_continue_it">Davom ettirish</string>
<string name="play_start_new">Yangisini boshlash</string>
<string name="play_adjourned_new_text">Yangi o‘yin uning o‘rnini oladi; o‘ynalgani tugallanmagan holda o‘yinchi bazasiga yoziladi.</string>
<string name="play_offer_draw">Durang</string>
<string name="end_agreement">kelishuv bo‘yicha</string>
<string name="play_draw_declined">Maia durangdan bosh tortadi</string>
<string name="play_draw_later">Maia rad etdi; uning ikki yurishidan keyin yana taklif qiling</string>
<string name="play_draw_no_engine">Maia durangga Stockfish bilan javob beradi: uni «Dvigatel» tugmasi bilan yuklab oling</string>
<string name="player_db_name">%1$s — kompyuter bilan o‘yinlar</string>
<string name="player_db_shared">Kompyuter bilan o‘yinlar</string>
<string name="player_written">✓ «%1$s» da, № %2$s ›</string>
<string name="player_kept_unfinished">O‘yin tugallanmagan holda «%1$s» ga yozildi</string>
<string name="player_db_row">o‘zi yoziladi</string>
<string name="record_games">Kompyuter bilan o‘yinlarni o‘yinchi bazasiga yozish</string>
<string name="player_line_existing">O‘yinlar «%1$s» ga yoziladi</string>
<string name="player_line_new">O‘yinlar yangi «%1$s» bazasiga yoziladi.</string>
<string name="player_line_noname">Ismsiz o‘yinlar «%1$s» ga tushadi. O‘z bazangiz bo‘lishi uchun ismingizni yozing.</string>
<string name="player_line_off">O‘yinlar o‘zi yozilmaydi (Sozlamalar).</string>
<string name="player_written_new">✓ Yangi baza «%1$s», № %2$s ›</string>
<string name="player_write_failed">«%1$s» ga yozib bo‘lmadi: %2$s</string>
<string name="play_adjourned_replaced">Yangi o‘yin uning o‘rnini oladi.</string>
<string name="last_opened">Oxirgi ochilgan</string>
<string name="play_adjourned_title">%1$s bilan o‘yin</string>
<string name="play_move_n">%1$d-yurish</string>
<!-- Rodent IV on the phone (android-rodent.md §9); the characters and the desktop's sentences come from apps/desktop/src/i18n.rs. -->
<string name="rodent_iv_amanda">Amanda</string>
<string name="rodent_iv_amanda_about">Avval hujum qiladi, keyin donalar faolligi uchun o‘ynaydi.</string>
<string name="rodent_iv_cloe">Kloe</string>
<string name="rodent_iv_cloe_about">Yopiq pozitsiyalarni yaxshi ko‘radi.</string>
<string name="rodent_iv_deborah">Debora</string>
<string name="rodent_iv_deborah_about">Yaxshi himoyalanadi va filllarini yaxshi ko‘radi.</string>
<string name="rodent_iv_defender">Himoyachi</string>
<string name="rodent_iv_defender_about">Mustahkam va ehtiyotkor; duranga rozi.</string>
<string name="rodent_iv_dynamic">Dinamik</string>
<string name="rodent_iv_dynamic_about">Hujum qiladi, fillarni yaxshi ko‘radi, ba’zan qurbon qiladi.</string>
<string name="rodent_iv_grumpy">G‘udranuvchi</string>
<string name="rodent_iv_grumpy_about">Hujum va siqish; yopiq pozitsiyalarni yoqtiradi, durangdan qochadi.</string>
<string name="rodent_iv_partisan">Partizan</string>
<string name="rodent_iv_partisan_about">Sokin, sezilmas debyutlardan keyin hujum qiladi.</string>
<string name="rodent_iv_pawnsacker">Gambitchi</string>
<string name="rodent_iv_pawnsacker_about">Muvozanatli, lekin piyodalarni osonroq beradi.</string>
<string name="rodent_iv_pedrita">Pedrita</string>
<string name="rodent_iv_pedrita_about">Piyodalar, himoya va siqish.</string>
<string name="rodent_iv_preston">Preston</string>
<string name="rodent_iv_preston_about">Materialist, o‘rtacha hujumchi.</string>
<string name="rodent_iv_simple">Oddiy</string>
<string name="rodent_iv_simple_about">Eng «kompyuterona»: oddiy, to‘g‘ri shaxmat.</string>
<string name="rodent_iv_spitfire">Jo‘shqin</string>
<string name="rodent_iv_spitfire_about">O‘tkir va tajovuzkor.</string>
<string name="rodent_iv_strangler">Bo‘g‘uvchi</string>
<string name="rodent_iv_strangler_about">Bo‘g‘ma ilon: sekin siqadi, juda insoniy.</string>
<string name="rodent_iv_alekhine">Alyoxin</string>
<string name="rodent_iv_alekhine_about">Dinamik hujumlar va chuqur kombinatsiyalar.</string>
<string name="rodent_iv_anand">Anand</string>
<string name="rodent_iv_anand_about">Tez, universal o‘yin, o‘tkir debyutlar bilan.</string>
<string name="rodent_iv_anderssen">Anderssen</string>
<string name="rodent_iv_anderssen_about">XIX asrning romantik hujumchisi: qurbonlar.</string>
<string name="rodent_iv_bosboom">Bosboom</string>
<string name="rodent_iv_bosboom_about">Noodatiy debyutlar va ijodiy blits.</string>
<string name="rodent_iv_botvinnik">Botvinnik</string>
<string name="rodent_iv_botvinnik_about">Chuqur tayyorgarlikka asoslangan ilmiy, strategik o‘yin.</string>
<string name="rodent_iv_fischer">Fischer</string>
<string name="rodent_iv_fischer_about">Aniq, klassik va puxta.</string>
<string name="rodent_iv_karpov">Karpov</string>
<string name="rodent_iv_karpov_about">Pozitsion bosim, profilaktika va texnika.</string>
<string name="rodent_iv_kasparov">Kasparov</string>
<string name="rodent_iv_kasparov_about">Tashabbus va kuchli hujum.</string>
<string name="rodent_iv_kortchnoi">Kortchnoi</string>
<string name="rodent_iv_kortchnoi_about">Qat’iyatli himoyachi va qarshi hujumchi.</string>
<string name="rodent_iv_larsen">Larsen</string>
<string name="rodent_iv_larsen_about">O‘ziga xos va tavakkalchi, noodatiy debyutlar bilan.</string>
<string name="rodent_iv_lasker">Lasker</string>
<string name="rodent_iv_lasker_about">Amaliy, psixolog kurashchi.</string>
<string name="rodent_iv_marshall">Marshall</string>
<string name="rodent_iv_marshall_about">Gambitlar bilan dadil hujumchi.</string>
<string name="rodent_iv_morphy">Morphy</string>
<string name="rodent_iv_morphy_about">Tez rivojlanish va ochiq chiziqlar.</string>
<string name="rodent_iv_nimzowitsch">Nimzowitsch</string>
<string name="rodent_iv_nimzowitsch_about">Siqish, blokada va ortiqcha himoya.</string>
<string name="rodent_iv_petrosian">Petrosian</string>
<string name="rodent_iv_petrosian_about">Profilaktika va xavfsizlik birinchi.</string>
<string name="rodent_iv_reti">Reti</string>
<string name="rodent_iv_reti_about">Gipermodern: markazni uzoqdan nazorat qiladi.</string>
<string name="rodent_iv_rubinstein">Rubinstein</string>
<string name="rodent_iv_rubinstein_about">Klassik pozitsion o‘yin, endshpilda kuchli.</string>
<string name="rodent_iv_spassky">Spassky</string>
<string name="rodent_iv_spassky_about">Universal o‘yinchi, har qanday pozitsiyada o‘zini uydagidek his qiladi.</string>
<string name="rodent_iv_steinitz">Steinitz</string>
<string name="rodent_iv_steinitz_about">Pozitsion o‘yin asoschisi, qaysar himoyachi.</string>
<string name="rodent_iv_tal">Tal</string>
<string name="rodent_iv_tal_about">Rigalik sehrgar: qurbonlar va hujum.</string>
<string name="rodent_iv_tarrasch">Tarrasch</string>
<string name="rodent_iv_tarrasch_about">Klassik qoidalar: makon, rivojlanish, faol donalar.</string>
<string name="rodent_iv_topalov">Topalov</string>
<string name="rodent_iv_topalov_about">Tajovuzkor va dinamik, sifatni qurbon qiladi.</string>
<string name="opp_maia_sub">odamdek o‘ynaydi</string>
<string name="opp_rodent_sub">kuchli, uslubli</string>
<string name="like_human">Odamdek</string>
<string name="maia_no_style">Maia uslub tanlamaydi: u o‘z reytingidagi odamlardek o‘ynaydi.</string>
<string name="rodent_measured">Rodent ning o‘z reytingi (UCI_Elo): u odamning Elo reytingiga teng emas.</string>
<string name="rodent_resigns">Rodent taslim bo‘lmoqda</string>
<string name="end_rodent_resigned">Rodent taslim bo‘ldi</string>
<string name="rodent_draw_declined">Rodent durangdan bosh tortadi</string>
<string name="rodent_draw_later">Rodent rad etdi; uning ikki yurishidan keyin yana taklif qiling</string>
<string name="rodent_position_lost">Uning pozitsiyasi yutqazilgan. G‘alabani qabul qilasizmi yoki oxirigacha o‘ynaysizmi?</string>
<string name="play_button">O‘ynash</string>
<string name="play_button_cd">Kompyuter bilan o‘ynash</string>
<string name="strength_n">Kuch: %1$s</string>
<string name="pick_title">Kim bilan o‘ynash</string>
<string name="pick_intro">Xarakter — bu uslub va debyutlar, kuchni esa slayder belgilaydi.</string>
<string name="pick_players">Buyuk shaxmatchilar</string>
<string name="pick_characters">Xarakterlar</string>
<string name="pick_change">O‘zgartirish</string>
<string name="pick_player_cd">%1$s, buyuk shaxmatchi</string>
<string name="pick_character_cd">%1$s, xarakter</string>
<string name="character_cd">Xarakter: %1$s</string>
<string name="books_ready">Rodent IV va uning debyut kitoblari telefonda</string>
<string name="books_offer">Rodent IV debyut kitoblari: %1$s MB, github.com dan bir marta</string>
<string name="books_not_needed">Pozitsiyadan o‘ynashda debyut kitobi kerak emas — Rodent IV darhol o‘ynaydi</string>
<string name="books_without">Kitobsiz</string>
<string name="books_without_cd">Kitobsiz: debyut kitobisiz o‘ynash</string>
<string name="books_notification">Rodent IV debyut kitoblari</string>
<string name="books_settings">Rodent IV — debyut kitoblari</string>
<string name="books_downloaded_mb">yuklab olingan · %1$s MB</string>
<string name="books_missing_mb">yuklab olinmagan · %1$s MB</string>
<string name="books_deleted">Debyut kitoblari o‘chirildi</string>
<string name="rodent_draw_no_engine">Rodent durangga Stockfish bilan javob beradi: uni «Dvigatel» tugmasi bilan yuklab oling</string>
<string name="rodent_stopped">Rodent ishga tushmadi.</string>
<string name="rodent_restart">Qayta ishga tushirish</string>
<string name="play_note_from_rodent">Bundan keyin — Rodent IV %1$s · %2$s bilan o‘yin.</string>
<string name="rodent_stopped_playing">Rodent o‘yin paytida to‘xtadi.</string>
<string name="strength_range">%1$s, %2$s dan %3$s gacha</string>
<string name="strength">Kuch</string>
<string name="books_delete_cd">Debyut kitoblarini o‘chirish</string>
<!-- Raqibga tayyorgarlik (48-vazifa). -->
<string name="players">Oʻyinchilar</string>
<string name="player_name_hint">Oʻyinchi ismi</string>
<string name="players_read_failed">Oʻyinchilarni oʻqib boʻlmadi</string>
<string name="reading_players">Oʻyinchilar oʻqilmoqda…</string>
<string name="no_named_players">Bu bazada nomi koʻrsatilgan oʻyinchilar yoʻq</string>
<string name="player_not_found">Oʻyinchi topilmadi</string>
<string name="to_games">Partiyalarga qaytish</string>
<string name="reset_search">Qidiruvni tozalash</string>
<string name="prepare_action">Tayyorlanish</string>
<string name="prep_choose_color">Rangni tanlang</string>
<string name="prep_against_player">Raqibga tayyorlanish %1$s</string>
<string name="prep_against_white">Oqlarga qarshi</string>
<string name="prep_against_black">Qoralarga qarshi</string>
<string name="prep_opponent">Raqibga tayyorlanish…</string>
<string name="prep_title">Raqibga tayyorgarlik</string>
<string name="prep_close_engine_line">Avval dvigatel chizigʻini yoping</string>
<!--suppress TypographyDashes: literal PGN null move -->
<string name="prep_null_move_unavailable">Oʻquv -- dan keyin qidirish mavjud emas</string>
<string name="prep_as_white">Oqlar</string>
<string name="prep_as_black">Qoralar</string>
<string name="prep_move_failed">Bu yurishni bajarib boʻlmadi</string>
<string name="prep_play_continuation">%1$s yurish, %2$s, %3$s foiz</string>
<string name="prep_board_start">Doska, boshlangʻich pozitsiya. Pastda %1$s.</string>
<string name="prep_board_after">Doska, %1$s dan keyingi pozitsiya. Pastda %2$s.</string>
<string name="turn_white">Oqlar yurishi</string>
<string name="turn_black">Qoralar yurishi</string>
<string name="prep_opponent_plays">Raqib yuradi</string>
<string name="prep_opponents_play">Uning raqiblari yuradi</string>
<string name="prep_after">%1$s dan keyin</string>
<string name="prep_beginning">boshlanishi</string>
<string name="prep_context_description">%1$s, %2$s, %3$s, %4$s</string>
<string name="prep_failed">Davomlarni hisoblab boʻlmadi</string>
<string name="prep_no_memory">Bu bazadan qidirish uchun xotira yetarli emas</string>
<string name="prep_calculating">Davomlar hisoblanmoqda…</string>
<string name="prep_position_absent">%1$s partiyalarida bu pozitsiya yoʻq</string>
<string name="prep_position_absent_hint">Doskada davom etishingiz yoki orqaga qaytishingiz mumkin</string>
<string name="prep_all_ended">Barcha partiyalar shu yerda tugagan</string>
<string name="prep_ended_here">Shu yerda tugagan: %1$s</string>
<string name="prep_no_normal">Oddiy davom yoʻq: %1$s</string>
<string name="to_game">Partiyaga qaytish</string>
<string name="to_players">Oʻyinchilarga qaytish</string>
<string name="prep_choose_move">Yurishni tanlang</string>
<plurals name="prep_wins"><item quantity="one">%1$s gʻalaba</item><item quantity="other">%1$s gʻalaba</item></plurals>
<plurals name="prep_draws"><item quantity="one">%1$s durang</item><item quantity="other">%1$s durang</item></plurals>
<plurals name="prep_losses"><item quantity="one">%1$s magʻlubiyat</item><item quantity="other">%1$s magʻlubiyat</item></plurals>
<string name="prep_unknown_accessibility">Nomaʼlum natijalar: %1$d; ular foizlarga kiritilmaydi.</string>
<string name="prep_continuation_description">%1$s. %3$s dan %2$d tasi, %4$s foiz. %5$s natijalari: %6$s, %7$s, %8$s; %9$s, %10$s va %11$s foiz. %12$s Yurish.</string>
<string name="prep_play">Yurish</string>
<string name="prep_unknown_short">yana %1$s</string>
<string name="prep_wdl_counts">+%1$s =%2$s −%3$s · W/D/L %4$s/%5$s/%6$s %%</string>
</resources>

View file

@ -37,9 +37,10 @@
<string name="to_start">To the start</string>
<string name="move_back">Move back</string>
<string name="move_forward">Move forward</string>
<string name="move_back_hint">Previous move. Hold for the first position</string>
<string name="move_forward_hint">Next move. Hold for the end of the line</string>
<string name="to_end">To the end of the line</string>
<string name="next_moves">Next:</string>
<string name="board_hint">This is a game viewer. Step through the moves with ◀ ▶ below.</string>
<string name="board_description">Board, position after %1$s</string>
<string name="board_start">Board, starting position</string>
<string name="white_won">White won</string>
@ -113,8 +114,7 @@
<string name="about">About</string>
<string name="build_full">Stockfish built in</string>
<string name="build_light">Stockfish downloaded in the app</string>
<string name="alpha">alpha</string>
<string name="about_text">A viewer of chess databases: PGN, ChessBase, archives. Files are only read, never changed.</string>
<string name="about_text">Chess databases, game analysis and play against the computer. Your files are only read, never changed.</string>
<string name="licenses">Licenses and authors</string>
<string name="website">Website and source code</string>
@ -218,6 +218,14 @@
<string name="add_paste_hint">Games copied in another app</string>
<string name="paste_none">No PGN games in the clipboard</string>
<string name="paste_db">Pasted %1$s</string>
<plurals name="clipboard_open_title">
<item quantity="one">Game in clipboard</item>
<item quantity="other">Games in clipboard</item>
</plurals>
<string name="clipboard_open_one">Save this PGN game and open it on the board?</string>
<string name="clipboard_open_many">Save %1$s and open the first game on the board? All games will be kept in the local copy.</string>
<string name="clipboard_open">Open</string>
<string name="clipboard_database_name">Clipboard</string>
<string name="opening_file">Opening the file…</string>
<string name="file_failed">Couldn’t open the file</string>
<string name="file_no_games">There are no chess games in this file.</string>
@ -230,15 +238,10 @@
<string name="review_menu">Game analysis</string>
<string name="review_report_menu">Game report</string>
<string name="review_text">The engine evaluates every position of the main line. The game itself is not changed.</string>
<string name="review_quality">Quality</string>
<string name="review_fast">Fast</string>
<string name="review_normal">Normal</string>
<string name="review_deep">Deep</string>
<string name="review_seconds">%d s</string>
<string name="review_minutes">%d min</string>
<string name="review_start">Analyse</string>
<string name="review_fill">Fill in</string>
<string name="review_again">Analyse again</string>
<string name="review_partial">%1$d of %2$d positions are evaluated already.</string>
<string name="review_progress">Game analysis · %1$d of %2$d</string>
<string name="review_stop">Stop the analysis</string>
@ -252,6 +255,10 @@
<string name="review_inaccuracies">Inaccuracies</string>
<string name="review_mistakes">Mistakes</string>
<string name="review_blunders">Blunders</string>
<string name="review_great">Great move</string>
<string name="review_brilliant">Brilliant move</string>
<string name="review_greats">Great moves</string>
<string name="review_brilliants">Brilliant moves</string>
<string name="review_missing">Not evaluated: %d</string>
<string name="review_failed">The analysis stopped</string>
<string name="review_resume">Continue</string>
@ -261,13 +268,17 @@
<string name="review_endgame">Endgame</string>
<string name="review_source">%1$s · %2$s nodes per move</string>
<string name="review_source_pgn" formatted="false">Evaluations from the PGN ([%eval])</string>
<string name="review_no_notes">!! and ! need the engine: the PGN has evaluations only</string>
<string name="review_no_seconds">!! and ! were not looked for in this analysis</string>
<string name="review_stale">This analysis was made with other engine settings</string>
<string name="review_update">Update</string>
<string name="review_engine">Analyse with the engine</string>
<string name="review_hide">Hide analysis</string>
<string name="review_graph">Evaluation graph</string>
<string name="review_engine_paused">Paused: the game is being analysed</string>
<string name="review_best_preview">Better line · move %1$d of %2$d</string>
<string name="review_next">Go to the next such move</string>
<string name="review_show_best">Show the better line on the board</string>
<string name="review_restart">Start over</string>
<string name="review_graph_state">%1$s, evaluation %2$s</string>
<string name="review_start_position">Start position</string>
<plurals name="review_estimate">
@ -393,4 +404,334 @@
<string name="upd_card_downloading">Update to %1$s, %2$d of %3$d megabytes downloaded</string>
<!-- Shown only when the interface is not in English. -->
<string name="upd_short_release">The file cannot be checked</string>
<string name="undo_action">Undo</string>
<string name="moves_deleted">Moves deleted</string>
<string name="make_main">Make it the main line</string>
<string name="delete_move">Delete the move and what follows</string>
<string name="move_actions">Move actions</string>
<string name="new_game">New game</string>
<string name="own_databases">My databases</string>
<string name="own_new">+ New database</string>
<string name="own_empty">Games you enter or play against the computer will be here</string>
<string name="files_add">+ Add</string>
<string name="files_empty">PGN and ChessBase files, folders and games from the internet that you add will be here</string>
<string name="files">Files</string>
<string name="own_default_name">My games</string>
<string name="own_new_title">New database</string>
<string name="own_name">Name</string>
<string name="own_new_hint">Kept on the phone, in ChessPenguin. You can export the file from the database\'s menu.</string>
<string name="create">Create</string>
<string name="own_on_phone">on the phone</string>
<string name="own_export">Export the file…</string>
<string name="own_delete">Delete the database</string>
<string name="own_exported">File saved</string>
<string name="own_export_failed">Could not save the file</string>
<string name="own_removed">Database deleted</string>
<string name="own_delete_title">Delete “%1$s”?</string>
<plurals name="own_delete_text">
<item quantity="one">%1$s game will be deleted from the phone. If you need it, export the file first.</item>
<item quantity="other">%1$s games will be deleted from the phone. If you need them, export the file first.</item>
</plurals>
<string name="saved_to">Saved to “%1$s”, No. %2$s</string>
<string name="save_failed">Could not save the game</string>
<string name="save_in">Save to “%1$s”</string>
<string name="save_to_mine">Save to my database…</string>
<string name="save_to_db">Save to a database</string>
<string name="save_to_db_ellipsis">Save to a database…</string>
<string name="own_new_ellipsis">New database…</string>
<string name="create_and_save">Create and save</string>
<string name="save_changes_in">Save the changes to “%1$s”?</string>
<string name="save_game_question">Save the game?</string>
<string name="dont_save">Don’t save</string>
<string name="game_data">Game data</string>
<string name="date_hint">YYYY.MM.DD</string>
<string name="date_wrong">Not a date: 2026.10.26, 2026 or 26.10.2026</string>
<string name="discard_changes">Discard the changes?</string>
<string name="discard">Discard</string>
<string name="keep_editing">Keep editing</string>
<string name="edit">Edit</string>
<string name="next">Next</string>
<string name="train_title">Learning the opening</string>
<string name="train_up_to">up to %1$s</string>
<string name="train_learn">Learn the opening up to this move</string>
<string name="train_move_of">Move %1$s of %2$s</string>
<string name="train_white">♔ White to move</string>
<string name="train_black">♚ Black to move</string>
<string name="train_mistakes">Mistakes: %1$s</string>
<string name="train_run">Run %1$s</string>
<string name="train_wrong">× The game has another move here</string>
<string name="train_show">Show the move</string>
<string name="train_not_done">Not done before</string>
<string name="train_last_streak">Last time: %1$s · clean in a row: %2$s</string>
<string name="train_last_best">Last time: %1$s · best: %2$s</string>
<string name="train_done_clean">Done without mistakes</string>
<string name="train_done_hint">Done with a hint · mistakes: %1$s</string>
<string name="train_done">Done · mistakes: %1$s</string>
<string name="train_run_best">Run %1$s · best: %2$s</string>
<string name="train_streak">clean in a row: %1$s</string>
<string name="train_recent">Recent: %1$s</string>
<string name="train_arrow">Play the move on the arrow</string>
<string name="train_again">↻ Again</string>
<string name="train_back">⬅ Back to the game</string>
<string name="train_restart">From the start</string>
<plurals name="train_runs">
<item quantity="one">%1$d run</item>
<item quantity="other">%1$d runs</item>
</plurals>
<string name="maia_download_title">Maia for ChessPenguin</string>
<string name="play_won">You won</string>
<string name="play_lost">You lost</string>
<string name="play_you_resigned">You resigned</string>
<string name="play_draw">Draw</string>
<string name="end_mate">checkmate</string>
<string name="end_stalemate">stalemate</string>
<string name="end_threefold">the position occurred three times</string>
<string name="end_fifty">50 moves without a capture or a pawn move</string>
<string name="end_material">neither side can checkmate</string>
<string name="end_maia_resigned">Maia resigned</string>
<string name="play_resign_q">Resign?</string>
<string name="play_resign">⚑ Resign</string>
<string name="play_take_back">↶ Take back</string>
<string name="play_title">Play against the computer</string>
<string name="play_colour">Your colour</string>
<string name="color_white">White</string>
<string name="color_black">Black</string>
<string name="color_random">Random</string>
<string name="play_measured">Maia’s own rating: it does not match a person’s Elo.</string>
<string name="play_download_note">Maia is downloaded once (%1$s MB, from huggingface.co, the authors\' own file).</string>
<string name="play_download_and_play">Download and play</string>
<string name="play_play">Play</string>
<string name="play_thinking">thinking…</string>
<string name="play_event">Game vs computer</string>
<string name="play_analyse">Analyse</string>
<string name="play_rematch">↻ Rematch</string>
<string name="play_from_here">Play on from here…</string>
<string name="play_checking">Checking…</string>
<string name="play_maia_failed">Maia did not start: %1$s</string>
<string name="play_accept_win">Accept the win</string>
<string name="play_to_end">Play to the end</string>
<string name="play_maia_resigns">Maia resigns</string>
<string name="play_note_from">From here on, a game against Maia %1$s.</string>
<string name="play_abort">Abort</string>
<string name="play_your_name">Your name</string>
<string name="play_maia_ready">Maia is downloaded</string>
<string name="play_retry">Try again</string>
<string name="play_her_position_lost">Her position is lost. Accept the win or play on?</string>
<string name="play_continue">Continue</string>
<string name="play_adjourned">Game against Maia %1$s · you play %2$s</string>
<string name="play_as_white">White</string>
<string name="play_as_black">Black</string>
<string name="play_removed">Game removed</string>
<string name="play_untimed">no clock</string>
<string name="play_you">You</string>
<string name="play_saved">✓ Saved</string>
<string name="play_save">Save…</string>
<string name="play_adjourned_sub">you play %1$s · %2$s</string>
<string name="play_from_label">After %1$s</string>
<string name="sound">Sound</string>
<string name="undo_menu">Undo</string>
<string name="made_main">Now the main line</string>
<string name="elo">Elo</string>
<string name="play_analyse_short">Analyse</string>
<string name="play_on_short">Play on</string>
<string name="play_viewing">Viewing: %1$s · back to the game ›</string>
<string name="start_position">the starting position</string>
<string name="play_maia_stopped">Maia did not start.</string>
<string name="play_maia_reload">Download Maia again</string>
<string name="play_adjourned_q">There is a game put aside against %1$s</string>
<string name="play_continue_it">Continue it</string>
<string name="play_start_new">Start a new one</string>
<string name="play_adjourned_new_text">A new game replaces it; what was played goes into the player’s database, unfinished.</string>
<string name="play_offer_draw">Draw</string>
<string name="end_agreement">by agreement</string>
<string name="play_draw_declined">Maia declines the draw</string>
<string name="play_draw_later">Maia declined; offer again after two of her moves</string>
<string name="play_draw_no_engine">Maia answers a draw offer with Stockfish: download it in the game screen (“Engine”)</string>
<string name="player_db_name">%1$s — games against the computer</string>
<string name="player_db_shared">Games against the computer</string>
<string name="player_written">✓ In “%1$s”, No. %2$s ›</string>
<string name="player_kept_unfinished">Game written to “%1$s” unfinished</string>
<string name="player_db_row">recorded automatically</string>
<string name="record_games">Write games against the computer to the player’s database</string>
<string name="player_line_existing">Games are written to “%1$s”</string>
<string name="player_line_new">Games will be written to a new database “%1$s”.</string>
<string name="player_line_noname">Without a name games go to “%1$s”. Enter a name to have a database of your own.</string>
<string name="player_line_off">Games are not written by themselves (Settings).</string>
<string name="player_written_new">✓ New database “%1$s”, No. %2$s ›</string>
<string name="player_write_failed">Could not write to “%1$s”: %2$s</string>
<string name="play_adjourned_replaced">A new game replaces it.</string>
<string name="last_opened">Last opened</string>
<string name="play_adjourned_title">Game against %1$s</string>
<string name="play_move_n">move %1$d</string>
<!-- Rodent IV on the phone (android-rodent.md §9); the characters and the desktop's sentences come from apps/desktop/src/i18n.rs. -->
<string name="rodent_iv_amanda">Amanda</string>
<string name="rodent_iv_amanda_about">Attacks first, then plays for active pieces.</string>
<string name="rodent_iv_cloe">Cloe</string>
<string name="rodent_iv_cloe_about">Likes closed positions.</string>
<string name="rodent_iv_deborah">Deborah</string>
<string name="rodent_iv_deborah_about">Defends well and likes her bishops.</string>
<string name="rodent_iv_defender">Defender</string>
<string name="rodent_iv_defender_about">Solid and careful; content with a draw.</string>
<string name="rodent_iv_dynamic">Dynamic</string>
<string name="rodent_iv_dynamic_about">Attacks, likes bishops, sacrifices now and then.</string>
<string name="rodent_iv_grumpy">Grumpy</string>
<string name="rodent_iv_grumpy_about">Attack and restraint; likes blocked positions, avoids draws.</string>
<string name="rodent_iv_partisan">Partisan</string>
<string name="rodent_iv_partisan_about">Attacks after quiet, stealthy openings.</string>
<string name="rodent_iv_pawnsacker">Pawnsacker</string>
<string name="rodent_iv_pawnsacker_about">Balanced, but gives up pawns more readily.</string>
<string name="rodent_iv_pedrita">Pedrita</string>
<string name="rodent_iv_pedrita_about">Pawns, defence and restraint.</string>
<string name="rodent_iv_preston">Preston</string>
<string name="rodent_iv_preston_about">A materialistic, moderate attacker.</string>
<string name="rodent_iv_simple">Simple</string>
<string name="rodent_iv_simple_about">The most computer-like: plain, sound chess.</string>
<string name="rodent_iv_spitfire">Spitfire</string>
<string name="rodent_iv_spitfire_about">Sharp and aggressive.</string>
<string name="rodent_iv_strangler">Strangler</string>
<string name="rodent_iv_strangler_about">A boa constrictor: squeezes slowly, very human-like.</string>
<string name="rodent_iv_alekhine">Alekhine</string>
<string name="rodent_iv_alekhine_about">Dynamic attacks and deep combinations.</string>
<string name="rodent_iv_anand">Anand</string>
<string name="rodent_iv_anand_about">Quick, universal play with sharp openings.</string>
<string name="rodent_iv_anderssen">Anderssen</string>
<string name="rodent_iv_anderssen_about">A romantic attacker of the 19th century: sacrifices.</string>
<string name="rodent_iv_bosboom">Bosboom</string>
<string name="rodent_iv_bosboom_about">Offbeat openings and creative blitz play.</string>
<string name="rodent_iv_botvinnik">Botvinnik</string>
<string name="rodent_iv_botvinnik_about">Scientific, strategic play from deep preparation.</string>
<string name="rodent_iv_fischer">Fischer</string>
<string name="rodent_iv_fischer_about">Clear, classical and precise.</string>
<string name="rodent_iv_karpov">Karpov</string>
<string name="rodent_iv_karpov_about">Positional squeeze, prophylaxis and technique.</string>
<string name="rodent_iv_kasparov">Kasparov</string>
<string name="rodent_iv_kasparov_about">Initiative and powerful attack.</string>
<string name="rodent_iv_kortchnoi">Kortchnoi</string>
<string name="rodent_iv_kortchnoi_about">A tenacious defender and counter-attacker.</string>
<string name="rodent_iv_larsen">Larsen</string>
<string name="rodent_iv_larsen_about">Original and risky, with offbeat openings.</string>
<string name="rodent_iv_lasker">Lasker</string>
<string name="rodent_iv_lasker_about">A practical, psychological fighter.</string>
<string name="rodent_iv_marshall">Marshall</string>
<string name="rodent_iv_marshall_about">A swashbuckling attacker with gambits.</string>
<string name="rodent_iv_morphy">Morphy</string>
<string name="rodent_iv_morphy_about">Quick development and open lines.</string>
<string name="rodent_iv_nimzowitsch">Nimzowitsch</string>
<string name="rodent_iv_nimzowitsch_about">Restraint, blockade and overprotection.</string>
<string name="rodent_iv_petrosian">Petrosian</string>
<string name="rodent_iv_petrosian_about">Prophylaxis and safety first.</string>
<string name="rodent_iv_reti">Reti</string>
<string name="rodent_iv_reti_about">Hypermodern: controls the centre from afar.</string>
<string name="rodent_iv_rubinstein">Rubinstein</string>
<string name="rodent_iv_rubinstein_about">Classical positional play, great in endgames.</string>
<string name="rodent_iv_spassky">Spassky</string>
<string name="rodent_iv_spassky_about">A universal player, at home in any position.</string>
<string name="rodent_iv_steinitz">Steinitz</string>
<string name="rodent_iv_steinitz_about">The founder of positional play, a stubborn defender.</string>
<string name="rodent_iv_tal">Tal</string>
<string name="rodent_iv_tal_about">The magician from Riga: sacrifices and attack.</string>
<string name="rodent_iv_tarrasch">Tarrasch</string>
<string name="rodent_iv_tarrasch_about">Classical rules: space, development, active pieces.</string>
<string name="rodent_iv_topalov">Topalov</string>
<string name="rodent_iv_topalov_about">Aggressive and dynamic, sacrifices the exchange.</string>
<string name="opp_maia_sub">plays like a human</string>
<string name="opp_rodent_sub">strong, with a style</string>
<string name="like_human">Like a human</string>
<string name="maia_no_style">Maia does not pick a style: she plays like people of her rating.</string>
<string name="rodent_measured">Rodent’s own rating (UCI_Elo): it does not match a person’s Elo.</string>
<string name="rodent_resigns">Rodent resigns</string>
<string name="end_rodent_resigned">Rodent resigned</string>
<string name="rodent_draw_declined">Rodent declines the draw</string>
<string name="rodent_draw_later">Rodent declined; offer again after two of its moves</string>
<string name="rodent_position_lost">Its position is lost. Accept the win, or play to the end?</string>
<string name="play_button">Play</string>
<string name="play_button_cd">Play the computer</string>
<string name="strength_n">Strength: %1$s</string>
<string name="pick_title">Who to play</string>
<string name="pick_intro">A character is a style and openings; the slider sets the strength.</string>
<string name="pick_players">Great players</string>
<string name="pick_characters">Characters</string>
<string name="pick_change">Change</string>
<string name="pick_player_cd">%1$s, great player</string>
<string name="pick_character_cd">%1$s, character</string>
<string name="character_cd">Character: %1$s</string>
<string name="books_ready">Rodent IV and its opening books are on the phone</string>
<string name="books_offer">Rodent IV opening books: %1$s MB, downloaded once from github.com</string>
<string name="books_not_needed">From a position no opening book is needed: Rodent IV plays at once</string>
<string name="books_without">No book</string>
<string name="books_without_cd">No book: play without the opening book</string>
<string name="books_notification">Rodent IV opening books</string>
<string name="books_settings">Rodent IV — opening books</string>
<string name="books_downloaded_mb">downloaded · %1$s MB</string>
<string name="books_missing_mb">not downloaded · %1$s MB</string>
<string name="books_deleted">Opening books deleted</string>
<string name="rodent_draw_no_engine">Rodent answers a draw offer with Stockfish: download it in the game screen (“Engine”)</string>
<string name="rodent_stopped">Rodent did not start.</string>
<string name="rodent_restart">Restart</string>
<string name="play_note_from_rodent">From here on, a game against Rodent IV %1$s · %2$s.</string>
<string name="rodent_stopped_playing">Rodent stopped during the game.</string>
<string name="strength_range">%1$s, from %2$s to %3$s</string>
<string name="strength">Strength</string>
<string name="books_delete_cd">Delete the opening books</string>
<!-- Opponent preparation (task 48). -->
<string name="players">Players</string>
<string name="player_name_hint">Player name</string>
<string name="players_read_failed">Could not read players</string>
<string name="reading_players">Reading players…</string>
<string name="no_named_players">There are no named players in this database</string>
<string name="player_not_found">Player not found</string>
<string name="to_games">Back to games</string>
<string name="reset_search">Clear search</string>
<string name="prepare_action">Prepare</string>
<string name="prep_choose_color">Choose a color</string>
<string name="prep_against_player">Prepare against %1$s</string>
<string name="prep_against_white">Against White</string>
<string name="prep_against_black">Against Black</string>
<string name="prep_opponent">Prepare for opponent…</string>
<string name="prep_title">Opponent preparation</string>
<string name="prep_close_engine_line">Close the engine line first</string>
<!--suppress TypographyDashes: literal PGN null move -->
<string name="prep_null_move_unavailable">Search after a teaching -- is unavailable</string>
<string name="prep_as_white">White</string>
<string name="prep_as_black">Black</string>
<string name="prep_move_failed">Could not play this move</string>
<string name="prep_play_continuation">Play %1$s, %2$s, %3$s percent</string>
<string name="prep_board_start">Board, starting position. %1$s at the bottom.</string>
<string name="prep_board_after">Board, position after %1$s. %2$s at the bottom.</string>
<string name="turn_white">White to move</string>
<string name="turn_black">Black to move</string>
<string name="prep_opponent_plays">Opponent plays</string>
<string name="prep_opponents_play">Their opponents play</string>
<string name="prep_after">after %1$s</string>
<string name="prep_beginning">start</string>
<string name="prep_context_description">%1$s, %2$s, %3$s, %4$s</string>
<string name="prep_failed">Could not calculate continuations</string>
<string name="prep_no_memory">Not enough memory to search this database</string>
<string name="prep_calculating">Calculating continuations…</string>
<string name="prep_position_absent">This position does not occur in games by %1$s</string>
<string name="prep_position_absent_hint">You can continue on the board or go back</string>
<string name="prep_all_ended">All games ended here</string>
<string name="prep_ended_here">Ended here: %1$s</string>
<string name="prep_no_normal">No normal continuation: %1$s</string>
<string name="to_game">Back to game</string>
<string name="to_players">Back to players</string>
<string name="prep_choose_move">Choose a move</string>
<plurals name="prep_wins">
<item quantity="one">%1$s win</item>
<item quantity="other">%1$s wins</item>
</plurals>
<plurals name="prep_draws">
<item quantity="one">%1$s draw</item>
<item quantity="other">%1$s draws</item>
</plurals>
<plurals name="prep_losses">
<item quantity="one">%1$s loss</item>
<item quantity="other">%1$s losses</item>
</plurals>
<string name="prep_unknown_accessibility">Unknown results: %1$d; excluded from the percentages.</string>
<string name="prep_continuation_description">%1$s. %2$d of %3$s, %4$s percent. Results for %5$s: %6$s, %7$s, %8$s; %9$s, %10$s and %11$s percent. %12$s Play.</string>
<string name="prep_play">Play</string>
<string name="prep_unknown_short">more %1$s</string>
<string name="prep_wdl_counts">+%1$s =%2$s −%3$s · W/D/L %4$s/%5$s/%6$s %%</string>
</resources>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The RuStore build (build.gradle.kts, buildType "rustore"): the store installs and
updates the app, so it neither installs packages nor receives the installer's answer. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" tools:node="remove" />
<uses-permission android:name="android.permission.UPDATE_PACKAGES_WITHOUT_USER_ACTION" tools:node="remove" />
<application>
<receiver android:name=".data.InstallResult" tools:node="remove" />
</application>
</manifest>

View file

@ -0,0 +1,95 @@
package io.github.vrubelroman.chesspenguin
import io.github.vrubelroman.chesspenguin.data.DbEntry
import io.github.vrubelroman.chesspenguin.data.Source
import kotlinx.coroutines.flow.MutableStateFlow
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
class ClipboardIncomingTest {
@Test
fun `pasted existing copy ignores a previous empty filtered view`() {
val shown = hashMapOf("copy" to emptyList<UInt>())
val lastOpened = hashMapOf("copy" to ("not-found" to 0))
resetPastedView(shown, lastOpened, "copy")
assertFalse(shown.containsKey("copy"))
assertFalse(lastOpened.containsKey("copy"))
}
@Test
fun `uri and clipboard publish only their latest common request`() {
val requests = LatestIncoming()
val uri = requests.next()
val clipboard = requests.next()
assertFalse(requests.isLatest(uri))
assertTrue(requests.isLatest(clipboard))
val newerUri = requests.next()
assertFalse(requests.isLatest(clipboard))
assertTrue(requests.isLatest(newerUri))
}
@Test
fun `stale request cannot publish after a newer request starts`() {
val requests = LatestIncoming()
val old = requests.next()
val current = requests.next()
var published: Long? = null
assertFalse(requests.publish(old) { published = old })
assertNull(published)
assertTrue(requests.publish(current) { published = current })
assertEquals(current, published)
}
@Test
fun `blank clipboard snapshot does not invalidate uri import`() {
val requests = LatestIncoming()
val uri = requests.next(IncomingOrigin.Uri)
assertFalse(requests.invalidateClipboard())
assertTrue(requests.isLatest(uri))
}
@Test
fun `clipboard snapshot invalidates active clipboard import`() {
val requests = LatestIncoming()
val clipboard = requests.next(IncomingOrigin.Clipboard)
assertTrue(requests.invalidateClipboard())
assertFalse(requests.isLatest(clipboard))
}
@Test
fun `failed dismiss compareAndSet cannot clear a newer opening`() {
val incoming = MutableStateFlow<Incoming?>(Incoming.Failed(IllegalStateException("old")))
val expected = incoming.value
incoming.value = Incoming.Opening
assertFalse(incoming.compareAndSet(expected, null))
assertEquals(Incoming.Opening, incoming.value)
}
@Test
fun `stale collector cannot clear a newer incoming event`() {
val entry = DbEntry(
id = "copy",
name = "Clipboard",
source = Source.Copy,
location = "copy.pgn",
fileName = "clipboard.pgn",
)
val incoming = MutableStateFlow<Incoming?>(Incoming.Opened(entry))
val expected = incoming.value
incoming.value = Incoming.Opening
assertFalse(incoming.compareAndSet(expected, null))
assertEquals(Incoming.Opening, incoming.value)
}
}

View file

@ -0,0 +1,135 @@
package io.github.vrubelroman.chesspenguin.data
import org.junit.Assert.assertArrayEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNotEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Assert.assertSame
import org.junit.Assert.assertTrue
import org.junit.Test
class ClipboardPromptGateTest {
@Test
fun `new offer is accepted once and same offer cannot be accepted twice`() {
val gate = ClipboardPromptGate()
val generation = gate.invalidate()
val offer = offer("same", generation)
assertTrue(gate.publish(offer))
val accepted = gate.accept(offer)
assertNotNull(accepted)
assertNull(gate.accept(offer))
assertTrue(gate.canPublish(accepted!!))
}
@Test
fun `blank snapshot invalidates offer and pending publication`() {
val gate = ClipboardPromptGate()
val generation = gate.invalidate()
val offer = offer("old", generation)
assertTrue(gate.publish(offer))
val accepted = gate.accept(offer)!!
gate.invalidate()
assertFalse(gate.canPublish(accepted))
assertFalse(gate.publish(offer))
}
@Test
fun `stale accept is ignored after snapshot changes`() {
val gate = ClipboardPromptGate()
val old = offer("old", gate.invalidate())
assertTrue(gate.publish(old))
gate.invalidate()
val current = offer("current", gate.invalidate())
assertNull(gate.accept(old))
assertTrue(gate.publish(current))
assertNotNull(gate.accept(current))
}
@Test
fun `changed snapshot forbids old import publication`() {
val gate = ClipboardPromptGate()
val accepted = gate.accept(offer("old", gate.invalidate()).also { gate.publish(it) })!!
gate.invalidate()
assertFalse(gate.canPublish(accepted))
}
@Test
fun `dismissed digest stays decided while changed text is allowed`() {
val gate = ClipboardPromptGate()
val dismissed = offer("dismissed", gate.invalidate())
assertTrue(gate.publish(dismissed))
assertTrue(gate.dismiss(dismissed))
assertFalse(gate.publish(dismissed.copy(generation = gate.invalidate())))
assertTrue(gate.publish(offer("changed", gate.invalidate())))
}
@Test
fun `successful open persists digest only after entry and survives cold restoration`() {
var persisted = emptySet<String>()
val first = ClipboardPromptGate(onDecide = { persisted = it })
val offer = offer("sha256-of-opened-text", first.invalidate())
assertTrue(first.publish(offer))
val accepted = first.accept(offer)!!
assertTrue(persisted.isEmpty())
assertTrue(first.finish(accepted, true))
val restored = ClipboardPromptGate(decided = persisted)
assertFalse(restored.publish(offer.copy(generation = restored.invalidate())))
assertTrue(restored.publish(offer.copy(digest = "new-text", generation = restored.invalidate())))
}
@Test
fun `failed import does not persist digest and retries after cold start`() {
var persisted = emptySet<String>()
val first = ClipboardPromptGate(onDecide = { persisted = it })
val offer = offer("retry-digest", first.invalidate())
assertTrue(first.publish(offer))
val accepted = first.accept(offer)!!
assertTrue(persisted.isEmpty())
assertTrue(first.finish(accepted, false))
val restored = ClipboardPromptGate(decided = persisted)
assertTrue(restored.publish(offer.copy(generation = restored.invalidate())))
}
@Test
fun `one UTF8 snapshot preserves BOM CRLF unicode and import bytes`() {
val text = "\uFEFF[Event \"Партия 😀\"]\r\n1. e4 e5\r\n*"
val bytes = clipboardUtf8(text)
val gate = ClipboardPromptGate()
val offer = ClipboardOffer(bytes, 1, clipboardSha256(bytes), gate.invalidate())
assertTrue(gate.publish(offer))
val accepted = gate.accept(offer)!!
assertArrayEquals(text.toByteArray(Charsets.UTF_8), accepted.bytes)
assertSame(bytes, accepted.bytes)
assertNotEquals(
clipboardSha256(bytes),
clipboardSha256(clipboardUtf8(text.replace("\r\n", "\n"))),
)
}
@Test
fun `clipboard size limit includes eight MiB and rejects one byte more`() {
assertTrue(clipboardPgnLengthMayFit("a".repeat(CLIPBOARD_PGN_MAX_BYTES)))
assertFalse(clipboardPgnLengthMayFit("a".repeat(CLIPBOARD_PGN_MAX_BYTES + 1)))
assertTrue(clipboardPgnWithinLimit(CLIPBOARD_PGN_MAX_BYTES - 1))
assertTrue(clipboardPgnWithinLimit(CLIPBOARD_PGN_MAX_BYTES))
assertFalse(clipboardPgnWithinLimit(CLIPBOARD_PGN_MAX_BYTES + 1))
}
private fun offer(digest: String, generation: Long, games: Int = 1): ClipboardOffer =
ClipboardOffer(byteArrayOf(1), games, digest, generation)
}

View file

@ -0,0 +1,47 @@
package io.github.vrubelroman.chesspenguin.data
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertSame
import org.junit.Assert.assertTrue
import org.junit.Test
class LibraryClipboardTest {
@Test
fun `first valid record is accepted even when a later record is malformed`() {
assertTrue(firstPgnGameIsMeaningful(count = 2, tags = 1, nodes = 1))
assertTrue(firstPgnGameIsMeaningful(count = 2, tags = 0, nodes = 2))
}
@Test
fun `first malformed record is rejected even when a later record is valid`() {
assertFalse(firstPgnGameIsMeaningful(count = 2, tags = 0, nodes = 1))
}
@Test
fun `multiple empty records and zero records are rejected`() {
assertFalse(firstPgnGameIsMeaningful(count = 3, tags = 0, nodes = 1))
assertFalse(firstPgnGameIsMeaningful(count = 0, tags = 0, nodes = 0))
}
@Test
fun `tag only first record is accepted by the shared addCopy rule`() {
assertTrue(firstPgnGameIsMeaningful(count = 1, tags = 1, nodes = 1))
}
@Test
fun `final digest lookup reuses an existing copy after concurrent parsing`() {
val existing = DbEntry(
id = "existing",
name = "Clipboard",
source = Source.Copy,
location = "existing.pgn",
fileName = "clipboard.pgn",
sha256 = "same-digest",
)
val other = existing.copy(id = "other", sha256 = "other-digest")
assertSame(existing, copyWithDigest(listOf(other, existing), "same-digest"))
assertNull(copyWithDigest(listOf(other, existing), "new-digest"))
}
}

View file

@ -0,0 +1,41 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.ui.geometry.Offset
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
class BoardArrowHitTest {
@Test
fun `flip changes the hit point but not UCI`() {
val move = BoardArrowMove("e2e4", "e2", "e4", "e4")
val square = 40f
val center = Offset(square / 2, square / 2)
val target = squareIndex("e4")!!
val normal = boardCell(target, square, false) + center
val flipped = boardCell(target, square, true) + center
assertEquals(listOf("e2e4"), arrowHits(normal, square, false, listOf(move), 24f).map { it.uci })
assertTrue(arrowHits(normal, square, true, listOf(move), 24f).isEmpty())
assertEquals(listOf("e2e4"), arrowHits(flipped, square, true, listOf(move), 24f).map { it.uci })
}
@Test
fun `overlapping targets return every conflicting UCI`() {
val square = 35f
val center = Offset(square / 2, square / 2)
val target = boardCell(squareIndex("e8")!!, square, false) + center
val moves = listOf(
BoardArrowMove("e7e8q", "e7", "e8", "queen"),
BoardArrowMove("e7e8n", "e7", "e8", "knight"),
)
assertEquals(listOf("e7e8q", "e7e8n"), arrowHits(target, square, false, moves, 24f).map { it.uci })
}
@Test
fun `points outside the board never activate an arrow`() {
val move = BoardArrowMove("e2e4", "e2", "e4", "e4")
assertTrue(arrowHits(Offset(-1f, 10f), 40f, false, listOf(move), 24f).isEmpty())
}
}

View file

@ -0,0 +1,54 @@
package io.github.vrubelroman.chesspenguin.ui
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class GameBarStateTest {
@Test
fun `loaded game can start or open its report`() {
assertTrue(enabled())
assertTrue(enabled(hasData = true, running = true))
}
@Test
fun `review is unavailable during computer play and without moves`() {
assertFalse(enabled(gameOn = true, sessionGame = true))
assertFalse(enabled(hasMoves = false))
}
@Test
fun `database game waits for its review state`() {
assertFalse(enabled(loaded = false))
assertTrue(enabled(sessionGame = true, loaded = false))
}
@Test
fun `first running database analysis disables duplicate start`() {
assertFalse(enabled(running = true))
}
@Test
fun `session game cannot duplicate its first run`() {
assertFalse(enabled(sessionGame = true, loaded = true, running = true))
assertEquals(ReviewAction.Wait, reviewAction(hasData = false, running = true))
}
@Test
fun `report wins over running while an empty run waits`() {
assertEquals(ReviewAction.Start, reviewAction(hasData = false, running = false))
assertEquals(ReviewAction.Wait, reviewAction(hasData = false, running = true))
assertEquals(ReviewAction.Report, reviewAction(hasData = true, running = false))
assertEquals(ReviewAction.Report, reviewAction(hasData = true, running = true))
}
private fun enabled(
hasMoves: Boolean = true,
gameOn: Boolean = false,
sessionGame: Boolean = false,
loaded: Boolean = true,
hasData: Boolean = false,
running: Boolean = false,
) = reviewEnabled(hasMoves, gameOn, sessionGame, loaded, hasData, running)
}

View file

@ -0,0 +1,46 @@
package io.github.vrubelroman.chesspenguin.ui
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
class PlayersStateTest {
@Test
fun `two available colors always require an explicit choice`() {
val blackMoreOften = player(white = 2, black = 3)
val whiteMoreOften = player(white = 9, black = 1)
assertTrue(playerNeedsColorChoice(blackMoreOften))
assertTrue(playerNeedsColorChoice(whiteMoreOften))
assertNull(solePlayerColor(blackMoreOften))
assertNull(solePlayerColor(whiteMoreOften))
}
@Test
fun `exactly one available color is the direct action`() {
val whiteOnly = player(white = 2, black = 0)
val blackOnly = player(white = 0, black = 1)
assertTrue(solePlayerColor(whiteOnly) == true)
assertTrue(solePlayerColor(blackOnly) == false)
assertFalse(playerNeedsColorChoice(whiteOnly))
assertFalse(playerNeedsColorChoice(blackOnly))
}
@Test
fun `zero colors do not become an action`() {
val empty = player(white = 0, black = 0)
assertNull(solePlayerColor(empty))
assertFalse(playerNeedsColorChoice(empty))
}
private fun player(white: Int, black: Int) = PlayerSummary(
id = 1,
name = "Player",
total = 100,
whiteGames = white,
blackGames = black,
)
}

View file

@ -0,0 +1,101 @@
package io.github.vrubelroman.chesspenguin.ui
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
class PrepLineStateTest {
@Test
fun `back and forward follow the same continuation`() {
val line = line("e2e4", "e7e5", "g1f3")
val back = line.back().back()
assertEquals(1, back.cursor)
assertEquals("e2e4", back.last?.uci)
assertTrue(back.canForward)
val forward = back.forward()
assertEquals("e7e5", forward.last?.uci)
assertEquals("g1f3", forward.forward().last?.uci)
}
@Test
fun `long actions jump without an extra step`() {
val line = line("e2e4", "e7e5", "g1f3")
assertEquals(0, line.start().cursor)
assertEquals(line.steps.size, line.start().end().cursor)
assertEquals(line, line.end())
assertEquals(line.start(), line.start().start())
}
@Test
fun `a played line replaces only the temporary future`() {
val original = line("e2e4", "e7e5", "g1f3").back().back()
val prefix = original.steps.take(original.cursor)
val replacement = step("c7c5", 2, "c5")
val changed = original.replaceVisibleLine(prefix + replacement, replacement.node)
assertEquals(listOf("e2e4", "c7c5"), changed.moves)
assertEquals(2, changed.cursor)
assertFalse(changed.canForward)
assertEquals(listOf("e2e4", "e7e5", "g1f3"), original.moves)
}
@Test
fun `opponent color puts the user at the bottom`() {
assertTrue(prepBoardStartsFlipped(opponentWhite = true))
assertFalse(prepBoardStartsFlipped(opponentWhite = false))
}
@Test
fun `side and number come from FEN rather than parity`() {
val black = "8/8/8/8/8/8/4k3/4K3 b - - 0 0"
assertEquals(false, prepWhiteToMove(black))
assertEquals("0…Kd2", moveLabel(black, "Kd2"))
assertEquals("12.Nf3", moveLabel(STANDARD_START.substringBeforeLast(" 1") + " 12", "Nf3"))
assertNull(prepWhiteToMove("not a fen"))
}
@Test
fun `frequency and WDL have separate denominators`() {
val move = PrepContinuation("e7e5", "e5", games = 4, wins = 2, draws = 0, losses = 1, unknown = 1)
assertEquals("40", frequencyPercent(move.games, 10))
assertEquals(Triple("67", "0", "33"), outcomePercents(move))
assertEquals("<1", frequencyPercent(1, 113))
assertEquals("0", frequencyPercent(0, 113))
assertEquals(Triple("—", "—", "—"), outcomePercents(move.copy(wins = 0, losses = 0)))
}
@Test
fun `continuations are sorted by games then SAN without hiding rare moves`() {
val position = PrepPosition(
games = 5,
continuations = listOf(
PrepContinuation("g1f3", "Nf3", 1, 1, 0, 0),
PrepContinuation("e2e4", "e4", 3, 1, 1, 1),
PrepContinuation("d2d4", "d4", 1, 0, 1, 0),
),
)
assertEquals(listOf("e4", "Nf3", "d4"), sortedContinuations(position).map { it.san })
}
private fun line(vararg moves: String): PrepLineState = PrepLineState(
startFen = STANDARD_START,
rootFen = STANDARD_START,
steps = moves.mapIndexed { i, uci -> step(uci, i + 1, uci.take(4)) },
cursor = moves.size,
)
private fun step(uci: String, node: Int, san: String) = PrepLineStep(
node = node,
uci = uci,
san = san,
moveNumber = (node + 1) / 2,
white = node % 2 == 1,
fen = STANDARD_START,
from = uci.take(2),
to = uci.substring(2, 4),
)
}

View file

@ -2,6 +2,9 @@
# Builds the two signed release APKs into androidApp/dist:
# ChessPenguin-<version>-android.apk Stockfish built in ("full")
# ChessPenguin-<version>-android-noengine.apk Stockfish downloaded in the app ("light")
# and, apart (not a file of the release), into androidApp/dist-rustore:
# ChessPenguin-<version>-rustore.apk the full one for RuStore: no updates of its
# own, no check the site counts
# The key comes from the environment or from ~/.config/chesspenguin/android/.env.
set -euo pipefail
cd "$(dirname "$0")/.."
@ -13,15 +16,22 @@ if [[ -z "${CP_KEYSTORE:-}" && -f "${env_file}" ]]; then
set +a
fi
: "${CP_KEYSTORE:?no release key: set CP_KEYSTORE and the passwords, or CP_SIGNING_ENV}"
./gradlew --console=plain assembleFullRelease assembleLightRelease
./gradlew --console=plain assembleFullRelease assembleLightRelease assembleFullRustore
version="$(sed -n 's/^version = "\(.*\)"/\1/p' ../Cargo.toml | head -n1)"
mkdir -p dist
cp app/build/outputs/apk/full/release/app-full-release.apk "dist/ChessPenguin-${version}-android.apk"
cp app/build/outputs/apk/light/release/app-light-release.apk "dist/ChessPenguin-${version}-android-noengine.apk"
mkdir -p dist-rustore
cp app/build/outputs/apk/full/rustore/app-full-rustore.apk "dist-rustore/ChessPenguin-${version}-rustore.apk"
build_tools="$(ls -d "${ANDROID_HOME:-$HOME/Android/Sdk}"/build-tools/* | sort -V | tail -n1)"
for apk in dist/ChessPenguin-"${version}"-android*.apk; do
for apk in dist/ChessPenguin-"${version}"-android*.apk dist-rustore/ChessPenguin-"${version}"-rustore.apk; do
"${build_tools}/apksigner" verify "${apk}"
"${build_tools}/zipalign" -c -P 16 4 "${apk}"
done
(cd dist && sha256sum ChessPenguin-"${version}"-android*.apk > ChessPenguin-"${version}"-android.sha256)
ls -l dist
# The store's build asks for nothing it would not need.
if "${build_tools}/aapt2" dump permissions "dist-rustore/ChessPenguin-${version}-rustore.apk" | grep -q 'INSTALL_PACKAGES'; then
echo "the RuStore build may install packages" >&2
exit 1
fi
ls -l dist dist-rustore

77
androidApp/scripts/rodent4.sh Executable file
View file

@ -0,0 +1,77 @@
#!/usr/bin/env bash
# Builds Rodent IV (github.com/nescitus/rodent-iv, GPL-3.0) for Android from the authors'
# sources at the commit the desktop build uses (.github/workflows/rodent-iv.yml), with the
# same fix (packaging/rodent-iv/home-dir.patch), and two more: think-thread.patch (a
# dangling reference that clang builds trip over) and android.patch (bionic has no
# wordexp); takes its personalities.
#
# scripts/rodent4.sh OUT_DIR
# OUT_DIR/jniLibs/arm64-v8a/librodent4.so, OUT_DIR/jniLibs/x86_64/librodent4.so
# OUT_DIR/home/personalities/* (basic.ini and the personality files)
# OUT_DIR/source/LICENSE, README.md, COPYRIGHT, books/<folder>/readme.txt (the books'
# credits, the authors' #readme.txt)
#
# The executable goes into the APK as a "library", the only place Android 10+ lets an
# app execute a file from (docs/research/android-stack.md §5). The engine finds its
# personalities and books in the folder named by RODENT4HOME: NDK clang defines
# __ANDROID__ but not ANDROID, so the authors' /sdcard/Rodent4 branch is not compiled
# (android.patch keys only the missing wordexp on __ANDROID__).
# The books are not here: the app downloads them. libc++ is linked statically.
# The source is cached in ~/.cache/chesspenguin-android and checked against its SHA-256.
# Needs ANDROID_NDK_HOME (NDK r27c or later).
set -euo pipefail
commit="e8d84c8c8c189a1cf4eb27c578fc573af3b916d2"
source_sha256="db372b48a8ccf22d9bfbe3e5454cbbccb81dadca0120cbc0abaee2a81a0cb3fe"
api=31
here="$(cd "$(dirname "$0")" && pwd)"
patches="${here}/../../packaging/rodent-iv"
out="$(realpath -m "${1:?usage: $0 OUT_DIR}")"
ndk="${ANDROID_NDK_HOME:?set ANDROID_NDK_HOME}"
cache="${XDG_CACHE_HOME:-$HOME/.cache}/chesspenguin-android"
mkdir -p "${cache}" "${out}"
file="rodent-iv-${commit}.tar.gz"
if ! { [[ -f "${cache}/${file}" ]] \
&& echo "${source_sha256} ${cache}/${file}" | sha256sum -c --quiet - 2>/dev/null; }; then
curl -fsSL --retry 3 --max-time 900 -o "${cache}/${file}.part" \
"https://github.com/nescitus/rodent-iv/archive/${commit}.tar.gz"
if ! echo "${source_sha256} ${cache}/${file}.part" | sha256sum -c --quiet -; then
rm -f "${cache}/${file}.part"
echo "rodent4.sh: the source does not match its SHA-256" >&2
exit 1
fi
mv "${cache}/${file}.part" "${cache}/${file}"
fi
work="$(mktemp -d)"
trap 'rm -rf "${work}"' EXIT
tar -xzf "${cache}/${file}" -C "${work}"
root="${work}/rodent-iv-${commit}"
patch -s -d "${root}" -p1 < "${patches}/home-dir.patch"
patch -s -d "${root}" -p1 < "${patches}/think-thread.patch"
patch -s -d "${root}" -p1 < "${patches}/android.patch"
bin="${ndk}/toolchains/llvm/prebuilt/linux-x86_64/bin"
build() { # abi target
"${bin}/$2${api}-clang++" -O3 -w -pipe -DNDEBUG -fno-rtti -finline-functions -std=c++14 \
-static-libstdc++ "${root}"/sources/src/*.cpp -o "${work}/rodent4-$1" -lm
mkdir -p "${out}/jniLibs/$1"
"${bin}/llvm-strip" -o "${out}/jniLibs/$1/librodent4.so" "${work}/rodent4-$1"
}
build arm64-v8a aarch64-linux-android
build x86_64 x86_64-linux-android
rm -rf "${out}/home" "${out}/source"
mkdir -p "${out}/home" "${out}/source"
cp -r "${root}/personalities" "${out}/home/personalities"
cp "${root}/LICENSE" "${root}/README.md" "${out}/source/"
# The authors are named in the sources' headers; the repository has no AUTHORS file.
sed -n '/^\/\*/,/^\*\//p' "${root}/sources/src/main.cpp" > "${out}/source/COPYRIGHT"
# The books are downloaded by the app; their credits come with the licence.
for credits in $(cd "${root}" && find books -name '#readme.txt'); do
mkdir -p "${out}/source/$(dirname "${credits}")"
cp "${root}/${credits}" "${out}/source/$(dirname "${credits}")/readme.txt"
done
echo "Rodent IV (${commit:0:8}) for Android -> ${out}"

View file

@ -9,10 +9,22 @@ edition.workspace = true
rust-version.workspace = true
license.workspace = true
# The interface, shared with the web version (apps/web); src/main.rs starts it in a
# window.
[lib]
name = "chesspenguin_app"
path = "src/lib.rs"
[[bin]]
name = "chesspenguin"
path = "src/main.rs"
[dependencies]
chess-core.workspace = true
chess-openings.workspace = true
maia.workspace = true
game-review.workspace = true
prep.workspace = true
chess-import.workspace = true
shakmaty.workspace = true
uci.workspace = true
@ -20,21 +32,16 @@ egui.workspace = true
eframe.workspace = true
egui_extras.workspace = true
image.workspace = true
rfd.workspace = true
arboard.workspace = true
rodio.workspace = true
directories.workspace = true
trainer.workspace = true
play.workspace = true
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
online-games.workspace = true
releases.workspace = true
# Downloading the official Stockfish on request (decision 14).
ureq = "3.4"
flate2 = "1.1"
tar = "0.4"
web-time.workspace = true
sha2 = "0.11"
zip = { version = "9.0.5", default-features = false, features = ["deflate-flate2-zlib-rs"] }
# The system language for the first start.
sys-locale = "0.3"
whatlang = "0.18.0"
@ -46,6 +53,42 @@ log = "0.4"
base64 = "0.22"
form_urlencoded = "1"
# The desktop program: native dialogs, the clipboard, sound, the network (updates,
# engines and Maia on request, online games, translation).
[target.'cfg(not(target_family = "wasm"))'.dependencies]
rfd.workspace = true
arboard.workspace = true
rodio.workspace = true
releases.workspace = true
# Downloading the official Stockfish on request (decision 14).
ureq = "3.4"
flate2 = "1.1"
tar = "0.4"
# The web version: the page, its files and storage (apps/web starts it).
[target.'cfg(target_family = "wasm")'.dependencies]
# The reader worker gives the page a database's index (platform::web::import).
chess-core = { workspace = true, features = ["serde"] }
getrandom = { version = "0.3", features = ["wasm_js"] }
# The browser's languages for the first start.
sys-locale = { version = "0.3", features = ["js"] }
# Today's date from the browser's clock.
chrono = { version = "0.4", default-features = false, features = ["clock", "std", "wasmbind"] }
wasm-bindgen = "0.2.129"
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
web-sys = { version = "0.3", features = [
"Window", "Document", "Element", "HtmlElement", "HtmlInputElement", "HtmlAnchorElement",
"File", "FileList", "Blob", "BlobPropertyBag", "Url", "Event", "Location", "Navigator",
"Storage", "UrlSearchParams", "EventTarget", "CssStyleDeclaration", "Clipboard",
"IdbFactory", "IdbDatabase", "IdbOpenDbRequest", "IdbRequest", "IdbTransaction",
"IdbTransactionMode", "IdbObjectStore", "DomStringList", "HtmlAudioElement",
"HtmlMediaElement", "HtmlCanvasElement", "console", "CacheStorage", "Cache",
"Request", "Response", "ResponseInit", "Headers", "ReadableStream",
"ReadableStreamDefaultReader", "StorageManager", "StorageEstimate", "History",
"BeforeUnloadEvent", "WorkerOptions", "WorkerType",
] }
[build-dependencies]
winresource = "0.1"

View file

@ -0,0 +1,96 @@
-------------------------------
UBUNTU FONT LICENCE Version 1.0
-------------------------------
PREAMBLE
This licence allows the licensed fonts to be used, studied, modified and
redistributed freely. The fonts, including any derivative works, can be
bundled, embedded, and redistributed provided the terms of this licence
are met. The fonts and derivatives, however, cannot be released under
any other licence. The requirement for fonts to remain under this
licence does not require any document created using the fonts or their
derivatives to be published under this licence, as long as the primary
purpose of the document is not to be a vehicle for the distribution of
the fonts.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this licence and clearly marked as such. This may
include source files, build scripts and documentation.
"Original Version" refers to the collection of Font Software components
as received under this licence.
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to
a new environment.
"Copyright Holder(s)" refers to all individuals and companies who have a
copyright ownership of the Font Software.
"Substantially Changed" refers to Modified Versions which can be easily
identified as dissimilar to the Font Software by users of the Font
Software comparing the Original Version with the Modified Version.
To "Propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification and with or without charging
a redistribution fee), making available to the public, and in some
countries other activities as well.
PERMISSION & CONDITIONS
This licence does not grant any rights under trademark law and all such
rights are reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of the Font Software, to propagate the Font Software, subject to
the below conditions:
1) Each copy of the Font Software must contain the above copyright
notice and this licence. These can be included either as stand-alone
text files, human-readable headers or in the appropriate machine-
readable metadata fields within text or binary files as long as those
fields can be easily viewed by the user.
2) The font name complies with the following:
(a) The Original Version must retain its name, unmodified.
(b) Modified Versions which are Substantially Changed must be renamed to
avoid use of the name of the Original Version or similar names entirely.
(c) Modified Versions which are not Substantially Changed must be
renamed to both (i) retain the name of the Original Version and (ii) add
additional naming elements to distinguish the Modified Version from the
Original Version. The name of such Modified Versions must be the name of
the Original Version, with "derivative X" where X represents the name of
the new work, appended to that name.
3) The name(s) of the Copyright Holder(s) and any contributor to the
Font Software shall not be used to promote, endorse or advertise any
Modified Version, except (i) as required by this licence, (ii) to
acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with
their explicit written permission.
4) The Font Software, modified or unmodified, in part or in whole, must
be distributed entirely under this licence, and must not be distributed
under any other licence. The requirement for fonts to remain under this
licence does not affect any document created using the Font Software,
except any version of the Font Software extracted from a document
created using the Font Software may only be distributed under this
licence.
TERMINATION
This licence becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

View file

@ -0,0 +1,12 @@
[Event "ChessPenguin: Queen's Gambit for White"]
[White "Repertoire"]
[Black "?"]
[Result "*"]
[ECO "D37"]
{Queen's Gambit for White: the Queen's Gambit Declined with 5.Bf4, plus answers to the Queen's Gambit Accepted and the Slav Defence.}
1. d4 d5 2. c4 {White offers a pawn to deflect Black's d-pawn from the centre.}
2... e6 (2... dxc4 {Queen's Gambit Accepted.} 3. Nf3 Nf6 4. e3 e6 5. Bxc4 c5 6. O-O a6 7. dxc5 Bxc5 8. Qxd8+ Kxd8 {White keeps a small, risk-free edge in the endgame.})
(2... c6 {Slav Defence.} 3. Nf3 Nf6 4. Nc3 dxc4 5. a4 Bf5 6. e3 e6 7. Bxc4 Bb4 8. O-O {White has a central space advantage and easy development.})
3. Nc3 Nf6 4. Nf3 Be7 5. Bf4 {The modern main line: the bishop is active and safe from ...h6 and ...Ne4.}
5... O-O 6. e3 c5 7. dxc5 Bxc5 8. a3 Nc6 9. Qc2 Qa5 10. Rd1 Re8 11. Nd2 {White plays against the isolated pawn that may appear after ...dxc4 or cxd5.} *

View file

@ -0,0 +1,12 @@
[Event "ChessPenguin: Ферзевый гамбит за белых"]
[White "Repertoire"]
[Black "?"]
[Result "*"]
[ECO "D37"]
{Ферзевый гамбит за белых: отказанный ферзевый гамбит с 5.Bf4, а также ответы на принятый ферзевый гамбит и Славянскую защиту.}
1. d4 d5 2. c4 {Белые предлагают пешку, чтобы отвлечь пешку d5 из центра.}
2... e6 (2... dxc4 {Принятый ферзевый гамбит.} 3. Nf3 Nf6 4. e3 e6 5. Bxc4 c5 6. O-O a6 7. dxc5 Bxc5 8. Qxd8+ Kxd8 {Белые сохраняют небольшой безрисковый перевес в эндшпиле.})
(2... c6 {Славянская защита.} 3. Nf3 Nf6 4. Nc3 dxc4 5. a4 Bf5 6. e3 e6 7. Bxc4 Bb4 8. O-O {У белых перевес в пространстве в центре и удобное развитие.})
3. Nc3 Nf6 4. Nf3 Be7 5. Bf4 {Современная основная система: слон активен и не попадает под ...h6 и ...Ne4.}
5... O-O 6. e3 c5 7. dxc5 Bxc5 8. a3 Nc6 9. Qc2 Qa5 10. Rd1 Re8 11. Nd2 {Белые играют против изолированной пешки, которая может возникнуть после ...dxc4 или cxd5.} *

View file

@ -0,0 +1,11 @@
[Event "ChessPenguin: Sicilian Najdorf for Black"]
[White "?"]
[Black "Repertoire"]
[Result "*"]
[ECO "B90"]
{Sicilian Defence, Najdorf Variation for Black, with answers to 6.Be3, 6.Bg5 and the Alapin 2.c3.}
1. e4 c5 2. Nf3 (2. c3 {Alapin Variation.} 2... Nf6 3. e5 Nd5 4. d4 cxd4 5. Nf3 Nc6 6. cxd4 d6 {Black attacks the e5 pawn at once.})
2... d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 a6 {The Najdorf: ...a6 controls b5 and prepares ...e5 or ...b5.}
6. Be3 (6. Bg5 e6 7. f4 Be7 8. Qf3 Qc7 9. O-O-O Nbd7 {Black keeps the position solid and prepares ...b5.})
6... e5 7. Nb3 Be6 8. f3 Be7 9. Qd2 O-O 10. O-O-O Nbd7 11. g4 b5 {English Attack: both sides race on opposite wings.} *

View file

@ -0,0 +1,11 @@
[Event "ChessPenguin: Сицилианская защита, вариант Найдорфа за чёрных"]
[White "?"]
[Black "Repertoire"]
[Result "*"]
[ECO "B90"]
{Сицилианская защита, вариант Найдорфа за чёрных: ответы на 6.Be3, 6.Bg5 и вариант Алапина 2.c3.}
1. e4 c5 2. Nf3 (2. c3 {Вариант Алапина.} 2... Nf6 3. e5 Nd5 4. d4 cxd4 5. Nf3 Nc6 6. cxd4 d6 {Чёрные сразу атакуют пешку e5.})
2... d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 a6 {Вариант Найдорфа: ...a6 контролирует b5 и готовит ...e5 или ...b5.}
6. Be3 (6. Bg5 e6 7. f4 Be7 8. Qf3 Qc7 9. O-O-O Nbd7 {Чёрные сохраняют прочную позицию и готовят ...b5.})
6... e5 7. Nb3 Be6 8. f3 Be7 9. Qd2 O-O 10. O-O-O Nbd7 11. g4 b5 {Английская атака: обе стороны наступают на противоположных флангах.} *

View file

@ -0,0 +1,13 @@
[Event "ChessPenguin: Spanish Opening for White"]
[White "Repertoire"]
[Black "?"]
[Result "*"]
[ECO "C84"]
{Spanish Opening (Ruy Lopez) for White: the Closed main line, the Marshall Attack and the Berlin Defence.}
1. e4 e5 2. Nf3 Nc6 3. Bb5 {The Spanish bishop pressures the knight that defends e5.}
3... a6 (3... Nf6 {Berlin Defence.} 4. O-O Nxe4 5. d4 Nd6 6. Bxc6 dxc6 7. dxe5 Nf5
8. Qxd8+ Kxd8 {The Berlin endgame: White has the healthier pawn majority.})
4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 (7... O-O 8. c3 d5 {Marshall Attack.}
9. exd5 Nxd5 10. Nxe5 Nxe5 11. Rxe5 c6 12. d4 {White returns material later if needed, but keeps the extra pawn for now.})
8. c3 O-O 9. h3 {Stops ...Bg4 and prepares d4.} 9... Na5 10. Bc2 c5 11. d4 Qc7 12. Nbd2 {Chigorin Variation: the knight heads for f1 and g3.} *

View file

@ -0,0 +1,13 @@
[Event "ChessPenguin: Испанская партия за белых"]
[White "Repertoire"]
[Black "?"]
[Result "*"]
[ECO "C84"]
{Испанская партия за белых: закрытая основная система, атака Маршалла и Берлинская защита.}
1. e4 e5 2. Nf3 Nc6 3. Bb5 {Испанский слон давит на коня, защищающего e5.}
3... a6 (3... Nf6 {Берлинская защита.} 4. O-O Nxe4 5. d4 Nd6 6. Bxc6 dxc6 7. dxe5 Nf5
8. Qxd8+ Kxd8 {Берлинский эндшпиль: у белых более здоровое пешечное большинство.})
4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 (7... O-O 8. c3 d5 {Атака Маршалла.}
9. exd5 Nxd5 10. Nxe5 Nxe5 11. Rxe5 c6 12. d4 {Белые пока сохраняют лишнюю пешку, а при необходимости вернут материал позже.})
8. c3 O-O 9. h3 {Не допускает ...Bg4 и готовит d4.} 9... Na5 10. Bc2 c5 11. d4 Qc7 12. Nbd2 {Вариант Чигорина: конь идёт на f1 и g3.} *

View file

@ -0,0 +1,13 @@
[Event "ChessPenguin: Semi-Slav Triangle for Black"]
[White "?"]
[Black "Repertoire"]
[Result "*"]
[ECO "D47"]
{Semi-Slav (Triangle) for Black: the Meran main line, with answers to 5.Bg5, the Exchange Variation and the quiet 4.e3.}
1. d4 d5 2. c4 c6 3. Nf3 e6 {The triangle c6-d5-e6 makes the centre very solid.}
4. Nc3 (4. e3 Nf6 5. Bd3 Nbd7 6. O-O Bd6 7. Nbd2 O-O 8. e4 dxe4 9. Nxe4 Nxe4 10. Bxe4 e5 {Black frees the position with the central break.})
(4. cxd5 exd5 5. Nc3 Nf6 6. Bg5 Be7 7. e3 Bf5 {Exchange Variation: the c8-bishop gets outside the pawn chain.})
4... Nf6 5. e3 (5. Bg5 h6 6. Bh4 dxc4 7. e4 g5 8. Bg3 b5 {Moscow Variation: Black grabs the pawn and keeps it with ...b5.})
5... Nbd7 6. Bd3 dxc4 7. Bxc4 b5 {The Meran: Black gains space on the queenside with tempo.}
8. Bd3 Bb7 9. O-O a6 10. e4 c5 11. d5 Qc7 {Black attacks the centre and is ready to castle.} *

View file

@ -0,0 +1,13 @@
[Event "ChessPenguin: Полуславянская защита (треугольник) за чёрных"]
[White "?"]
[Black "Repertoire"]
[Result "*"]
[ECO "D47"]
{Полуславянская защита (треугольник) за чёрных: основная система Меран и ответы на 5.Bg5, разменный вариант и спокойное 4.e3.}
1. d4 d5 2. c4 c6 3. Nf3 e6 {Треугольник c6-d5-e6 делает центр очень прочным.}
4. Nc3 (4. e3 Nf6 5. Bd3 Nbd7 6. O-O Bd6 7. Nbd2 O-O 8. e4 dxe4 9. Nxe4 Nxe4 10. Bxe4 e5 {Чёрные освобождают игру центральным подрывом.})
(4. cxd5 exd5 5. Nc3 Nf6 6. Bg5 Be7 7. e3 Bf5 {Разменный вариант: слон c8 выходит за пешечную цепь.})
4... Nf6 5. e3 (5. Bg5 h6 6. Bh4 dxc4 7. e4 g5 8. Bg3 b5 {Московский вариант: чёрные берут пешку и удерживают её ходом ...b5.})
5... Nbd7 6. Bd3 dxc4 7. Bxc4 b5 {Меран: чёрные с темпом захватывают пространство на ферзевом фланге.}
8. Bd3 Bb7 9. O-O a6 10. e4 c5 11. d5 Qc7 {Чёрные атакуют центр и готовы рокироваться.} *

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more