Compare commits

...

515 commits
v0.2.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
vrubelroman
ec7bb2a434 Release 1.3.0: play against Maia
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
Play against Maia, a human-like neural network (600–2600), with Lichess time
controls, clocks, premoves, take-backs and a resignation offer when she is
lost; the always-queen setting. README, metainfo and third-party notices
(Maia-3: architecture after CSSLab/maia3, AGPL-3.0, under GPLv3 §13; weights
downloaded on request, not bundled). The website gains a section on playing
against Maia, in nine languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:17:31 +03:00
vrubelroman
53da355044 A defeat sound when Maia offers to resign
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 sound set gets a Defeat sound, played when Maia offers to resign: the
Lichess sets their own Defeat.ogg (sfx, piano, futuristic, nes — Enigmahack,
AGPLv3+, unmodified), the Kenney sets a falling tone of «Interface Sounds»
(CC0: clicks minimize_006, the pair of its checkmate maximize_006; wood
minimize_008; glass minimize_004), leading silence trimmed and the peak matched
to the set's checkmate sound. Sources in THIRD_PARTY_NOTICES.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:11:16 +03:00
vrubelroman
5e7a588368 Maia offers to resign; even custom-time and Resign? 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
When her position is lost — twelve pawns or more, or mated by force — on two
of her turns judged in a row, Maia offers to resign instead of moving: «Accept
the win» ends the game (You won · Maia resigned), «Play to the end» lets her
move and she does not offer again. The judge is ChessPenguin's Stockfish (else
the active engine when its file is there) in its own thread for the whole
game, 150k nodes a position, never shown; without an engine she plays every
game out. The clocks wait while the offer is open, also under the leave
question (one pause, the offer's) and at any end; a take-back closes it; a
verdict on a position gone is dropped.

The custom-time labels flush left in one column; «Yes» and «No» of «Resign?»
of one size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 12:54:14 +03:00
vrubelroman
9ecc1a0a07 Premoves, the auto-queen setting, the play dialog redone
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Premoves in the game against Maia, as on Lichess: while she thinks, a move of
the user's piece by its pattern on an empty board (a pawn forward and both
diagonals, sliders through pieces, the king at home to castle with an own rook,
by the king's square or the rook's) is set and shown in dark blue; after her
move it is played at once when legal (a promotion as a queen), else dropped.
A right click or a click beside the own pieces cancels it; a take-back, the
leave question and the end drop it. A piece in hand stays there when Maia
moves, unless she took it.

Settings › Board: «Always promote to a queen», off by default — then the
piece is chosen, as before.

The dialog «Play against the computer» redone after the owner's review: You,
Opponent (the strength in the title, the slider edge to edge with 600/2600,
Weaker · As me · Stronger lit when they match, or a line asking for the
rating), Colour, Time; every choice a framed tile of one height, the tiles of a
row sharing its width; time 3+0…30+20 without category captions, Custom with
aligned sliders, Unlimited (no clocks) as a double tile; a solid scroll bar
in a low window, where the introduction is left out. Dev hook CP_PREMOVE.
Adjourning a game recorded as a task.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 12:12:35 +03:00
vrubelroman
6cd5250e99 Play against Maia: 10+5 by default, no bullet, no time limit as a tile
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 choices: the fastest control is 3+0 (the bullet presets and the
custom minutes below 3 are gone; a remembered bullet control falls back to
the default), 10+5 by default, «∞ No time limit» a tile of the grid like the
others. The tiles' lines are centred. The note on ratings says what it means:
Maia's scale is Lichess's, higher than FIDE and club ratings, so Maia 1500 is
weaker than a club player rated 1500. Decisions recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 11:33:39 +03:00
vrubelroman
a24f2f4271 tasks: play mode follow-ups from the design review
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 05:04:46 +03:00
vrubelroman
ff4dc8b7ed Play against Maia: the designer's must-fix items
- The toolbar's words (Take back, Abort, Resign, Yes/No) at 14 pt, as tall
  as the icon buttons beside them.
- The result strip: four even buttons in a row when they fit; else Analyse,
  Rematch and New game side by side, Save — each as wide as the strip.
- ♞ instead of ⚔ for Play and New game: at small sizes ⚔ read as a cross.
- Maia not downloaded: the main button says «Download and play» and starts
  the game once she is there; the size line, progress and errors sit by the
  buttons, outside the scrolling body.
- No unsaved mark during the game; an unnamed user is «You» in the title.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 05:04:34 +03:00
vrubelroman
9d44c3fea0 Play against Maia: the tester's findings
- Leaving a game in progress any way (window closed, Find in database, an
  update restart) asks «The game is on» first; «Resign and leave» asks nothing
  more. Find in database and the game data are hidden during the game.
- Maia's pause is at most a fortieth of her time plus most of the increment,
  and her clock takes the pause only, not the computing: she never flags.
- Take back gives the clock back to the user (and a first move stays free).
- Maia plays no move a tenth as likely as her best: human mistakes, not a
  2600 hanging her queen.
- The clocks stand on screen while «The game is on» is open.
- The moves played are not undone with Ctrl+Z after the end.
- The dialog body scrolls in a low window; its buttons stay in view.
- «Viewing an earlier position» has its own strip above the user's clock.
- Weights that do not load are removed, so the dialog offers them again.
- Who could not mate when time ran out is said right.
- The checkpoint reader: checked sizes and offsets, bounded memo values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 04:56:51 +03:00
vrubelroman
41c00fa43d Play against Maia: texts in nine languages
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 04:11:22 +03:00
vrubelroman
9cd28b9039 Play against Maia: dialog, clocks, game screen, result strip
«⚔ Play» (Ctrl+G) opens «Play against the computer»: name and rating
(optional), strength 600–2600 (or weaker/as me/stronger), colour, Lichess time
controls, custom, no clock. The game screen in play mode: clock cards above
and below the notation (read-only), take back, resign (abort before the first
moves); no engine, analysis or editing. Maia answers in a background thread
with a human-like pause bounded so she never loses on time; stale answers are
dropped. Endings: mate, stalemate, no material, threefold, fifty moves, time
(draw when the other side cannot mate), resignation; then the result strip
(Analyse, Rematch, New game, Save to a database) and an ordinary game with the
tags of a played game and [%clk]. Leaving during a game asks (resign and add /
resign and leave / keep playing), the clocks wait meanwhile. maia reads the
published PyTorch checkpoint directly (zip + a small pickle reader that refuses
everything but tensors); maia_download fetches it on request (pinned revision,
SHA-256). Dev hooks CP_PLAY, CP_PLAY_AUTO, CP_MAIA. Russian texts; the other
languages follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 04:10:02 +03:00
vrubelroman
8b468f99a7 maia: the Maia-3 network in plain Rust (human-like moves by rating)
The 5M model (8 transformer blocks with generated attention bias) computed with
plain f32 loops: no ML runtime, no Python. Weights in a small own format (f16,
10 MB) written by scripts/maia-convert.py from the published checkpoint; the
shared bias tensor is kept once. Agrees with the original PyTorch model to four
decimals on the reference positions (tests/reference.json, an ignored test that
needs the weights); about 85 ms per position on one CPU core. Also the
analyst's research for playing against it (docs/research/play-mode.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 03:56:45 +03:00
vrubelroman
4d3db2799a AUR: chesspenguin-bin 1.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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 03:40:15 +03:00
vrubelroman
a1276848d0 Release 1.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 / 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-25 03:26:53 +03:00
vrubelroman
f03a0d2a4b No preview strip: «+ Add as variation» at the end of the line being shown
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-25 03:22:51 +03:00
vrubelroman
6d3d393e25 Notation: the moves of a «Better:» line are painted by hand too (no size change under the mouse)
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-25 03:17:11 +03:00
vrubelroman
670360b9e7 Notation: a variation's moves are painted by hand, so the current move does not change size under the mouse
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-25 03:09:23 +03:00
vrubelroman
fbb5233395 Comment editor: the reviewers' fixes
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Shift+Enter is a paragraph (checked before Enter); the editor does not widen the
narrow panel (22-wide symbols, tighter margins); a variation's continuation after
the editor starts with the move number; 💾, «Add to database…», quitting and a
line preview write the draft first; Ctrl+1…6 with the editor open change its
draft; the ☰ item sits after «Game data…». Look: «Done» at the far right, Cancel
as tall; painted ✓/✕ in a narrow panel; 24-wide symbols with both groups on one
line at 1400; the pressed symbol in the selection's text colour; the field in its
own box; a readable hint line; the field capped so a notation row stays above
and below; the end of a long comment in view; the comment block lights up under
the mouse; the field is named after the title.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 03:04:00 +03:00
vrubelroman
7aee0467db Comment editor: own-language notes are not translated, the whole block takes the click, Cancel as tall as 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
A short note in the interface language's script inside a book of another script
(and a longer one the detector tells unreliably) is the reader's own: it is left
out of the translation plan. The comment block, not only its text, takes the
double click and the right button.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 02:54:13 +03:00
vrubelroman
d3477f140b AUR: chesspenguin-bin 1.1.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
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 02:47:05 +03:00
vrubelroman
dc7d9f88b3 User comments: an editor in the notation, symbols, arrows on the board
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
Enter on a move (the move's menu, a double click on a comment, the ☰ menu) opens
the editor where the comment stands: after any move, in a variation too (the
flow is cut at the move), or at the start of the game; Enter — done, Esc —
cancel, Shift+Enter — a paragraph; another move writes the draft; one edit —
one undo step. Symbols of the move (! ? !! ?? !? ?!, Ctrl+1…6) and of the
position in the editor and in the menu. The right mouse button draws arrows
and circles on the board ([%cal]/[%csl] of the current move; colours by
modifiers). Existing comments are edited and deleted; their commands and
untouched bytes are kept. chess_core: with_text, with_shapes, shapes,
Game::set_comments_before. Dev hooks CP_COMMENT_EDIT, CP_TYPE, CP_SHAPE.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 02:35:54 +03:00
vrubelroman
9967d6b759 PGN writer keeps comment paragraphs; research and design: user comments
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Comments were reflowed word by word, so a book comment's paragraphs became one
after Ctrl+S or «Add to database». Lines are still reflowed, blank lines kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 02:12:09 +03:00
vrubelroman
08cca27948 Release 1.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 / 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-25 02:04:44 +03:00
vrubelroman
b1e3b6eab7 Library: New game and Paste PGN first in the title row; the chooser's search only for a long list
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 01:59:34 +03:00
vrubelroman
863c957947 Library: New game and Paste PGN beside the database actions; one «+ Game» in an empty base; the folder button under the path
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 01:49:40 +03:00
vrubelroman
1518fc5f70 Library: shelf actions in the title row, «+ Game» for a database, read-only samples
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 row holds only databases; «+ Add database», «✚ New database» and
«🌐 Online games» stand beside «Databases» (folded to «+ ▾ 🌐» when narrow); an
empty shelf shows them as large cards. A database that takes games has «+ Game»
in its table header: a new game meant for it, whose Ctrl+S adds it there (the
target is dropped when the base leaves the shelf or stops taking games). The
chooser lists only databases that take games; with none, «✚ New database…» is
the main button; the UTF-8 copy is in the card menu (also for a file not read
yet). Built-in samples are read-only. An empty database has no filter panel or
search; a narrow search field says «🔍 Search». The table header keeps a short
database name. Task 8 closed: the quick search stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 01:39:19 +03:00
vrubelroman
40e5af5896 Research and design: library layout (shelf actions, quick search, + 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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 01:09:39 +03:00
vrubelroman
05026ec45a Own databases: the chooser lists only bases that take games; UTF-8 copy from the card menu; Create does not jump
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 01:03:57 +03:00
vrubelroman
0f66486a22 Own databases: create PGN bases, add, save, delete games; library logging
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Desktop: «✚ New database» on the shelf (Ctrl+Shift+N), «Add to database…»
(Ctrl+Shift+S, 💾, ☰) for any game — new, pasted, from a ChessBase, online or
legacy-encoded database — into a PGN of the user's choice; Ctrl+S saves the
changes back into the game's own PGN (its record is replaced) or adds the game
when the source is read-only; the game data editor (F2, the title, ☰) asked once
when a new game is first added; duplicate check (same players, date, moves →
replace / add as new, no Enter); delete from the table with a question and Undo
(Ctrl+Z, 6 s, waits under the mouse); UTF-8 copy for legacy-encoded files with
the restored letters; online and ChessBase stay read-only. Writes are explicit:
append, or an atomic rewrite through a temporary file and a rename (through a
symlink, keeping the mode, syncing the folder), refused when the file changed on
the disk. chess_core::pgn::store: append/replace/remove/restore/write_utf8_copy,
find_same_game, pgn_date; Game::remove_tag and order_roster. Settings: your
name (annotator), the folder for new databases, the last target. Nine languages.

Also: library warnings (wgpu, winit) go to chesspenguin.log, CP_LOG_FRAMES=1
traces egui_wgpu frames (the GNOME hang hunt); dev hooks CP_OWN, CP_PASTE,
CP_COMMENT, CP_KEYS with Ctrl+, CP_SETTINGS=interface.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 00:46:47 +03:00
vrubelroman
b6024e9bdd Tasks: is the quick search needed beside the filters?
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-24 23:46:58 +03:00
vrubelroman
74976c8a5c Design: own databases — new base, add to base, save, delete, game data
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 Fable 5.1 <noreply@anthropic.com>
2026-10-24 23:22:12 +03:00
vrubelroman
3ed8868860 Research: own databases (create, add, save) — ChessBase cases, requirements, open 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
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-24 22:59:19 +03:00
vrubelroman
33b3a47ea8 Tasks: 6 dropped, 7 postponed, 1 in progress
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-24 21:05:54 +03:00
vrubelroman
5909f98518 Tasks: other engines dropped (Lc0 research)
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-24 21:02:12 +03:00
vrubelroman
ae80a2c5fd Research: Lc0 builds, backends, networks for a second engine
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-24 21:00:40 +03:00
vrubelroman
3c05160c4b Tasks: a user's ideas (AI coach, more engines, analysis styles) and iOS
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-24 20:37:58 +03:00
vrubelroman
7fbe596ecc AUR PKGBUILD for chesspenguin-bin 1.0.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-24 15:33:01 +03:00
vrubelroman
584089e0bd ChessPenguin 1.0.3
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-24 15:21:46 +03:00
vrubelroman
ed0e3b1fe1 A new icon everywhere: the penguin in a crown (icons/icon2.png)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
packaging/icons/make-icons.sh makes every icon from one picture: the Linux hicolor PNGs
(the macOS .icns and the packages take them), the window icon, the Windows .ico, the
Android adaptive foreground (62 % of the 108 dp canvas) and a solid monochrome one for
themed icons, the site's tab, header and iOS icons. The site's link preview takes the
transparent icon and names Android too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 15:20:01 +03:00
vrubelroman
e54fb74c45 Tasks: Android screenshots on the site for Android visitors
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-24 15:06:39 +03:00
vrubelroman
050657f14b AUR PKGBUILD for chesspenguin-bin 1.0.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-24 15:01:00 +03:00
vrubelroman
75692ede4d Site: the big clouds are machines, not people
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 Windows installation 'in Cheyenne' right after a release is Microsoft's scanner running
the new program in Azure. The DB-IP Lite ASN database (fetched like the city one) tells
the networks of Microsoft, Amazon, Google, Oracle, Alibaba, Tencent and IBM apart: their
launches are not counted or announced, their downloads and visits count as crawlers.
Small hostings are left alone: people's VPNs run on them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 14:58:38 +03:00
vrubelroman
7bf4d58cbf Tasks: SEO of the site
Some checks are pending
CI / macos-build (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / check (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 14:53:10 +03:00
vrubelroman
501e627d0e ChessPenguin 1.0.2
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 / 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-24 14:49:51 +03:00
vrubelroman
bb329ba17d Android: the update offer without GitHub; × stops the offers until 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
The card on Databases: the new version, «you have …», one button and ×. × turns
«Offer new versions» off (a snackbar says where to turn it on, with Undo); the update
check and the installation counting go on. Settings → About: «Offer new versions» above
«Check for updates at start»; a new version is shown and installable there regardless.
'What's new' (GitHub, English) is gone from the card, the sheet, About and the
after-update snackbar; the old per-version hiding is dropped (android-ui.md §25, §28).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 14:47:42 +03:00
vrubelroman
c3003068d0 Tasks list (internal): the owner's tasks, ideas and bugs; first: GNOME hang
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-24 14:43:53 +03:00
vrubelroman
37c98e439f Site stats: people only, one story from the main numbers down
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
- Main numbers: site visitors, downloads, new and running installations — today, 7 and
  30 days, all time. Nothing about what was left out.
- Two 30-day charts: the site (visitors, downloads), the programs (installations that
  ran, new ones).
- Platforms: one row per family (Windows, macOS, Linux, Android) with downloads and
  installations, the variants under it; no separate Android and installations tables.
- Versions in use, countries and cities, where visitors came from, page languages.
- Latest events: downloads by people and new installations, in one list.
- Grids and day labels fit a phone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 14:32:59 +03:00
vrubelroman
a1403d04b0 Site: notices name the city too; the privacy line says cities are counted
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-24 14:26:51 +03:00
vrubelroman
0305b3b04b AUR PKGBUILD for chesspenguin-bin 1.0.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-24 14:22:41 +03:00
vrubelroman
ca4939f6fd ChessPenguin 1.0.1
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 / 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-24 14:09:27 +03:00
vrubelroman
df2ee6f528 Installation counter after review: strict input, limits, country only, GitHub outages
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
- /api/update takes a 32-hex id, an x.y.z version and a known platform; at most 5 new
  installations a day per address are counted (made-up ids do not flood the bot).
- A download's notice: once a day per file and visitor; notices name the country only,
  as the texts promise; Android's text also says the system is sent.
- The release cache is not locked while GitHub is asked (one request asks, the others
  get what is known); after a failure GitHub is asked again in a minute, not on every
  request.
- An unrecognised desktop installation counts as 'other'; the bot logs a wrong token or a
  second listener; .env.example lists the bot's settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 14:08:05 +03:00
vrubelroman
d15989bff1 Site: notices to the owner's Telegram bot and /stat
Downloads by people, new installations, updates and a day's first run of an installation
go to the owner's chat; /stat answers with today and all time (downloads, installations,
active in 7 and 30 days, by platform). Installations are numbered in the order they first
ran (installs table). Configured with TELEGRAM_TOKEN and TELEGRAM_CHAT; off without them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:57:07 +03:00
vrubelroman
a87d3e9f44 Site: clippy
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:45:20 +03:00
vrubelroman
1edbbda368 Count installations that run: the update check goes through the site
The programs (desktop, Android) ask https://chess.vrubel.xyz/api/update for the latest
release instead of GitHub, with a random id of the installation (made once, kept in the
settings), the version and the platform; the site passes GitHub's answer on and keeps one
row per installation and day (no IP; the country of the address). Without the site the
programs ask GitHub, uncounted; with the update check off nothing is sent. /stats shows
installations that ran today, in 7 and 30 days, in all and new ones, by platform and
version. The texts about the update check and the site's privacy line say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:45:15 +03:00
vrubelroman
04bd7c08a1 AUR PKGBUILD for chesspenguin-bin 1.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-24 13:30:50 +03:00
vrubelroman
559ea1b7b8 ChessPenguin 1.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 / 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-24 13:16:20 +03:00
vrubelroman
cb13453e22 Android: player layout after review — fonts, studies, scroll, title
- List rows grow with the font scale (fixed heights cut letters at 1.3); a study's or a
  book's title starts on the first line and is read as the title.
- Notation keeps the current move a third down what is visible, whole even beside the
  board with the engine on (only two or three rows there).
- Top bar: no event or site — the database's name; 'round' in lower case; the whole
  title space opens the game's details.
- The winner's 1 in medium weight; TalkBack reads ratings as Elo and the result in words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:03:29 +03:00
vrubelroman
7c383f6c93 Android: players above and below the board; White and Black on lines of their own
The game screen's top bar had both names on one line beside three buttons, so Black's
was cut; the games list split one line between them. Now (android-ui.md §6.2, §7.7, §7.11):
the player bars stand above and below the board (Black above, swapped with the board;
beside it in landscape), each with the side's disc, the name in full while it fits, the
rating and the share of the result; the top bar names the event, year and round, a tap
shows the game's details. List rows are 80 dp: White, Black, then event · year · ECO,
read by TalkBack as one sentence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 12:52:06 +03:00
vrubelroman
9734108b83 Portuguese (Brazil), Uzbek (Latin) and Kazakh (Cyrillic) on the desktop, Android and the site
Nine interface languages. The system's language is picked up; Portuguese notation has its
own piece letters (R D T B C), Uzbek and Kazakh keep the Latin ones (the 'letters of
the language' choice is not offered for them). Uzbek o'/g' are written with U+2018 on
the desktop, whose font has no U+02BB. Comment translation targets the new languages too.
The shelf's two side cards widen for a longer label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 12:48:03 +03:00
vrubelroman
0594e819d2 Site stats: download times in the server's zone (МСК), like the days
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-24 12:04:33 +03:00
vrubelroman
78ef78fda1 Site: no «free and open source» line; recent downloads without bots, long cells wrap
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-24 11:58:22 +03:00
vrubelroman
8b0d68f480 AUR PKGBUILD for chesspenguin-bin 0.16.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-24 11:05:08 +03:00
vrubelroman
d1e15928e9 ChessPenguin 0.16.2
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 / 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-24 10:51:43 +03:00
vrubelroman
38841574fb Desktop: narrow windows after testing — Escape and the filters over the list
- The library's Escape waits while a window is open over it (settings, notes); on the
  board alone it first puts back a picked-up piece.
- A condition's chip clicked with the filters over the list keeps them open; widening
  the window with them open over the board alone keeps the board.
- The list's header leaves the database's name out before taking a second line.
- The report's long names wrap in a narrow panel.
- In the 'Game modified' question Escape is Cancel when quitting the program.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 10:39:38 +03:00
vrubelroman
c17f5bc1cb Desktop: narrow side panel polish (designer review)
- The engine row: the name and depth go under the row when they do not fit beside the
  evaluation (⚙ covered them in a 240 pt panel); alone, the name is centred.
- Stacked: the notation part grows by the engine's lines and settings.
- The toolbar wraps a group at a time, without a separator at a row's end.
- A move's cell is at most 160 pt (the notation under the board).
- The filters over the list cast their shadow to the left; the counter on a line of its
  own loses its leading dot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 10:34:20 +03:00
vrubelroman
4ebb1bb683 Desktop: the library in a narrow window — filters over the list, the board in its place
By the window's width alone (docs/design/narrow-windows.md §2): when the list would get
less than its least width beside them, the filters open over it (Esc, a click elsewhere
or the segment closes them) and the search board takes the list's place (Esc, the
segment or the counter go back). The header of the list is measured from its texts and
takes a second line when needed; the shelf folds into one line when its cards need more
than two rows or the window is low, its buttons showing icons when narrow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 10:19:59 +03:00
vrubelroman
0a2c924bfa Desktop: a narrow tall window stacks the notation under the board; least sizes
The game screen is side by side or stacked by the window's size alone (stacked when the
board would be at least 1.25 times bigger so). The side panel never leaves the board
under 220 pt; the window's least size is 640×480 (docs/design/narrow-windows.md §3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 10:14:10 +03:00
vrubelroman
f65668c0b7 Desktop: side panel content fits its panel (reference tab, engine settings, game header)
- Reference tab: the database box's text was shortened to the whole row (a wrapping row
  reports it as available), and an 8 pt gap stuck out at the end of a full row; the
  result bar was never given up. The content was 51 pt wider than the 320 pt panel, and
  egui moved the panel left, under the board, from a 1200 pt window down.
- Engine settings: the slider gets what the measured names and values leave; under
  100 pt the name and value share a line above a slider across the panel.
- Game header: the buttons are measured first; the title gets the rest and is shortened,
  the result always shows; under 160 pt for the title the buttons show icons.
- CP_PANEL_CHECK=1 reports a side panel wider than its place (a debug build also marks
  what widened it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 10:12:10 +03:00
vrubelroman
b265e32da3 AUR PKGBUILD for chesspenguin-bin 0.16.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-24 00:56:22 +03:00
vrubelroman
8714e012f9 ChessPenguin 0.16.1
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 / 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-24 00:45:04 +03:00
vrubelroman
e68f4ecbc1 Desktop: the filter panel keeps its width while one types; the Game group on one grid
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 text field keeps the place of its × (22 pt and a 4 pt gap) whether shown or not: the
  row stuck out 4 pt once there was text, egui's side panel widened to it, the field grew
  again… up to the panel's largest width.
- The colours row wraps (long words in French); a name field's «=» is on its caption's
  line, so the field does not move when a name is picked.
- «Game»: Years, Elo, Moves, ECO on one grid — captions in a column as wide as the
  longest, «from – to» and Elo with its rule in equal halves, one right edge; Result
  after them (docs/design/large-databases.md §2.6).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 00:43:21 +03:00
vrubelroman
a3541ed1d4 Desktop: Escape in a modified game asks about saving; Escape in the question leaves
The game's Escape is taken when it leaves: the question about unsaved edits, opened in
the same frame, read the same key as its own Escape and closed at once, so Escape seemed
to do nothing in a modified game. In the question Escape now goes on without saving (the
owner's choice); Cancel stays to keep editing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 00:37:34 +03:00
vrubelroman
ff6c966953 AUR PKGBUILD for chesspenguin-bin 0.16.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-24 00:09:26 +03:00
vrubelroman
a00575009d ChessPenguin 0.16.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 / 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-23 23:57:54 +03:00
vrubelroman
35ab12999a Desktop: tester's review of the unified view
- Guiding texts of a converted ChessBase database are texts again (§9.4): the converter
  marks them (CbText), the list shows «📄 title», the header counts them, «show texts»
  is offered, a text is no player and only tournament and annotator conditions keep it.
- The PGN filters' index is built in the loading thread, not on the screen's.
- Empty names last when sorting both ways (PGN and ChessBase).
- The quick search finds a date as the table shows it (18.10.2026).
- A position not applied for lack of memory: the arrow shows the order in effect.
- «21 текст», «3 текста»: plural forms of games and texts in the header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 23:57:11 +03:00
vrubelroman
bd1daef951 Desktop: design review of the unified view
- A position not applied for lack of memory: the list in the view's own order (not
  strongest first) and the counter of the filters only.
- The header shortens the database's name before the counter; the quick search keeps
  the place of its × so it does not move on the first letter.
- Each set of table columns keeps its own widths (no stale widths after a resize).
- «Рез.» in the header, «Сбросить поиск» when only the search is set, «нет Эло»,
  «ходов: N» and «тур 1.1» in a row's tooltip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 23:46:36 +03:00
vrubelroman
8c8a723eee Desktop: CP_SEARCH sets the quick search at start (screenshots)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 23:39:46 +03:00
vrubelroman
29ffff3de9 Desktop: the filters and position search of ChessBase for every database
- chess-import pgn_catalog: the tags of a PGN as ChessBase's filters, sorting and name
  suggestions (tournament «Event (place) year», dates with any separator, rating, ECO,
  length counted when there is no PlyCount, comments without clock marks); the quick
  search (Filter::text) for PGN and ChessBase, ё folded as е; which fields a database
  has. The PGN scan counts main-line and all moves and real comments; the position
  table's memory is reckoned from the moves.
- Desktop: one view for all databases (large_db.rs): the PGN table and its small board
  are gone; the quick search in the header with its chip, Ctrl+F twice to the filters;
  downloaded databases sorted newest first by date; texts' checkbox only where there are
  texts; an empty result says which field no game has; position search without memory
  says so on the board and its chip; a reread keeps the conditions.
- Bench: the quick search on a large base.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 23:39:31 +03:00
vrubelroman
e8deec7b27 Downloaded games newest first on the desktop too; the games list counts a download as it goes
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
- Desktop: in a database from Lichess and Chess.com the «№» order is the time the games
  were played, the most recent first (as on the phone); a click turns it around.
- chess-core GameEntry::played_at: the shared key (UTCDate+UTCTime, else Date).
- Android: over a downloaded database's games list the number of games grows with its
  download (it stood still until the end), as on the list of databases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 23:08:40 +03:00
vrubelroman
44e8d5b763 AUR PKGBUILD for chesspenguin-bin 0.15.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-23 18:57:14 +03:00
vrubelroman
03b04f6433 ChessPenguin 0.15.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 / 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-23 18:42:37 +03:00
vrubelroman
7f23bca320 Android: the app updates itself; one release check for the desktop and the phone
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
- crates/releases: the latest release on GitHub, its files and SHA-256 sums, shared by
  the desktop updater and the phone (desktop update.rs keeps its installers).
- mobile-api check_release: a newer release with its APKs and sums; a desktop-only
  release is no update, one without the light APK's sum cannot be checked.
- Android (android-ui.md §25): a check at start and on return once a day (switch and
  «Check now» in About), a card over the databases, a sheet through the install
  permission, the download (DownloadManager), the SHA-256, the full build keeping its
  engine network, and PackageInstaller; the state survives restarts, the update's
  snackbar waits for a screen. Network state permission for both builds (the full one
  crashed without it). Debug builds may ask a test server (CP_UPDATE_API).
- Release notes on GitHub come from this version's CHANGELOG section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:42:27 +03:00
vrubelroman
136f5320a8 AUR PKGBUILD for chesspenguin-bin 0.14.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-23 17:06:58 +03:00
vrubelroman
96907edd26 ChessPenguin 0.14.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-23 16:55:11 +03:00
vrubelroman
f6072cb7c3 Android: games from Lichess and Chess.com, newest first, with «Download new games»
The downloads of the desktop (lookup by nickname, one database per site or both in one,
resuming without duplicates, games still being played fetched once they end) move into a
shared crate, online-games; the desktop keeps its window on top of it.

On Android, «Add a database» → «Games from Lichess and Chess.com»: a nickname, what each
site has, the download with its progress. It belongs to the app, not to the screen: the
list of databases shows how it goes and says how it ended. «Download new games» in the
database's menu and over its games list fetches only the new ones. The games of a
downloaded database are listed from the most recent one (by UTC date and time, both sites
interleaved). Both builds may now use the internet, only when the user asks.

Reviewed by an independent tester and designer (docs/design/android-ui.md §23, §24).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:37:16 +03:00
vrubelroman
0ca444ed8d Android: the system bars follow the app's theme, not the phone's
enableEdgeToEdge() picks the bar icons from the system's night mode, so the dark theme
of the app on a light phone left dark icons on a dark bar. The bars are set again with
the theme chosen in the app whenever it changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 14:44:59 +03:00
vrubelroman
b88e339f0b AUR PKGBUILD for chesspenguin-bin 0.13.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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 14:44:49 +03:00
vrubelroman
a302723e56 ChessPenguin 0.13.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-23 14:21:38 +03:00
vrubelroman
1661e238d8 Android: game report — mistakes, blunders and accuracy, as on the desktop
The game analysis of the desktop (evaluations of the main line, judgements, accuracy,
cache and the engine job) moves into a shared crate, game-review, so both apps give the
same numbers. The desktop uses it unchanged in behaviour.

On Android, ⋮ → «Game analysis» runs Stockfish over the main line in its own process
(the live engine waits): an evaluation graph and a status row between the board and the
notation, marks in the notation, the better line of an error on the board, a report sheet
with both players side by side. Games with [%eval] and games analysed before show their
report at once. The analysis stops with the screen and goes on after it, also after the
phone is turned, and is cached as it goes.

Reviewed by an independent tester and designer (docs/design/android-ui.md §21, §22).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 14:10:58 +03:00
vrubelroman
7fcc75c7af AUR PKGBUILD for chesspenguin-bin 0.12.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-23 02:22:47 +03:00
vrubelroman
721c43f38d Notes for continuing the work on another machine
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-23 02:17:34 +03:00
vrubelroman
18badad70f ChessPenguin 0.12.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-23 02:08:54 +03:00
vrubelroman
7d77a1aaef Android: paste PGN, open files from other apps, a calmer screen while the engine thinks
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: «Add a database» offers the clipboard's games when it holds text; they are kept
  in the app as a copy (one game opens on the board). Text with no game is said so.
- Open with / Share: PGN, ZIP, 7z, .cbv from other apps are copied in, listed and opened;
  one copy at a time, the last one shown; not again from Recents; a lone .cbh says to
  add its folder. A copy is marked «copy» and removing it deletes it.
- Engine: the button turns it off again; its words reach the screen up to 5 times a
  second and redraw only the strip and the arrows; Stockfish runs at nice 10 (uci
  EngineConfig::nice) with 2 threads by default.
- PGN scan: tags right after a result on the same line start the next game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 02:06:08 +03:00
vrubelroman
cb61f546ba Android: the engine button turns the engine off again
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 button kept toggleEngine as it was when the screen was first drawn, so it
saw the engine off forever; the function now reads the states when pressed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 01:10:10 +03:00
vrubelroman
f8c2f11e46 AUR PKGBUILD for chesspenguin-bin 0.11.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-23 00:58:44 +03:00
vrubelroman
d13147079e Site: the Android button offers the build without Stockfish first
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-23 00:33:33 +03:00
vrubelroman
7002731346 ChessPenguin 0.11.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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 00:31:20 +03:00
vrubelroman
3a08ac05c9 Android: boards and pieces, game numbers, the engine only on the button; fix the download's space 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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 00:27:48 +03:00
vrubelroman
028f82a846 AUR PKGBUILD for chesspenguin-bin 0.11.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-22 22:52:32 +03:00
vrubelroman
864afc0a1d ChessPenguin 0.11.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-22 22:39:58 +03:00
vrubelroman
a8978c765b Android: add a folder — every database in it, ChessBase databases (.cbh) too
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
«Добавить базу» offers a file or a folder. A folder is looked through two levels down;
the databases found are offered with tick boxes: PGN, archives, .cbv and ChessBase sets
(.cbh with the files beside it, names in any case), each a separate entry. A .cbv beside
its own set is not offered twice, a set without its .cbg is shown but not added, and
databases already on the list (also picked as a file) are marked. The folder's read
permission is kept while one of its databases is on the list or can still be restored
with Undo, and access no entry uses is given back at start. A moved file or a missing
.cbg is said in plain words. Reviewed by the designer and the tester.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 22:27:14 +03:00
vrubelroman
356384b13e Site: the Android button's texts reach the page; platform links show the download heading
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 page script gets only the texts listed in CLIENT_KEYS; the Android ones were missing,
so a phone saw "btn_android". A test now checks every text the script uses. A link to a
platform (Android, Linux…) scrolls to the start of the download section instead of the
panel under its tabs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 22:20:26 +03:00
vrubelroman
ba00887cc2 Site: downloads go straight to the file; Android in the stats
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 phone with the GitHub app asks to open github.com links in it; the server now asks
GitHub where the release file is and sends the browser there (the usual link when
GitHub does not answer). Stats: the Android share in the summary, both builds with the
downloads left out of the counts, readable names of the files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 21:00:07 +03:00
vrubelroman
b05c4988d8 AUR PKGBUILD for chesspenguin-bin 0.10.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-22 20:42:18 +03:00
vrubelroman
29ded2f55f Desktop: ↑ to the end, ↓ to the start, Escape leaves the 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
Variations move to Shift+↑/↓. Escape cancels a preview or a picked-up piece first, then
returns to the previous game or the library; a window, menu or dialog open over the game
(this frame or the last) keeps the key. CP_KEYS presses keys for manual checks.
Also drops an empty database of a local site run committed by mistake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 19:57:53 +03:00
vrubelroman
3cb6730692 Android: the engine's download through the system, four more languages, a themed icon
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 / 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
The network is downloaded by DownloadManager: it goes on with the app closed, waits for
the network and shows a notification; the app picks the finished download up, checks its
SHA-256 and moves it in. German, French, Spanish and Italian, as on the site. A monochrome
layer for themed icons. UniFFI's Android mode picks the cleaner by the API level.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:16:36 +03:00
vrubelroman
403880c03d ChessPenguin 0.10.0: the Android app as an 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 site, the READMEs and the app's About screen call the Android app an alpha.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:06:10 +03:00
vrubelroman
7eac8db29a Android: fixes from the tester's report
- An old evaluation never shows for a new position, not even for a frame:
  every snapshot carries its position and the screen compares it with the
  board; the engine handle is held for 40 ms at most.
- Turning the engine off while it starts no longer leaves a Stockfish process
  behind (generations in EngineSession).
- Landscape: the board on the left, the notation, engine and buttons beside it.
- "Undo" after removing a database keeps the access to its file; picking a
  file again restores the access.
- After Android restarts the app the same game comes back (the search is kept).
- Mate and stalemate are named instead of waiting for the engine.
- The download sheet shows progress and "Cancel" at once; a cancelled download
  stops reading and never writes the file together with the next one.
- Plain error texts with "Remove from list"; evaluations rounded ("+0.5",
  "0.0", "#−2"); search results start at the top; tag names translated;
  "PGN copied" / "FEN copied".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 02:44:40 +03:00
vrubelroman
305fff20b6 Android: the language setting, TalkBack moves, sample names in the current language
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 01:59:17 +03:00
vrubelroman
de5ca02a82 Android: design review fixes, icon, signed releases, the site's Android downloads
- The design review (docs/design/android-ui.md §17): the move buttons in the
  bottom bar (snackbars above them), ripple on press, larger ◀ ▶, coordinates
  over the pieces, readable NAG colors in the light theme, 16 dp edges, the
  ⋮ menu (game details, copy PGN/FEN, share), "Deeper" next to ▾, TalkBack
  states, no "*" for unfinished games, "Found N of M", texts.
- The penguin as the adaptive icon and on the splash screen; dark window.
- Release builds: R8, signing from the environment, androidApp/scripts/release.sh
  (two APKs, apksigner and 16 KB alignment checks); the release workflow builds
  them from the repository secrets.
- Website: the Android tab with both APKs, "Download for Android" on phones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 01:57:03 +03:00
vrubelroman
68fcabd691 Android stage 1: databases, games, the game viewer and the engine
androidApp/: Kotlin + Jetpack Compose over the Rust core (mobile-api, UniFFI).
- Databases: the desktop samples on the list from the first start, files added
  with the system picker and read in place, rename, remove with undo.
- Games: a paged list with a search by players, event, site and date.
- Game: the green board with Merida pieces, the notation as on the desktop
  (variations, comments, NAG), forks, paging games, hold-to-repeat steps,
  comment arrows and squares, the check glow, Latin/figurine/local notation.
- Engine: Stockfish 19 built from the pinned source (scripts/stockfish.sh) and
  run from nativeLibraryDir through the uci crate. Two builds: "full" with the
  network inside, "light" downloading it on request (resume, SHA-256 check).
  The time per position, lines, line preview on the board; the engine quits
  when the screen goes away.
- Settings and About with the licenses.

mobile-api: game search, UCI moves and comment marks for nodes, the Analyzer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 01:40:37 +03:00
vrubelroman
0c912ac669 Android stage 0: the core opens databases without paths; the mobile-api bridge
chess-import opens a database from its content (PGN, zip, 7z, cbv) and a
ChessBase database from the contents of its files: Android hands over file
descriptors, not paths. The text of comments as shown moves to chess-core
(comment_display_text), so the phone and the desktop show the same.

crates/mobile-api: a thin UniFFI bridge — open a database from a descriptor, a
ChessBase folder's files, or a path (tests); game rows a page at a time; a game
as a tree of moves with positions, last-move squares, NAGs and comments. It
builds for arm64-v8a and x86_64 with cargo-ndk (NDK r30, API 31) and its Kotlin
bindings generate with `cargo run -p mobile-api --features bindgen --bin
uniffi-bindgen`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 00:43:54 +03:00
vrubelroman
985b877063 Android app: the owner's answers on theme, board and build labels
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 00:34:26 +03:00
vrubelroman
a075499c0c Android app: interface spec revised (Android 12+, two APKs, look and feel)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 00:31:26 +03:00
vrubelroman
5435197c1e Android app: stack research, interface design, the owner's decisions
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 00:22:29 +03:00
vrubelroman
5bff9b8535 AUR PKGBUILD for chesspenguin-bin 0.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-22 00:05:29 +03:00
vrubelroman
92099a8b2f ChessPenguin 0.9.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 / 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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 23:54:34 +03:00
vrubelroman
005601afb2 Website: new features and fresh screenshots; no missing glyphs in the app
The site lists the reference tab, games from Lichess and Chess.com, translated
comments and self-update, and the notation and animation under "Make it
yours", in six languages. Thirteen screenshots (three new: reference,
translation, online games) on the owner's green board with Merida pieces, the
"looks" one on another board. The translation shot shows a real ChatGPT
translation of our own German comments to Reti-Tartakower 1910, put into the
screenshot cache once (shots/translate-for-shots.py); the shots send nothing.

The app: "✕" next to the Chess.com nickname, "⌂" in board search and "✓" in
translation texts had no glyph (empty boxes): replaced by the bundled 🗙, 🏠
and ✔. A test now checks every character of the translations and the string
literals against the character maps of the bundled fonts. The online games dev
hook takes two nicknames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 23:47:14 +03:00
vrubelroman
6e8420a45c AUR PKGBUILD for chesspenguin-bin 0.8.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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 23:10:05 +03:00
vrubelroman
f7a51c3ecb ChessPenguin 0.8.6: a steady side panel, even comment sizes, no scroll bar over engine lines
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 / 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
The translation mark sat in a row with its comment, the row's width computed by
subtraction; rounding made it a pixel wider than the panel and the resizable
panel grew every frame (moves in comments jumped while the mouse moved). The
mark is now painted in the comment's corner, outside the layout, with room
kept by the frame's margin. Comments in variations use the comment size.
Engine lines keep their horizontal scroll without a visible bar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 23:00:20 +03:00
vrubelroman
758d304125 Translation: no count for a game sent in one request
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 count jumped from 0 to all; it stays for long games sent in parts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 22:33:52 +03:00
vrubelroman
3fd98b40da ChessPenguin 0.8.5: translation with a ChatGPT subscription works
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 / 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
The plan's /v1/models answers {"models": [{"slug", "visibility", "priority"}]},
not the API's {"data": [{"id"}]}: no model was found and requests went out
with an empty model (HTTP 400). Both shapes are read now and OpenAI's preferred
chat model is taken; a job without a model picks one itself. Check failures
show in Settings › Translation; translation errors go to chesspenguin.log. The
offer starts at a sentence or two of foreign text, and text in brackets is
translated (only [%…] commands are kept, and they never reach the model).

Verified with the owner's subscription: models listed, French comments
translated into Russian with their moves intact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 22:33:08 +03:00
vrubelroman
2d732e52f9 AUR PKGBUILD for chesspenguin-bin 0.8.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-21 21:30:46 +03:00
vrubelroman
5d9960e960 ChessPenguin 0.8.4: translated comments, move notation, piece animation
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 / publish (push) Has been cancelled
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:19:54 +03:00
vrubelroman
d92d93fc14 Move notation: Latin letters, figurines or the interface language's letters
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Settings › Board & pieces: Nf3, ♘f3 as on Lichess, or Кр Ф Л С К (German
K D T L S, French R D T F C, Spanish and Italian R D T A C; in English the
Latin letters), with a sample per option and a line of a game. Only the shown
label changes (san::show): the game, PGN, copied games, the analysis written
into a game, the reference cache and every comparison stay Latin SAN. Applied
in the move list, engine lines, the reference tab, board search and the
analysis report. The figurines are egui's chess glyphs cut out to a 4.7 KB
font, a little smaller and on the baseline. Latin remains the default.

Reviewed by the designer and the tester agents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:18:53 +03:00
vrubelroman
1d901b61ff Translation of game comments
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
When a game's comments are in another language, ChessPenguin offers to translate
them into the reader's: with the ChatGPT Plus/Pro subscription (Sign in with
ChatGPT: OAuth with PKCE in the browser, a loopback callback, tokens refreshed
one at a time), or an OpenAI-compatible API key (DeepSeek, OpenAI, Gemini, a
model on this computer with Ollama or LM Studio, another address). After the
first consent, games in other languages are translated as they are opened;
[Original | Translation] (Ctrl+Shift+T) switches back.

Only comment text is sent; the model gets strict instructions and a glossary,
and every answer must keep the moves and squares of the original, or the
comment stays in the original with a mark. Translations are never written to
the PGN; a cache keeps them per language. Keys and tokens live in a 0600 file
apart from the settings. Settings › Translation holds the target language,
when to translate, the connection, permissions and the cache.

Also: the monospace font and three glyphs of Noto Sans Math are text fallbacks,
so arrows and the evaluation signs ⩲ ⩱ ⌓ no longer show as boxes.

Reviewed by the designer and the tester agents (two rounds).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:03:03 +03:00
vrubelroman
cbf76d6909 Design: translation — the owner's decisions
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-21 20:09:38 +03:00
vrubelroman
02c14ae712 Design: translating game annotations (proposal, after the designer's review)
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-21 20:02:05 +03:00
vrubelroman
59dee878d6 AUR PKGBUILD for chesspenguin-bin 0.8.2
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-21 20:00:55 +03:00
vrubelroman
d250ddf2cc Piece animation, as on Lichess
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 move slides with chessground's easing: each piece of the new position slides
from the nearest square that held the same piece, a piece left over fades out,
so castling moves king and rook and a jump over several moves slides each piece
once. Settings → Board: Off, Fast 120 ms, Normal 250 ms (default), Slow 500 ms.
A piece dropped by dragging does not slide (the castling rook still does);
picking up a piece in flight takes it from its square.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 19:57:54 +03:00
vrubelroman
c7a8f0d453 ChessPenguin 0.8.2: graphics fallbacks on Windows, an empty nickname in the online window
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 / publish (push) Has been cancelled
Release / linux (push) Has been cancelled
Release / flatpak (push) Has been cancelled
Release / windows (push) Has been cancelled
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 19:51:05 +03:00
vrubelroman
5f9ad28b6d CI: show the Windows start log as annotations
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-21 19:27:41 +03:00
vrubelroman
16b7572d57 Windows: graphics fallbacks, a visible start error, the C runtime inside the exe
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 Windows 10 user saw the program quit silently after SmartScreen: a Windows
program has no console, so a failed graphics start left no trace. A start that
fails or dies before its first frame now tries again without Vulkan, with
OpenGL, then with software drawing (WARP), and keeps the mode that worked; what
no mode overcomes, and any panic, goes to a message box and chesspenguin.log.
The C runtime is linked statically (no VCRUNTIME140.dll needed); CI checks that
and starts the window on the GPU-less Windows runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 19:15:21 +03:00
vrubelroman
5f7e0f5178 Online games: the window opens with an empty nickname, ready to type
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 last nickname was put back each time, to be erased before searching for
another player; the databases already downloaded update with "⟳ New games".
The nickname is no longer kept in the settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 21:59:00 +03:00
vrubelroman
7b0cd27507 Site: a reload no longer jumps back to the download section
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
After a jump to an anchor (a download badge, a menu link) the anchor is
dropped from the address, so a reload keeps the place the visitor scrolled to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 20:41:34 +03:00
vrubelroman
a773d73208 AUR PKGBUILD for chesspenguin-bin 0.8.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-20 19:55:11 +03:00
vrubelroman
43458c5ab7 ChessPenguin 0.8.1: the side panel fits small screens
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 / 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
The reference tab no longer slides under the board on a laptop screen with
200 % scaling: the games table narrows its player columns to the panel, the
moves table shows a column only while it fits, its heading lines wrap, and the
board gives way in a tall narrow window so the reference keeps 320 px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 19:43:58 +03:00
vrubelroman
ec8b794abe publish-github.sh: do not stop silently when main is the only branch
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-20 09:12:11 +03:00
vrubelroman
33b3125556 AUR PKGBUILD for chesspenguin-bin 0.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-20 09:11:34 +03:00
vrubelroman
98183f9ffe Merge feature/online-games: games from Lichess and Chess.com (0.8.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 / 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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 08:50:18 +03:00
vrubelroman
d0846daf9b ChessPenguin 0.8.0: games from Lichess and Chess.com
Pending Lichess games are asked about by id; broken connections are retried with waits;
a file lock keeps two running ChessPenguins from writing one database.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 08:50:18 +03:00
vrubelroman
e0c99074e2 Online games: anyone's games, one download per database, crash-safe resume, unfinished Lichess games, friendly errors, progress per site
- the window and the shelf speak of any player's games (yours, a pupil's, an opponent's)
- a database is claimed by one download at a time; updates write into the database itself
- merged databases of different nicknames get names of their own
- the state remembers the file length and its last bytes: what a crash appended is cut off
- a deleted database is downloaded again; a partial download goes on the shelf
- Lichess games still being played are fetched once they end (correspondence)
- downloads stop and save on quitting; results show as a toast when the window is closed
- New games button with the time of the last download, disabled offline; 🌐 on online databases

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 08:30:31 +03:00
vrubelroman
68a17acd4e AUR PKGBUILD for chesspenguin-bin 0.7.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-20 08:17:06 +03:00
vrubelroman
79a1a43423 Merge main (0.7.1) into feature/online-games
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 08:03:26 +03:00
vrubelroman
149699f70f Online games: one database for both sites (several accounts per database), live test of it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 08:02:12 +03:00
vrubelroman
9a5871d0b0 CI: quote the update test commands (a trailing colon broke the YAML)
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 / 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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 07:57:35 +03:00
vrubelroman
8c3ed18b12 ChessPenguin 0.7.1: updates
The newest release is checked at start; a button next to Settings offers it. The Windows
zip, the AppImage and the Linux archive replace themselves (checksum-checked) and restart;
macOS opens the disk image; packages are downloaded with the command that installs them.
Reviewed by independent tester and designer agents; their findings fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 07:55:59 +03:00
vrubelroman
3e8377dba7 Merge main (0.7.0) into feature/online-games
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 00:25:15 +03:00
vrubelroman
b4621bc077 AUR PKGBUILD for chesspenguin-bin 0.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-20 00:23:34 +03:00
vrubelroman
d670d63bcc publish-github.sh: publish main and tags only (work-in-progress branches stay on Forgejo)
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-20 00:12:14 +03:00
vrubelroman
eb923234af ChessPenguin 0.7.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 / 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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 00:11:36 +03:00
vrubelroman
24326abeb4 Game view: the board always keeps the full height (side panel capped); Справочник: novelty and copy on the database line
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 00:04:13 +03:00
vrubelroman
5d6a73aff5 Справочник: "Without moves" in the start position, no "comparing" text
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 23:54:48 +03:00
vrubelroman
6b1523b1b9 Справочник: novelty instead of "known up to", "Game over" row, whole rows clickable, leaving asks about each modified game; no second Stockfish offer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 23:48:02 +03:00
vrubelroman
3f16ba50fe Справочник (Reference) tab: moves and games of the current position in a shelf database
Two tables (moves with statistics; strongest/newest games with how they went on), theory
of the game and its copies in the database, a stack of games opened from it with no lost
edits, background work cancellable. Reviewed by independent designer and tester agents;
their findings fixed and re-verified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 23:20:37 +03:00
vrubelroman
d3c87ae269 Games from Lichess and Chess.com by nickname (feature branch, not released)
Probe of both public APIs at start (hidden when offline or changed), lookup, download
into a database per platform with resumable updates, window and shelf card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 21:10:22 +03:00
vrubelroman
7f62369dea AUR PKGBUILD for chesspenguin-bin 0.6.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 Fable 5.1 <noreply@anthropic.com>
2026-10-19 19:59:35 +03:00
vrubelroman
e11e09aa18 ChessPenguin 0.6.3
Some checks failed
CI / macos-build (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / check (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 / publish (push) Has been cancelled
Opening index: games from a set-up position are left to the pass; exact preparation
progress; quiet import notes; clearer preparation text; randomized Mega test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 19:48:14 +03:00
vrubelroman
4b92fa32de Opening index for large ChessBase bases (first 10 moves, built with the booster, loaded when memory allows); memory guard for big PGN position tables; CP_MEMORY_LIMIT
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-19 19:24:15 +03:00
vrubelroman
1506ebdf26 chesspenguin --bench: timings of a database on this machine; memory probe via sysinfo
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-19 19:07:47 +03:00
vrubelroman
a7d9d599aa Large ChessBase bases: our own search booster when .cbb is missing or stale; skip the booster for early positions
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-19 18:54:22 +03:00
vrubelroman
c66117e387 Email: copy the address instead of a bare mailto link; drop the checksum how-to from the site
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:34:38 +03:00
vrubelroman
e50c117f56 AUR PKGBUILD for chesspenguin-bin 0.6.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-19 15:58:43 +03:00
vrubelroman
518b036e68 ChessPenguin 0.6.2
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 / 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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:47:15 +03:00
vrubelroman
148a02f308 Website: clear macOS first-launch instructions; no /donate for now
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 download section and the "download started" panel explain in advance that
macOS warns about every app not signed by Apple, quote what it says, and give both ways
to allow ChessPenguin once (System Settings step by step, or one Terminal command with a
copy button); Mac visitors get a link to it under the hero button. The /donate redirect
is removed until a donation service is chosen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:32:03 +03:00
vrubelroman
6168210112 Version 0.6.2 (not released yet); About tab without the donation button for now
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:32:03 +03:00
vrubelroman
507e44b6ae Settings → About: version, website, release notes, sources, support, donations
Some checks are pending
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
The About tab shows the version and links to the website (in the interface language),
the release notes of this version, the source code and the support contacts; "Support
the project" opens chess.vrubel.xyz/donate, which the website server sends on to
DONATE_URL (the support section while it is not set), so the donation service can change
without a new release. Links open in the browser (eframe "links": webbrowser, MIT OR
Apache-2.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:11:25 +03:00
vrubelroman
530f801ae9 AUR PKGBUILD for chesspenguin-bin 0.6.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-19 12:41:29 +03:00
vrubelroman
383d34cab5 ChessPenguin 0.6.1
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 / 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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 12:28:20 +03:00
vrubelroman
9f661c9e3c First start in the system language; sample databases named in it
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 first start (no settings file yet) picks the first of the system's preferred
languages that ChessPenguin has, otherwise English (sys-locale, MIT OR Apache-2.0).
A language chosen in the settings is kept. The sample databases get names in the
interface language.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 12:24:40 +03:00
vrubelroman
673f447491 Sample databases on the first start: 38 classic games and Alekhine's 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
The library is no longer empty at the first start: Classic games (the four annotated
samples plus 34 famous games from Steinitz to Carlsen, each with a short introduction
of our own) and Alekhine (267 games, moves only, the book's commentary removed). They
are built in, written once to the data directory and put on the shelf; a sample
removed from the shelf does not come back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 12:21:09 +03:00
vrubelroman
97d38ec919 Website: a program for chess databases, not a database (titles in six languages, link preview)
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-19 11:58:57 +03:00
vrubelroman
96e5142826 Website stats: page visitors, conversion, bots filtered out
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
site.js reports page views (POST /hit), so crawlers that do not run JavaScript are
not visitors. Downloads and views are classified as human, bot (no language, not a
browser, crawler user agent, or three files within ten minutes), owner (the browser
that opened /stats) or local network; only people are counted. Visitors are told
apart by a daily-salted hash, the IP is still not stored. Old rows are reclassified.
The stats page is in Russian: visitors, downloaders, conversion, downloads by period.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 11:45:24 +03:00
vrubelroman
c8e33e4ecd Website deploy: run the image tagged current, so plain compose commands work on the server
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-19 11:15:37 +03:00
vrubelroman
02fc61b88c Website: production compose (port 8140) and deploy script with rollback
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-19 11:12:41 +03:00
vrubelroman
18515fb287 Website container: own the mounted data/, run as an unprivileged user; health start period
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-19 11:11:32 +03:00
vrubelroman
265d9d794b Website: one page in six languages, downloads via the server, download statistics
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Rust server (axum) with server-side translations, OS-aware download buttons,
/download/<platform> redirecting to the latest GitHub release asset and logging
platform, version and geolocated region (no IP stored), password-protected /stats
and /stats.csv. Docker compose setup behind nginx. Ten screenshots taken with new
dev hooks (CP_FILTER, CP_PANE, CP_SORT, CP_BOARD).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 11:00:10 +03:00
vrubelroman
cb55ddea29 Publish to GitHub without the internal files (Forgejo keeps everything)
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-19 10:15:24 +03:00
vrubelroman
fd3b05284e AUR PKGBUILD for chesspenguin-bin 0.6.0 (Stockfish optional)
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-19 09:58:15 +03:00
vrubelroman
82dfa38b6e ChessPenguin 0.6.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 / 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
Stockfish downloaded on request (packages about 14 MB; the Flatpak keeps it
inside), macOS builds for Apple Silicon, position search fixes and the
narrow-window layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 09:45:48 +03:00
vrubelroman
50eb5e6623 Stockfish on request instead of bundled; macOS (Apple Silicon) builds
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Packages no longer carry Stockfish (about 14 MB instead of 95): the first
analysis without an engine offers to download the official Stockfish 19
"universal" build from GitHub (pinned per platform with its SHA-256, checked
before use, unpacked into the user's local data directory, test-started),
then starts the analysis the user asked for. Settings -> Engines: download
with progress and cancel, "file not found" with download again, removal with
confirmation; "Choose engine file…" for any other engine. A system stockfish
is offered first when there is one. ChessPenguin's Stockfish = bundled
(Flatpak) or downloaded.

macOS: release job and CI job on macos-14 build ChessPenguin.app (icon,
Info.plist, ad-hoc signature) in a .dmg; Homebrew paths for a system
stockfish. Not signed by Apple yet.

Decisions 14-15; design docs/design/engine-download.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 09:33:37 +03:00
vrubelroman
99264f3d24 Search board: number every continuation, not only the first nine
Some checks are pending
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-19 09:15:16 +03:00
vrubelroman
131e4b62fb Position search fixes from QA report 3
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
- The result cache keys on the board's move order too, so "in this move
  order" is not reused from another order of the same position.
- While a search runs, the hover arrow and the position a game opens at
  belong to the rows shown; small databases keep the last result dimmed.
- PGN: a game ending in its chosen occurrence has no next move (it was
  taken from a variation); Collector::add_match_with_next.
- Average rating of a continuation only from games with both ratings.
- Narrow windows: the pane switch stays visible, chips that do not fit
  become "+N more", columns hide by priority, the date becomes the year.
- Ctrl+Shift+Backspace clears all conditions with the position; × for the
  position in small databases; the outcome cache is bounded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 09:03:26 +03:00
vrubelroman
b9eab389c7 AUR PKGBUILD for chesspenguin-bin 0.5.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 09:03:26 +03:00
vrubelroman
998c7dd59f Position search: portable positional reads (the Windows build failed)
Some checks failed
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 / publish (push) Has been cancelled
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 08:52:08 +03:00
vrubelroman
307c55d8e6 ChessPenguin 0.5.0: find games by position on a board
Some checks are pending
CI / windows-build (push) Waiting to run
CI / check (push) Waiting to run
Release / version (push) Waiting to run
Release / linux (push) Blocked by required conditions
Release / flatpak (push) Blocked by required conditions
Release / windows (push) Blocked by required conditions
Release / publish (push) Blocked by required conditions
The "Board" pane next to the game list (Ctrl+B): moves played on it filter
the list to the games that reach the position by any move order, together
with the filters; the moves played next are listed with games, a results
bar, average rating and last year. Games reached by another order are
marked and "only this order" narrows the list; strongest games first.
A game opens at the found position; "Find in database" (Ctrl+Shift+F)
searches the position of the game on screen.

Large ChessBase databases: a fast main-line walk (moves built from the
board), pruning by material and pawns, the .cbb search booster when valid;
Mega Database: 0.4 s for the starting position, under 0.1 s deeper.
PGN databases and books: positions of all games, variations included,
kept in memory once built.

Also: × to clear filter and search fields; "Open as a new game" opens at
the last move; the "Moves" column is now "Length".

Docs: decision 13, design (docs/design/board-search.md), research
(position-search, position-index), dev notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 08:42:08 +03:00
vrubelroman
502a235251 AUR PKGBUILD for chesspenguin-bin 0.4.0
Some checks are pending
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-19 01:21:21 +03:00
vrubelroman
34a4a6ad15 ChessPenguin 0.4.0: large ChessBase databases with a filter panel
Some checks failed
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 / publish (push) Has been cancelled
Mega Database (11.7 million games) opens in under a second: a .cbh with
20,000 records or more is read in place, a game is converted to PGN when
opened. Filter panel on the right (player with suggestions, colour,
opponent, tournament, annotator, years, Elo rule, result, ECO, moves,
comments, variations), applied live in the background with cancellation.

Fixes: a ChessBase game unreadable from its first move (Chess960) crashed
the import; databases mixing UTF-8 and single-byte texts were decoded as
Cyrillic.

Docs: decision 12, design (docs/design/large-databases.md), format research
and acceptance criteria, QA report 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 01:02:36 +03:00
vrubelroman
ff1a939ef3 Remove the in-app close button; the window manager provides window controls
Some checks are pending
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-18 23:04:13 +03:00
vrubel
80672b343d AUR PKGBUILD for chesspenguin-bin 0.3.0
Some checks are pending
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-18 15:13:43 +03:00
vrubel
c190b3aff4 ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
Some checks failed
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 / publish (push) Has been cancelled
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
  horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
  (Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
  play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
vrubel
f25826664a Game screen: result in the header, move badges, refutation arrows, viewed games
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
- Header shows the result (1-0, 0-1, ½-½) next to the players.
- Lichess-style badge on the moved piece: engine judgement (??, ?, ?!) when the
  game analysis is shown, otherwise the author's !/?/!!/!?/?! symbol.
- On a marked move the board shows the engine's refutation (opponent's best
  reply) and the best answer to it instead of the better move.
- Engine arrows are all blue and deduplicated; with the live engine on only its
  arrows are drawn.
- Library marks games opened before with a check (remembered by content in
  viewed.json); context menu to mark/unmark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:00:19 +03:00
vrubel
bb7d3b3fa6 Open ChessBase databases (.cbh, .cbv) and zip/7z archives
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
New crate chess-import converts non-PGN sources to PGN in memory and returns
a PgnDatabase, so the library, notation and analysis work unchanged:
- .cbv archives (container rewritten after uncbv), .cbh with companion files
  (layout after the public Morphy format description): games, variations,
  comments with per-database code page detection, NAGs, squares/arrows, set-up
  positions, time spent, book chapters (guiding texts) as move-less records;
- ChessBase figurines become piece letters, diagram/object markers handled,
  Western names in Cyrillic databases read correctly;
- .zip/.7z with PGN (own encoding each), .cbh and .cbv; duplicates skipped;
- .cbz/encrypted archives and 2CBH rejected with clear messages.
Library: '+ Add database', format shown, import notes; comments keep
paragraph breaks. Tests on the user's sample books (skipped when absent).

Also: AUR PKGBUILD for 0.2.0 with the bundled Stockfish.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 13:18:27 +03:00
833 changed files with 233257 additions and 2644 deletions

9
.cargo/config.toml Normal file
View file

@ -0,0 +1,9 @@
# Windows: the C runtime is linked into the executable, so it starts on a Windows
# 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

@ -29,10 +29,48 @@ jobs:
- uses: actions/checkout@v7 - uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo build --locked -p chesspenguin - run: cargo build --release --locked -p chesspenguin
# The bundled engine: pinned download, checksum and a UCI handshake. # Self-update: replacing the running executable (the Windows rename scheme).
- name: Stockfish - run: "cargo test --release --locked -p chesspenguin update::"
shell: bash # The C runtime is inside the executable (.cargo/config.toml): no VCRUNTIME140.dll.
- name: No Visual C++ runtime needed
shell: pwsh
run: | run: |
packaging/stockfish.sh windows build/stockfish $bytes = [IO.File]::ReadAllBytes("target/release/chesspenguin.exe")
printf 'uci\nquit\n' | build/stockfish/stockfish.exe | grep -m1 '^id name' $text = [Text.Encoding]::ASCII.GetString($bytes)
if ($text -match "(?i)vcruntime140\.dll") { throw "chesspenguin.exe imports VCRUNTIME140.dll" }
# The window starts on a machine without a graphics card (the runner): the log says
# which graphics mode it took. Informational for now.
- name: Start the window
shell: pwsh
continue-on-error: true
run: |
$env:CP_SCREENSHOT = "$PWD/start.png"
$env:CP_SCREENSHOT_DELAY = "5"
$p = Start-Process target/release/chesspenguin.exe -PassThru
$p | Wait-Process -Timeout 90 -ErrorAction SilentlyContinue
Get-Process chesspenguin -ErrorAction SilentlyContinue | Stop-Process -Force
$dir = "$env:APPDATA/vrubelroman/ChessPenguin/config"
# Annotations: readable on the run page without signing in.
$lines = @("exit code: $($p.ExitCode)")
if (Test-Path "$dir/graphics") { $lines += "graphics: " + (Get-Content "$dir/graphics") }
if (Test-Path "$dir/chesspenguin.log") { $lines += Get-Content "$dir/chesspenguin.log" | Select-Object -First 40 }
foreach ($l in $lines) { Write-Output "::warning title=Windows start::$($l -replace '%','%25')" }
if (-not (Test-Path start.png)) { throw "no screenshot: the window did not start" }
- uses: actions/upload-artifact@v7
if: always()
with:
name: windows-start
path: start.png
if-no-files-found: ignore
# Apple Silicon: the build and the app bundle (decision 15).
macos-build:
runs-on: macos-15
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --locked -p chesspenguin
- run: VERSION=0.0.0 packaging/macos/build-app.sh dist
- run: "cargo test --locked -p chesspenguin update::"

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

@ -43,14 +43,13 @@ jobs:
- name: System libraries - name: System libraries
run: sudo apt-get update && sudo apt-get install -y pkg-config libasound2-dev libxkbcommon-dev libwayland-dev libfuse2 run: sudo apt-get update && sudo apt-get install -y pkg-config libasound2-dev libxkbcommon-dev libwayland-dev libfuse2
- run: cargo build --release --locked -p chesspenguin - run: cargo build --release --locked -p chesspenguin
- name: Stockfish # Stockfish is not bundled here: the program downloads it on request (decision 14).
run: packaging/stockfish.sh linux build/stockfish
- name: Tarball - name: Tarball
run: | run: |
name="ChessPenguin-${VERSION}-linux-x86_64" name="ChessPenguin-${VERSION}-linux-x86_64"
mkdir -p "dist/${name}" mkdir -p "dist/${name}"
cp target/release/chesspenguin LICENSE README.md THIRD_PARTY_NOTICES.md "dist/${name}/" cp target/release/chesspenguin LICENSE README.md THIRD_PARTY_NOTICES.md "dist/${name}/"
cp -r packaging/icons packaging/*.desktop examples build/stockfish "dist/${name}/" cp -r packaging/icons packaging/*.desktop examples "dist/${name}/"
tar -C dist -czf "dist/${name}.tar.gz" "${name}" tar -C dist -czf "dist/${name}.tar.gz" "${name}"
rm -rf "dist/${name}" rm -rf "dist/${name}"
- name: deb, rpm and Arch Linux packages - name: deb, rpm and Arch Linux packages
@ -96,9 +95,6 @@ jobs:
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo build --release --locked -p chesspenguin - run: cargo build --release --locked -p chesspenguin
- name: Stockfish
shell: bash
run: packaging/stockfish.sh windows build/stockfish
- name: Zip - name: Zip
shell: pwsh shell: pwsh
run: | run: |
@ -106,7 +102,7 @@ jobs:
New-Item -ItemType Directory -Force -Path "dist/$name" | Out-Null New-Item -ItemType Directory -Force -Path "dist/$name" | Out-Null
Copy-Item target/release/chesspenguin.exe "dist/$name/ChessPenguin.exe" Copy-Item target/release/chesspenguin.exe "dist/$name/ChessPenguin.exe"
Copy-Item LICENSE, README.md, THIRD_PARTY_NOTICES.md "dist/$name/" Copy-Item LICENSE, README.md, THIRD_PARTY_NOTICES.md "dist/$name/"
Copy-Item -Recurse examples, build/stockfish "dist/$name/" Copy-Item -Recurse examples "dist/$name/"
Compress-Archive -Path "dist/$name" -DestinationPath "dist/$name.zip" Compress-Archive -Path "dist/$name" -DestinationPath "dist/$name.zip"
Remove-Item -Recurse "dist/$name" Remove-Item -Recurse "dist/$name"
- uses: actions/upload-artifact@v7 - uses: actions/upload-artifact@v7
@ -114,8 +110,73 @@ jobs:
name: windows name: windows
path: dist/* path: dist/*
macos:
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-15
env:
VERSION: ${{ needs.version.outputs.version }}
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --locked -p chesspenguin
- name: App bundle and disk image
run: packaging/macos/build-app.sh dist
- uses: actions/upload-artifact@v7
with:
name: macos
path: dist/*
android:
needs: version
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "21"
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,x86_64-linux-android
- uses: Swatinem/rust-cache@v2
- name: Android NDK and platform, cargo-ndk
run: |
yes | "${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" --install "ndk;30.0.16248370" "platforms;android-37.0" > /dev/null
cargo install cargo-ndk --version 4.1.2 --locked
# Two APKs: Stockfish built in, and Stockfish downloaded in the app
# (androidApp/scripts/release.sh, which also builds Stockfish from its source).
# The signing key comes from the repository secrets.
- name: Signed APKs
env:
KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
CP_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
CP_KEY_ALIAS: chesspenguin
CP_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
if [[ -z "${KEYSTORE_BASE64}" ]]; then
echo "::error::The Android signing key is not in the repository secrets"
exit 1
fi
export CP_KEYSTORE="${RUNNER_TEMP}/release.jks"
echo "${KEYSTORE_BASE64}" | base64 -d > "${CP_KEYSTORE}"
export ANDROID_NDK_HOME="${ANDROID_HOME}/ndk/30.0.16248370"
androidApp/scripts/release.sh
rm -f "${CP_KEYSTORE}"
- uses: actions/upload-artifact@v7
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: publish:
needs: [version, linux, flatpak, windows] needs: [version, linux, flatpak, windows, macos, android]
if: github.ref_type == 'tag' if: github.ref_type == 'tag'
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
@ -124,13 +185,23 @@ jobs:
with: with:
path: dist path: dist
merge-multiple: true merge-multiple: true
- name: Stockfish source (GPL-3.0 source offer for the bundled engine) # 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 run: packaging/stockfish.sh source dist
- name: Checksums - name: Checksums
run: cd dist && sha256sum * > SHA256SUMS.txt run: cd dist && sha256sum * > SHA256SUMS.txt
# The release page says what is new: the site and the apps' "What's new" lead there.
- name: Release notes (this version's section of CHANGELOG.md)
run: |
v="${GITHUB_REF_NAME#v}"
awk -v h="## [$v]" 'index($0, h) == 1 { f = 1; next } f && /^## \[/ { exit } f' CHANGELOG.md > "${RUNNER_TEMP}/notes.md"
test -s "${RUNNER_TEMP}/notes.md" || echo "See CHANGELOG.md." > "${RUNNER_TEMP}/notes.md"
- uses: softprops/action-gh-release@v3 - uses: softprops/action-gh-release@v3
with: with:
files: dist/* files: dist/*
body_path: ${{ runner.temp }}/notes.md
generate_release_notes: true generate_release_notes: true
# v1.0.0-beta.1 and similar tags become pre-releases. # v1.0.0-beta.1 and similar tags become pre-releases.
prerelease: ${{ contains(github.ref_name, '-') }} prerelease: ${{ contains(github.ref_name, '-') }}

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

9
.gitignore vendored
View file

@ -7,3 +7,12 @@
# Third-party reference screenshots (kept locally, not published) # Third-party reference screenshots (kept locally, not published)
/designExample/ /designExample/
# 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" 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" 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" 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" 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" 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`. - Исходное ТЗ: `техническое задание.txt`.
- Пользовательские материалы: `designExample/`, `pgnFilesforExample/`, `engines/`. - Пользовательские материалы: `designExample/`, `pgnFilesforExample/`, `engines/`.
- Рабочий язык обсуждений и проектных заметок — русский; идентификаторы кода — английский. - Рабочий язык обсуждений и проектных заметок — русский; идентификаторы кода — английский.
- Текущий этап: исследование и согласование архитектуры. Рекомендация не равна утверждённому решению. - Текущий этап: развитие выпускаемого продукта (релиз 2.5.2). Задачи и бэклог — `docs/dev/tasks.md`.
- Сводка решений: `docs/architecture.md`; исследования: `docs/research/`. - Архитектура реализованной системы: `docs/architecture.md`; архитектурное предложение этапа исследования — `docs/research/architecture-proposal-2026-10-17.md`; исследования: `docs/research/`.
- Подтверждённые пользователем границы первой версии: `docs/decisions.md`; они имеют приоритет над ранними предложениями исследований. - Журнал решений: `docs/decisions.md`; подтверждённые пользователем решения имеют приоритет над предложениями исследований.
## Команда ## Команда
Оркестратор распределяет независимые задачи между `analyst`, `designer`, `developer`, `tester`, согласует результаты и обсуждает продуктовые решения с пользователем. Делегирование разрешено. Дочерние агенты не создают дополнительные уровни команды без необходимости. Оркестратор распределяет независимые задачи между `analyst`, `designer`, `developer`, `tester`, согласует результаты и обсуждает продуктовые решения с пользователем. Делегирование разрешено. Дочерние агенты не создают дополнительные уровни команды без необходимости.
- Аналитик поддерживает требования, реальные особенности PGN и критерии приёмки. - Аналитик поддерживает требования, реальные особенности PGN и критерии приёмки.
- Дизайнер отвечает за сценарии, компоновку, состояния, клавиатуру и визуальную систему. - Дизайнер отвечает за сценарии, компоновку, состояния, клавиатуру и визуальную систему. После UI-реализации отдельный дизайн-ревьюер, не автор реализации, проверяет её на реальных снимках приложения: сравнение с главным экраном и экраном партии, выравнивание, размеры и состояния, отсутствие скачков при переходах и появлении данных. Одного чтения кода и тестов для визуальной приёмки недостаточно.
- Разработчик отвечает за Rust, архитектуру, хранение, PGN и UCI. - Разработчик отвечает за 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 как форматом обмена. - Локальное приложение для просмотра, ввода и анализа шахматных партий, с 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,798 @@
All notable changes are listed here. Versions follow [Semantic Versioning](https://semver.org/). 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
against Maia — a neural network (Maia-3, CSSLab, University of Toronto) that plays like
a human of the chosen rating, 600–2600, mistakes included. Your name and rating
(optional; «Weaker · As me · Stronger» choose the strength relative to it), colour,
Lichess time controls from 3+0 to 30+20 (10+5 by default), custom, or no time limit. During the game: the
board, the notation, both clocks (time runs after each side's first move, increment
after the move, low time in red), take back, resign; no engine or analysis. Maia
thinks like a human — a pause that depends on her clock — and never loses on time. The
game ends by mate, stalemate, no material, threefold repetition, fifty moves, time or
resignation; then it is an ordinary game with the result strip: Analyse, Rematch, New
game, Save to a database (tags: players, ratings, TimeControl, Termination, [%clk]).
Maia is computed in plain Rust, about 0.1 s a move on one core; its weights (21 MB,
the authors' own file from huggingface.co) are downloaded once on request.
- Premoves against Maia, as on Lichess: while she thinks, set your next move; it is
played at once after hers when legal.
- Maia resigns: when her position is lost by twelve pawns or more for two of her turns
(judged by Stockfish, unseen), she offers to resign — accept the win, or play to the
end.
- Settings › Board: «Always promote to a queen» (off: the piece is chosen).
## [1.2.0] — 2026-10-25
- Your own comments in a game (desktop): Enter on a move (or the right-click menu, a
double click on a comment, the ☰ menu) opens an editor right where the comment stands
in the notation — after any move of the main line or of a variation, or at the start of
the game; Enter — done, Esc — cancel, Shift+Enter — a paragraph; going to another move
writes the draft. Symbols of the move (! ? !! ?? !? ?!, also Ctrl+1…6) and of the
position (= ∞ ⩲ ⩱ ± ∓ +− −+) in the editor and in the move's menu, one click on, one
click off. Arrows and circles drawn with the right mouse button on the board (green;
Shift red, Alt blue, Shift+Alt yellow; the same shape again takes it off) go into the
comment as `[%cal]`/`[%csl]`. Existing comments, book ones too, can be edited and
deleted (Ctrl+Z puts them back); their `[%clk]`, `[%eval]` and board commands are kept,
an untouched comment keeps its bytes. One edit is one undo step; the game is marked
modified and Ctrl+S saves it. Paragraphs of comments survive writing now.
- The strip «Engine line preview … Add as variation · Exit» above the notation is gone:
stepping through a line of the report or of the engine panel just shows it on the
board, Esc leaves it, and a small «+ Add as variation» stands at the end of the line
being shown. Moves of variations and of the report's better lines keep their size under
the mouse.
## [1.1.0] — 2026-10-25
- Your own databases (desktop): «✚ New database» on the shelf makes an empty PGN file
(Documents/ChessPenguin by default, the folder is shown and can be changed); any game —
new, pasted, from a ChessBase, an online or any other database — is added to a PGN of
your choice with «Add to database…» (Ctrl+Shift+S, the 💾 button, the ☰ menu); Ctrl+S
saves the changes back into the game's own PGN (replacing its record) or, for a game
from a read-only source, adds it to a database. The data of a game (players, Elo, event,
site, date, round, result, annotator from «Your name» in Settings) are asked when a new
game is first added and can be edited any time (F2, the title, the ☰ menu). A game that
is already in the target (same players, date and moves) can replace its record or go in
as a new one. Games are deleted from the table (Delete, the row menu) after a question,
with Undo for six seconds (Ctrl+Z). Online databases and ChessBase files stay read-only;
a PGN in a legacy encoding is offered a UTF-8 copy next to it. Writes are explicit:
appending to the file, or rewriting it through a temporary file and a rename, with a
check that the file did not change on the disk meanwhile. The game's header names its
database and number (🔒 read-only, 🌐 online); the card menu has «Show in folder»;
«Remove from list» says where the file stays. A new game gets today's date.
- Library: «+ Add database», «✚ New database» and «🌐 Online games» moved from the row of
database cards to the title row, beside «Databases» (folded into «+ ▾» and «🌐» in a
narrow window); the cards row holds only databases. An empty shelf shows the three
actions as large cards in the middle. The table header of a database that takes games
has «+ Game»: a new game meant for that database — its header says so and Ctrl+S adds
it there straight away. «Add to database» lists only databases that take games; a PGN
in a legacy encoding gets its UTF-8 copy from its card's menu. The built-in sample
databases are read-only. An empty database shows no filter panel.
## [1.0.3] — 2026-10-24
- A new icon — a penguin in a crown — on the desktop, Android and the website.
## [1.0.2] — 2026-10-24
- Android: the update card on the main screen has a × that stops the offers (with "Undo";
they come back with "Offer new versions" in Settings → About, where a new version can
always be installed); the update check and the counting go on. No "What's new" link to
GitHub anywhere in the app's update screens.
## [1.0.1] — 2026-10-24
- The update check goes through the ChessPenguin site (GitHub when the site does not
answer), which counts installations that run: once a day, only a random number of the
installation, the version and the platform. With the check at start turned off,
nothing is sent unless one checks by hand. The site's statistics show installations by day, platform and version.
## [1.0.0] — 2026-10-24
- Three more interface languages on the desktop, on Android and on the website: Brazilian
Portuguese, Uzbek (Latin script) and Kazakh (Cyrillic script) — nine in all. The
system's language is picked up; Portuguese notation uses its own piece letters.
- Android: the players stand above and below the board, as on Lichess (Black above,
swapped with the board), with their ratings and their share of the result; the top bar
names the event, the year and the round. In the list of games White and Black have a
line each, so neither name is cut.
## [0.16.2] — 2026-10-24
- Desktop: narrow windows (half a screen, a tiling window manager) no longer overlap:
- the reference tab, the engine settings and the game's title fit their place (the
reference tab slid under the board from a 1200-point window down);
- in a narrow window the filters open over the list of games, and the search board
takes the place of the list (Esc goes back);
- a narrow tall window shows the notation under the board;
- the header of the list and the shelf shorten what does not fit, or take a second
line; the window can be made as small as 640×480.
- Desktop: Escape in the "Game modified" question quits nothing: when closing the program
it is Cancel (leaving a game, it still goes on without saving).
## [0.16.1] — 2026-10-24
- Desktop: the filter panel no longer widens while a name is typed; the rows of «Game»
(years, rating, moves, ECO) are aligned on one grid.
- Desktop: Escape in a game with unsaved edits asks about saving (the question used to
close at once, so Escape seemed to do nothing); Escape in the question goes on without
saving, Cancel stays in the game.
## [0.16.0] — 2026-10-24
- Desktop: **every database gets the filters and the position search of a ChessBase
database** — PGN files of any size, downloads from Lichess and Chess.com, archives and
small ChessBase databases. Player and opponent (with the colour), tournament or place,
annotator, years, rating, result, ECO, length, «with comments» (clock and evaluation
marks such as `[%clk]` do not count) and «with variations»; names suggested as you
type; the table sorts by any column. Fields a file does not have stay in the panel,
and an empty result says when no game of the database has that field. Dates are read
with dots, dashes or slashes (`2026-10-18`), the length of a game is counted when the
file has no `PlyCount`.
- Desktop: the quick search is in the header of every database (Mega too); each word may
be found in a different field ("carlsen 2024"). Ctrl+F goes there, again to the filters.
- Desktop: games downloaded from Lichess and Chess.com are shown newest first (by the
date and time they were played); on Android the count over a downloaded database's
games grows during its download.
- Names are found with «е» for «ё» («Артем» finds «Артём»).
- The memory a PGN's position search needs is reckoned from its moves, not from the size
of the file (a file with clock comments was thought to need 14 times too much).
## [0.15.0] — 2026-10-23
- Android: **the app updates itself.** Once a day (a switch in About turns it off; «Check
now» is there too) it asks GitHub for the latest release. A newer one shows as a card
over the list of databases: «Update» downloads the small build (about 9 MB; the engine
already on the phone stays — the build with Stockfish inside keeps it first), checks it
against the release's SHA-256 and hands it to Android to install. The first time Android
asks to allow installs from ChessPenguin; the app leads there and back. The download
goes on with the app in the background, and the next start says what was updated.
- The release page on GitHub now lists what is new in that version (from this file); the
apps' and the site's «What's new» lead there.
- The desktop and Android apps share one check for new releases.
## [0.14.0] — 2026-10-23
- Android: **games from Lichess and Chess.com** — «Add a database» → «Games from Lichess
and Chess.com»: any player's games by nickname (yours, a pupil's, an opponent's; no login,
another nickname for Chess.com if it differs) become a database on the phone, both sites
merged into one by default. «Download new games» — in the database's menu and over its
games list — fetches only the games played since; a download that was stopped, failed or
cut off by a closed app continues where it stopped, without duplicates. The games of such
a database are listed from the most recent one. The download goes on when the screen is
left; the list shows its progress and says how it ended. Only standard chess is kept. The
app asks the sites only when told to (both builds may now use the internet for this).
- The downloads of games from Lichess and Chess.com are one shared part of the desktop and
Android apps.
- Android: the status bar and the navigation bar follow the theme chosen in the app: with
the dark theme on a light phone their icons are light again (they stayed dark on dark).
## [0.13.0] — 2026-10-23
- Android: **game report** — ⋮ → «Game analysis» lets Stockfish evaluate every move of the
main line, as on the desktop: inaccuracies, mistakes and blunders marked in the notation,
an evaluation graph under the board (tap or drag to go to a move), each player's accuracy
and average centipawn loss in the report, the better move of every error shown on the
board. Games with `[%eval]` comments (Lichess exports) and games analysed before show
their report at once. The live engine waits while the game is analysed.
- The game report's evaluations, judgements, accuracy and cache are now one shared part of
the desktop and Android apps, so both give the same numbers.
## [0.12.0] — 2026-10-23
- Android: **paste PGN** — when the clipboard holds text, «Add a database» offers to paste
it: the games are kept in the app as a database and opened (one game on the board at
once). Text with no game in it is said so.
- Android: **open with ChessPenguin** — PGN, ZIP, 7z and ChessBase archives (`.cbv`) open
from other apps (Telegram, a file manager, «Share»): the file is copied into the app,
put on the list and opened. The same file again opens the same database.
- Android: the engine button turns the engine off again (in 0.11.1 it only turned it on).
- Android: a smoother screen while the engine thinks — its words are shown up to five
times a second and redraw only the engine strip and the arrows; Stockfish runs below the
app's priority and takes 2 threads by default (a value chosen in Settings stays).
- PGN: a game whose tags follow the previous game's result on the same line (`… 1-0
[Event "B"]`, as pasted text often has it) now shows its players in the games list too.
## [0.11.1] — 2026-10-23
- Android: **boards and pieces** — Settings → «Board and pieces» offers the 37 boards and
17 piece sets of the desktop app, seen at once on a board above them.
- Android: the games list shows each game's number in the database (it stays the same
when a search narrows the list).
- Android: the engine turns on only with its button in each game, and turns off when you
leave the game or the app goes to the background.
- Android: the engine download no longer says there is not enough space on a phone with
plenty of it (the free space was asked of a folder not made yet).
## [0.11.0] — 2026-10-22
- Android: **add a folder** — every database in it and in the folders inside it (two
levels) is offered with a tick box: PGN files, archives, ChessBase archives (`.cbv`) and
ChessBase databases (`.cbh` with the files beside it), which a single picked file could
not open. A ChessBase database without its `.cbg` is shown but not added; databases
already on the list are marked. Picking the folder again offers what is new. Errors say
in plain words when a file was moved or a part of a ChessBase database is missing.
- Desktop, keys in a game: ↑ goes to the end, ↓ to the start (as End and Home); variations are
switched with Shift+↑/↓. Escape first closes what is open (a preview of an engine line,
a picked-up piece); then it goes back to the game this one was opened from, or to the
library. A window, menu or dialog over the game keeps Escape for itself, and a game with
unsaved changes still asks first.
## [0.10.0] — 2026-10-22
- **ChessPenguin for Android, alpha** (12 and newer): add databases of the same formats (PGN, ChessBase
`.cbv`, `.zip`/`.7z` archives), the desktop's sample games from the first start, a list of
games with a search, the game with the notation under the board (variations, comments, NAG,
comment arrows), paging games, and Stockfish 19 with its evaluation, lines and a preview of
a line on the board. Two APKs: Stockfish built in, or Stockfish downloaded in the app.
Files are only read, never changed. The engine's download goes on in the background, with
the app closed too. In English, Russian, German, French, Spanish and Italian.
## [0.9.0] — 2026-10-22
The 0.8 series together — the reference tab, games from Lichess and Chess.com, self-update,
translated comments, move notation and piece animation — with these fixes:
- Symbols that had no glyph and showed as empty boxes now render: the "✕" beside the
Chess.com nickname, the start-position mark in board search, the check marks of the
translation texts. A test checks every character the interface shows against the bundled
fonts.
## [0.8.6] — 2026-10-21
- The side panel no longer widens by itself while a game's comments are translated (the mark
of a translated comment made its row a pixel wider than the panel, frame after frame), so
moves in comments no longer jump when the mouse moves over them.
- Comments inside variations have the same size as the other comments.
- No scroll bar pops up over the engine lines: a long line is cut at the edge (it still scrolls
with Shift+wheel or by dragging).
- A game whose comments go in one request shows just "Translating…": the count
("12 of 40") is kept for long games sent in several parts.
## [0.8.5] — 2026-10-21
- Translation with a ChatGPT subscription works: the list of models the subscription answers
with is now understood (it differs from the API's), so requests no longer go out without a
model and fail with "error 400". OpenAI's preferred model is used. A failed check now shows
in Settings › Translation, and translation errors are written to chesspenguin.log.
- Comments of a sentence or two in another language are offered for translation too, and text
in brackets ("[source: …]") is translated as well.
## [0.8.4] — 2026-10-21
- Move notation (Settings › Board & pieces): Latin letters (Nf3), figurines as on Lichess
(♘f3), or the piece letters of the interface language — Russian Кр Ф Л С К, German
K D T L S, French R D T F C, Spanish and Italian R D T A C. It applies to the move list,
engine lines, the reference tab, board search and the analysis report; PGN files and
copied games always stay in K Q R B N. Latin remains the default.
- Translation of game comments: when a game's comments are in another language, ChessPenguin
offers to translate them into yours. Sign in with your ChatGPT Plus or Pro subscription (no
key), or use an API key — DeepSeek, OpenAI, Google Gemini — or a model on this computer
(Ollama, LM Studio). After the first consent, games in other languages are translated as you
open them; [Original | Translation] (Ctrl+Shift+T) switches back. Moves are never translated:
a translation that changes a move is not shown. The translation is never written to the PGN;
a local cache keeps it, so a game opens translated again without the network. Settings ›
Translation: the target language, when to translate, the connection, permissions, the cache.
- Arrows (→, ⇄) and the evaluation signs ⩲ ⩱ ⌓, shown as empty boxes before, now render.
- Piece animation, as on Lichess: a move slides on the board (castling moves both king and
rook; jumping several moves slides every piece once), a captured piece fades out. Speed in
Settings → Board: Off, Fast (120 ms), Normal (250 ms, the default), Slow (500 ms). A piece
dropped by dragging is already in place and does not slide.
## [0.8.2] — 2026-10-21
- Windows: ChessPenguin no longer quits silently on a machine whose graphics do not
cooperate (an old driver, a broken Vulkan, a virtual machine). A start that fails or dies
before its first frame tries again without Vulkan, then with OpenGL, then with software
drawing, and keeps the mode that worked. What still prevents the start is shown in a
message and written to chesspenguin.log beside the settings. The C runtime is now inside
the executable, so the Visual C++ Redistributable is not needed.
- The window "Games from Lichess and Chess.com" opens with an empty nickname, the cursor in
it: the next search is usually for another player (a database already downloaded fetches
its new games with "⟳ New games").
## [0.8.1] — 2026-10-20
- The side panel fits small screens (a laptop with 200 % scaling): the reference tab no longer
slides under the board and is no longer cut off on the left. Its tables narrow their columns
and drop the less important ones to fit, their headings wrap, and in a tall narrow window the
board gives way so the reference keeps enough width.
## [0.8.0] — 2026-10-20
- Games from Lichess and Chess.com: anyone's games by nickname — yours, a pupil's, an
opponent's, a champion's (no login; another nickname for Chess.com if it differs). See what
was found, download the games into a database — both sites merged into one by default, or
one per site — and later fetch the new ones with "⟳ New games" in the database header. The
progress shows per site with the time left; the window may be closed meanwhile (the result
then shows as a message). An interrupted download — stopped, failed, or the program closed —
keeps what it got and continues where it stopped, without duplicates (also after a crash);
games still being played (correspondence) are fetched once they end. Only standard chess is
kept. The feature is offered only when the sites answer: ChessPenguin asks each for a public
profile at start (nothing of yours is sent), so offline it stays hidden.
## [0.7.1] — 2026-10-20
- Updates: at start ChessPenguin asks GitHub for the latest version (can be turned off in
Settings → About) and offers a newer one with a button next to Settings. The Windows zip,
the AppImage and the Linux archive update themselves (download, checksum check, replace,
restart); macOS downloads and opens the disk image with step-by-step instructions; deb, rpm,
Arch and Flatpak packages are downloaded into Downloads and the one command that installs
them is shown with a Copy button; the AUR package shows the helper command. "Skip this
version" hides the button until the next one.
- The Flatpak may use the network (the update check).
## [0.7.0] — 2026-10-20
- «Справочник» (Reference) tab of a game: what was played in the current position in a
database of the shelf (Mega for theory, an opening collection, a pupil's games), as two
tables — the moves with games, share, results, White's score, average rating, year and
the best players who played them, and the strongest (or newest) games that reached the
position with how they went on. Click a move to see its games, double-click to play it;
double-click a game to open it at this position (the current game stays a click away:
"⬅ Back to …", unsaved edits included). It also tells how far the game follows the
database (the novelty: the first move no other game of the database played) and finds the
game itself there (to open, for example, an annotated copy).
- The board of a game always keeps the full height of the window (the side panel is never
wider than the room beside it).
- Settings → Engines no longer offers to download Stockfish when one is already set up.
- Russian numbers use a decimal comma ("11,7 млн").
## [0.6.3] — 2026-10-19
- Import notes (for example, Chess960 games shown without moves) are a quiet grey "ℹ" now
instead of an orange warning sign.
- Position search in a large ChessBase database without a usable `.cbb` search index: the
program builds its own once (in the background, kept in the cache) and deep positions are
then found in milliseconds instead of a pass over every game.
- Opening positions (the start, 1.e4, …) in a large ChessBase database: an index of the
first ten moves of every game, built with the booster and kept in the cache, answers them
four to eight times faster. It is held in memory only when the machine has room for it
(about 600 MB for Mega Database); otherwise the search works as before.
- A big PGN file whose position table would not fit in memory now says so on the search
board instead of running out of memory.
- `chesspenguin --bench <database>` prints timings of opening, filtering and position
search for comparing machines.
- Settings → About: clicking the email address copies it instead of opening a mail app,
which does nothing useful when none is installed.
## [0.6.2] — 2026-10-19
- Settings → About: the version, links to the website (in the interface language), the release
notes and the source code, and the support contacts. Links open in the browser.
## [0.6.1] — 2026-10-19
- The library is no longer empty at the first start: two sample databases are on the shelf —
classic games (38 famous games from Anderssen and Morphy to Kasparov and Carlsen, each with a
short introduction; four with full comments, variations and arrows) and Alekhine's games (267
games, moves only). Remove them from the shelf like any database; they do not come back.
- The first start uses the system language when it is one of the six (English, Russian, French,
German, Spanish, Italian), otherwise English. A language chosen in the settings is kept.
## [0.6.0] — 2026-10-19
- Stockfish is no longer inside the packages (they shrink from about 95 MB to about 14 MB): the
first time you analyse, ChessPenguin offers to download the official Stockfish 19 (checked
before use, installed for your account only) and starts the analysis when it is there. The same
button is in Settings → Engines, with progress, cancel and "remove" to free the space. A system
`stockfish` is still found and offered; the Flatpak keeps Stockfish inside.
- macOS on Apple Silicon: a `.dmg` with ChessPenguin.app (not signed by Apple yet).
- Position search fixes (QA report 3): "in this move order" no longer reused from another move
order of the same position; while a search runs, the arrow and the position a game opens at
belong to the rows shown; in books the next move of a game ending in the position is no longer
taken from a variation; average rating of a continuation only from games with both ratings.
- Narrow windows: the [Filters | Board] switch stays visible, conditions that do not fit become
"+N more", columns hide by priority and the date becomes the year.
- Continuations are numbered through the whole list (keys 1-9 still play the first nine).
- Ctrl+Shift+Backspace clears all conditions with the position; a × removes the position in small
databases; the cache of search results is bounded.
## [0.5.0] — 2026-10-19
- Find games by position: the "Board" pane next to the game list (Ctrl+B). Play moves and the list
shows the games that reach the position by any move order, with the moves played next (games,
results bar, average rating, last year); click a move to play it. Works together with the
filters, sorts strongest games first, marks games reached by another move order (↪) and offers
"only this order". Books and PGN collections are searched in variations too. A game opens at the
found position. On the game screen "🔍 Find in database" (Ctrl+Shift+F) searches its position.
Mega Database: 0.4 s for the starting position, under 0.1 s deeper in the opening.
- The game list's "Moves" column is now "Length".
- Filter fields and the search field have a × to clear them.
- "Open as a new game" from the search board opens at the last move played on it.
## [0.4.0] — 2026-10-19
- Large ChessBase databases (Mega Database: 11.7 million games) open in seconds: read in place from
the `.cbh` records, a game is converted when opened. A filter panel on the right (player with
suggestions, colour, opponent, tournament, annotator, years, Elo, result, ECO, moves, comments and
variations) updates the list as you type; sorting and filtering run in the background.
- Fixed: a ChessBase game that cannot be read from its first move (e.g. Chess960) crashed the import.
- Fixed: ChessBase databases mixing UTF-8 and single-byte texts could be decoded as Cyrillic.
- Removed the in-app ✕ (close) button: the window manager or desktop provides window controls.
## [0.3.0] — 2026-10-18
- Open ChessBase databases (`.cbh` with companion files) and ChessBase archives (`.cbv`), and
`.zip` / `.7z` archives holding PGN, `.cbh` or `.cbv` files. Games, variations, comments (with the
right code page, including Cyrillic), symbols, coloured squares and arrows, set-up positions and
book chapters are converted to PGN in memory; sources are read-only. Problems are listed under
"Import notes" in the library.
- Comments keep paragraph breaks (a blank line starts a new paragraph).
- Game screen: the result next to the players; Lichess-style badges on the moved piece (engine
judgement or the author's symbol); on a marked move, arrows show the refutation and the best
answer; all engine arrows blue, only the live engine's while it runs.
- Library: games opened before are marked with a check (context menu to change).
- More looks: piece sets governor, kosal, metaltops; boards IC, NCF, Ice, Navy, Mint, Emerald,
Orange, Rose, Dusk, Night and Sketch; sound sets Futuristic, NES, Wood, Glass, Clicks.
- Fixed: the checkmate sound was silent (a copied link instead of a sound file).
- Library: "+ Add database"; long database names are shortened on the cards.
## [0.2.0] — 2026-10-18 ## [0.2.0] — 2026-10-18
- Stockfish 19 is bundled with every package (unmodified official "universal" build, which picks - Stockfish 19 is bundled with every package (unmodified official "universal" build, which picks

1339
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,24 @@
[workspace] [workspace]
resolver = "3" resolver = "3"
members = ["crates/chess-core", "crates/uci", "apps/desktop"] 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] [workspace.package]
version = "0.2.0" version = "2.5.2"
edition = "2024" edition = "2024"
rust-version = "1.97" rust-version = "1.97"
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
@ -16,10 +31,12 @@ shakmaty = "0.30.2"
pgn-reader = "0.29.1" pgn-reader = "0.29.1"
encoding_rs = "0.8" encoding_rs = "0.8"
thiserror = "2" thiserror = "2"
# `Instant`/`SystemTime` that also work in a browser (std's panic there).
web-time = "1.1"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
egui = "=0.36.2" egui = "=0.36.2"
eframe = { version = "=0.36.2", default-features = false, features = ["wgpu", "wayland", "x11", "accesskit", "default_fonts"] } eframe = { version = "=0.36.2", default-features = false, features = ["wgpu", "wayland", "x11", "accesskit", "default_fonts", "links"] }
egui_extras = { version = "=0.36.2", features = ["svg", "image"] } egui_extras = { version = "=0.36.2", features = ["svg", "image"] }
image = { version = "0.25", default-features = false, features = ["jpeg", "png"] } image = { version = "0.25", default-features = false, features = ["jpeg", "png"] }
rfd = "0.17" rfd = "0.17"
@ -27,7 +44,24 @@ arboard = { version = "3.6", features = ["wayland-data-control"] }
rodio = "0.22" rodio = "0.22"
directories = "6" directories = "6"
chess-core = { path = "crates/chess-core" } chess-core = { path = "crates/chess-core" }
chess-import = { path = "crates/chess-import" }
uci = { path = "crates/uci" } 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."*"] [profile.dev.package."*"]
opt-level = 2 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"

103
README.md
View file

@ -5,8 +5,9 @@
<h1 align="center">ChessPenguin</h1> <h1 align="center">ChessPenguin</h1>
<p align="center"> <p align="center">
A native chess database for Linux: open PGN collections, read annotated games, A chess database for Linux, Windows, macOS and Android: open PGN and ChessBase collections,
enter your own and analyse them with Stockfish or any UCI engine. read annotated games, enter your own, analyse them with Stockfish, prepare against an
opponent and play against the computer.
</p> </p>
<p align="center"> <p align="center">
@ -14,37 +15,84 @@
<a href="README.ru.md">Русский</a> <a href="README.ru.md">Русский</a>
</p> </p>
![Analysis](docs/screenshots/analysis.png) ![A game with its review](docs/screenshots/game.png)
## Features ## Features
- **PGN library** — keep several databases at hand, search and sort games, reopen where you left off. - **PGN library** — keep several databases at hand, search and sort games, reopen where you left off.
- **ChessBase and archives** — open ChessBase databases (`.cbh`) and archives (`.cbv`), and `.zip` /
`.7z` files with PGN or ChessBase inside: games, variations, comments, symbols, arrows and the book
chapters, read-only (export to PGN by saving a game).
- **Real-world PGN** — nested variations, comments, NAGs, games from a FEN position, legacy - **Real-world PGN** — nested variations, comments, NAGs, games from a FEN position, legacy
encodings (windows-1251, windows-1252, KOI8-R, CP866) and teaching null moves (`--`). encodings (windows-1251, windows-1252, KOI8-R, CP866) and teaching null moves (`--`).
Source files are never modified. Source files are never modified.
- **Notation** — main line as a two-column table, comments and variations as blocks, - **Notation** — main line as a two-column table, comments and variations as blocks,
mouse and keyboard navigation. mouse and keyboard navigation.
- **Stockfish included** — analysis works right after installation; other UCI engines can be added. - **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; - **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. 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), 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 - **Engine lines on the board** — step through a line without touching the game, add it as a
variation with one click (undoable). variation with one click (undoable).
- **Editing** — enter moves and variations, promote or delete lines, undo/redo, - **Editing** — enter moves and variations, promote or delete lines, undo/redo,
copy PGN/FEN, save a game to a new file. copy PGN/FEN, save a game to a new file.
- **Looks** — 14 piece sets and 26 boards (flat colours and textures from Lichess), - **Your comments** — write a comment after any move or at the start of the game, in the
sounds, dark and light themes. main line or inside a variation, right in the notation; put symbols on moves and
- **Languages** — English, Русский, Français, Deutsch, Español, Italiano. positions; draw arrows and circles on the board with the right mouse button. Existing
book comments can be edited; their embedded commands and bytes are kept when untouched.
- **Your own databases** — create an empty PGN database, add any game to it (a new one, a
pasted one, a game from a ChessBase or online database), save your changes back
(Ctrl+S), edit the game data (players, event, date, result, annotator), delete games with
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 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; 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) | | ![Preparing against an opponent](docs/screenshots/prep-openings.jpg) | ![Game review](docs/screenshots/review.png) |
| **Engine settings in the analysis panel** | **Library** | | **Engine analysis** | **Reference: what was played here** |
| ![Engine settings](docs/screenshots/engine.png) | ![Library](docs/screenshots/library.png) | | ![Engine analysis](docs/screenshots/engine.jpg) | ![Reference](docs/screenshots/reference.jpg) |
| **Boards and pieces** | | | **Library with filters** | **Search by position** |
| ![Settings](docs/screenshots/settings.png) | | | ![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 ## Install
@ -58,9 +106,21 @@ Packages for every release are on the [Releases](https://github.com/vrubelroman/
| Any distribution | `chmod +x ChessPenguin-<version>-x86_64.AppImage && ./ChessPenguin-<version>-x86_64.AppImage` | | Any distribution | `chmod +x ChessPenguin-<version>-x86_64.AppImage && ./ChessPenguin-<version>-x86_64.AppImage` |
| Flatpak | `flatpak install --user ChessPenguin-<version>-x86_64.flatpak` | | Flatpak | `flatpak install --user ChessPenguin-<version>-x86_64.flatpak` |
| Windows | unzip `ChessPenguin-<version>-windows-x86_64.zip`, run `ChessPenguin.exe` | | 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+ | open `ChessPenguin-<version>-android.apk` (Stockfish built in) or `…-android-noengine.apk` (Stockfish downloaded in the app) on the phone |
**Stockfish 19 is included** and set up on the first start: install and analyse. A `stockfish` On macOS the app is not signed by Apple yet: the first time, right-click ChessPenguin in
from your distribution is found too, and any other UCI engine can be added in **Settings → Engines**. Applications and choose **Open** (on macOS 15: System Settings → Privacy & Security → Open Anyway).
**Stockfish** is one click away: the first time you analyse, ChessPenguin offers to download the
official Stockfish 19 (about 80 MB, checked before use, installed for your account only); the
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** 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 ### Build from source
@ -75,17 +135,22 @@ cargo run --release -p chesspenguin -- examples/classics.pgn
| Where | Keys | | Where | Keys |
| --- | --- | | --- | --- |
| Library | ↑/↓ select · Enter open · Ctrl+O add PGN · Ctrl+N new game · Ctrl+F search | | Library | ↑/↓ select · Enter open · Ctrl+O add database · Ctrl+Shift+N new database · Ctrl+N new game · Ctrl+F search · F2 game data · Ctrl+Shift+S add the game to another database · Delete delete the game (Ctrl+Z puts it back) |
| Game | ←/→ move · ↑/↓ switch variation · Home/End · F flip · L engine · Shift+A game analysis · Esc leave preview | | Game | ←/→ move · ↑ end · ↓ start (also End/Home) · Shift+↑/↓ switch variation · F flip · L engine · Shift+A game analysis · Esc leave a preview, then back to the previous game or the library (unsaved edits: Esc again leaves without saving) |
| Editing | Ctrl+Z / Ctrl+Y undo/redo · Ctrl+Shift+C copy PGN · Ctrl+S save as · Ctrl+W back to library | | Editing | Ctrl+Z / Ctrl+Y undo/redo · Ctrl+Shift+C copy PGN · Ctrl+S save to the game's database (or add to one) · Ctrl+Shift+S add to a database · F2 game data · Ctrl+W back to library |
| Comments | Enter comment on the move (Enter done · Esc cancel · Shift+Enter paragraph) · Ctrl+1…6 the move's symbol ! ? !! ?? !? ?! · right mouse button on the board: an arrow (drag) or a circle (click); Shift red, Alt blue, Shift+Alt yellow |
## Project layout ## Project layout
- `crates/chess-core` — game tree, tolerant PGN import/export. - `crates/chess-core` — game tree, tolerant PGN import/export.
- `crates/uci` — UCI engine process supervisor. - `crates/uci` — UCI engine process supervisor.
- `apps/desktop` — the egui application. - `apps/desktop` — the egui application.
- `crates/mobile-api`, `androidApp` — the core for the Android app and the app itself.
- `packaging/` — desktop entry, AppStream metadata, icons, deb/rpm, AppImage and Flatpak recipes. - `packaging/` — desktop entry, AppStream metadata, icons, deb/rpm, AppImage and Flatpak recipes.
The Android app is `androidApp/` (Kotlin, Jetpack Compose) over the same Rust core
(`crates/mobile-api`, UniFFI); `androidApp/scripts/release.sh` builds the two signed APKs.
Releases are built by GitHub Actions when a `v*` tag is pushed (see `.github/workflows/release.yml`). Releases are built by GitHub Actions when a `v*` tag is pushed (see `.github/workflows/release.yml`).
## License ## License

View file

@ -1,45 +1,91 @@
# ChessPenguin # ChessPenguin
Нативная шахматная база для Linux: открывайте PGN-сборники, читайте аннотированные партии, Шахматная база для Linux, Windows, macOS и Android: открывайте сборники PGN и ChessBase, читайте
вводите свои и анализируйте их со Stockfish или любым UCI-движком. аннотированные партии, вводите свои, анализируйте их со Stockfish, готовьтесь к сопернику и
играйте с компьютером.
[English](README.md) · [Скачать](https://github.com/vrubelroman/chessPenguin/releases/latest) [English](README.md) · [Скачать](https://github.com/vrubelroman/chessPenguin/releases/latest)
![Анализ](docs/screenshots/ru/analysis.png) ![Партия с разбором](docs/screenshots/game.png)
Скриншоты — английского интерфейса; в программе девять языков, русский среди них.
## Возможности ## Возможности
- **Библиотека PGN** — несколько баз под рукой, поиск и сортировка партий, возврат к той же строке. - **Библиотека PGN** — несколько баз под рукой, поиск и сортировка партий, возврат к той же строке.
- **ChessBase и архивы** — базы ChessBase (`.cbh`) и архивы (`.cbv`), а также `.zip` / `.7z` с PGN
или ChessBase внутри: партии, варианты, комментарии, знаки, стрелки и текстовые главы книг; только
чтение (в PGN — сохранением партии).
- **Реальные PGN** — вложенные варианты, комментарии, NAG, партии из позиции FEN, старые кодировки - **Реальные PGN** — вложенные варианты, комментарии, NAG, партии из позиции FEN, старые кодировки
(windows-1251, windows-1252, KOI8-R, CP866) и учебные нулевые ходы `--`. Исходные файлы не изменяются. (windows-1251, windows-1252, KOI8-R, CP866) и учебные нулевые ходы `--`. Исходные файлы не изменяются.
- **Нотация** — основная линия таблицей в две колонки, комментарии и варианты блоками, - **Нотация** — основная линия таблицей в две колонки, комментарии и варианты блоками,
навигация мышью и клавиатурой. навигация мышью и клавиатурой.
- **Справочник** — какие ходы делали из текущей позиции в базе с полки (для теории — в большой),
их статистика, сколько партия держится в базе, сильнейшие партии с этой позицией.
- **Поиск по позиции** — расставьте ходы на доске и отфильтруйте базу на миллионы партий по
позиции, рядом — фильтры по игроку, годам, рейтингу, дебюту и результату.
- **Анализ движком** — любой UCI-движок, до 5 линий, стрелки лучших ходов, шкала оценки; - **Анализ движком** — любой UCI-движок, до 5 линий, стрелки лучших ходов, шкала оценки;
время, потоки и память настраиваются прямо в панели анализа. время, потоки и память настраиваются прямо в панели анализа.
- **Анализ партии** — оценка всей партии в фоне: график под доской, точность, неточности, ошибки - **Разбор партии** — оценка всей партии в фоне: график под доской, точность, неточности, ошибки
и зевки каждого игрока и по стадиям партии (методика Lichess), лучшие ходы в нотации; и зевки каждого игрока и по стадиям партии (методика Lichess), **блестящие (!!) и
запись анализа в партию знаками, комментариями и `[%eval]` (с отменой). замечательные (!) ходы**, сверенные с отметками chess.com на известных партиях, лучшие ходы в
нотации и значки на доске; запись разбора в партию знаками, комментариями и `[%eval]` (с
отменой). Разбор всегда идёт на одних и тех же параметрах движка, поэтому у партии одинаковые
отметки на любом компьютере и телефоне.
- **Подготовка к сопернику** — выберите игрока базы и посмотрите его дебютный репертуар за белых и
за чёрных: дерево его ходов с названиями дебютов, партиями, счётом и датой последней партии,
таблица дебютов и вариантов с первыми ходами, где он уходит из теории; по кнопке движок находит
его ошибки в дебютах — по дебютам и те, что он повторяет. Все таблицы сортируются по колонкам.
- **Линии движка на доске** — просмотр линии без изменения партии и вставка её вариантом (с отменой). - **Линии движка на доске** — просмотр линии без изменения партии и вставка её вариантом (с отменой).
- **Редактирование** — ввод ходов и вариантов, повышение и удаление линий, отмена/повтор, - **Редактирование** — ввод ходов и вариантов, повышение и удаление линий, отмена/повтор,
копирование PGN/FEN, сохранение партии в новый файл. копирование PGN/FEN, сохранение партии в новый файл.
- **Оформление** — 14 наборов фигур и 26 досок (цвета и текстуры Lichess), звуки, тёмная и светлая тема. - **Вставка варианта** — ходы или целая партия PGN из буфера встают в открытую партию вариантом
- **Языки** — English, Русский, Français, Deutsch, Español, Italiano. с того места, где расходятся, с комментариями и вариантами (Ctrl+V).
- **Изучение дебюта** — повторите по памяти ходы обеих сторон партии до выбранного хода; ошибки
считаются, прохождения каждой линии запоминаются. Или продолжите партию с любого хода против Maia.
- **Игра с компьютером** — Maia, нейросеть, обученная на партиях людей, играет как человек
выбранного уровня, вместе с ошибками (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 по нику (без входа) в базу; новые партии приходят сами.
- **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/prep-openings.jpg) | ![Разбор партии](docs/screenshots/review.png) |
| **Настройки движка в панели анализа** | **Библиотека** | | **Анализ движком** | **Справочник: что здесь играли** |
| ![Настройки движка](docs/screenshots/ru/engine.png) | ![Библиотека](docs/screenshots/ru/library.png) | | ![Анализ движком](docs/screenshots/engine.jpg) | ![Справочник](docs/screenshots/reference.jpg) |
| **Доски и фигуры** | | | **Библиотека с фильтрами** | **Поиск по позиции** |
| ![Настройки](docs/screenshots/ru/settings.png) | | | ![Библиотека](docs/screenshots/library.png) | ![Поиск по позиции](docs/screenshots/position-search.jpg) |
| **Игра с компьютером** | **Android** |
| ![Игра](docs/screenshots/play.jpg) | ![Android](docs/screenshots/android.jpg) |
| **Доски, фигуры и светлая тема** | |
| ![Оформление](docs/screenshots/looks.jpg) | |
## Установка ## Установка
Пакеты каждого релиза — на странице [Releases](https://github.com/vrubelroman/chessPenguin/releases): Пакеты каждого релиза — на странице [Releases](https://github.com/vrubelroman/chessPenguin/releases):
`.deb`, `.rpm`, AppImage, Flatpak и архив для Windows. Команды установки — в [README.md](README.md#install). `.deb`, `.rpm`, AppImage, Flatpak, архив для Windows и `.dmg` для macOS на Apple Silicon (приложение пока
не подписано Apple: в первый раз — правый клик → «Открыть»). Команды установки — в [README.md](README.md#install).
**Stockfish 19 входит в комплект** и настраивается при первом запуске: установил и анализируешь. **Stockfish — в один клик:** при первом анализе ChessPenguin предложит скачать официальный
Системный `stockfish` тоже находится автоматически, другие UCI-движки добавляются в **Настройки → Движки**. Stockfish 19 (около 80 МБ, проверяется перед запуском, ставится только для вас); та же кнопка есть
в **Настройки → Движки**. Установленный в системе `stockfish` находится сам, другие UCI-движки
добавляются из файла. Во Flatpak Stockfish уже есть.
**Android 12+:** базы и партии (те же форматы), нотация под доской, Stockfish; ходы на доске
(варианты, отмена), свои базы на телефоне, разбор партии с !! и !, игра с Maia и Rodent IV,
изучение дебюта.
Две сборки: `ChessPenguin-<версия>-android.apk` — Stockfish уже внутри, `…-android-noengine.apk` —
Stockfish скачивается в приложении. Ставятся одна поверх другой, базы и настройки сохраняются.
Сборка из исходников: Rust 1.97+, затем `cargo run --release -p chesspenguin` Сборка из исходников: Rust 1.97+, затем `cargo run --release -p chesspenguin`
или `./scripts/install.sh` для установки в `~/.local` вместе со Stockfish (`--no-stockfish` — без него). или `./scripts/install.sh` для установки в `~/.local` вместе со Stockfish (`--no-stockfish` — без него).

View file

@ -27,18 +27,117 @@ https://github.com/lichess-org/lila at revision `cd2656d2787a766ba743da8da1dd3b2
| `apps/desktop/assets/boards/*` | `public/images/board/*` (wood, wood2–4, maple, maple2, leather, marble, blue-marble, blue2, blue3, canvas2, metal, olive, grey, green-plastic, purple-diag, pink-pyramid) | the lila authors and pirouetti | AGPLv3+ | | `apps/desktop/assets/boards/*` | `public/images/board/*` (wood, wood2–4, maple, maple2, leather, marble, blue-marble, blue2, blue3, canvas2, metal, olive, grey, green-plastic, purple-diag, pink-pyramid) | the lila authors and pirouetti | AGPLv3+ |
| `apps/desktop/assets/sounds/sfx` | `public/sound/sfx` | Enigmahack | AGPLv3+ | | `apps/desktop/assets/sounds/sfx` | `public/sound/sfx` | Enigmahack | AGPLv3+ |
| `apps/desktop/assets/sounds/piano` | `public/sound/piano` | Enigmahack | AGPLv3+ | | `apps/desktop/assets/sounds/piano` | `public/sound/piano` | Enigmahack | AGPLv3+ |
| `apps/desktop/assets/sounds/futuristic` | `public/sound/futuristic` | Enigmahack | AGPLv3+ |
| `apps/desktop/assets/sounds/nes` | `public/sound/nes` | Enigmahack | AGPLv3+ |
| `apps/desktop/assets/boards/horsey.jpg` | `public/images/board/horsey.jpg` | the lila authors | AGPLv3+ |
The flat "IC" and "NCF" boards reproduce the two colours of `public/images/board/ic.png` and
`ncf-board.png`; the other flat boards are ChessPenguin's own colour pairs.
### From PyChess
Downloaded unmodified (files renamed `wk.svg` → `wK.svg`) from https://github.com/pychess/pychess
(`pieces/`, 2026-10-18), with the license file of each set:
| Path in this repo | Author / origin | License |
| --- | --- | --- |
| `apps/desktop/assets/pieces/governor` | the lila authors (Lichess "governor") | AGPLv3+ |
| `apps/desktop/assets/pieces/kosal` | Kosal Sen (philatype.com) | CC BY 4.0 |
| `apps/desktop/assets/pieces/metaltops` | PyChess (`license.txt`: "published under the GPL") | GPL |
### Kenney sounds
`apps/desktop/assets/sounds/wood`, `glass` and `clicks` are made from Kenney's "Impact Sounds" and
"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 | 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 |
`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: Notes:
- Lichess keeps a set's checkmate sound as a link to its check sound; ChessPenguin plays the check
sound for checkmate in the Lichess sets.
- Lichess "standard" sounds are listed as non-free in `COPYING.md` and are intentionally not used. - Lichess "standard" sounds are listed as non-free in `COPYING.md` and are intentionally not used.
- Piece sets and boards under CC BY-NC-SA (e.g. california, staunty, maestro, horsey) are not bundled: non-commercial terms are incompatible with the GPL. - Piece sets and boards under CC BY-NC-SA (e.g. california, staunty, maestro, horsey) are not bundled: non-commercial terms are incompatible with the GPL.
- AGPLv3+ sound, piece and board files are combined with this GPLv3+ program under GPLv3 §13. - AGPLv3+ sound, piece and board files are combined with this GPLv3+ program under GPLv3 §13.
## Stockfish (bundled engine) ## Maia-3 (play against the computer)
Release packages include **Stockfish 19** (tag `sf_19`), the unmodified official `crates/maia` computes the Maia-3 network (CSSLab, University of Toronto: Reid McIlroy-Young,
`stockfish-*-x86-64-universal` binaries from Ashton Anderson and co-authors) in Rust. Its architecture and input encoding follow the
https://github.com/official-stockfish/Stockfish/releases/tag/sf_19 (SHA-256 pinned in reference implementation https://github.com/CSSLab/maia3 (AGPL-3.0), translated to Rust and
`packaging/stockfish.sh`). checked against it (`scripts/maia-reference.py`, `crates/maia/tests/reference.json`); as with the
AGPL sounds above, it is combined with this GPLv3+ program under GPLv3 §13.
The network weights are **not** part of ChessPenguin. On the user's request the program
downloads the authors' own file `maia3-5m.pt` from https://huggingface.co/UofTCSSLab/Maia3-5M
(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
https://github.com/official-stockfish/Stockfish/releases/tag/sf_19. The Flatpak bundles it;
the other packages do not: on request the program downloads the same official archive for the
platform into the user's data directory and checks its SHA-256 (pinned in
`apps/desktop/src/engine_download.rs` and `packaging/stockfish.sh`) before using it.
- License: GNU General Public License version 3 (`Copying.txt`, installed as - License: GNU General Public License version 3 (`Copying.txt`, installed as
`stockfish-Copying.txt` next to this application's license); authors: the Stockfish `stockfish-Copying.txt` next to this application's license); authors: the Stockfish
@ -50,7 +149,70 @@ https://github.com/official-stockfish/Stockfish/releases/tag/sf_19 (SHA-256 pinn
Open Database License (ODbL). Open Database License (ODbL).
- ChessPenguin runs Stockfish as a separate process over the UCI protocol. - 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
(https://github.com/antoyo/uncbv, Antoni Boucher, GPL-3.0-or-later); the code is a rewrite.
- The ChessBase database layout (`crates/chess-import/src/chessbase/`) follows the public format
description in https://github.com/Yarin78/morphy (`format/v1`), used as a source of facts; no code
is taken from that project.
- ChessBase is a trademark of ChessBase GmbH; ChessPenguin is not affiliated with it.
## Rust crates ## Rust crates
Dependency licenses are recorded by `Cargo.lock`; key ones: shakmaty / pgn-reader (GPL-3.0-or-later), Dependency licenses are recorded by `Cargo.lock`; key ones: shakmaty / pgn-reader (GPL-3.0-or-later),
egui / eframe (MIT OR Apache-2.0). egui / eframe (MIT OR Apache-2.0), zip (MIT), sevenz-rust2 (Apache-2.0), sysinfo (MIT),
sys-locale (MIT OR Apache-2.0), whatlang (MIT, detecting the language of comments).
egui's bundled fonts are part of the program: Ubuntu Light (Ubuntu Font Licence 1.0), Hack
(MIT and Bitstream Vera licence), Noto Emoji (SIL OFL 1.1), emoji-icon-font (MIT).
Three evaluation signs (⩲ ⩱ ⌓) come from Noto Sans Math (Copyright 2022 Google LLC, SIL OFL 1.1),
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`.

18
androidApp/.gitignore vendored Normal file
View file

@ -0,0 +1,18 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
/dist
/dist-rustore
.env

1
androidApp/app/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,275 @@
// ChessPenguin for Android (docs/design/android-ui.md, docs/research/android-stack.md):
// the interface in Kotlin + Jetpack Compose, the reading of databases in the Rust core
// of the desktop app (crates/mobile-api), bound with UniFFI.
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.kotlin.serialization)
}
/// The repository root: the Rust workspace, the sample games, the piece sets.
val repo: File = rootDir.parentFile
val cargoOut = layout.buildDirectory.dir("rust/ndk")
val rustLibs = layout.buildDirectory.dir("rust/jniLibs")
val bindings = layout.buildDirectory.dir("generated/uniffi")
val bundled = layout.buildDirectory.dir("generated/assets")
val ndkHome = System.getenv("ANDROID_NDK_HOME")
?: "${System.getenv("ANDROID_HOME") ?: "${System.getProperty("user.home")}/Android/Sdk"}/ndk/30.0.16248370"
/// The version of the workspace (Cargo.toml): the phone and the desktop are one release.
val version: String = Regex("""(?m)^version = "([^"]+)"""")
.find(File(repo, "Cargo.toml").readText())!!.groupValues[1]
val versionNumber: Int = version.split('.').map { it.takeWhile(Char::isDigit).toInt() }
.let { (major, minor, patch) -> major * 10000 + minor * 100 + patch }
/// The core for the phones (arm64) and the emulator (x86_64).
val cargoBuild = tasks.register<Exec>("cargoBuild") {
workingDir = repo
environment("ANDROID_NDK_HOME", ndkHome)
commandLine(
"cargo", "ndk", "-t", "arm64-v8a", "-t", "x86_64", "--platform", "31",
"-o", cargoOut.get().asFile.path, "build", "--release", "-p", "mobile-api",
)
inputs.dir(File(repo, "crates"))
inputs.file(File(repo, "Cargo.lock"))
outputs.dir(cargoOut)
}
/// Only our library: cargo-ndk also copies the cdylibs of dependencies (sevenz-rust2),
/// which are linked into ours already.
val rustJniLibs = tasks.register<Copy>("rustJniLibs") {
dependsOn(cargoBuild)
from(cargoOut) { include("*/libmobile_api.so") }
into(rustLibs)
}
/// The Kotlin side of the bridge, generated from the built library.
val uniffiBindings = tasks.register<Exec>("uniffiBindings") {
dependsOn(rustJniLibs)
workingDir = repo
commandLine(
"cargo", "run", "-q", "-p", "mobile-api", "--features", "bindgen", "--bin", "uniffi-bindgen",
"--", "generate", "--no-format", "--language", "kotlin",
"--library", rustLibs.get().file("x86_64/libmobile_api.so").asFile.path,
"--out-dir", bindings.get().asFile.path,
)
inputs.dir(rustLibs)
inputs.file(repo.resolve("crates/mobile-api/uniffi.toml"))
outputs.dir(bindings)
}
/// Stockfish for Android (scripts/stockfish.sh): the executable for both builds, its
/// network only inside the "full" one.
val stockfishOut = layout.buildDirectory.dir("stockfish")
val stockfish = tasks.register<Exec>("stockfish") {
environment("ANDROID_NDK_HOME", ndkHome)
commandLine(File(rootDir, "scripts/stockfish.sh").path, stockfishOut.get().asFile.path)
inputs.file(File(rootDir, "scripts/stockfish.sh"))
outputs.dir(stockfishOut)
}
/// 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")
into("examples")
}
from(File(repo, "apps/desktop/assets/pieces")) {
include("*/*.svg")
into("pieces")
}
from(File(repo, "apps/desktop/assets/boards")) {
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")
}
// 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)
}
android {
namespace = "io.github.vrubelroman.chesspenguin"
compileSdk = 37
flavorDimensions += "engine"
productFlavors {
// «Stockfish уже внутри»: the network is in the APK, nothing to download.
create("full") {
dimension = "engine"
buildConfigField("boolean", "NET_BUILT_IN", "true")
}
// «Stockfish скачивается в приложении»: the network is downloaded on request.
create("light") {
dimension = "engine"
buildConfigField("boolean", "NET_BUILT_IN", "false")
}
}
defaultConfig {
applicationId = "io.github.vrubelroman.chesspenguin"
minSdk = 31
targetSdk = 36
versionCode = versionNumber
versionName = version
ndk {
abiFilters += listOf("arm64-v8a", "x86_64")
}
// The network of Stockfish 19 (scripts/stockfish.sh), checked after download.
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",
"\"https://github.com/official-stockfish/networks/raw/master/nn-1a298aa575a0.nnue\"",
)
}
// The release key is never in the repository: CP_KEYSTORE, CP_KEYSTORE_PASSWORD,
// CP_KEY_ALIAS, CP_KEY_PASSWORD come from the environment (scripts/release.sh, CI).
val keystore = System.getenv("CP_KEYSTORE")
signingConfigs {
if (keystore != null) {
create("release") {
storeFile = File(keystore)
storePassword = System.getenv("CP_KEYSTORE_PASSWORD")
keyAlias = System.getenv("CP_KEY_ALIAS")
keyPassword = System.getenv("CP_KEY_PASSWORD")
}
}
}
buildTypes {
// Where the app asks for a newer release: GitHub ("" = the core's address). A debug
// build may ask a test server instead (CP_UPDATE_API at build time, e.g.
// http://10.0.2.2:8765/latest.json for a server on the emulator's host).
debug {
buildConfigField("String", "UPDATE_API", "\"${System.getenv("CP_UPDATE_API") ?: ""}\"")
}
release {
buildConfigField("String", "UPDATE_API", "\"\"")
isMinifyEnabled = true
isShrinkResources = true
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 {
localeFilters += listOf("en", "ru", "de", "fr", "es", "it", "pt", "uz", "kk")
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures {
compose = true
aidl = false
buildConfig = true
shaders = false
}
sourceSets {
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)
}
getByName("full") {
assets.directories.add(stockfishOut.get().dir("net").asFile.path)
}
}
packaging {
// Unpacked at install: Stockfish and Rodent IV run from nativeLibraryDir as their
// own processes.
jniLibs {
useLegacyPackaging = true
}
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}
kotlin {
jvmToolchain(21)
}
tasks.named("preBuild") {
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 {
val composeBom = platform(libs.androidx.compose.bom)
implementation(composeBom)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material.icons)
debugImplementation(libs.androidx.compose.ui.tooling)
implementation(libs.androidx.navigation3.ui)
implementation(libs.androidx.navigation3.runtime)
implementation(libs.androidx.lifecycle.viewmodel.navigation3)
implementation(libs.androidx.datastore.preferences)
implementation(libs.kotlinx.serialization.json)
// The bridge to the Rust core (UniFFI uses JNA), and the SVG pieces.
implementation("${libs.jna.get()}@aar")
implementation(libs.androidsvg)
testImplementation(libs.junit)
}

6
androidApp/app/proguard-rules.pro vendored Normal file
View file

@ -0,0 +1,6 @@
# The Rust core is reached through JNA (UniFFI): JNA finds the native functions and
# the structures by reflection, so neither may be renamed or removed.
-keep class com.sun.jna.** { *; }
-keep class * implements com.sun.jna.** { *; }
-keep class uniffi.mobile_api.** { *; }
-dontwarn java.awt.**

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:networkSecurityConfig="@xml/network_security_config" />
</manifest>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Debug builds only: a test release served over plain HTTP by the emulator's host
(build.gradle.kts, CP_UPDATE_API). Release builds keep Android's default: HTTPS only. -->
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">10.0.2.2</domain>
</domain-config>
</network-security-config>

View file

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Games from Lichess and Chess.com, only when asked for (android-ui.md §23). -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Whether there is a network, before a download (the engine's, an update) and a check
for updates: in both builds. -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- The app installs its own updates (android-ui.md §25); the second one lets Android
skip its question when the app installed the previous version itself. -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.UPDATE_PACKAGES_WITHOUT_USER_ACTION" />
<application
android:name=".ChessPenguinApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.ChessPenguin"
android:localeConfig="@xml/locales_config"
android:enableOnBackInvokedCallback="true">
<!-- 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>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- "Open with": PGN, ZIP, 7z, and files of no known type (.cbv, and .pgn
from apps that do not know it). -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content" />
<data android:mimeType="application/x-chess-pgn" />
<data android:mimeType="application/vnd.chess-pgn" />
<data android:mimeType="application/zip" />
<data android:mimeType="application/x-7z-compressed" />
<data android:mimeType="application/octet-stream" />
</intent-filter>
<!-- "Share" with a file of the same kinds. -->
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/x-chess-pgn" />
<data android:mimeType="application/vnd.chess-pgn" />
<data android:mimeType="application/zip" />
<data android:mimeType="application/x-7z-compressed" />
<data android:mimeType="application/octet-stream" />
</intent-filter>
</activity>
<!-- The package installer's answer to an update (data/AppUpdates.kt). -->
<receiver
android:name=".data.InstallResult"
android:exported="false" />
</application>
</manifest>

View file

@ -0,0 +1,218 @@
package io.github.vrubelroman.chesspenguin
import android.app.Application
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
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
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import java.io.FileNotFoundException
import java.util.UUID
/// The app's databases, settings and engine files live as long as the process.
class ChessPenguinApp : Application() {
/// Work that outlives a screen (the download of the engine).
val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
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).
var visit by mutableStateOf(UUID.randomUUID().toString())
private set
fun leftApp() {
visit = UUID.randomUUID().toString()
}
/// A file opened from another app: being copied in, on the list, or why not.
val incoming = MutableStateFlow<Incoming?>(null)
/// One copy at a time, in the order the files came; only the last one opened is shown.
private val copying = Mutex()
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) {
val request = latestIncoming.withLock {
latestIncoming.next(IncomingOrigin.Uri).also { incoming.value = Incoming.Opening }
}
scope.launch {
val result = copying.withLock {
try {
val name = displayName(uri) ?: "games.pgn"
val ext = name.substringAfterLast('.', "").lowercase()
// One file of a ChessBase database: the others are not given with it.
if (ext in CHESSBASE_PARTS) throw ChessBasePart()
// A name with no known ending (some apps give "file_123") is read as PGN.
val fileName = if (ext in setOf("pgn", "zip", "7z", "cbv")) name else "$name.pgn"
val input = contentResolver.openInputStream(uri) ?: throw FileNotFoundException(uri.toString())
Incoming.Opened(input.use { library.addCopy(fileName, it) { name.substringBeforeLast('.') } })
} catch (e: Exception) {
Incoming.Failed(e)
}
}
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)
}
}
}
private fun displayName(uri: Uri): String? = runCatching {
contentResolver.query(uri, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null)?.use { c ->
if (c.moveToFirst()) c.getString(0) else null
}
}.getOrNull()
}
/// A `.cbh` (or another part) of a ChessBase database, opened alone.
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

@ -0,0 +1,139 @@
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
import androidx.lifecycle.repeatOnLifecycle
import kotlinx.coroutines.launch
import android.net.Uri
import android.os.Bundle
import android.graphics.Color
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
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
import io.github.vrubelroman.chesspenguin.data.Theme
import io.github.vrubelroman.chesspenguin.theme.ChessPenguinTheme
/// The scrims behind three-button navigation, as `enableEdgeToEdge` has them by default.
private val LIGHT_SCRIM = Color.argb(0xe6, 0xFF, 0xFF, 0xFF)
private val DARK_SCRIM = Color.argb(0x80, 0x1b, 0x1b, 0x1b)
class MainActivity : ComponentActivity() {
override fun attachBaseContext(base: Context) {
super.attachBaseContext(Language.wrap(base))
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
// Not again when the activity is made anew (turned): it was taken the first time.
if (savedInstanceState == null) receive(intent)
val app = application as ChessPenguinApp
val settings = app.settings
// Android's question «Update this app?» is put on the screen only while the app is
// on it (the installer may answer while the user is elsewhere).
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
app.updates.confirm.collect { confirm ->
if (confirm != null) {
app.updates.confirmShown()
startActivity(confirm.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
}
}
}
}
setContent {
val prefs by settings.prefs.collectAsState()
val dark = when (prefs.theme) {
Theme.System -> isSystemInDarkTheme()
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) {
enableEdgeToEdge(
statusBarStyle = SystemBarStyle.auto(Color.TRANSPARENT, Color.TRANSPARENT) { dark },
navigationBarStyle = SystemBarStyle.auto(LIGHT_SCRIM, DARK_SCRIM) { dark },
)
onDispose {}
}
ChessPenguinTheme(darkTheme = dark) {
Surface(Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) { MainNavigation() }
}
}
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
receive(intent)
}
/// A file given by another app: "Open with" (VIEW) or "Share" (SEND).
private fun receive(intent: Intent?) {
// Opened again from Recents: the task keeps the intent of the file it was made for.
if (intent == null || intent.flags and Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY != 0) return
val uri = when (intent.action) {
Intent.ACTION_VIEW -> intent.data
Intent.ACTION_SEND -> androidx.core.content.IntentCompat.getParcelableExtra(intent, Intent.EXTRA_STREAM, Uri::class.java)
else -> null
} ?: return
(application as ChessPenguinApp).receive(uri)
}
override fun onStart() {
super.onStart()
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()
val app = application as ChessPenguinApp
app.updates.onResume()
app.clipboardPgn.check(clipboardText(this))
}
override fun onStop() {
super.onStop()
(application as ChessPenguinApp).updates.foreground = false
// Gone to the background or closed, not turned.
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

@ -0,0 +1,273 @@
package io.github.vrubelroman.chesspenguin
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
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
import androidx.compose.ui.window.DialogProperties
import androidx.compose.ui.semantics.semantics
import io.github.vrubelroman.chesspenguin.data.DbEntry
import io.github.vrubelroman.chesspenguin.data.NoGames
import uniffi.mobile_api.ApiException
import java.io.FileNotFoundException
import io.github.vrubelroman.chesspenguin.ui.app
import io.github.vrubelroman.chesspenguin.ui.openProblem
import io.github.vrubelroman.chesspenguin.ui.UpdateSheet
import androidx.navigation3.runtime.NavKey
import androidx.navigation3.runtime.entryProvider
import androidx.navigation3.runtime.rememberSaveableStateHolderNavEntryDecorator
import androidx.lifecycle.viewmodel.navigation3.rememberViewModelStoreNavEntryDecorator
import androidx.navigation3.runtime.rememberNavBackStack
import androidx.navigation3.ui.NavDisplay
import io.github.vrubelroman.chesspenguin.ui.AboutScreen
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
@Serializable data object BoardStyleKey : NavKey
@Serializable data object OnlineKey : NavKey
@Composable
fun MainNavigation() {
val backStack = rememberNavBackStack(Databases)
// A database just added from outside (the clipboard, another app): its list, or its
// only game at once, over the list of databases.
fun show(entry: DbEntry) {
while (backStack.size > 1) backStack.removeAt(backStack.lastIndex)
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) {
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) {
Row(Modifier.padding(24.dp).semantics(mergeDescendants = true) {}, verticalAlignment = Alignment.CenterVertically) {
CircularProgressIndicator(Modifier.size(24.dp), strokeWidth = 3.dp)
Spacer(Modifier.size(16.dp))
Text(stringResource(R.string.opening_file), style = MaterialTheme.typography.bodyLarge)
}
}
}
is Incoming.Failed -> AlertDialog(
onDismissRequest = { app.incoming.compareAndSet(i, null) },
title = { Text(stringResource(R.string.file_failed)) },
text = { Text(incomingProblem(i.error)) },
confirmButton = { TextButton(onClick = { app.incoming.compareAndSet(i, null) }) { Text(stringResource(R.string.ok)) } },
)
else -> {}
}
NavDisplay(
backStack = backStack,
onBack = { backStack.removeLastOrNull() },
// Each screen keeps its own saved state and view models: they go with the screen
// when it leaves the stack (the search of the online screen must not outlive it).
entryDecorators = listOf(
rememberSaveableStateHolderNavEntryDecorator(),
rememberViewModelStoreNavEntryDecorator(),
),
entryProvider = entryProvider {
entry<Databases> {
DatabasesScreen(
onOpen = { backStack.add(Games(it)) },
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)) },
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) },
onPlayGame = { backStack.add(PlayKey) },
onPrepare = { backStack.add(Preparation(it)) },
)
}
entry<SettingsKey> {
SettingsScreen(
onBack = { backStack.removeLastOrNull() },
onAbout = { backStack.add(AboutKey) },
onBoardStyle = { backStack.add(BoardStyleKey) },
)
}
entry<BoardStyleKey> {
BoardStyleScreen(onBack = { backStack.removeLastOrNull() })
}
entry<OnlineKey> {
OnlineScreen(
onBack = { backStack.removeLastOrNull() },
// The downloaded database instead of this screen: "back" goes to the list.
onOpen = { id ->
backStack.removeLastOrNull()
backStack.add(Games(id))
},
)
}
entry<AboutKey> {
AboutScreen(onBack = { backStack.removeLastOrNull() })
}
},
)
}
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
private fun incomingProblem(e: Throwable): String = when (e) {
is ChessBasePart -> stringResource(R.string.file_chessbase_part)
is NoGames -> stringResource(R.string.file_no_games)
is SecurityException, is FileNotFoundException, is ApiException.Io -> stringResource(R.string.file_unreadable)
is ApiException -> openProblem(e).ifEmpty { stringResource(R.string.open_corrupt) }
else -> stringResource(R.string.file_copy_failed)
}

View file

@ -0,0 +1,662 @@
package io.github.vrubelroman.chesspenguin.data
import android.app.DownloadManager
import android.app.PendingIntent
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.pm.PackageInstaller
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.net.Uri
import android.os.Build
import android.os.storage.StorageManager
import io.github.vrubelroman.chesspenguin.BuildConfig
import io.github.vrubelroman.chesspenguin.ChessPenguinApp
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.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 kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import uniffi.mobile_api.ReleaseCheck
import uniffi.mobile_api.checkRelease
import uniffi.mobile_api.checkReleaseCounted
import java.io.File
import java.io.IOException
import java.security.MessageDigest
/// A newer release, as it is kept between starts: its light APK is what is installed.
@Serializable
data class Update(
val version: String,
val page: String,
val apkName: String,
val apkUrl: String,
val apkSize: Long,
val sha256: String,
)
/// A step that takes seconds and cannot be stopped.
enum class UpdateStep { CheckingFile, KeepingEngine, Installing }
/// Why an update did not go on (android-ui.md §25.3 F).
enum class UpdateProblem { NoInternet, DownloadFailed, NoSpace, Corrupt, BadRelease, InstallStorage, Conflict, Blocked, InstallFailed }
/// Where the update of a known newer release is.
sealed interface UpdateState {
val update: Update
data class Available(override val update: Update) : UpdateState
/// Android needs the user's permission to install apps; `denied`: back without it.
data class NeedsPermission(override val update: Update, val denied: Boolean) : UpdateState
data class Downloading(override val update: Update, val done: Long, val waitingNetwork: Boolean) : UpdateState
data class Busy(override val update: Update, val step: UpdateStep) : UpdateState
/// Downloaded and checked; `aborted`: the user said no to Android's question.
data class Ready(override val update: Update, val aborted: Boolean) : UpdateState
data class Failed(override val update: Update, val problem: UpdateProblem, val detail: String?) : UpdateState
}
/// The manual check in About.
sealed interface CheckState {
data object Idle : CheckState
data object Checking : CheckState
data object Latest : CheckState
data object Offline : CheckState
data object Failed : CheckState
}
/// Messages for a snackbar over the app.
sealed interface UpdateMessage {
data object Ready : UpdateMessage
data object Cancelled : UpdateMessage
data object Latest : UpdateMessage
data class Updated(val from: String, val to: String) : UpdateMessage
}
/// The app updating itself (android-ui.md §25): asks GitHub for a newer release (the
/// core's check, the same as the desktop's), downloads its light APK with the system's
/// download service, checks it against the release's SHA-256 and gives it to Android's
/// package installer. What is known is kept, so a restart picks it up where it was.
class AppUpdates(private val context: Context, private val scope: CoroutineScope, private val engine: EngineFiles) {
private val prefs = context.getSharedPreferences("update", Context.MODE_PRIVATE)
private val downloads get() = context.getSystemService(DownloadManager::class.java)
private val dir get() = context.getExternalFilesDir("updates")
private val json = Json { ignoreUnknownKeys = true }
/// A test server (debug builds); otherwise the site, which counts this installation.
private val testApi = BuildConfig.UPDATE_API
/// A random id of this installation, made once; the site counts installations that
/// run by it (nothing else about the user is sent).
private fun installId(): String = prefs.getString(INSTALL_ID, null) ?: java.util.UUID.randomUUID().toString().replace("-", "").also {
prefs.edit().putString(INSTALL_ID, it).apply()
}
private val _state = MutableStateFlow<UpdateState?>(null)
/// The known newer release and where its update is; null when there is none.
val state: StateFlow<UpdateState?> = _state.asStateFlow()
private val _check = MutableStateFlow<CheckState>(CheckState.Idle)
val check: StateFlow<CheckState> = _check.asStateFlow()
private val _auto = MutableStateFlow(prefs.getBoolean(AUTO, !BuildConfig.DEBUG))
/// «Check for updates at start».
val auto: StateFlow<Boolean> = _auto.asStateFlow()
private val _offer = MutableStateFlow(prefs.getBoolean(OFFER, true))
/// «Offer new versions»: the card on «Databases» (its × turns this off). The check
/// goes on without it.
val offer: StateFlow<Boolean> = _offer.asStateFlow()
/// The release was found by «Check now»: its card shows even with the check off.
private val _asked = MutableStateFlow(false)
val asked: StateFlow<Boolean> = _asked.asStateFlow()
private val _lastCheck = MutableStateFlow(prefs.getLong(LAST_OK, 0L))
/// When the last check that got an answer was made (0: never).
val lastCheck: StateFlow<Long> = _lastCheck.asStateFlow()
private val _message = MutableStateFlow<UpdateMessage?>(null)
/// One message for a snackbar; the screen that shows it calls [shown].
val message: StateFlow<UpdateMessage?> = _message.asStateFlow()
fun shown(m: UpdateMessage) {
_message.compareAndSet(m, null)
if (m is UpdateMessage.Updated) prefs.edit().remove(UPDATED_FROM).apply()
}
private val _confirm = MutableStateFlow<Intent?>(null)
/// Android's question «Update this app?», to be shown when the app is on the screen.
val confirm: StateFlow<Intent?> = _confirm.asStateFlow()
private val _sheet = MutableStateFlow(prefs.getString(AWAITING_PERMISSION, null) != null)
/// The update sheet is open: a finished download goes on to install by itself. It
/// opens again after a restart while the user was in the permission's settings.
val sheet: StateFlow<Boolean> = _sheet.asStateFlow()
/// The app is on the screen (MainActivity's onStart … onStop).
@Volatile var foreground = false
/// The user watches the sheet: a finished download goes on to install. Not when the
/// app is in the background — Android would close it unseen (§25.1 p. 6).
private val watched get() = _sheet.value && foreground
fun openSheet() {
_sheet.value = true
}
fun closeSheet() {
_sheet.value = false
}
private var watching: Job? = null
private var session: Int? = null
private var confirmShown = false
init {
// The first start of a new version: say so, and forget the update.
// Kept until a screen shows it: Android may start the new version in the background
// first, only to hand it the installer's answer.
// Keys of 1.0.0 and earlier: a version hidden with «Not now», a page of what's new.
prefs.edit().remove(HIDDEN).remove(UPDATED_PAGE).apply()
prefs.getString(INSTALLING_FROM, null)?.let { from ->
if (from != BuildConfig.VERSION_NAME) {
prefs.edit()
.putString(UPDATED_FROM, from)
.remove(LATEST)
.remove(READY)
.apply()
forgetFile()
}
prefs.edit().remove(INSTALLING_FROM).apply()
}
prefs.getString(UPDATED_FROM, null)?.let { from ->
_message.value = UpdateMessage.Updated(from, BuildConfig.VERSION_NAME)
}
val update = known()
when {
// 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)
else -> {
forgetFile()
_state.value = UpdateState.Available(update)
}
}
}
/// 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 (!BuildConfig.SELF_UPDATE || !_auto.value || busy()) return
val now = System.currentTimeMillis()
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 (!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
}
_check.value = CheckState.Checking
prefs.edit().putLong(LAST_ATTEMPT, System.currentTimeMillis()).apply()
if (!online()) {
_check.value = if (manual) CheckState.Offline else CheckState.Idle
return
}
val platform = if (BuildConfig.FLAVOR == "full") "android" else "android-noengine"
val result = withContext(Dispatchers.IO) {
if (testApi.isNotEmpty()) checkRelease(testApi) else checkReleaseCounted(installId(), platform)
}
when (result) {
is ReleaseCheck.Newer -> {
val light = result.release.light ?: return
val update = Update(result.release.version, result.release.page, light.name, light.url, light.size.toLong(), light.sha256)
checked()
_check.value = CheckState.Idle
if (manual) _asked.value = true
found(update)
}
is ReleaseCheck.Unverifiable -> {
checked()
_check.value = CheckState.Idle
val light = result.release.light ?: return
val update = Update(result.release.version, result.release.page, light.name, light.url, light.size.toLong(), "")
if (manual) _asked.value = true
found(update)
if (!busy()) _state.value = UpdateState.Failed(update, UpdateProblem.BadRelease, null)
}
is ReleaseCheck.UpToDate -> {
checked()
_check.value = CheckState.Latest
if (manual) _message.value = UpdateMessage.Latest
if (!busy()) forgetAll()
}
is ReleaseCheck.Failed -> _check.value = if (manual) CheckState.Failed else CheckState.Idle
}
}
private fun checked() {
val now = System.currentTimeMillis()
_lastCheck.value = now
prefs.edit().putLong(LAST_OK, now).apply()
}
/// A newer release found: a downloaded older one is of no use any more.
private fun found(update: Update) {
val current = _state.value
if (current != null && current.update == update) return
if (busy()) return
forgetFile()
prefs.edit().putString(LATEST, json.encodeToString(update)).remove(READY).apply()
_state.value = UpdateState.Available(update)
}
fun setAuto(on: Boolean) {
_auto.value = on
if (!on) _asked.value = false
prefs.edit().putBoolean(AUTO, on).apply()
if (on) checkIfDue()
}
fun setOffer(on: Boolean) {
_offer.value = on
prefs.edit().putBoolean(OFFER, on).apply()
if (on) checkIfDue()
}
/// «Update» / «Try again» / «Download again»: from the permission on to the install.
fun start() {
val update = _state.value?.update ?: return
if (update.sha256.isEmpty()) {
_state.value = UpdateState.Failed(update, UpdateProblem.BadRelease, null)
return
}
if (!context.packageManager.canRequestPackageInstalls()) {
_state.value = UpdateState.NeedsPermission(update, denied = false)
return
}
if (prefs.getString(READY, null) == update.version && apk(update).exists()) {
install(update)
return
}
download(update)
}
/// The permission's settings page is being opened: back from it, the update goes on
/// (also when Android restarted the app meanwhile).
fun permissionAsked() {
_state.value?.let { prefs.edit().putString(AWAITING_PERMISSION, it.update.version).apply() }
}
/// Back in the app after the permission's settings page.
fun onResume() {
prefs.getString(AWAITING_PERMISSION, null)?.let { version ->
val update = _state.value?.update
prefs.edit().remove(AWAITING_PERMISSION).apply()
if (update != null && update.version == version) {
if (context.packageManager.canRequestPackageInstalls()) {
_sheet.value = true
start()
} else {
_state.value = UpdateState.NeedsPermission(update, denied = true)
}
}
}
// Android's question was closed with no answer: the file waits for «Install».
if (confirmShown) {
confirmShown = false
scope.launch {
delay(1500)
val s = _state.value
if (s is UpdateState.Busy && s.step == UpdateStep.Installing && _confirm.value == null) {
abandon()
_state.value = UpdateState.Ready(s.update, aborted = true)
}
}
}
}
/// The question was put on the screen.
fun confirmShown() {
_confirm.value = null
confirmShown = true
}
private fun download(update: Update) {
if (!online()) {
_state.value = UpdateState.Failed(update, UpdateProblem.NoInternet, null)
return
}
if (freeSpace() < needed(update)) {
_state.value = UpdateState.Failed(update, UpdateProblem.NoSpace, null)
return
}
forgetFile()
// Under another name while it comes: removing the download from the system's list
// deletes its file, and the checked file must stay.
val target = File(apk(update).path + ".download")
val request = DownloadManager.Request(Uri.parse(update.apkUrl))
.setTitle(context.getString(R.string.upd_notification))
.setDestinationUri(Uri.fromFile(target))
// No "complete" notification: tapping it would open the file past the check.
.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
.setAllowedOverMetered(true)
.setAllowedOverRoaming(true)
val id = try {
downloads.enqueue(request)
} catch (e: IllegalArgumentException) {
_state.value = UpdateState.Failed(update, UpdateProblem.DownloadFailed, e.message)
return
}
prefs.edit().putLong(DOWNLOAD, id).putString(DOWNLOAD_VERSION, update.version).apply()
_state.value = UpdateState.Downloading(update, 0, waitingNetwork = false)
watch(update, id)
}
/// «Cancel» while downloading.
fun cancel() {
val update = _state.value?.update ?: return
watching?.cancel()
val id = prefs.getLong(DOWNLOAD, -1L)
if (id != -1L) downloads.remove(id)
prefs.edit().remove(DOWNLOAD).remove(DOWNLOAD_VERSION).apply()
forgetFile()
_state.value = UpdateState.Available(update)
_message.value = UpdateMessage.Cancelled
}
/// «Not now» in the sheet after an error: the card shows the release again.
fun dismissProblem() {
val s = _state.value
// The same file would fail the same way: the card keeps saying so.
if (s is UpdateState.Failed && s.problem in setOf(UpdateProblem.Conflict, UpdateProblem.Blocked, UpdateProblem.BadRelease)) return
if (s is UpdateState.Failed || s is UpdateState.NeedsPermission) {
prefs.edit().remove(AWAITING_PERMISSION).apply()
val ready = prefs.getString(READY, null) == s.update.version && apk(s.update).exists()
_state.value = if (ready) UpdateState.Ready(s.update, aborted = false) else UpdateState.Available(s.update)
}
}
private fun watch(update: Update, id: Long) {
watching?.cancel()
_state.value = UpdateState.Downloading(update, 0, waitingNetwork = false)
watching = scope.launch(Dispatchers.Main.immediate) {
while (isActive) {
val row = withContext(Dispatchers.IO) { progress(id) }
if (row == null) {
// Removed from the system's list of downloads.
prefs.edit().remove(DOWNLOAD).remove(DOWNLOAD_VERSION).apply()
_state.value = UpdateState.Available(update)
return@launch
}
when (row.status) {
DownloadManager.STATUS_SUCCESSFUL -> {
val moved = File(apk(update).path + ".download").renameTo(apk(update))
downloads.remove(id)
prefs.edit().remove(DOWNLOAD).remove(DOWNLOAD_VERSION).apply()
if (moved) {
verify(update)
} else {
forgetFile()
_state.value = UpdateState.Failed(update, UpdateProblem.DownloadFailed, null)
}
return@launch
}
DownloadManager.STATUS_FAILED -> {
downloads.remove(id)
prefs.edit().remove(DOWNLOAD).remove(DOWNLOAD_VERSION).apply()
forgetFile()
val space = row.reason == DownloadManager.ERROR_INSUFFICIENT_SPACE
_state.value = UpdateState.Failed(update, if (space) UpdateProblem.NoSpace else UpdateProblem.DownloadFailed, null)
return@launch
}
else -> {
// A server that does not answer is retried quietly; only a missing network is said.
val waiting = row.status == DownloadManager.STATUS_PAUSED && row.reason == DownloadManager.PAUSED_WAITING_FOR_NETWORK
_state.value = UpdateState.Downloading(update, row.done.coerceAtLeast(0), waiting)
}
}
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)),
)
}
/// The SHA-256 of the file against the release's; then on to the install when the user
/// waits for it in the sheet, or «downloaded» when they are elsewhere.
private suspend fun verify(update: Update) {
_state.value = UpdateState.Busy(update, UpdateStep.CheckingFile)
val file = apk(update)
val sum = withContext(Dispatchers.IO) { runCatching { sha256(file) }.getOrNull() }
if (sum != update.sha256) {
forgetFile()
_state.value = UpdateState.Failed(update, UpdateProblem.Corrupt, null)
return
}
prefs.edit().putString(READY, update.version).apply()
if (watched) {
install(update)
} else {
_state.value = UpdateState.Ready(update, aborted = false)
// With the sheet open the user sees it there.
if (!_sheet.value) _message.value = UpdateMessage.Ready
}
}
/// «Install»: the engine's network kept (full build), then Android's installer.
fun install() {
val s = _state.value ?: return
if (!context.packageManager.canRequestPackageInstalls()) {
start()
return
}
install(s.update)
}
private fun install(update: Update) {
scope.launch(Dispatchers.Main.immediate) {
if (engine.builtIn) {
_state.value = UpdateState.Busy(update, UpdateStep.KeepingEngine)
engine.keepBuiltIn()
}
_state.value = UpdateState.Busy(update, UpdateStep.Installing)
val committed = withContext(Dispatchers.IO) { runCatching { commit(apk(update)) } }
committed.onFailure { e ->
abandon()
val problem = if (e is IOException && freeSpace() < update.apkSize * 2) UpdateProblem.InstallStorage else UpdateProblem.InstallFailed
_state.value = UpdateState.Failed(update, problem, e.message)
}
}
}
/// Writes the APK into an installer session and commits it; the answer comes to
/// [InstallResult].
private fun commit(file: File) {
val installer = context.packageManager.packageInstaller
val params = PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL).apply {
setAppPackageName(context.packageName)
setSize(file.length())
// Without Android's question when it allows that (the app installed the last
// version itself): the conditions are Android's.
setRequireUserAction(PackageInstaller.SessionParams.USER_ACTION_NOT_REQUIRED)
if (Build.VERSION.SDK_INT >= 33) setPackageSource(PackageInstaller.PACKAGE_SOURCE_DOWNLOADED_FILE)
}
val id = installer.createSession(params)
session = id
installer.openSession(id).use { s ->
file.inputStream().use { input ->
s.openWrite("base.apk", 0, file.length()).use { out ->
input.copyTo(out, 256 * 1024)
s.fsync(out)
}
}
prefs.edit().putString(INSTALLING_FROM, BuildConfig.VERSION_NAME).apply()
val intent = Intent(context, InstallResult::class.java).setPackage(context.packageName)
// Mutable: the installer fills in the result.
val pending = PendingIntent.getBroadcast(context, id, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE)
s.commit(pending.intentSender)
}
}
private fun abandon() {
session?.let { runCatching { context.packageManager.packageInstaller.abandonSession(it) } }
session = null
prefs.edit().remove(INSTALLING_FROM).apply()
}
/// The installer's answer (from [InstallResult]).
internal fun onInstallResult(status: Int, message: String?, confirm: Intent?) {
val update = _state.value?.update ?: return
when (status) {
PackageInstaller.STATUS_PENDING_USER_ACTION -> _confirm.value = confirm
// The process ends with the install: nothing more to show.
PackageInstaller.STATUS_SUCCESS -> {}
else -> {
session = null
prefs.edit().remove(INSTALLING_FROM).apply()
_confirm.value = null
_state.value = when (status) {
PackageInstaller.STATUS_FAILURE_ABORTED -> UpdateState.Ready(update, aborted = true)
PackageInstaller.STATUS_FAILURE_STORAGE -> UpdateState.Failed(update, UpdateProblem.InstallStorage, message)
PackageInstaller.STATUS_FAILURE_CONFLICT -> UpdateState.Failed(update, UpdateProblem.Conflict, message)
PackageInstaller.STATUS_FAILURE_BLOCKED -> UpdateState.Failed(update, UpdateProblem.Blocked, message)
else -> UpdateState.Failed(update, UpdateProblem.InstallFailed, message)
}
}
}
}
/// Space the update needs: the file twice (download, install), and the engine's
/// network when the full build keeps it first.
fun needed(update: Update): Long =
2 * update.apkSize + if (engine.builtIn && engine.state.value != NetState.Ready) BuildConfig.NET_SIZE else 0
/// Downloading, checking or installing: a check waits for it to end.
private fun busy(): Boolean = _state.value.let { it is UpdateState.Downloading || it is UpdateState.Busy || it is UpdateState.NeedsPermission }
private fun known(): Update? = prefs.getString(LATEST, null)?.let { runCatching { json.decodeFromString<Update>(it) }.getOrNull() }
private fun newer(version: String): Boolean = compare(version, BuildConfig.VERSION_NAME) > 0
private fun apk(update: Update): File = File(dir ?: context.cacheDir, update.apkName)
private fun forgetFile() {
dir?.listFiles()?.forEach { it.delete() }
prefs.edit().remove(READY).apply()
}
private fun forgetAll() {
forgetFile()
prefs.edit().remove(LATEST).remove(DOWNLOAD).remove(DOWNLOAD_VERSION).remove(AWAITING_PERMISSION).apply()
_state.value = null
_asked.value = false
}
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 AUTO = "autoCheck"
const val LAST_OK = "lastCheckOk"
const val LAST_ATTEMPT = "lastAttempt"
const val INSTALL_ID = "installId"
const val LATEST = "latest"
const val OFFER = "offerUpdates"
/// No longer used: «Not now» hid one version (until 1.0.1).
const val HIDDEN = "hiddenVersion"
const val DOWNLOAD = "downloadId"
const val DOWNLOAD_VERSION = "downloadVersion"
const val READY = "readyVersion"
const val AWAITING_PERMISSION = "awaitingPermission"
const val INSTALLING_FROM = "installingFrom"
const val UPDATED_FROM = "updatedFrom"
/// No longer used (until 1.0.1).
const val UPDATED_PAGE = "updatedPage"
const val RECHECK = 6 * 60 * 60 * 1000L
const val HOUR = 60 * 60 * 1000L
}
}
/// "0.15.0" against "0.14.2": the numbers major.minor.patch.
fun compare(a: String, b: String): Int {
fun parts(v: String) = v.trim().removePrefix("v").split('.').map { p -> p.takeWhile(Char::isDigit).toIntOrNull() ?: 0 }
val (x, y) = parts(a) to parts(b)
for (i in 0 until maxOf(x.size, y.size)) {
val c = (x.getOrElse(i) { 0 }).compareTo(y.getOrElse(i) { 0 })
if (c != 0) return c
}
return 0
}
private fun sha256(file: File): String {
val digest = MessageDigest.getInstance("SHA-256")
file.inputStream().use { input ->
val buf = ByteArray(256 * 1024)
while (true) {
val n = input.read(buf)
if (n < 0) break
digest.update(buf, 0, n)
}
}
return digest.digest().joinToString("") { "%02x".format(it) }
}
/// The package installer's answer to an update.
class InstallResult : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_FAILURE)
val message = intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE)
val confirm = androidx.core.content.IntentCompat.getParcelableExtra(intent, Intent.EXTRA_INTENT, Intent::class.java)
(context.applicationContext as ChessPenguinApp).updates.onInstallResult(status, message, confirm)
}
}

View file

@ -0,0 +1,78 @@
package io.github.vrubelroman.chesspenguin.data
import androidx.annotation.StringRes
import androidx.compose.ui.graphics.Color
import io.github.vrubelroman.chesspenguin.R
/// The piece sets of the desktop app (apps/desktop/src/assets.rs), drawn from
/// `assets/pieces/<dir>`; the name is the set's own, as on Lichess.
enum class PieceSet(val dir: String) {
Cburnett("cburnett"),
Merida("merida"),
Mpchess("mpchess"),
Chessnut("chessnut"),
Fantasy("fantasy"),
Celtic("celtic"),
Spatial("spatial"),
Rhosgfx("rhosgfx"),
Shapes("shapes"),
KiwenSuwi("kiwen-suwi"),
Firi("firi"),
Pixel("pixel"),
Letter("letter"),
Pirouetti("pirouetti"),
Governor("governor"),
Kosal("kosal"),
Metaltops("metaltops"),
}
/// The boards of the desktop app (assets.rs `BoardThemeId`): two colors, and for some a
/// full-board image (`assets/boards/<file>`, 8×8 squares, a1 dark) drawn instead of them.
/// The colors stay for the coordinates and the previews.
enum class BoardTheme(
@StringRes val label: Int,
val number: Int?,
val light: Color,
val dark: Color,
val texture: String? = null,
) {
Brown(R.string.board_brown, null, rgb(240, 217, 181), rgb(181, 136, 99)),
Blue(R.string.board_blue, null, rgb(222, 227, 230), rgb(140, 162, 173)),
Green(R.string.board_green, null, rgb(255, 255, 221), rgb(134, 166, 102)),
Tournament(R.string.board_tournament, null, rgb(238, 238, 210), rgb(118, 150, 86)),
Sand(R.string.board_sand, null, rgb(240, 228, 196), rgb(200, 168, 110)),
Coral(R.string.board_coral, null, rgb(177, 228, 185), rgb(112, 162, 163)),
Grey(R.string.board_grey, null, rgb(217, 217, 217), rgb(154, 154, 154)),
Purple(R.string.board_purple, null, rgb(232, 224, 240), rgb(159, 144, 176)),
Ic(R.string.board_ic, null, rgb(236, 236, 236), rgb(193, 193, 142)),
Ncf(R.string.board_ncf, null, rgb(187, 207, 255), rgb(84, 119, 202)),
Ice(R.string.board_ice, null, rgb(222, 234, 240), rgb(122, 157, 178)),
Navy(R.string.board_navy, null, rgb(220, 226, 236), rgb(70, 96, 140)),
Mint(R.string.board_mint, null, rgb(222, 241, 230), rgb(118, 178, 148)),
Emerald(R.string.board_emerald, null, rgb(226, 236, 218), rgb(74, 132, 100)),
Orange(R.string.board_orange, null, rgb(250, 228, 196), rgb(208, 139, 72)),
Rose(R.string.board_rose, null, rgb(242, 220, 220), rgb(190, 126, 138)),
Dusk(R.string.board_dusk, null, rgb(204, 186, 176), rgb(112, 102, 122)),
Night(R.string.board_night, null, rgb(128, 136, 146), rgb(68, 74, 84)),
Wood(R.string.board_wood, null, rgb(215, 161, 91), rgb(154, 88, 35), "wood.jpg"),
Wood2(R.string.board_wood, 2, rgb(151, 124, 79), rgb(121, 95, 48), "wood2.jpg"),
Wood3(R.string.board_wood, 3, rgb(186, 173, 157), rgb(129, 94, 56), "wood3.jpg"),
Wood4(R.string.board_wood, 4, rgb(191, 158, 104), rgb(134, 91, 54), "wood4.jpg"),
Maple(R.string.board_maple, null, rgb(224, 190, 146), rgb(180, 111, 60), "maple.jpg"),
Maple2(R.string.board_maple, 2, rgb(222, 193, 151), rgb(167, 114, 85), "maple2.jpg"),
Leather(R.string.board_leather, null, rgb(206, 206, 198), rgb(192, 140, 18), "leather.jpg"),
Marble(R.string.board_marble, null, rgb(126, 150, 128), rgb(97, 120, 97), "marble.jpg"),
BlueMarble(R.string.board_blue_marble, null, rgb(229, 224, 212), rgb(148, 158, 174), "blue-marble.jpg"),
Blue2(R.string.board_blue, 2, rgb(129, 151, 173), rgb(96, 118, 138), "blue2.jpg"),
Blue3(R.string.board_blue, 3, rgb(189, 200, 211), rgb(68, 114, 163), "blue3.jpg"),
Canvas(R.string.board_canvas, null, rgb(203, 206, 223), rgb(114, 130, 156), "canvas2.jpg"),
Metal(R.string.board_metal, null, rgb(177, 177, 177), rgb(119, 119, 119), "metal.jpg"),
Olive(R.string.board_olive, null, rgb(173, 166, 148), rgb(132, 124, 106), "olive.jpg"),
Stone(R.string.board_stone, null, rgb(169, 169, 169), rgb(136, 136, 136), "grey.jpg"),
GreenPlastic(R.string.board_green_plastic, null, rgb(241, 246, 178), rgb(89, 147, 93), "green-plastic.png"),
PurpleDiag(R.string.board_purple_diag, null, rgb(227, 216, 238), rgb(151, 123, 178), "purple-diag.png"),
PinkPyramid(R.string.board_pink_pyramid, null, rgb(237, 238, 191), rgb(242, 117, 117), "pink-pyramid.png"),
Horsey(R.string.board_sketch, null, rgb(239, 222, 198), rgb(151, 112, 81), "horsey.jpg"),
}
private fun rgb(r: Int, g: Int, b: Int) = Color(r, g, b)

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

@ -0,0 +1,55 @@
package io.github.vrubelroman.chesspenguin.data
import android.content.Context
import io.github.vrubelroman.chesspenguin.BuildConfig
import io.github.vrubelroman.chesspenguin.R
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.StateFlow
import java.io.File
/// 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
/// ([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"
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 = download.metered()
/// Gets the network ready: from the APK, or from the internet.
fun prepare() {
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 = !builtIn || download.installNow { context.assets.open(BuildConfig.NET_NAME) }
/// Stops a download and throws away what came.
fun cancel() = download.cancel()
/// Removes a downloaded network (Settings → "Delete the engine").
fun delete() = download.delete()
}

View file

@ -0,0 +1,230 @@
package io.github.vrubelroman.chesspenguin.data
import android.os.SystemClock
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
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.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext
import uniffi.mobile_api.Analysis
import uniffi.mobile_api.Analyzer
import uniffi.mobile_api.GameData
/// The position for the engine: where the history starts and the moves since then.
data class EnginePosition(val startFen: String, val moves: List<String>)
/// The history of a node, so the engine sees repetitions; after a training null move
/// ("--") it starts again from the position as a FEN (android-ui.md §8, AGENTS.md).
fun enginePosition(game: GameData, node: Int): EnginePosition {
val path = ArrayList<Int>()
var n: Int? = node
while (n != null) {
path.add(n)
n = game.nodes[n].parent?.toInt()
}
path.reverse()
var start = game.nodes[0].fen
val moves = ArrayList<String>()
for (id in path.drop(1)) {
val m = game.nodes[id]
if (m.uci.isEmpty()) {
start = m.fen
moves.clear()
} else {
moves.add(m.uci)
}
}
return EnginePosition(start, moves)
}
sealed interface EngineStatus {
data object Off : EngineStatus
data object Starting : EngineStatus
/// Thinking about the current position.
data object Thinking : EngineStatus
/// The time per position is over; "Deeper" thinks on.
data object Paused : EngineStatus
/// The engine stopped answering or does not run on this phone.
data class Failed(val notStarting: Boolean) : EngineStatus
}
/// What the engine said, and about which position: the screen shows it only while that
/// position is on the board, so an old evaluation never appears for a new one, not
/// even for a frame.
data class EngineView(val position: EnginePosition, val analysis: Analysis)
/// The engine while a game is on the screen: one Stockfish process, the analysis of the
/// shown position only.
class EngineSession(private val files: EngineFiles, private val scope: CoroutineScope) {
private val _status = MutableStateFlow<EngineStatus>(EngineStatus.Off)
val status: StateFlow<EngineStatus> = _status.asStateFlow()
private val _analysis = MutableStateFlow<EngineView?>(null)
val analysis: StateFlow<EngineView?> = _analysis.asStateFlow()
private val lock = Mutex()
@Volatile private var analyzer: Analyzer? = null
private var loop: Job? = null
private var timer: Job? = null
/// The search whose snapshots are taken, and its position (set together).
private data class Search(val id: ULong, val position: EnginePosition)
@Volatile private var search: Search? = null
private var position: EnginePosition? = null
private var prefs = Prefs()
/// Bumped by [shutdown]: work queued before it is dropped instead of starting the
/// engine again.
@Volatile private var generation = 0
/// Starts the engine (if it is not running) and analyses `pos`.
fun show(pos: EnginePosition, p: Prefs) {
prefs = p
val changed = pos != position
position = pos
val gen = generation
scope.launch {
lock.withLock {
if (gen != generation) return@withLock
val a = analyzer ?: startLocked(gen) ?: return@withLock
// The same position again (the screen redrawn, the time over) stays as it is.
if (changed || _status.value == EngineStatus.Starting) analyzeLocked(a, pos)
}
}
}
/// Stops thinking (a mate or stalemate on the board); the process stays for the next
/// position.
fun pause() {
position = null
search = null
_analysis.value = null
timer?.cancel()
val gen = generation
scope.launch {
lock.withLock {
if (gen != generation) return@withLock
val a = analyzer ?: return@withLock
withContext(Dispatchers.IO) { a.stop() }
_status.value = EngineStatus.Paused
}
}
}
/// Thinks on about the same position after the time ran out.
fun deeper() {
val pos = position ?: return
val gen = generation
scope.launch {
lock.withLock {
if (gen == generation) analyzer?.let { analyzeLocked(it, pos) }
}
}
}
/// Quits the process (the screen went away, the button was turned off).
fun shutdown() {
generation++
position = null
search = null
_analysis.value = null
_status.value = EngineStatus.Off
loop?.cancel()
timer?.cancel()
// Taken now, so that a show() right after it starts a new engine.
val a = analyzer ?: return
analyzer = null
scope.launch(Dispatchers.IO) {
lock.withLock {
a.quit()
a.close()
}
}
}
private suspend fun startLocked(gen: Int): Analyzer? {
_status.value = EngineStatus.Starting
val a = withContext(Dispatchers.IO) {
runCatching {
Analyzer.start(files.executable, files.net.path, prefs.engineThreads.toUInt(), prefs.engineHashMb.toUInt())
}
}.getOrElse {
if (gen == generation) _status.value = EngineStatus.Failed(notStarting = true)
return null
}
if (gen != generation) {
// Turned off while it was starting.
withContext(Dispatchers.IO) {
a.quit()
a.close()
}
return null
}
analyzer = a
loop = scope.launch(Dispatchers.IO) { poll(a) }
return a
}
private suspend fun analyzeLocked(a: Analyzer, pos: EnginePosition) {
search = null
val id = withContext(Dispatchers.IO) {
runCatching { a.analyze(pos.startFen, pos.moves, prefs.engineLines.toUInt()) }
}.getOrElse {
_status.value = EngineStatus.Failed(notStarting = false)
return
}
val s = Search(id, pos)
search = s
_status.value = EngineStatus.Thinking
timer?.cancel()
if (prefs.engineSeconds > 0) {
timer = scope.launch {
delay(prefs.engineSeconds * 1000L)
lock.withLock {
if (search == s && analyzer === a) {
withContext(Dispatchers.IO) { a.stop() }
_status.value = EngineStatus.Paused
}
}
}
}
}
private suspend fun poll(a: Analyzer) {
// What the engine said last and was not shown yet.
var held: EngineView? = null
var shown = 0L
while (scope.isActive && analyzer === a) {
// A short wait: analyze() waits for the engine handle while this holds it.
val snapshot = try {
a.poll(40u)
} catch (e: Exception) {
if (analyzer === a) _status.value = EngineStatus.Failed(notStarting = false)
return
}
val s = search
if (snapshot != null && s != null && snapshot.search == s.id && analyzer === a) {
held = EngineView(s.position, snapshot)
}
// The screen follows the engine a few times a second, not at every word of
// it; the first words about a new position are shown at once.
val next = held ?: continue
val now = SystemClock.uptimeMillis()
if (now - shown >= SHOW_EVERY_MS || next.position != _analysis.value?.position) {
_analysis.value = next
held = null
shown = now
}
}
}
private companion object {
const val SHOW_EVERY_MS = 200L
}
}

View file

@ -0,0 +1,44 @@
package io.github.vrubelroman.chesspenguin.data
import android.app.LocaleManager
import android.content.Context
import android.content.res.Configuration
import android.os.Build
import android.os.LocaleList
/// The interface languages; "" follows the system (android-ui.md §9).
val LANGUAGES = listOf("", "en", "ru", "de", "fr", "es", "it", "pt", "uz", "kk")
/// The language chosen in the app. Android 13+ keeps it itself (and shows it in the
/// system settings of the app); on Android 12 the app keeps it and applies it to its
/// activity.
object Language {
private const val KEY = "language"
fun get(context: Context): String = if (Build.VERSION.SDK_INT >= 33) {
context.getSystemService(LocaleManager::class.java).applicationLocales.get(0)?.language ?: ""
} else {
context.getSharedPreferences("settings", Context.MODE_PRIVATE).getString(KEY, "") ?: ""
}
/// Returns true when the activity has to be recreated to show it (Android 12).
fun set(context: Context, tag: String): Boolean {
if (Build.VERSION.SDK_INT >= 33) {
context.getSystemService(LocaleManager::class.java).applicationLocales =
if (tag.isEmpty()) LocaleList.getEmptyLocaleList() else LocaleList.forLanguageTags(tag)
return false
}
context.getSharedPreferences("settings", Context.MODE_PRIVATE).edit().putString(KEY, tag).apply()
return true
}
/// The activity's context in the chosen language (Android 12 only).
fun wrap(base: Context): Context {
if (Build.VERSION.SDK_INT >= 33) return base
val tag = base.getSharedPreferences("settings", Context.MODE_PRIVATE).getString(KEY, "") ?: ""
if (tag.isEmpty()) return base
val config = Configuration(base.resources.configuration)
config.setLocales(LocaleList.forLanguageTags(tag))
return base.createConfigurationContext(config)
}
}

View file

@ -0,0 +1,663 @@
package io.github.vrubelroman.chesspenguin.data
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.provider.DocumentsContract
import android.provider.OpenableColumns
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import uniffi.mobile_api.ApiException
import uniffi.mobile_api.Database
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
/// Where a database comes from.
@Serializable
enum class Source {
/// One of the sample games of the desktop app, inside the app (assets/examples).
Sample,
/// A file the user picked, or found in a picked folder; read in place through its
/// persisted permission (of the file, or of the folder: [DbEntry.tree]).
File,
/// A ChessBase database (`.cbh` with `.cbg`, `.cba`, … beside it) in a picked folder.
ChessBase,
/// A copy kept inside the app (`files/copies/`): games pasted from the clipboard, a
/// file opened from another app, which gives access to it only for a while.
Copy,
/// 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. Its file is never changed, except an own database's.
@Serializable
data class DbEntry(
val id: String,
val name: String,
val source: Source,
/// The asset path of a sample, the content URI of a file; for a ChessBase database,
/// the URI of the folder it is in; for a copy, its file's name in `files/copies/`.
val location: String,
/// The file's name, for its extension (PGN, .zip, .7z, .cbv, .cbh).
val fileName: String,
/// The picked folder whose permission covers this database (none for a picked file).
val tree: String? = null,
/// The file's size when it was added: with the name, how the same file is known when
/// it is picked again through another way (a folder, or on its own).
val size: Long? = null,
val games: Int? = null,
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 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,
)
/// Text or a file with no games in it.
class NoGames : Exception()
/// A database found in a picked folder, offered to be added.
data class Found(
val name: String,
val fileName: String,
/// What [DbEntry.location] becomes.
val location: String,
val source: Source,
/// Where it lies inside the picked folder ("" at its top), shown with the name.
val path: String,
val size: Long? = null,
/// A ChessBase database without its games file (`.cbg`): it cannot be opened.
val incomplete: Boolean = false,
/// Already on the list.
val added: Boolean = false,
)
/// A file of a ChessBase database is not beside its `.cbh` any more.
class MissingPart(val file: String) : Exception(file)
/// Names as people sort them: "g2" before "g10", letters without case.
fun naturalOrder(a: String, b: String): Int {
val chunk = Regex("\\d+|\\D+")
val x = chunk.findAll(a.lowercase()).map { it.value }.toList()
val y = chunk.findAll(b.lowercase()).map { it.value }.toList()
for (i in 0 until minOf(x.size, y.size)) {
val (p, q) = x[i] to y[i]
val c = if (p[0].isDigit() && q[0].isDigit()) {
compareValuesBy(p, q, { it.trimStart('0').length }, { it.trimStart('0') })
} else {
p.compareTo(q)
}
if (c != 0) return c
}
return x.size - y.size
}
/// What a picked folder holds.
data class FolderScan(val tree: Uri, val name: String, val found: List<Found>)
/// The databases on the list and the open ones (docs/design/android-ui.md §3).
class Library(private val context: Context) {
private val file = File(context.filesDir, "library.json")
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()
/// Open databases by entry id (they are small: phone-sized).
private val open = HashMap<String, Database>()
private val lock = Mutex()
/// Taken off the list, "Undo" still offered: their access is kept.
private val pending = ArrayList<DbEntry>()
init {
releaseUnused()
// A download cut short by a closed app wrote games the list does not know of yet.
update { list -> list.map(::withOnlineState) }
}
/// A downloaded database with the number of games and the time of its last download
/// as its state file has them (they change while the list does not look).
private fun withOnlineState(e: DbEntry): DbEntry {
if (e.source != Source.Online) return e
val info = uniffi.mobile_api.onlineDatabase(onlineFile(e).path) ?: return e
return e.copy(games = info.games.toInt(), updated = info.updated ?: e.updated)
}
/// Gives back the access to files and folders no database on the list uses (a
/// folder picked, then the app closed before anything was added from it; the app
/// closed while "Undo" was offered).
private fun releaseUnused() {
val kept = _entries.value.filter { it.source == Source.Copy }.map { it.location }.toSet()
copies.listFiles()?.filter { it.name !in kept }?.forEach { it.delete() }
// A downloaded database left behind (the app closed while "Undo" was offered).
// Names may hold dots ("Name (Lichess + Chess.com).pgn"): whole names are compared.
val online = _entries.value.filter { it.source == Source.Online }.flatMap {
val stem = it.location.removeSuffix(".pgn")
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) {
runCatching { context.contentResolver.releasePersistableUriPermission(p.uri, Intent.FLAG_GRANT_READ_URI_PERMISSION) }
}
}
}
private fun load(): List<DbEntry> {
if (!file.exists()) return samples().also { save(it) }
return runCatching { json.decodeFromString<List<DbEntry>>(file.readText()) }.getOrDefault(emptyList())
}
private fun save(list: List<DbEntry>) {
val tmp = File(file.path + ".tmp")
tmp.writeText(json.encodeToString(list))
tmp.renameTo(file)
}
private fun update(change: (List<DbEntry>) -> List<DbEntry>) {
val next = change(_entries.value)
_entries.value = next
save(next)
}
/// The sample games of the desktop app: on the list from the first start.
private fun samples(): List<DbEntry> {
val names = listOf(
"classics.pgn" to context.getString(io.github.vrubelroman.chesspenguin.R.string.sample_classics),
"alekhine.pgn" to context.getString(io.github.vrubelroman.chesspenguin.R.string.sample_alekhine),
)
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 } } }
fun entry(id: String): DbEntry? = _entries.value.firstOrNull { it.id == id }
/// Adds a file picked with the system picker; its read permission is kept across
/// restarts. Returns the new entry, or the one already on the list.
fun addFile(uri: Uri): DbEntry {
// Taken again for a file already on the list: picking it grants a new permission.
runCatching {
context.contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
val fileName = displayName(uri) ?: "database.pgn"
val size = fileSize(uri)
_entries.value.firstOrNull { it.location == uri.toString() || sameFile(it, fileName, size) }?.let {
// The entry keeps its own way to the file; the new permission is not needed.
if (it.location != uri.toString()) {
runCatching { context.contentResolver.releasePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION) }
}
open.remove(it.id)?.close()
return it
}
val entry = DbEntry(
id = UUID.randomUUID().toString(),
name = fileName.substringBeforeLast('.'),
source = Source.File,
location = uri.toString(),
fileName = fileName,
size = size,
)
update { it + entry }
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
/// stays behind then.
suspend fun addCopy(fileName: String, input: java.io.InputStream, name: (Database) -> String): DbEntry = withContext(Dispatchers.IO) {
copies.mkdirs()
val ext = fileName.substringAfterLast('.', "pgn").lowercase()
val tmp = File(copies, "incoming-${UUID.randomUUID()}.$ext")
try {
val digest = java.security.MessageDigest.getInstance("SHA-256")
tmp.outputStream().use { out ->
val buf = ByteArray(256 * 1024)
while (true) {
val n = input.read(buf)
if (n < 0) break
out.write(buf, 0, n)
digest.update(buf, 0, n)
}
}
val sum = digest.digest().joinToString("") { "%02x".format(it) }
lock.withLock {
copyWithDigest(_entries.value, sum)?.let { return@withContext it }
}
val id = UUID.randomUUID().toString()
val kept = File(copies, "$id.$ext")
if (!tmp.renameTo(kept)) throw java.io.IOException("cannot keep the copy")
val db = try {
openFile(fileName, android.os.ParcelFileDescriptor.open(kept, android.os.ParcelFileDescriptor.MODE_READ_ONLY).detachFd())
} catch (e: ApiException.Empty) {
kept.delete()
throw NoGames()
} catch (t: Throwable) {
kept.delete()
throw t
}
// PGN reading is lenient: any text is one "game" of a comment. A game counts
// when it has a tag or a move.
if (db.len() == 0u || (db.len() == 1u && db.game(0u).let { it.tags.isEmpty() && it.nodes.size <= 1 })) {
db.close()
kept.delete()
throw NoGames()
}
val entry = DbEntry(
id = id,
name = name(db),
source = Source.Copy,
location = kept.name,
fileName = fileName,
size = kept.length(),
games = db.len().toInt(),
format = db.format(),
sha256 = sum,
)
lock.withLock {
copyWithDigest(_entries.value, sum)?.let { existing ->
db.close()
kept.delete()
return@withContext existing
}
open[id] = db
update { it + entry }
}
entry
} finally {
tmp.delete()
}
}
/// 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 }
val entry = DbEntry(
id = UUID.randomUUID().toString(),
name = file.name.substringBeforeLast('.'),
source = Source.Online,
location = file.name,
fileName = file.name,
games = 0,
format = "PGN",
)
update { it + entry }
entry
}
/// A downloaded database got new games: it is read again when next opened. The old
/// one is not closed: a screen may still show it; it is freed once nothing holds it.
suspend fun downloaded(id: String, games: Int, updated: Long?) {
lock.withLock {
open.remove(id)
update { list -> list.map { if (it.id == id) it.copy(games = games, updated = updated ?: it.updated) else it } }
}
}
/// Takes a downloaded database that got no games off the list, with its files.
fun dropEmpty(id: String) {
val e = entry(id) ?: return
update { it.filterNot { x -> x.id == id } }
open.remove(id)?.close()
uniffi.mobile_api.deleteOnlineDatabase(onlineFile(e).path)
}
fun rename(id: String, name: String) = update { list -> list.map { if (it.id == id) it.copy(name = name, renamed = true) else it } }
/// Takes the database off the list (the file stays where it is). Returns its place,
/// for "Undo"; the access to the file is kept until [forget].
fun remove(id: String): Pair<Int, DbEntry>? {
val list = _entries.value
val i = list.indexOfFirst { it.id == id }
if (i < 0) return null
val e = list[i]
pending += e
update { it.filterNot { x -> x.id == id } }
open.remove(id)?.close()
return i to e
}
/// Gives the access to a removed file back to the system, once "Undo" is gone.
fun forget(entry: DbEntry) {
pending.remove(entry)
if (entry.source == Source.Sample) return
if (entry.source == Source.Copy) {
File(copies, entry.location).delete()
return
}
if (entry.source == Source.Online) {
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
if ((_entries.value + pending).any { (it.tree ?: it.location) == granted }) return
runCatching {
context.contentResolver.releasePersistableUriPermission(Uri.parse(granted), Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
}
/// Keeps the read permission of a picked folder, for the databases added from it
/// (given back by [forgetFolder] when none is).
fun keepFolder(tree: Uri) {
runCatching {
context.contentResolver.takePersistableUriPermission(tree, Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
}
/// Looks for databases in a picked folder and in the folders inside it (two levels
/// down): PGN files, archives, ChessBase archives (.cbv) and ChessBase databases.
suspend fun scanFolder(tree: Uri): FolderScan = withContext(Dispatchers.IO) {
val rootId = DocumentsContract.getTreeDocumentId(tree)
val rootName = childName(DocumentsContract.buildDocumentUriUsingTree(tree, rootId)) ?: ""
val list = _entries.value
val found = ArrayList<Found>()
fun visit(dirId: String, path: String, depth: Int) {
val children = children(tree, dirId)
val names = children.filter { !it.dir }.map { it.name }.toSet()
fun has(name: String) = names.any { it.equals(name, ignoreCase = true) }
for (c in children.sortedWith { a, b -> naturalOrder(a.name, b.name) }) {
if (c.dir) continue
val ext = c.name.substringAfterLast('.', "").lowercase()
val stem = c.name.substringBeforeLast('.')
when (ext) {
"pgn", "zip", "7z", "cbv" -> {
// A ChessBase archive beside its unpacked database is the same
// database: the unpacked one is offered.
if (ext == "cbv" && has("$stem.cbh") && has("$stem.cbg")) continue
val uri = DocumentsContract.buildDocumentUriUsingTree(tree, c.id).toString()
val added = list.any { it.location == uri || sameFile(it, c.name, c.size) }
found += Found(stem, c.name, uri, Source.File, path, size = c.size, added = added)
}
"cbh" -> {
val dir = DocumentsContract.buildDocumentUriUsingTree(tree, dirId).toString()
found += Found(
stem, c.name, dir, Source.ChessBase, path,
incomplete = !has("$stem.cbg"),
added = list.any { it.source == Source.ChessBase && it.location == dir && it.fileName == c.name },
)
}
}
}
if (depth < 2) {
for (c in children.filter { it.dir }.sortedWith { a, b -> naturalOrder(a.name, b.name) }) {
visit(c.id, if (path.isEmpty()) c.name else "$path/${c.name}", depth + 1)
}
}
}
visit(rootId, "", 0)
FolderScan(tree, rootName, found)
}
/// Gives a scanned folder's permission back when none of its databases is on the list.
fun forgetFolder(tree: Uri) {
if ((_entries.value + pending).any { it.tree == tree.toString() }) return
runCatching {
context.contentResolver.releasePersistableUriPermission(tree, Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
}
/// Puts the chosen databases of a folder on the list, at its end.
fun addFound(tree: Uri, chosen: List<Found>) = update { list ->
list + chosen.filter { !it.added && !it.incomplete }.map {
DbEntry(
id = UUID.randomUUID().toString(),
name = it.name,
source = it.source,
location = it.location,
fileName = it.fileName,
tree = tree.toString(),
size = it.size,
)
}
}
private class Child(val id: String, val name: String, val dir: Boolean, val size: Long?)
private fun children(tree: Uri, dirId: String): List<Child> {
val uri = DocumentsContract.buildChildDocumentsUriUsingTree(tree, dirId)
val columns = arrayOf(
DocumentsContract.Document.COLUMN_DOCUMENT_ID,
DocumentsContract.Document.COLUMN_DISPLAY_NAME,
DocumentsContract.Document.COLUMN_MIME_TYPE,
DocumentsContract.Document.COLUMN_SIZE,
)
return runCatching {
context.contentResolver.query(uri, columns, null, null, null)?.use { c ->
buildList {
while (c.moveToNext()) {
val name = c.getString(1) ?: continue
val size = if (c.isNull(3)) null else c.getLong(3)
add(Child(c.getString(0), name, c.getString(2) == DocumentsContract.Document.MIME_TYPE_DIR, size))
}
}
}
}.getOrNull() ?: emptyList()
}
private fun childName(uri: Uri): String? = runCatching {
context.contentResolver.query(uri, arrayOf(DocumentsContract.Document.COLUMN_DISPLAY_NAME), null, null, null)?.use { c ->
if (c.moveToFirst()) c.getString(0) else null
}
}.getOrNull()
/// A file for reading. A file deleted from a picked folder makes the provider throw
/// IllegalArgumentException ("is not a child of the tree"): it is a missing file.
private fun openDocument(uri: Uri): android.os.ParcelFileDescriptor = try {
context.contentResolver.openFileDescriptor(uri, "r") ?: throw java.io.FileNotFoundException(uri.toString())
} catch (e: IllegalArgumentException) {
throw java.io.FileNotFoundException(e.message)
}
/// The files of a ChessBase database: those beside its `.cbh` with the same name.
private fun openChessBase(e: DbEntry): Database {
val tree = Uri.parse(e.tree ?: throw ApiException.Io(detail = "no access to the folder"))
val dirId = DocumentsContract.getDocumentId(Uri.parse(e.location))
val stem = e.fileName.substringBeforeLast('.')
// Names may differ in case (sets copied from Windows: "Base.CBH", "base.cbg").
val parts = children(tree, dirId).filter { !it.dir && it.name.substringBeforeLast('.').equals(stem, ignoreCase = true) }
if (parts.none { it.name.equals(e.fileName, ignoreCase = true) }) throw java.io.FileNotFoundException(e.fileName)
if (parts.none { it.name.substringAfterLast('.').equals("cbg", ignoreCase = true) }) throw MissingPart("$stem.cbg")
// All opened first: a file that cannot be opened leaves none of them open.
val opened = ArrayList<Pair<String, android.os.ParcelFileDescriptor>>()
try {
for (c in parts) {
val pfd = openDocument(DocumentsContract.buildDocumentUriUsingTree(tree, c.id))
opened += c.name to pfd
}
} catch (t: Throwable) {
opened.forEach { it.second.close() }
throw t
}
// The descriptors go over to the core, which closes them.
return openChessbase(e.fileName, opened.map { (name, pfd) -> FolderFile(name, pfd.detachFd()) })
}
fun restore(place: Int, entry: DbEntry) {
pending.remove(entry)
// A download may have gone on while it was off the list.
update { it.toMutableList().apply { add(place.coerceIn(0, size), withOnlineState(entry)) } }
}
/// The same file on the list, picked through another way (its URI differs).
private fun sameFile(e: DbEntry, fileName: String, size: Long?) =
e.source == Source.File && size != null && e.size == size && e.fileName == fileName
private fun fileSize(uri: Uri): Long? = runCatching {
context.contentResolver.query(uri, arrayOf(OpenableColumns.SIZE), null, null, null)?.use { c ->
if (c.moveToFirst() && !c.isNull(0)) c.getLong(0) else null
}
}.getOrNull()
private fun displayName(uri: Uri): String? = runCatching {
context.contentResolver.query(uri, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null)?.use { c ->
if (c.moveToFirst()) c.getString(0) else null
}
}.getOrNull()
/// The games of a database that `query` finds, in the order the list shows them: a
/// downloaded database from the most recent game down (android-ui.md §23), the others
/// as in the file. Slow for a big database: call it off the main thread.
fun listed(id: String, db: Database, query: String): List<UInt> {
val found = db.find(query)
return if (entry(id)?.source == Source.Online) db.newestFirst(found) else found
}
/// The open database of an entry (opened in the background the first time).
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 -> 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(
e.fileName,
android.os.ParcelFileDescriptor.open(File(copies, e.location), android.os.ParcelFileDescriptor.MODE_READ_ONLY).detachFd(),
)
Source.Online -> openFile(
e.fileName,
android.os.ParcelFileDescriptor.open(onlineFile(e), android.os.ParcelFileDescriptor.MODE_READ_ONLY).detachFd(),
)
Source.Own -> openPath(ownFile(e).path)
}
}
}
result.onSuccess { db ->
open[id] = db
val games = db.len().toInt()
val format = db.format()
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

@ -0,0 +1,114 @@
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
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import uniffi.mobile_api.DownloadState
import uniffi.mobile_api.OnlineAccount
import uniffi.mobile_api.OnlineDownload
import uniffi.mobile_api.onlineDatabase
import java.io.File
import java.util.concurrent.ConcurrentHashMap
/// A download of a database and how it stands (or how it ended); `fresh` when the
/// 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;
/// `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
/// databases shows how they go.
class OnlineDownloads(private val library: Library, private val scope: CoroutineScope) {
private val _views = MutableStateFlow<Map<String, DownloadView>>(emptyMap())
/// By database id: the running downloads, and the last one of each database.
val views: StateFlow<Map<String, DownloadView>> = _views.asStateFlow()
private val running = ConcurrentHashMap<String, OnlineDownload>()
private val _finished = MutableSharedFlow<Finished>(extraBufferCapacity = 8)
/// Each download as it ends (android-ui.md §23.3: a snackbar says how it went).
val finished: SharedFlow<Finished> = _finished.asSharedFlow()
/// Where the downloaded databases are kept.
val dir: File get() = library.onlineDir
/// 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 = 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 to null
val d = OnlineDownload.start(accounts, path)
running[entry.id] = d
val job = scope.launch(Dispatchers.IO) {
while (true) {
val s = d.state()
_views.update { it + (entry.id to DownloadView(accounts, s, fresh)) }
if (!s.running) break
delay(POLL_MS)
}
running.remove(entry.id)
d.close()
val info = onlineDatabase(path)
val games = info?.games?.toInt() ?: 0
// 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, quiet)) }
}
return entry to job
}
/// Fetches the games played since the last download of a database.
fun update(entry: DbEntry) {
val path = library.onlineFile(entry).path
val info = onlineDatabase(path) ?: return
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()
}
fun isRunning(id: String): Boolean = running.containsKey(id)
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

@ -0,0 +1,133 @@
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.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext
import uniffi.mobile_api.Database
import uniffi.mobile_api.GameReview
import uniffi.mobile_api.ReviewState
/// 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
/// job has its own engine process (the Rust side runs it on a thread of its own).
class ReviewSession(private val cacheDir: String, private val scope: CoroutineScope) {
private val _state = MutableStateFlow<ReviewState?>(null)
/// The analysis of the game shown, `null` while it loads.
val state: StateFlow<ReviewState?> = _state.asStateFlow()
private val lock = Mutex()
private var review: GameReview? = null
private var game: Pair<String, UInt>? = null
private var poller: Job? = null
/// Bumped whenever another game comes: work for the old one is dropped.
@Volatile private var generation = 0
/// 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) = 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 { make() }.getOrNull() } ?: return
if (gen != generation) {
withContext(Dispatchers.IO) { r.close() }
return
}
review = r
game = key
_state.value = withContext(Dispatchers.IO) { r.state() }
}
}
/// 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, full)
}
_state.value = withContext(Dispatchers.IO) { r.state() }
if (started) poll(r, gen, done)
}
}
}
/// Stops the engine; what it evaluated stays (and is cached).
fun cancel() {
poller?.cancel()
val gen = generation
scope.launch {
lock.withLock {
val r = review ?: return@withLock
withContext(Dispatchers.IO) { r.cancel() }
if (gen == generation) _state.value = withContext(Dispatchers.IO) { r.state() }
}
}
}
/// The screen went away: the job stops and the object is freed.
fun close() {
generation++
poller?.cancel()
scope.launch { lock.withLock { closeLocked() } }
}
private suspend fun closeLocked() {
poller?.cancel()
val r = review ?: return
review = null
game = null
withContext(Dispatchers.IO) {
r.cancel()
r.close()
}
}
/// While the job runs: its state a few times a second (the graph grows with it).
private fun poll(r: GameReview, gen: Int, done: (ReviewState) -> Unit) {
poller?.cancel()
poller = scope.launch(Dispatchers.IO) {
while (true) {
delay(POLL_MS)
val s = lock.withLock {
if (review !== r || gen != generation) null else r.state()
} ?: return@launch
_state.value = s
if (!s.running) {
done(s)
return@launch
}
}
}
}
private companion object {
const val POLL_MS = 300L
}
}

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

@ -0,0 +1,124 @@
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
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.Dark,
val notation: Notation = Notation.Latin,
val board: BoardTheme = BoardTheme.Green,
val pieces: PieceSet = PieceSet.Merida,
val vibration: Boolean = true,
val animation: Boolean = true,
val bestArrow: Boolean = true,
val engineLines: Int = 2,
/// Seconds of thinking per position; 0 = no limit.
val engineSeconds: Int = 20,
val engineThreads: Int = defaultThreads(),
val engineHashMb: Int = 64,
/// 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).
fun defaultThreads(): Int = (Runtime.getRuntime().availableProcessors() / 2).coerceIn(1, 2)
class Settings(context: Context) {
private val store = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
private val _prefs = MutableStateFlow(read())
init {
// Up to 0.11 the engine button was kept here (it is not remembered any more), and
// the threads were half the cores up to 4: that default becomes the new one.
if (store.getInt("version", 1) < 2) {
val oldDefault = (Runtime.getRuntime().availableProcessors() / 2).coerceIn(1, 4)
if (store.getInt("engineThreads", oldDefault) == oldDefault) update { it.copy(engineThreads = defaultThreads()) }
store.edit().remove("engineOn").putInt("version", 2).apply()
}
}
val prefs: StateFlow<Prefs> = _prefs.asStateFlow()
private fun read(): Prefs {
val d = Prefs()
return Prefs(
theme = enumValueOrNull<Theme>(store.getString("theme", null)) ?: d.theme,
notation = enumValueOrNull<Notation>(store.getString("notation", null)) ?: d.notation,
board = enumValueOrNull<BoardTheme>(store.getString("board", null)) ?: d.board,
pieces = enumValueOrNull<PieceSet>(store.getString("pieces", null)) ?: d.pieces,
vibration = store.getBoolean("vibration", d.vibration),
animation = store.getBoolean("animation", d.animation),
bestArrow = store.getBoolean("bestArrow", d.bestArrow),
engineLines = store.getInt("engineLines", d.engineLines),
engineSeconds = store.getInt("engineSeconds", d.engineSeconds),
engineThreads = store.getInt("engineThreads", d.engineThreads),
engineHashMb = store.getInt("engineHashMb", d.engineHashMb),
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),
)
}
fun update(change: (Prefs) -> Prefs) {
val p = change(_prefs.value)
_prefs.value = p
store.edit()
.putString("theme", p.theme.name)
.putString("notation", p.notation.name)
.putString("board", p.board.name)
.putString("pieces", p.pieces.name)
.putBoolean("vibration", p.vibration)
.putBoolean("animation", p.animation)
.putBoolean("bestArrow", p.bestArrow)
.putInt("engineLines", p.engineLines)
.putInt("engineSeconds", p.engineSeconds)
.putInt("engineThreads", p.engineThreads)
.putInt("engineHashMb", p.engineHashMb)
.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()
}
}
private inline fun <reified T : Enum<T>> enumValueOrNull(name: String?): T? =
enumValues<T>().firstOrNull { it.name == name }

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

@ -0,0 +1,105 @@
package io.github.vrubelroman.chesspenguin.theme
import androidx.compose.ui.graphics.Color
// The colors of the desktop app and the website (docs/design/android-ui.md §10.3).
val LightBackground = Color(0xFFFFFFFF)
val LightContainerLow = Color(0xFFF5F6F7)
val LightContainer = Color(0xFFEEF0F2)
val LightContainerHigh = Color(0xFFE8EAED)
val LightOnSurface = Color(0xFF1C1D1F)
val LightOnSurfaceVariant = Color(0xFF5D636B)
val LightOutline = Color(0xFFC4C8CD)
val LightOutlineVariant = Color(0xFFE1E3E6)
val LightPrimary = Color(0xFF1F6FA8)
val LightPrimaryContainer = Color(0xFFD6E8F6)
val LightOnPrimaryContainer = Color(0xFF1A5F91)
val LightError = Color(0xFFC42B1C)
val LightErrorContainer = Color(0xFFFCE4E1)
val DarkBackground = Color(0xFF161718)
val DarkContainerLow = Color(0xFF1F2022)
val DarkContainer = Color(0xFF232427)
val DarkContainerHigh = Color(0xFF2A2C2F)
val DarkOnSurface = Color(0xFFE8E8E8)
val DarkOnSurfaceVariant = Color(0xFFA3A7AD)
val DarkOutline = Color(0xFF4A4D52)
val DarkOutlineVariant = Color(0xFF2E3033)
val DarkPrimary = Color(0xFF62AEE6)
val DarkOnPrimary = Color(0xFF0B2A40)
val DarkPrimaryContainer = Color(0xFF1A4566)
val DarkError = Color(0xFFF28B82)
val DarkErrorContainer = Color(0xFF5C1A14)
/// Colors of the notation and the board that stay ours whatever the theme (the
/// squares are the chosen board's, data/BoardStyle.kt).
data class ChessColors(
val dark: Boolean,
val currentMove: Color,
val comment: Color,
val lastMove: Color,
)
val LightChess = ChessColors(
dark = false,
currentMove = Color(0xFF90D1FF),
comment = Color(0xFF2A5B8A),
lastMove = Color(0x699BC700),
)
val DarkChess = LightChess.copy(
dark = true,
currentMove = Color(0xFF005C80),
comment = Color(0xFF9EC4E0),
)
/// 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(0xFF81B64C) // !
2 -> Color(0xFFFFA459) // ?
3 -> Color(0xFF26C2A3) // !!
4 -> Color(0xFFFA412D) // ??
5 -> Color(0xFFEA45D8) // !?
6 -> Color(0xFF56B4E9) // ?! (Lichess blue)
else -> null
}
} else {
when (nag) {
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

@ -0,0 +1,72 @@
package io.github.vrubelroman.chesspenguin.theme
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color
private val Light = lightColorScheme(
primary = LightPrimary,
onPrimary = Color.White,
primaryContainer = LightPrimaryContainer,
onPrimaryContainer = LightOnPrimaryContainer,
secondary = LightPrimary,
onSecondary = Color.White,
secondaryContainer = LightPrimaryContainer,
onSecondaryContainer = LightOnPrimaryContainer,
tertiary = LightPrimary,
background = LightBackground,
onBackground = LightOnSurface,
surface = LightBackground,
onSurface = LightOnSurface,
onSurfaceVariant = LightOnSurfaceVariant,
surfaceContainerLowest = LightBackground,
surfaceContainerLow = LightContainerLow,
surfaceContainer = LightContainer,
surfaceContainerHigh = LightContainerHigh,
surfaceContainerHighest = LightContainerHigh,
outline = LightOutline,
outlineVariant = LightOutlineVariant,
error = LightError,
errorContainer = LightErrorContainer,
)
private val Dark = darkColorScheme(
primary = DarkPrimary,
onPrimary = DarkOnPrimary,
primaryContainer = DarkPrimaryContainer,
onPrimaryContainer = LightPrimaryContainer,
secondary = DarkPrimary,
onSecondary = DarkOnPrimary,
secondaryContainer = DarkPrimaryContainer,
onSecondaryContainer = LightPrimaryContainer,
tertiary = DarkPrimary,
background = DarkBackground,
onBackground = DarkOnSurface,
surface = DarkBackground,
onSurface = DarkOnSurface,
onSurfaceVariant = DarkOnSurfaceVariant,
surfaceContainerLowest = DarkBackground,
surfaceContainerLow = DarkContainerLow,
surfaceContainer = DarkContainer,
surfaceContainerHigh = DarkContainerHigh,
surfaceContainerHighest = DarkContainerHigh,
outline = DarkOutline,
outlineVariant = DarkOutlineVariant,
error = DarkError,
errorContainer = DarkErrorContainer,
)
val LocalChessColors = staticCompositionLocalOf { LightChess }
/// Our own colors in the light or dark theme of the system (docs/design/android-ui.md §10.3).
@Composable
fun ChessPenguinTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
CompositionLocalProvider(LocalChessColors provides if (darkTheme) DarkChess else LightChess) {
MaterialTheme(colorScheme = if (darkTheme) Dark else Light, typography = Typography, content = content)
}
}

View file

@ -0,0 +1,20 @@
package io.github.vrubelroman.chesspenguin.theme
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
// The system font (Roboto on most phones), the sizes of §10.2.
val Typography = Typography().run {
copy(
titleLarge = titleLarge.copy(fontSize = 22.sp, lineHeight = 28.sp, fontWeight = FontWeight.Normal),
bodyLarge = bodyLarge.copy(fontSize = 16.sp, lineHeight = 24.sp),
bodyMedium = bodyMedium.copy(fontSize = 14.sp, lineHeight = 20.sp),
labelLarge = labelLarge.copy(fontSize = 14.sp, lineHeight = 20.sp, fontWeight = FontWeight.Medium),
labelSmall = labelSmall.copy(fontSize = 12.sp, lineHeight = 16.sp, fontWeight = FontWeight.Medium),
)
}
/// Digits that keep their width (results, counters).
val Tabular = TextStyle(fontFeatureSettings = "tnum")

View file

@ -0,0 +1,108 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import io.github.vrubelroman.chesspenguin.BuildConfig
import io.github.vrubelroman.chesspenguin.R
private const val SITE = "https://chess.vrubel.xyz"
/// The authors and licenses of what the app is made of (android-ui.md §8.3, §9).
private val NOTICES = listOf(
"ChessPenguin" to "GPL-3.0-or-later · vrubelroman",
"Stockfish 19" to "GPL-3.0 · The Stockfish developers (see AUTHORS) · github.com/official-stockfish/Stockfish",
"Pieces cburnett, merida" to "GPLv2+ · Colin M.L. Burnett; Armando Hernandez Marroquin (via Lichess)",
"Pieces mpchess" to "GPLv3+ · Maxime Chupin (via Lichess)",
"Pieces chessnut" to "Apache-2.0 · Alexis Luengas (via Lichess)",
"Pieces fantasy, celtic, spatial" to "MIT · Maurizio Monge (via Lichess)",
"Pieces rhosgfx" to "CC0-1.0 · RhosGFX (via Lichess)",
"Pieces shapes" to "CC BY-SA 4.0 · flugsio (via Lichess)",
"Pieces kiwen-suwi, firi" to "CC BY 4.0 · neverRare; James Faure (via Lichess)",
"Pieces pixel, letter, pirouetti" to "AGPLv3+ · therealqtpi; usolando; pirouetti (via Lichess)",
"Pieces governor" to "AGPLv3+ · the lila authors (via PyChess)",
"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",
"JNA" to "Apache-2.0 / LGPL-2.1",
"AndroidSVG" to "Apache-2.0 · Paul LeBeau",
"shakmaty" to "GPL-3.0-or-later · Niklas Fiekas",
)
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun AboutScreen(onBack: () -> Unit) {
val uri = LocalUriHandler.current
val snackbar = remember { SnackbarHostState() }
UpdateMessages(snackbar)
Scaffold(
snackbarHost = { SnackbarHost(snackbar) },
topBar = {
TopAppBar(
title = { Text(stringResource(R.string.about)) },
navigationIcon = {
IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Rounded.ArrowBack, stringResource(R.string.back)) }
},
)
},
) { padding ->
Column(Modifier.fillMaxSize().padding(padding).verticalScroll(rememberScrollState()).padding(horizontal = 16.dp, vertical = 8.dp)) {
Image(painterResource(R.drawable.penguin), null, Modifier.size(72.dp))
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} · $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))
}
Spacer(Modifier.height(16.dp))
Text(stringResource(R.string.licenses), style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.primary)
NOTICES.forEach { (what, license) ->
Spacer(Modifier.height(12.dp))
Text(what, style = MaterialTheme.typography.bodyLarge)
Text(license, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
}
}
}

View file

@ -0,0 +1,227 @@
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
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.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.selection.toggleable
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.CloudDownload
import androidx.compose.material.icons.outlined.ContentPaste
import androidx.compose.material.icons.outlined.Description
import androidx.compose.material.icons.outlined.Folder
import androidx.compose.material3.Button
import androidx.compose.material3.Checkbox
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.ListItem
import androidx.compose.material3.ListItemDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.rememberModalBottomSheetState
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.graphics.Color
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.heading
import androidx.compose.ui.semantics.semantics
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.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)
@Composable
fun AddSheet(onFile: () -> Unit, onFolder: () -> Unit, onPaste: (() -> Unit)?, onOnline: () -> Unit, onDismiss: () -> Unit) {
ModalBottomSheet(onDismissRequest = onDismiss) {
Column(Modifier.navigationBarsPadding().padding(bottom = 24.dp)) {
Text(
stringResource(R.string.add_database),
style = MaterialTheme.typography.titleLarge,
modifier = Modifier.padding(horizontal = 24.dp, vertical = 8.dp).semantics { heading() },
)
// Only when there is text to paste (asked without reading it: reading the
// clipboard makes Android say so on the screen).
if (onPaste != null) {
ListItem(
headlineContent = { Text(stringResource(R.string.add_paste)) },
supportingContent = { Text(stringResource(R.string.add_paste_hint)) },
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),
)
}
ListItem(
headlineContent = { Text(stringResource(R.string.online_title)) },
supportingContent = { Text(stringResource(R.string.add_online_hint)) },
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 = { 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 = { KindIcon(DbKind.Pgn, Icons.Outlined.Folder) },
colors = ListItemDefaults.colors(containerColor = Color.Transparent),
modifier = Modifier.clickable(role = Role.Button, onClick = onFolder).padding(horizontal = 8.dp),
)
// The system picker only says "Can't use this folder" in English, and gives
// nothing back: so it is said before.
Text(
stringResource(R.string.add_tree_hint),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(horizontal = 24.dp, vertical = 8.dp),
)
}
}
}
/// The databases found in a picked folder, to tick and add; `scan` is null while the
/// folder is being looked through.
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun FolderSheet(scan: FolderScan?, onAdd: (List<Found>) -> Unit, onPickAnother: () -> Unit, onDismiss: () -> Unit) {
// Open in full at once: the buttons under the list are always on the screen.
ModalBottomSheet(onDismissRequest = onDismiss, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)) {
Column(Modifier.navigationBarsPadding().padding(horizontal = 24.dp).padding(bottom = 24.dp)) {
if (scan == null) {
Row(Modifier.fillMaxWidth().height(96.dp), verticalAlignment = Alignment.CenterVertically) {
CircularProgressIndicator(Modifier.size(24.dp), strokeWidth = 3.dp)
Spacer(Modifier.size(16.dp))
Text(stringResource(R.string.folder_scanning), style = MaterialTheme.typography.bodyLarge)
}
return@Column
}
val addable = scan.found.filter { !it.added && !it.incomplete }
if (scan.found.isEmpty()) {
Text(stringResource(R.string.folder_empty_title), style = MaterialTheme.typography.titleLarge, modifier = Modifier.semantics { heading() })
Spacer(Modifier.height(8.dp))
Text(
stringResource(R.string.folder_empty_text),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Spacer(Modifier.height(24.dp))
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {
TextButton(onClick = onDismiss) { Text(stringResource(R.string.cancel)) }
Button(onClick = onPickAnother) { Text(stringResource(R.string.pick_another)) }
}
return@Column
}
// Everything that can be added is ticked at first.
var chosen by remember(scan) { mutableStateOf(addable.toSet()) }
Text(
pluralStringResource(R.plurals.folder_found, scan.found.size, scan.found.size, scan.name),
style = MaterialTheme.typography.titleLarge,
modifier = Modifier.semantics { heading() },
)
if (addable.size > 1) {
val all = chosen.size == addable.size
TextButton(onClick = { chosen = if (all) emptySet() else addable.toSet() }, contentPadding = PaddingValues(0.dp)) {
Text(stringResource(if (all) R.string.choose_none else R.string.choose_all))
}
}
Spacer(Modifier.height(8.dp))
LazyColumn(Modifier.weight(1f, fill = false)) {
itemsIndexed(scan.found) { _, f ->
FoundRow(f, f in chosen) { on -> chosen = if (on) chosen + f else chosen - f }
}
}
Spacer(Modifier.height(16.dp))
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {
if (addable.isEmpty()) {
// Everything there is already on the list (or cannot be opened).
Button(onClick = onDismiss) { Text(stringResource(R.string.done)) }
} else {
TextButton(onClick = onDismiss) { Text(stringResource(R.string.cancel)) }
Button(onClick = { onAdd(scan.found.filter { it in chosen }) }, enabled = chosen.isNotEmpty()) {
Text(if (chosen.isEmpty()) stringResource(R.string.add) else pluralStringResource(R.plurals.add_chosen, chosen.size, chosen.size))
}
}
}
}
}
}
@Composable
private fun FoundRow(f: Found, checked: Boolean, onChange: (Boolean) -> Unit) {
val enabled = !f.added && !f.incomplete
val label = when {
f.source == Source.ChessBase -> "CB"
else -> f.fileName.substringAfterLast('.', "").uppercase().let { if (it == "CBV") "CB" else it }
}
val note = when {
f.added -> stringResource(R.string.folder_added)
f.incomplete -> stringResource(R.string.folder_incomplete)
else -> f.fileName
}
Row(
Modifier
.fillMaxWidth()
.heightIn(min = 64.dp)
.toggleable(value = checked || f.added, enabled = enabled, role = Role.Checkbox, onValueChange = onChange),
verticalAlignment = Alignment.CenterVertically,
) {
Checkbox(checked = checked || f.added, onCheckedChange = null, enabled = enabled)
Spacer(Modifier.size(12.dp))
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"
Text(
where,
style = MaterialTheme.typography.bodyMedium,
color = if (f.incomplete) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
)
}
Box(Modifier.size(8.dp))
}
}

View file

@ -0,0 +1,540 @@
package io.github.vrubelroman.chesspenguin.ui
import android.content.Context
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.BitmapRegionDecoder
import android.graphics.Canvas
import android.graphics.Rect
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
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.produceState
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ImageBitmap
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
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
import io.github.vrubelroman.chesspenguin.data.PieceSet
import io.github.vrubelroman.chesspenguin.theme.LocalChessColors
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
/// The 64 squares of a FEN's placement, a8 first: the piece letter or ' '.
fun placement(fen: String): CharArray {
val out = CharArray(64) { ' ' }
var i = 0
for (c in fen.substringBefore(' ')) {
when {
c == '/' -> {}
c.isDigit() -> i += c - '0'
i < 64 -> out[i++] = c
}
}
return out
}
/// "e4" → its index in [placement] (a8 = 0).
fun squareIndex(square: String?): Int? {
if (square == null || square.length < 2) return null
val file = square[0] - 'a'
val rank = square[1] - '1'
if (file !in 0..7 || rank !in 0..7) return null
return (7 - rank) * 8 + file
}
/// The pieces of the desktop app's sets, drawn from their SVG at a size once.
class Pieces(private val context: Context) {
private val svgs = HashMap<Pair<PieceSet, Char>, SVG>()
private val bitmaps = HashMap<Triple<PieceSet, Char, Int>, ImageBitmap>()
fun bitmap(set: PieceSet, piece: Char, size: Int): ImageBitmap? {
if (size <= 0) return null
return bitmaps.getOrPut(Triple(set, piece, size)) {
val name = (if (piece.isUpperCase()) "w" else "b") + piece.uppercaseChar()
val svg = svgs.getOrPut(set to piece) { context.assets.open("pieces/${set.dir}/$name.svg").use { SVG.getFromInputStream(it) } }
val bmp = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888)
// Without a viewBox (kiwen-suwi, metaltops) AndroidSVG draws a set at its own
// size, whatever size is asked for.
if (svg.documentViewBox == null) svg.setDocumentViewBox(0f, 0f, svg.documentWidth, svg.documentHeight)
svg.setDocumentWidth(size.toFloat())
svg.setDocumentHeight(size.toFloat())
svg.renderToCanvas(Canvas(bmp))
bmp.asImageBitmap()
}
}
}
/// A board's image (1024 px) read at about `size` px: a phone's board needs no more, and
/// the whole image would take 4 MB.
fun boardImage(context: Context, file: String, size: Int): ImageBitmap? = runCatching {
val bytes = context.assets.open("boards/$file").use { it.readBytes() }
val bounds = BitmapFactory.Options().apply { inJustDecodeBounds = true }
BitmapFactory.decodeByteArray(bytes, 0, bytes.size, bounds)
var sample = 1
while (bounds.outWidth / (sample * 2) >= size) sample *= 2
BitmapFactory.decodeByteArray(bytes, 0, bytes.size, BitmapFactory.Options().apply { inSampleSize = sample })?.asImageBitmap()
}.getOrNull()
/// The corner of a board's image with a1: 2×2 squares, for the choice of boards.
fun boardCorner(context: Context, file: String, size: Int): ImageBitmap? = runCatching {
context.assets.open("boards/$file").use { input ->
val decoder = BitmapRegionDecoder.newInstance(input) ?: return null
try {
val q = decoder.width / 4
var sample = 1
while (q / (sample * 2) >= size) sample *= 2
decoder.decodeRegion(Rect(0, decoder.height - q, q, decoder.height), BitmapFactory.Options().apply { inSampleSize = sample })?.asImageBitmap()
} finally {
decoder.recycle()
}
}
}.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)
"G" -> Color(21, 120, 27, 170)
"B" -> Color(0, 48, 136, 170)
"Y" -> Color(230, 143, 0, 170)
else -> Color(120, 120, 120, 170)
}
/// 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). 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,
flipped: Boolean,
lastFrom: String?,
lastTo: String?,
pieces: Pieces,
theme: BoardTheme,
set: PieceSet,
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
// The image of a textured board, read off the main thread; the flat colors until then.
var side by remember { mutableIntStateOf(0) }
val texture by produceState<ImageBitmap?>(null, theme, side) {
value = null
val file = theme.texture ?: return@produceState
if (side > 0) value = withContext(Dispatchers.IO) { boardImage(context, file, side) }
}
val measurer = rememberTextMeasurer()
val squares = remember(fen) { placement(fen) }
val from = squareIndex(lastFrom)
val to = squareIndex(lastTo)
// The piece of the last move slides from its square when the position steps on.
val slide = remember { Animatable(1f) }
var previous by remember { mutableStateOf<String?>(null) }
var animate by remember { mutableStateOf(false) }
LaunchedEffect(fen) {
animate = animated && previous != null && from != null && to != null && placement(previous!!).let { p -> p[from] != ' ' && p[to] != squares[to] }
previous = fen
if (animate) {
slide.snapTo(0f)
slide.animateTo(1f, tween(250, easing = FastOutSlowInEasing))
} else {
slide.snapTo(1f)
}
}
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 }
.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 = 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.
drawImage(image, dstSize = IntSize(size.width.toInt(), size.height.toInt()))
}
for (i in 0 until 64) {
val light = (i / 8 + i % 8) % 2 == 0
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)
drawCircle(m.color, radius = sq * 0.45f, center = Offset(c.x + sq / 2, c.y + sq / 2), style = Stroke(width = sq * 0.08f))
}
if (check) {
// A red glow under the king of the side to move.
val king = if (fen.substringAfter(' ').startsWith("b")) 'k' else 'K'
val i = squares.indexOf(king)
if (i >= 0) {
val c = cell(i)
val center = Offset(c.x + sq / 2, c.y + sq / 2)
drawCircle(
Brush.radialGradient(
0f to Color(255, 0, 0, 230),
0.25f to Color(231, 0, 0, 230),
0.89f to Color(169, 0, 0, 0),
center = center,
radius = sq * 0.6f,
),
radius = sq * 0.6f,
center = center,
)
}
}
for (i in 0 until 64) {
val p = squares[i]
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 (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
val leftLight = k % 2 == 0
drawCoord(measurer, ('a' + fileIndex).toString(), coordStyle.copy(color = if (bottomLight) theme.dark else theme.light),
Offset((k + 1) * sq - with(density) { 8.sp.toPx() }, 8 * sq - with(density) { 13.sp.toPx() }))
drawCoord(measurer, ('1' + rankIndex).toString(), coordStyle.copy(color = if (leftLight) theme.dark else theme.light),
Offset(with(density) { 2.sp.toPx() }, k * sq + with(density) { 1.sp.toPx() }))
}
for (a in arrows) {
val f = squareIndex(a.from) ?: continue
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 dir = d / d.getDistance()
val width = sq * 0.16f * a.weight
val headW = sq * 0.38f * kotlin.math.sqrt(a.weight)
val normal = Offset(-dir.y, dir.x)
drawLine(a.color, geometry.start, geometry.base, strokeWidth = width)
val head = Path().apply {
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)
}
private fun DrawScope.drawCoord(
measurer: androidx.compose.ui.text.TextMeasurer,
text: String,
style: TextStyle,
at: Offset,
) {
drawText(measurer, text, at, style)
}

View file

@ -0,0 +1,256 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.border
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.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SecondaryTabRow
import androidx.compose.material3.Tab
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.produceState
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.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.dp
import io.github.vrubelroman.chesspenguin.R
import io.github.vrubelroman.chesspenguin.data.BoardTheme
import io.github.vrubelroman.chesspenguin.data.PieceSet
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
/// A position to see a board and its pieces by: the Ruy Lopez after 3.Bb5.
private const val SAMPLE = "r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R b KQkq - 3 3"
/// "Board and pieces": the boards and the piece sets of the desktop app, chosen at once
/// and seen on a board above them (android-ui.md §9).
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun BoardStyleScreen(onBack: () -> Unit) {
val app = app()
val context = LocalContext.current
val prefs by app.settings.prefs.collectAsState()
val pieces = remember { Pieces(context) }
val landscape = LocalConfiguration.current.orientation == android.content.res.Configuration.ORIENTATION_LANDSCAPE
Scaffold(
topBar = {
TopAppBar(
title = { Text(stringResource(R.string.board_and_pieces)) },
navigationIcon = {
IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Rounded.ArrowBack, stringResource(R.string.back)) }
},
)
},
) { padding ->
val preview: @Composable (Modifier) -> Unit = { modifier ->
Board(
fen = SAMPLE,
flipped = false,
lastFrom = "f1",
lastTo = "b5",
pieces = pieces,
theme = prefs.board,
set = prefs.pieces,
description = boardLabel(prefs.board) + " · " + prefs.pieces.dir,
animated = false,
modifier = modifier,
)
}
val choices: @Composable (Modifier) -> Unit = { modifier ->
Choices(
board = prefs.board,
set = prefs.pieces,
pieces = pieces,
onBoard = { b -> app.settings.update { it.copy(board = b) } },
onSet = { p -> app.settings.update { it.copy(pieces = p) } },
modifier = modifier,
)
}
// The board stays in sight while the choices scroll under it (or beside it).
if (landscape) {
Row(Modifier.fillMaxSize().padding(padding)) {
Box(Modifier.fillMaxSize().weight(1f), contentAlignment = Alignment.Center) {
preview(Modifier.padding(16.dp).fillMaxSize())
}
choices(Modifier.weight(1.4f))
}
} else {
Column(Modifier.fillMaxSize().padding(padding)) {
Box(Modifier.fillMaxWidth().padding(vertical = 12.dp), contentAlignment = Alignment.Center) {
preview(Modifier.fillMaxWidth(0.6f).widthIn(max = 240.dp))
}
choices(Modifier.weight(1f))
}
}
}
}
/// "Wood 2": the board's name in the interface language.
@Composable
fun boardLabel(b: BoardTheme): String = stringResource(b.label) + (b.number?.let { " $it" } ?: "")
/// Two tabs, so that the piece sets are not hidden under 37 boards.
@Composable
private fun Choices(
board: BoardTheme,
set: PieceSet,
pieces: Pieces,
onBoard: (BoardTheme) -> Unit,
onSet: (PieceSet) -> Unit,
modifier: Modifier,
) {
var tab by rememberSaveable { mutableIntStateOf(0) }
Column(modifier) {
SecondaryTabRow(selectedTabIndex = tab) {
Tab(selected = tab == 0, onClick = { tab = 0 }, text = { Text(stringResource(R.string.board)) })
Tab(selected = tab == 1, onClick = { tab = 1 }, text = { Text(stringResource(R.string.pieces_tab)) })
}
LazyVerticalGrid(
GridCells.Adaptive(88.dp),
Modifier.fillMaxSize(),
contentPadding = androidx.compose.foundation.layout.PaddingValues(12.dp),
verticalArrangement = Arrangement.spacedBy(4.dp),
) {
if (tab == 0) {
items(BoardTheme.entries, key = { "b" + it.name }) { b ->
Swatch(b, b == board) { onBoard(b) }
}
} else {
items(PieceSet.entries, key = { "p" + it.name }) { p ->
PieceChoice(p, p == set, board, pieces) { onSet(p) }
}
}
}
}
}
/// The ring around the chosen board or set.
@Composable
private fun Modifier.chosen(selected: Boolean, shape: RoundedCornerShape): Modifier =
if (selected) border(3.dp, MaterialTheme.colorScheme.primary, shape) else this
/// A board as 2×2 squares (the corner of its image), its name under it.
@Composable
private fun Swatch(b: BoardTheme, selected: Boolean, onClick: () -> Unit) {
val context = LocalContext.current
var side by remember { mutableIntStateOf(0) }
val corner by produceState<ImageBitmap?>(null, b, side) {
val file = b.texture ?: return@produceState
if (side > 0) value = withContext(Dispatchers.IO) { boardCorner(context, file, side) }
}
val shape = RoundedCornerShape(6.dp)
Column(
Modifier
.clip(RoundedCornerShape(8.dp))
.selectable(selected = selected, role = Role.RadioButton, onClick = onClick)
.padding(4.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Canvas(
Modifier
.fillMaxWidth()
.aspectRatio(1f)
.chosen(selected, shape)
.padding(if (selected) 5.dp else 0.dp)
.clip(RoundedCornerShape(if (selected) 2.dp else 6.dp))
.onSizeChanged { side = it.width },
) {
val image = corner
if (image != null) {
drawImage(image, dstOffset = IntOffset.Zero, dstSize = IntSize(size.width.toInt(), size.height.toInt()))
} else {
val sq = size.width / 2
// a1 dark at the bottom left, as on the board.
drawRect(b.light, Offset(0f, 0f), Size(sq, sq))
drawRect(b.dark, Offset(sq, 0f), Size(sq, sq))
drawRect(b.dark, Offset(0f, sq), Size(sq, sq))
drawRect(b.light, Offset(sq, sq), Size(sq, sq))
}
}
Label(boardLabel(b), selected)
}
}
/// A set as its white knight on a light square and black queen on a dark one of the
/// chosen board (a dark set stays readable), its name under them.
@Composable
private fun PieceChoice(p: PieceSet, selected: Boolean, board: BoardTheme, pieces: Pieces, onClick: () -> Unit) {
val shape = RoundedCornerShape(6.dp)
Column(
Modifier
.clip(RoundedCornerShape(8.dp))
.selectable(selected = selected, role = Role.RadioButton, onClick = onClick)
.padding(4.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Canvas(
Modifier
.fillMaxWidth()
.aspectRatio(2f)
.chosen(selected, shape)
.padding(if (selected) 5.dp else 0.dp)
.clip(RoundedCornerShape(if (selected) 2.dp else 6.dp)),
) {
val sq = size.height
val px = sq.toInt()
val gap = (size.width - 2 * sq) / 2
drawRect(board.light, Offset(gap, 0f), Size(sq, sq))
drawRect(board.dark, Offset(gap + sq, 0f), Size(sq, sq))
pieces.bitmap(p, 'N', px)?.let { drawImage(it, dstOffset = IntOffset(gap.toInt(), 0), dstSize = IntSize(px, px)) }
pieces.bitmap(p, 'q', px)?.let { drawImage(it, dstOffset = IntOffset((gap + sq).toInt(), 0), dstSize = IntSize(px, px)) }
}
Label(p.dir, selected)
}
}
@Composable
private fun Label(text: String, selected: Boolean) {
Text(
text,
style = MaterialTheme.typography.bodySmall,
color = if (selected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant,
textAlign = TextAlign.Center,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(top = 4.dp),
)
}

View file

@ -0,0 +1,338 @@
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
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.rememberTextMeasurer
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
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
import androidx.compose.ui.res.stringResource
@Composable
fun app(): ChessPenguinApp = LocalContext.current.applicationContext as ChessPenguinApp
/// 1248 → "1 248": digit groups apart, as on the desktop.
fun groupDigits(n: Int): String = "%,d".format(n).replace(',', ' ').replace(' ', ' ')
/// The name on the list: a sample keeps the name of the current language until renamed.
@Composable
fun displayName(e: DbEntry): String = when {
e.source != Source.Sample || e.renamed -> e.name
e.id == "sample-classics.pgn" -> stringResource(R.string.sample_classics)
e.id == "sample-alekhine.pgn" -> stringResource(R.string.sample_alekhine)
else -> e.name
}
/// The label of a database's format, for its badge (§10.6).
fun badge(e: DbEntry): String {
val ext = e.fileName.substringAfterLast('.', "").lowercase()
return when (ext) {
"zip" -> "ZIP"
"7z" -> "7Z"
"cbv", "cbh", "cbz" -> "CB"
else -> "PGN"
}
}
/// The format of a database in words, as the core names it once it is opened.
fun formatName(e: DbEntry): String = when (e.fileName.substringAfterLast('.', "").lowercase()) {
"cbh" -> "ChessBase"
"cbv" -> "ChessBase CBV"
"zip" -> "ZIP"
"7z" -> "7z"
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 KindBadge(
kind: DbKind,
error: Boolean = false,
content: @Composable (Color) -> Unit,
) {
val c = kindColor(kind, LocalChessColors.current.dark)
Box(
Modifier
.size(40.dp)
.clip(RoundedCornerShape(10.dp))
.background(if (error) MaterialTheme.colorScheme.errorContainer else c.container),
contentAlignment = Alignment.Center,
) { 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).
fun shortName(name: String): String {
val n = name.trim()
if (n.isEmpty() || n == "?") return "?"
val comma = n.indexOf(',')
if (comma <= 0) return n
val surname = n.substring(0, comma).trim()
val initials = n.substring(comma + 1).trim().split(' ', '-').filter { it.isNotEmpty() }.joinToString(" ") { "${it.first()}." }
return if (initials.isEmpty()) surname else "$surname $initials"
}
/// A player's name (android-ui.md §7.11): in full while it fits, else "Surname F.", else
/// cut with "…". `abbreviate = false` keeps the text as it is (a study's title for White).
@Composable
fun PlayerName(
name: String,
style: TextStyle,
modifier: Modifier = Modifier,
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(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)
}
}
}
/// A player's share of the result: "1", "0", "½", or null (unknown, unfinished).
fun sideResult(result: String, white: Boolean): String? = when (result) {
"1-0" -> if (white) "1" else "0"
"0-1" -> if (white) "0" else "1"
"1/2-1/2" -> "½"
else -> null
}
/// The rating of a player, or nothing ("0", "?", "").
fun elo(value: String): String = value.trim().takeIf { v -> v.toIntOrNull()?.let { it > 0 } == true } ?: ""
/// The colour of a side: a small disc (white with a rim, or black).
@Composable
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(size).clip(CircleShape)
.background(if (white) Color.White else if (dark) Color(0xFF0E0F10) else Color(0xFF1C1D1F))
.border(1.dp, MaterialTheme.colorScheme.onSurfaceVariant, CircleShape),
)
}
/// One player's line: name (giving way), Elo, the share of the result on the right.
@Composable
fun PlayerLine(
name: String,
elo: String,
result: String?,
style: TextStyle,
modifier: Modifier = Modifier,
disc: Boolean? = null,
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) {
SideDisc(disc)
Spacer(Modifier.width(8.dp))
}
Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) {
PlayerName(name, style, Modifier.weight(1f, fill = false), nameColor, maxLines, abbreviate)
if (elo.isNotEmpty()) {
Spacer(Modifier.width(8.dp))
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),
color = if (result == "1") MaterialTheme.colorScheme.onSurface else MaterialTheme.colorScheme.onSurfaceVariant,
fontWeight = if (result == "1") androidx.compose.ui.text.font.FontWeight.Medium else null,
textAlign = androidx.compose.ui.text.style.TextAlign.End,
maxLines = 1,
modifier = Modifier.width(24.dp),
)
}
}
/// "1/2-1/2" → "½-½".
fun shortResult(result: String): String = when (result) {
"1/2-1/2" -> "½-½"
"" -> "*"
else -> result
}
/// The year of a PGN date ("1927.??.??" → "1927"), or nothing.
fun year(date: String): String = date.take(4).takeIf { y -> y.length == 4 && y.all { it.isDigit() } } ?: ""
/// The parts that are known, joined with " · " (empty values and "?" left out).
fun joinKnown(vararg parts: String): String = parts.map { it.trim() }.filter { it.isNotEmpty() && it != "?" }.joinToString(" · ")
/// The figurines of the desktop app (OFL, apps/desktop/assets/fonts/OFL.txt).
val Figurines = FontFamily(Font(R.font.figurines))
/// King, queen, rook, bishop, knight in a language, as on the desktop (san.rs).
fun localLetters(lang: String): List<String>? = when (lang) {
"ru" -> listOf("Кр", "Ф", "Л", "С", "К")
"de" -> listOf("K", "D", "T", "L", "S")
"fr" -> listOf("R", "D", "T", "F", "C")
"es", "it" -> listOf("R", "D", "T", "A", "C")
"pt" -> listOf("R", "D", "T", "B", "C")
else -> null
}
/// A SAN move as shown: the piece letter at the start and after "=" replaced; the
/// game itself stays in Latin SAN.
fun displaySan(san: String, mode: Notation, lang: String): AnnotatedString {
val local = localLetters(lang)
if (mode == Notation.Latin || (mode == Notation.Local && local == null)) return AnnotatedString(san)
return buildAnnotatedString {
san.forEachIndexed { i, c ->
val k = "KQRBN".indexOf(c)
val piece = k >= 0 && (i == 0 || san[i - 1] == '=')
when {
!piece -> append(c)
mode == Notation.Figurines -> withStyle(SpanStyle(fontFamily = Figurines)) { append("♔♕♖♗♘"[k]) }
else -> append(local!![k])
}
}
}
}
/// A line like "14.Nd5 Bxd5 15.exd5": each move shown with [displaySan].
fun displayLine(text: String, mode: Notation, lang: String): AnnotatedString {
if (mode == Notation.Latin) return AnnotatedString(text)
return buildAnnotatedString {
text.split(' ').forEachIndexed { i, word ->
if (i > 0) append(' ')
val cut = word.indexOfLast { it == '.' || it == '…' } + 1
append(word.substring(0, cut))
append(displaySan(word.substring(cut), mode, lang))
}
}
}
/// The language of the interface ("ru", "en", …).
@Composable
fun uiLanguage(): String = LocalConfiguration.current.locales[0].language

View file

@ -0,0 +1,824 @@
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
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
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.padding
import androidx.compose.foundation.layout.size
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.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.SnackbarDuration
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.SnackbarResult
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalResources
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.input.TextFieldValue
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 androidx.compose.material3.LinearProgressIndicator
import io.github.vrubelroman.chesspenguin.data.DownloadView
import io.github.vrubelroman.chesspenguin.data.Finished
import io.github.vrubelroman.chesspenguin.data.DbEntry
import io.github.vrubelroman.chesspenguin.data.FolderScan
import io.github.vrubelroman.chesspenguin.data.Source
import uniffi.mobile_api.Database
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, onNewGame: () -> Unit, onPlay: () -> Unit) {
val library = app().library
val downloads = app().downloads
val views by downloads.views.collectAsState()
val entries by library.entries.collectAsState()
val snackbar = remember { SnackbarHostState() }
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)
val updatesForUndo = app().updates
// The card's ×: offers are off; «Undo» for a slip of the finger (android-ui.md §25.2).
val onUpdateDismissed: () -> Unit = {
scope.launch {
snackbar.currentSnackbarData?.dismiss()
if (snackbar.showSnackbar(offersOffText, offersUndoText, duration = androidx.compose.material3.SnackbarDuration.Long) == androidx.compose.material3.SnackbarResult.ActionPerformed) {
updatesForUndo.setOffer(true)
}
}
}
UpdateMessages(snackbar)
val removedOnlineText = stringResource(R.string.online_removed)
val resourcesForSnack = LocalResources.current
val openText = stringResource(R.string.online_open_short)
// How a download ended, said while this screen is shown (android-ui.md §23.3).
LaunchedEffect(Unit) {
downloads.finished.collect { f ->
val text = finishedText(resourcesForSnack, f) ?: return@collect
snackbar.currentSnackbarData?.dismiss()
val canOpen = f.games > 0 && library.entry(f.id) != null
if (snackbar.showSnackbar(text, if (canOpen) openText else null, withDismissAction = false) == SnackbarResult.ActionPerformed) onOpen(f.id)
}
}
val undoText = stringResource(R.string.undo)
val pick = rememberLauncherForActivityResult(ActivityResultContracts.OpenDocument()) { uri ->
if (uri != null) onOpen(library.addFile(uri).id)
}
var choosing by remember { mutableStateOf(false) }
// The folder sheet: shown while `folderOpen`, `scan` null while looking through it.
// The picked folder outlives a rotation; it is then looked through again.
var folderOpen by rememberSaveable { mutableStateOf(false) }
var folder by rememberSaveable { mutableStateOf<android.net.Uri?>(null) }
var scan by remember { mutableStateOf<FolderScan?>(null) }
LaunchedEffect(folderOpen, folder) {
val tree = folder
if (folderOpen && tree != null && scan?.tree != tree) scan = library.scanFolder(tree)
}
val pickFolder = rememberLauncherForActivityResult(ActivityResultContracts.OpenDocumentTree()) { tree ->
if (tree != null) {
scan = null
library.keepFolder(tree)
folder = tree
folderOpen = true
}
}
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.
val cardShown = update != null
LaunchedEffect(cardShown) {
if (cardShown && list.firstVisibleItemIndex == 1 && list.firstVisibleItemScrollOffset == 0) list.animateScrollToItem(0)
}
val scroll = TopAppBarDefaults.pinnedScrollBehavior()
// The samples are small: read them at once, so their rows show the number of games.
LaunchedEffect(Unit) { library.countSamples() }
Scaffold(
modifier = Modifier.nestedScroll(scroll.nestedScrollConnection),
topBar = {
TopAppBar(
title = { Text(stringResource(R.string.app_name)) },
actions = {
IconButton(onClick = onSettings) { Icon(Icons.Rounded.Settings, stringResource(R.string.settings)) }
},
scrollBehavior = scroll,
)
},
snackbarHost = { SnackbarHost(snackbar) },
) { padding ->
if (entries.isEmpty()) {
Column(Modifier.padding(padding)) {
update?.let { UpdateCard(it, onDismissed = onUpdateDismissed) }
Empty(Modifier.weight(1f), onAdd = add, onSamples = {
library.addSamples()
library.entries.value.firstOrNull()?.let { onOpen(it.id) }
})
}
} else {
LazyColumn(
Modifier.fillMaxSize(),
state = list,
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()) } }
// 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],
onOpen = { onOpen(e.id) },
onRename = { renaming = e },
onUpdate = { downloads.update(e) },
onStop = { downloads.cancel(e.id) },
onRemove = {
// A download into it stops first: its file goes with it.
downloads.cancel(e.id)
val removed = library.remove(e.id) ?: return@DatabaseRow
scope.launch {
snackbar.currentSnackbarData?.dismiss()
var restored = false
try {
// A copy is deleted, not only taken off the list.
val text = when (e.source) {
Source.Copy -> removedCopyText
Source.Online -> removedOnlineText
else -> removedText
}
// Not for ever: the deleted file goes once "Undo" is gone.
if (snackbar.showSnackbar(text, undoText, withDismissAction = false, duration = SnackbarDuration.Long) == SnackbarResult.ActionPerformed) {
library.restore(removed.first, removed.second)
restored = true
}
} finally {
// Also when the screen goes away while "Undo" is offered.
if (!restored) library.forget(removed.second)
}
}
},
modifier = Modifier.animateItem().groupCard(k, files.size),
)
}
}
}
}
val pasteNone = stringResource(R.string.paste_none)
val resources = LocalResources.current
if (choosing) {
val clipboard = remember { context.getSystemService(ClipboardManager::class.java) }
val hasText = remember { clipboard.primaryClipDescription?.hasMimeType("text/*") == true }
AddSheet(
onFile = {
choosing = false
pick.launch(arrayOf("*/*"))
},
onFolder = {
choosing = false
pickFolder.launch(null)
},
onPaste = if (!hasText) null else {
{
choosing = false
val text = clipboard.primaryClip?.takeIf { it.itemCount > 0 }?.getItemAt(0)?.coerceToText(context)?.toString().orEmpty()
val dated = resources.getString(
R.string.paste_db,
DateUtils.formatDateTime(context, System.currentTimeMillis(), DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_SHOW_TIME or DateUtils.FORMAT_ABBREV_MONTH),
)
scope.launch {
runCatching {
library.addCopy("clipboard.pgn", text.byteInputStream()) { db -> pastedName(db, dated) }
}.onSuccess(onAdded).onFailure {
snackbar.currentSnackbarData?.dismiss()
snackbar.showSnackbar(pasteNone)
}
}
}
},
onOnline = {
choosing = false
onOnline()
},
onDismiss = { choosing = false },
)
}
if (folderOpen) {
FolderSheet(
scan,
onAdd = { chosen ->
val s = scan ?: return@FolderSheet
library.addFound(s.tree, chosen)
folderOpen = false
val n = chosen.count { !it.added && !it.incomplete }
scope.launch {
snackbar.currentSnackbarData?.dismiss()
snackbar.showSnackbar(resources.getQuantityString(R.plurals.added_count, n, n))
}
// Nothing added: the folder's permission goes back.
if (n == 0) library.forgetFolder(s.tree)
},
onPickAnother = {
folderOpen = false
folder?.let { library.forgetFolder(it) }
pickFolder.launch(null)
},
onDismiss = {
folderOpen = false
folder?.let { library.forgetFolder(it) }
},
)
}
renaming?.let { e ->
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
private fun Empty(modifier: Modifier, onAdd: () -> Unit, onSamples: () -> Unit) {
Column(
modifier.fillMaxSize().padding(horizontal = 32.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
Image(painterResource(R.drawable.penguin), null, Modifier.size(96.dp))
Spacer(Modifier.height(24.dp))
Text(stringResource(R.string.empty_title), style = MaterialTheme.typography.titleLarge, textAlign = TextAlign.Center)
Spacer(Modifier.height(12.dp))
Text(
stringResource(R.string.empty_text),
style = MaterialTheme.typography.bodyLarge,
color = MaterialTheme.colorScheme.onSurfaceVariant,
textAlign = TextAlign.Center,
modifier = Modifier.widthIn(max = 296.dp),
)
Spacer(Modifier.height(32.dp))
Button(onClick = onAdd, modifier = Modifier.height(48.dp)) {
Icon(Icons.Rounded.Add, null)
Spacer(Modifier.size(8.dp))
Text(stringResource(R.string.add_database))
}
TextButton(onClick = onSamples, modifier = Modifier.height(48.dp)) { Text(stringResource(R.string.open_samples)) }
}
}
@OptIn(ExperimentalFoundationApi::class)
@Composable
private fun DatabaseRow(
e: DbEntry,
download: DownloadView?,
onOpen: () -> Unit,
onRename: () -> Unit,
onUpdate: () -> Unit,
onStop: () -> Unit,
onRemove: () -> Unit,
modifier: Modifier,
) {
var menu by remember { mutableStateOf(false) }
val format = badge(e)
val running = download?.state?.running == true
val failure = download?.state?.failure?.takeIf { !running }
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)
e.source != Source.Online -> subtitle
// A downloaded database: how its download goes, or when it was last brought up to date.
running -> stringResource(R.string.online_downloading, groupDigits(((e.games ?: 0) + download.state.added.toInt())))
else -> pluralStringResource(R.plurals.games_count, e.games ?: 0, groupDigits(e.games ?: 0)) + " · " + when {
// The games stay in the line: the database is not empty because a site failed.
failure != null -> onlineProblemShort(failure)
e.updated == null -> stringResource(R.string.online_unfinished)
System.currentTimeMillis() - e.updated * 1000 < 60_000 -> stringResource(R.string.online_updated_now)
else -> stringResource(
R.string.online_updated,
DateUtils.getRelativeTimeSpanString(e.updated * 1000, System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS).toString(),
)
}
}
Box(modifier) {
Row(
Modifier
.fillMaxWidth()
.height(72.dp)
.combinedClickable(onClick = onOpen, onLongClick = { menu = true })
.padding(start = 12.dp, end = 4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
// 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(
// 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,
overflow = TextOverflow.Ellipsis,
)
}
Box {
IconButton(onClick = { menu = true }) { Icon(Icons.Rounded.MoreVert, stringResource(R.string.menu)) }
DropdownMenu(expanded = menu, onDismissRequest = { menu = false }) {
if (e.source == Source.Online) {
DropdownMenuItem(text = { Text(stringResource(if (running) R.string.online_stop_download else R.string.online_update)) }, onClick = {
menu = false
if (running) onStop() else onUpdate()
})
}
DropdownMenuItem(text = { Text(stringResource(R.string.rename)) }, onClick = {
menu = false
onRename()
})
DropdownMenuItem(text = { Text(stringResource(R.string.remove)) }, onClick = {
menu = false
onRemove()
})
}
}
}
// A download going on: a thin bar along the bottom of the row (§23.3).
if (running) {
val share = downloadShare(download)
val bar = Modifier.fillMaxWidth().height(2.dp).align(Alignment.BottomStart)
if (share != null) LinearProgressIndicator(progress = { share }, modifier = bar) else LinearProgressIndicator(bar)
}
}
}
@Composable
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(
onDismissRequest = onDismiss,
title = { Text(stringResource(R.string.rename)) },
text = {
OutlinedTextField(
value = value,
onValueChange = { value = it },
singleLine = true,
// 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)) } },
dismissButton = { TextButton(onClick = onDismiss) { Text(stringResource(R.string.cancel)) } },
)
}
/// «**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 {
val rows = db.rowsOf((0u until db.len()).toList())
if (rows.size == 1) {
val (white, black) = shortName(rows[0].white) to shortName(rows[0].black)
if (white != "?" || black != "?") return "$white – $black"
} else {
rows.map { it.event.trim() }.distinct().singleOrNull()?.takeIf { it.isNotEmpty() && it != "?" }?.let { return it }
}
return dated
}
/// The snackbar of a finished download: "“Name”: +12, 1 246 games in all", "“Name”: no
/// new games", "“Name”: Lichess does not answer"; none when it was stopped or got nothing.
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
s.added == 0UL -> res.getString(R.string.online_snack_none, f.name)
else -> res.getString(R.string.online_snack_added, f.name, groupDigits(s.added.toInt()), games)
}
}

View file

@ -0,0 +1,315 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.border
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.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Close
import androidx.compose.material.icons.rounded.ExpandLess
import androidx.compose.material.icons.rounded.ExpandMore
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
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.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.luminance
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import io.github.vrubelroman.chesspenguin.BuildConfig
import io.github.vrubelroman.chesspenguin.R
import io.github.vrubelroman.chesspenguin.data.EngineStatus
import io.github.vrubelroman.chesspenguin.data.NetProblem
import io.github.vrubelroman.chesspenguin.data.NetState
import io.github.vrubelroman.chesspenguin.theme.Tabular
import uniffi.mobile_api.Analysis
import uniffi.mobile_api.EngineLine
import kotlin.math.exp
/// White's share of the bar, as on Lichess: 0.5 is equal, 1 is White winning.
fun whiteShare(line: EngineLine?): Float {
if (line == null) return 0.5f
line.mate?.let { return if (it > 0) 1f else 0f }
val cp = (line.cp ?: 0).coerceIn(-1000, 1000)
return (0.5 + 0.5 * (2 / (1 + exp(-0.00368208 * cp)) - 1)).toFloat()
}
/// The engine's row between the board and the notation (android-ui.md §8.2): the
/// evaluation, the depth, the best line; ▾ shows more lines. While the game is being
/// analysed (`waiting`, §21.6) the engine rests and the row says so.
@Composable
fun EngineStrip(
ending: String?,
status: EngineStatus,
analysis: Analysis?,
flipped: Boolean,
lines: Int,
expanded: Boolean,
onExpand: () -> Unit,
onLine: (EngineLine) -> Unit,
onDeeper: () -> Unit,
onRestart: () -> Unit,
notation: (String) -> AnnotatedString,
waiting: Boolean = false,
) {
val best = analysis?.lines?.firstOrNull()
val share by animateFloatAsState(whiteShare(best), tween(300), label = "eval")
Column(Modifier.fillMaxWidth().background(MaterialTheme.colorScheme.surfaceContainerLow)) {
// White's share on the left; on the right when the board is turned.
Row(Modifier.fillMaxWidth().height(3.dp)) {
// The light part must stand out from a light strip too.
val white = if (MaterialTheme.colorScheme.surface.luminance() > 0.5f) Color(0xFFD5D8DC) else Color(0xFFF5F5F0)
val black = Color(0xFF26282B)
val left = if (flipped) 1f - share else share
if (left > 0f) Box(Modifier.weight(left.coerceAtLeast(0.001f)).fillMaxHeight().background(if (flipped) black else white))
if (left < 1f) Box(Modifier.weight((1f - left).coerceAtLeast(0.001f)).fillMaxHeight().background(if (flipped) white else black))
}
if (ending != null) {
Row(Modifier.fillMaxWidth().height(48.dp).padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically) {
Text(ending, style = MaterialTheme.typography.labelLarge)
}
return@Column
}
if (waiting) {
Row(Modifier.fillMaxWidth().height(48.dp).padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically) {
Text(
stringResource(R.string.review_engine_paused),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
return@Column
}
if (status is EngineStatus.Failed) {
Row(Modifier.fillMaxWidth().height(48.dp).padding(start = 16.dp, end = 8.dp), verticalAlignment = Alignment.CenterVertically) {
Text(
stringResource(if (status.notStarting) R.string.engine_not_starting else R.string.engine_not_answering),
color = MaterialTheme.colorScheme.error,
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.weight(1f),
)
if (!status.notStarting) TextButton(onClick = onRestart) { Text(stringResource(R.string.restart)) }
}
return@Column
}
LineRow(best, analysis, status, true, lines > 1, expanded, onExpand, onLine, onDeeper, notation)
if (expanded) {
analysis?.lines?.drop(1)?.take(lines - 1)?.forEach { l ->
LineRow(l, analysis, status, false, false, false, {}, onLine, {}, notation)
}
}
}
}
@Composable
private fun LineRow(
line: EngineLine?,
analysis: Analysis?,
status: EngineStatus,
first: Boolean,
canExpand: Boolean,
expanded: Boolean,
onExpand: () -> Unit,
onLine: (EngineLine) -> Unit,
onDeeper: () -> Unit,
notation: (String) -> AnnotatedString,
) {
Row(
Modifier
.fillMaxWidth()
.height(if (first) 48.dp else 40.dp)
.then(if (line != null) Modifier.clickable { onLine(line) } else Modifier)
.padding(start = 16.dp, end = if (first) 0.dp else 16.dp),
verticalAlignment = Alignment.CenterVertically,
) {
EvalPlaque(line)
Spacer(Modifier.width(8.dp))
if (first) {
val depth = analysis?.depth?.toInt() ?: 0
val label = when {
line == null || status == EngineStatus.Starting -> stringResource(R.string.thinking)
status == EngineStatus.Paused -> stringResource(R.string.depth, depth) + " · " + stringResource(R.string.paused)
else -> stringResource(R.string.depth, depth)
}
Text(
label,
style = MaterialTheme.typography.bodyMedium.merge(Tabular),
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 1,
)
Spacer(Modifier.width(8.dp))
}
Text(
line?.let { notation(it.text) } ?: AnnotatedString(""),
style = MaterialTheme.typography.bodyMedium,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f),
)
if (first && status == EngineStatus.Paused) {
TextButton(onClick = onDeeper) { Text(stringResource(R.string.deeper)) }
}
if (first && canExpand) {
IconButton(onClick = onExpand) {
Icon(
if (expanded) Icons.Rounded.ExpandLess else Icons.Rounded.ExpandMore,
stringResource(if (expanded) R.string.fewer_lines else R.string.more_lines),
)
}
}
}
}
/// The evaluation: light when White is better, dark when Black is (§8.2).
@Composable
private fun EvalPlaque(line: EngineLine?) {
// Dark only when Black is better by what is shown ("0.0" stays light).
val blackBetter = line != null && ((line.mate ?: 0) < 0 || (line.mate == null && Math.round((line.cp ?: 0) / 10.0) < 0))
val bg = if (blackBetter) Color(0xFF26282B) else Color(0xFFF5F5F0)
val fg = if (blackBetter) Color(0xFFE8E8E8) else Color(0xFF1C1D1F)
Box(
Modifier
.width(56.dp)
.height(28.dp)
.clip(RoundedCornerShape(8.dp))
.background(bg)
.border(1.dp, MaterialTheme.colorScheme.outline, RoundedCornerShape(8.dp)),
contentAlignment = Alignment.Center,
) {
Text(
line?.let(::shownEval) ?: "",
color = fg,
fontSize = 15.sp,
fontWeight = FontWeight.Bold,
style = Tabular,
)
}
}
/// The evaluation as shown (§8.2): pawns with one decimal, rounded ("+0.45" → "+0.5"),
/// no sign for an equal position; mates as the engine line has them ("#3", "#−2").
fun shownEval(line: EngineLine): String {
if (line.mate != null) return line.eval
val tenths = Math.round((line.cp ?: 0) / 10.0).toInt()
if (tenths == 0) return "0.0"
val sign = if (tenths > 0) "+" else "\u2212"
val a = kotlin.math.abs(tenths)
return "$sign${a / 10}.${a % 10}"
}
/// The bar above the notation while an engine line is shown on the board (§8.3); `best`
/// for the better line of a game report's error (§21.1).
@Composable
fun PreviewBar(step: Int, total: Int, onClose: () -> Unit, best: Boolean = false) {
Row(
Modifier
.fillMaxWidth()
.height(48.dp)
.background(MaterialTheme.colorScheme.primaryContainer)
.padding(start = 16.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
stringResource(if (best) R.string.review_best_preview else R.string.engine_line_preview, step, total),
style = MaterialTheme.typography.labelLarge,
color = MaterialTheme.colorScheme.onPrimaryContainer,
modifier = Modifier.weight(1f),
)
IconButton(onClick = onClose) { Icon(Icons.Rounded.Close, stringResource(R.string.close)) }
}
}
private fun mb(bytes: Long) = (bytes / 1_000_000).toInt()
/// The sheet that offers the download of the engine (light build, §8.4).
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun EngineSheet(state: NetState, metered: Boolean, onDownload: () -> Unit, onCancel: () -> Unit, onDismiss: () -> Unit) {
val size = mb(BuildConfig.NET_SIZE)
ModalBottomSheet(onDismissRequest = onDismiss) {
Column(Modifier.fillMaxWidth().padding(start = 24.dp, end = 24.dp, bottom = 24.dp)) {
Text(stringResource(R.string.engine_sheet_title), style = MaterialTheme.typography.titleLarge)
Spacer(Modifier.height(16.dp))
Text(stringResource(R.string.engine_sheet_text), style = MaterialTheme.typography.bodyLarge)
Spacer(Modifier.height(16.dp))
when (state) {
is NetState.Loading -> {
LinearProgressIndicator(
progress = { state.done.toFloat() / state.total.coerceAtLeast(1) },
modifier = Modifier.fillMaxWidth(),
)
Spacer(Modifier.height(8.dp))
Text(
stringResource(R.string.downloaded_of, mb(state.done), mb(state.total)),
style = MaterialTheme.typography.bodyMedium.merge(Tabular),
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Spacer(Modifier.height(24.dp))
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
TextButton(onClick = onCancel) { Text(stringResource(R.string.cancel_download)) }
}
}
is NetState.Failed -> {
val text = when (state.problem) {
NetProblem.NoInternet -> stringResource(R.string.no_internet)
NetProblem.Interrupted -> stringResource(R.string.interrupted)
NetProblem.NoSpace -> stringResource(R.string.no_space, size)
NetProblem.Corrupt -> stringResource(R.string.corrupt)
}
Text(text, color = MaterialTheme.colorScheme.error, style = MaterialTheme.typography.bodyMedium)
Spacer(Modifier.height(24.dp))
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {
if (state.problem != NetProblem.NoSpace) TextButton(onClick = onDismiss) { Text(stringResource(R.string.not_now)) }
when (state.problem) {
NetProblem.NoSpace -> Button(onClick = onDismiss) { Text(stringResource(R.string.ok)) }
NetProblem.NoInternet, NetProblem.Interrupted -> Button(onClick = onDownload) { Text(stringResource(R.string.retry)) }
NetProblem.Corrupt -> Button(onClick = onDownload) { Text(stringResource(R.string.download_again)) }
}
}
}
else -> {
Text(stringResource(R.string.engine_size, size), style = MaterialTheme.typography.bodyMedium.merge(Tabular))
if (metered) {
Spacer(Modifier.height(8.dp))
Text(
stringResource(R.string.engine_metered),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
Spacer(Modifier.height(24.dp))
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {
TextButton(onClick = onDismiss) { Text(stringResource(R.string.not_now)) }
Button(onClick = onDownload) { Text(stringResource(R.string.download)) }
}
}
}
}
}
}

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)) } },
)
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,501 @@
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
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.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.rememberLazyListState
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.rounded.Close
import androidx.compose.material.icons.rounded.Search
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.material3.TextButton
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateMapOf
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.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
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.Source
import androidx.compose.ui.zIndex
import androidx.compose.ui.platform.LocalResources
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
import kotlinx.coroutines.withContext
import uniffi.mobile_api.ApiException
import uniffi.mobile_api.Database
import uniffi.mobile_api.GameRow
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,
onPlayers: () -> 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 failed by remember { mutableStateOf<Throwable?>(null) }
// Read again when a download brought new games into it (android-ui.md §23).
LaunchedEffect(db, entry?.games, entry?.updated) {
app.library.database(db).onSuccess { database = it }.onFailure { failed = it }
}
var searching by rememberSaveable { mutableStateOf(false) }
var query by rememberSaveable { mutableStateOf("") }
var shown by remember { mutableStateOf<List<UInt>?>(null) }
val list = rememberLazyListState()
val rows = remember { mutableStateMapOf<Int, List<GameRow>>() }
LaunchedEffect(database, query) {
val d = database ?: return@LaunchedEffect
if (query.isNotEmpty()) delay(250)
val found = withContext(Dispatchers.Default) { app.library.listed(db, d, query) }
rows.clear()
shown = found
// 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()
val download = app.downloads.views.collectAsState().value[db]
val snackbar = remember { SnackbarHostState() }
UpdateMessages(snackbar)
val resources = LocalResources.current
// How a download of this database ended (§23.3); the list reads it again by itself.
LaunchedEffect(db) {
app.downloads.finished.collect { f ->
if (f.id != db) return@collect
val text = finishedText(resources, f) ?: return@collect
snackbar.currentSnackbarData?.dismiss()
snackbar.showSnackbar(text)
}
}
val focus = remember { FocusRequester() }
val keyboard = LocalSoftwareKeyboardController.current
BackHandler(searching) {
searching = false
query = ""
}
Scaffold(
modifier = Modifier.nestedScroll(scroll.nestedScrollConnection),
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.search_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(entry?.let { displayName(it) } ?: "", maxLines = 1, overflow = TextOverflow.Ellipsis)
database?.let { d ->
val n = d.len().toInt()
val found = shown?.size
Text(
if (query.isNotEmpty() && found != null) {
stringResource(R.string.found_of, groupDigits(found), groupDigits(n))
} else if (download?.state?.running == true) {
// The games come as the download goes, as on the list of
// databases; the list itself is read again when it ends.
stringResource(R.string.online_downloading, groupDigits((entry?.games ?: n) + download.state.added.toInt()))
} else {
pluralStringResource(R.plurals.games_count, n, groupDigits(n))
},
style = MaterialTheme.typography.bodyMedium.merge(Tabular),
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
}
}
},
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 = 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.
if (entry?.source == Source.Online) {
if (download?.state?.running == true) {
IconButton(onClick = { app.downloads.cancel(db) }) { Icon(Icons.Rounded.Close, stringResource(R.string.online_stop_download)) }
} else {
IconButton(onClick = { entry.let { app.downloads.update(it) } }) { Icon(Icons.Rounded.Download, stringResource(R.string.online_update)) }
}
}
}
},
scrollBehavior = scroll,
)
},
snackbarHost = { SnackbarHost(snackbar) },
) { padding ->
Box(Modifier.fillMaxSize().padding(padding)) {
download?.takeIf { it.state.running }?.let { v ->
val share = downloadShare(v)
val bar = Modifier.fillMaxWidth().height(2.dp).align(Alignment.TopStart).zIndex(1f)
if (share != null) LinearProgressIndicator(progress = { share }, modifier = bar) else LinearProgressIndicator(bar)
}
val games = shown
when {
failed != null -> Message(stringResource(R.string.open_failed), openProblem(failed!!)) {
// The way out: take the database off the list, add the file again.
TextButton(onClick = {
app.library.remove(db)?.let { app.library.forget(it.second) }
onBack()
}) { Text(stringResource(R.string.remove)) }
}
games == null -> Column(Modifier.align(Alignment.Center), horizontalAlignment = Alignment.CenterHorizontally) {
CircularProgressIndicator()
Spacer(Modifier.height(16.dp))
Text(stringResource(R.string.reading), color = MaterialTheme.colorScheme.onSurfaceVariant)
}
games.isEmpty() -> Message(stringResource(R.string.nothing_found), "")
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
val loaded = rows[chunk]
LaunchedEffect(chunk, games) {
if (rows[chunk] == null) {
val d = database ?: return@LaunchedEffect
val part = games.subList(chunk * CHUNK, minOf(games.size, (chunk + 1) * CHUNK))
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),
lastOpened = place == last,
divider = place < games.size - 1,
query = query,
) { onGame(place, query) }
}
}
}
}
}
}
}
@Composable
private fun Message(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()
}
}
}
/// Why a database did not open, in plain words with the next step (§11).
@Composable
fun openProblem(e: Throwable): String = when (e) {
is io.github.vrubelroman.chesspenguin.data.NoGames -> stringResource(R.string.file_no_games)
is io.github.vrubelroman.chesspenguin.data.MissingPart -> stringResource(R.string.open_missing_part, e.file)
is SecurityException, is java.io.FileNotFoundException, is ApiException.Io -> stringResource(R.string.open_no_access)
is ApiException.Corrupt -> stringResource(R.string.open_corrupt)
is ApiException.Empty -> stringResource(R.string.open_empty)
is ApiException.Unsupported -> stringResource(R.string.open_unsupported, e.detail)
else -> ""
}
/// The width of the numbers column: the digits of `count`, grouped as shown.
@Composable
private fun numberWidth(count: Int): androidx.compose.ui.unit.Dp {
val style = MaterialTheme.typography.bodySmall.merge(Tabular)
val measurer = androidx.compose.ui.text.rememberTextMeasurer()
val density = androidx.compose.ui.platform.LocalDensity.current
return remember(count, style, density) {
with(density) { measurer.measure(groupDigits(count.coerceAtLeast(1)), style).size.width.toDp() }
}
}
/// 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?,
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 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 },
) {
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),
)
}
}
}
@Composable
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 != "?" }
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; no discs:
// these are not players.
Box(Modifier.height(nameLine * 2)) {
PlayerName(white, style, maxLines = 2, abbreviate = false, highlight = query)
}
} else {
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))
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,
)
}
}
/// "No. 12. White: Carlsen, Magnus, 2830. Black: … . 1-0, White won. Event · 2025 · C42."
@Composable
private fun rowDescription(number: Int, row: GameRow): String {
val player = { label: String, name: String, rating: String ->
"$label: " + joinKnownComma(name.trim().takeIf { it.isNotEmpty() } ?: "?", elo(rating).let { if (it.isEmpty()) "" else "Elo $it" })
}
val result = when (row.result) {
"1-0" -> "1-0, " + stringResource(R.string.white_won).lowercase()
"0-1" -> "0-1, " + stringResource(R.string.black_won).lowercase()
"1/2-1/2" -> stringResource(R.string.draw)
else -> ""
}
// A study or a book chapter: a title for White and no Black is read as the title.
val title = row.white.trim().takeIf { it.isNotEmpty() && it != "?" && row.black.trim().let { b -> b.isEmpty() || b == "?" } }
return listOf(
stringResource(R.string.game_number, groupDigits(number)),
title ?: player(stringResource(R.string.tag_white), row.white, row.whiteElo),
if (title != null) "" else player(stringResource(R.string.tag_black), row.black, row.blackElo),
result,
listOf(row.event, year(row.date), row.eco).map { it.trim() }.filter { it.isNotEmpty() && it != "?" }.joinToString(", "),
).filter { it.isNotEmpty() }.joinToString(". ")
}
private fun joinKnownComma(vararg parts: String): String = parts.filter { it.isNotEmpty() }.joinToString(", ")
/// A text style's line height in dp (it grows with the font scale), at least `min`.
@Composable
private fun lineHeight(style: androidx.compose.ui.text.TextStyle, min: androidx.compose.ui.unit.Dp): androidx.compose.ui.unit.Dp {
val h = style.lineHeight
if (!h.isSp) return min
return with(androidx.compose.ui.platform.LocalDensity.current) { h.toDp() }.coerceAtLeast(min)
}

View file

@ -0,0 +1,435 @@
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
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.shape.RoundedCornerShape
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
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
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.withLink
import androidx.compose.ui.text.withStyle
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.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
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import io.github.vrubelroman.chesspenguin.R
import io.github.vrubelroman.chesspenguin.theme.ChessColors
import io.github.vrubelroman.chesspenguin.theme.LocalChessColors
import io.github.vrubelroman.chesspenguin.theme.nagColor
import uniffi.mobile_api.GameData
import uniffi.mobile_api.MoveJudgement
import uniffi.mobile_api.MoveNode
/// A piece of the notation: the main line as a table of moves, comments and variations
/// as full-width blocks between its rows (as on the desktop, android-ui.md §7.3).
sealed interface Item {
data class Comment(val text: String) : Item
data class Moves(val number: Int, val white: Int?, val black: Int?) : Item
data class Variation(val start: Int, val depth: Int) : Item
data class Result(val text: String) : Item
}
/// The items of a game, and for each node the item that shows it (to keep it in view).
fun layout(game: GameData, resultText: String): Pair<List<Item>, Map<Int, Int>> {
val nodes = game.nodes
val items = ArrayList<Item>()
val where = HashMap<Int, Int>()
fun node(i: Int) = nodes[i]
val root = node(0)
if (root.commentAfter.isNotEmpty()) items += Item.Comment(root.commentAfter)
var row: Item.Moves? = null
fun flush() {
row?.let { r ->
items += r
r.white?.let { where[it] = items.size - 1 }
r.black?.let { where[it] = items.size - 1 }
}
row = null
}
fun markVariation(start: Int, at: Int) {
// Every node of the variation (its whole subtree) is shown by this item.
val stack = ArrayDeque(listOf(start))
while (stack.isNotEmpty()) {
val n = stack.removeLast()
where[n] = at
node(n).children.forEach { stack.add(it.toInt()) }
}
}
var parent = 0
while (true) {
val kids = node(parent).children
if (kids.isEmpty()) break
val id = kids[0].toInt()
val n = node(id)
if (n.commentBefore.isNotEmpty()) {
flush()
items += Item.Comment(n.commentBefore)
}
if (n.white) {
flush()
row = Item.Moves(n.moveNumber.toInt(), id, null)
} else {
row = (row ?: Item.Moves(n.moveNumber.toInt(), null, null)).copy(black = id)
}
val variations = kids.drop(1).map { it.toInt() }
val interrupted = n.commentAfter.isNotEmpty() || variations.isNotEmpty()
if (interrupted || !n.white) {
flush()
if (n.commentAfter.isNotEmpty()) items += Item.Comment(n.commentAfter)
for (v in variations) {
items += Item.Variation(v, 1)
markVariation(v, items.size - 1)
}
}
parent = id
}
flush()
if (resultText.isNotEmpty()) items += Item.Result(resultText)
return items to where
}
private fun label(n: MoveNode, number: Boolean, san: (String) -> AnnotatedString): AnnotatedString = when {
n.white -> AnnotatedString("${n.moveNumber}.") + san(n.san)
number -> AnnotatedString("${n.moveNumber}…") + san(n.san)
else -> san(n.san)
}
/// A variation as flowing text: its moves (each a link), comments in italics, nested
/// variations in parentheses.
@Composable
private fun variationText(
game: GameData,
start: Int,
current: Int,
chess: ChessColors,
san: (String) -> AnnotatedString,
onMove: (Int) -> Unit,
): AnnotatedString {
val nodes = game.nodes
val comment = chess.comment
val onSurface = MaterialTheme.colorScheme.onSurface
return remember(game, start, current, san) {
buildAnnotatedString {
// A space goes before each word, except right after "(".
var space = false
fun word(write: () -> Unit) {
if (space) append(' ')
write()
space = true
}
fun line(first: Int) {
var id = first
var number = true
while (true) {
val n = nodes[id]
if (n.commentBefore.isNotEmpty()) {
word { withStyle(SpanStyle(color = comment, fontStyle = FontStyle.Italic)) { append(n.commentBefore) } }
number = true
}
val style = if (id == current) {
SpanStyle(background = chess.currentMove, color = onSurface, fontWeight = FontWeight.Medium)
} else {
SpanStyle(color = onSurface)
}
val target = id
word {
withLink(LinkAnnotation.Clickable("m$id", TextLinkStyles(style)) { onMove(target) }) {
append(label(n, number, san))
}
if (n.nagSymbols.isNotEmpty()) {
// On the highlighted move the sign takes the text color.
val c = if (id == current) onSurface else n.nags.firstOrNull()?.let { nagColor(it.toInt(), chess.dark) } ?: onSurface
withStyle(SpanStyle(color = c)) { append(n.nagSymbols) }
}
}
number = false
if (n.commentAfter.isNotEmpty()) {
word { withStyle(SpanStyle(color = comment, fontStyle = FontStyle.Italic)) { append(n.commentAfter) } }
number = true
}
// The alternatives to this move (but not to the line's first move: those
// belong to the level above).
if (id != first) {
val parent = n.parent?.toInt()
if (parent != null) {
for (v in nodes[parent].children.drop(1)) {
word { append('(') }
space = false
line(v.toInt())
append(')')
number = true
}
}
}
val next = n.children.firstOrNull() ?: break
id = next.toInt()
}
}
line(start)
}
}
}
/// The notation under the board (android-ui.md §7.3): the current move highlighted
/// and kept in view; a tap on a move goes there. `marks` are the engine's judgements of
/// main-line moves (the game report, §21.4).
@Composable
fun Notation(
game: GameData,
items: List<Item>,
where: Map<Int, Int>,
current: Int,
state: LazyListState,
san: (String) -> AnnotatedString,
onMove: (Int) -> Unit,
modifier: Modifier = Modifier,
marks: Map<Int, MoveJudgement> = emptyMap(),
onLongMove: ((Int) -> Unit)? = null,
) {
val chess = LocalChessColors.current
LaunchedEffect(current) {
val at = where[current] ?: if (current == 0) 0 else return@LaunchedEffect
val visible = state.layoutInfo.visibleItemsInfo
if (visible.none { it.index == at } || visible.firstOrNull()?.index == at || visible.lastOrNull()?.index == at) {
// The current move a third down what is visible: whole however few rows fit
// (beside the board with the engine on, only two or three).
state.animateScrollToItem(at, -(state.layoutInfo.viewportSize.height / 3))
}
}
LazyColumn(modifier, state = state, contentPadding = PaddingValues(bottom = 8.dp)) {
itemsIndexed(items) { _, item ->
when (item) {
is Item.Comment -> Text(
item.text,
color = chess.comment,
fontSize = 15.sp,
lineHeight = 22.sp,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 4.dp)
.clip(RoundedCornerShape(12.dp))
.background(MaterialTheme.colorScheme.surfaceContainerLow)
.padding(horizontal = 12.dp, vertical = 8.dp),
)
is Item.Moves -> MovesRow(game, item, current, chess, san, onMove, marks, onLongMove)
is Item.Variation -> Box(
Modifier
.fillMaxWidth()
.padding(start = (16 + 16 * (item.depth - 1)).dp, end = 16.dp, top = 2.dp, bottom = 2.dp),
) {
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(
text,
fontSize = 15.sp,
lineHeight = 28.sp,
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
}
}
},
),
)
}
}
is Item.Result -> Box(Modifier.fillMaxWidth().padding(16.dp), contentAlignment = Alignment.Center) {
Text(
item.text,
style = MaterialTheme.typography.labelLarge,
modifier = Modifier
.clip(RoundedCornerShape(8.dp))
.background(MaterialTheme.colorScheme.surfaceContainerHigh)
.padding(horizontal = 16.dp, vertical = 8.dp),
)
}
}
}
}
}
@Composable
private fun MovesRow(
game: GameData,
row: Item.Moves,
current: Int,
chess: ChessColors,
san: (String) -> AnnotatedString,
onMove: (Int) -> Unit,
marks: Map<Int, MoveJudgement>,
onLongMove: ((Int) -> Unit)?,
) {
Row(Modifier.fillMaxWidth().height(48.dp), verticalAlignment = Alignment.CenterVertically) {
Text(
"${row.number}",
color = MaterialTheme.colorScheme.onSurfaceVariant,
fontSize = 15.sp,
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] }, onLongMove)
MoveCell(game, row.black, false, current, chess, san, onMove, Modifier.weight(1f), row.black?.let { marks[it] }, onLongMove)
}
}
@Composable
private fun MoveCell(
game: GameData,
id: Int?,
white: Boolean,
current: Int,
chess: ChessColors,
san: (String) -> AnnotatedString,
onMove: (Int) -> Unit,
modifier: Modifier,
mark: MoveJudgement?,
onLongMove: ((Int) -> Unit)?,
) {
val selected = id != null && id == current
// 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) }
val spoken = id?.let {
val n = game.nodes[it]
stringResource(if (white) R.string.move_white else R.string.move_black, n.moveNumber.toInt(), n.san + n.nagSymbols) +
(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(
when {
id == null -> Modifier
onLongMove != null -> Modifier.combinedClickable(onLongClick = { onLongMove(id) }) { onMove(id) }
else -> Modifier.clickable { onMove(id) }
},
)
.then(
if (spoken != null) {
Modifier.clearAndSetSemantics {
contentDescription = spoken
role = Role.Button
this.selected = selected
if (selected) stateDescription = currentLabel
onClick { onMove(id); true }
if (onLongMove != null) onLongClick(actionsLabel) { onLongMove(id); true }
}
} else {
Modifier
},
)
.padding(start = 4.dp),
contentAlignment = Alignment.CenterStart,
) {
if (id == null) {
// "4. … Nf6": only White's empty cell says that a move is there.
if (white) Text("…", color = MaterialTheme.colorScheme.onSurfaceVariant, fontSize = 17.sp, modifier = Modifier.padding(horizontal = 8.dp))
} else {
val n = game.nodes[id]
Row(verticalAlignment = Alignment.CenterVertically) {
Row(
Modifier
.clip(RoundedCornerShape(6.dp))
.background(if (selected) chess.currentMove else Color.Transparent)
.padding(horizontal = 8.dp, vertical = 6.dp),
horizontalArrangement = Arrangement.spacedBy(1.dp),
) {
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.Bold,
color = if (selected) {
MaterialTheme.colorScheme.onSurface
} else {
n.nags.firstOrNull()?.let { nagColor(it.toInt(), chess.dark) } ?: MaterialTheme.colorScheme.onSurfaceVariant
},
)
}
}
}
}
}
}

View file

@ -0,0 +1,500 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
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.imePadding
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.selection.toggleable
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material3.Button
import androidx.compose.material3.Checkbox
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.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.produceState
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.platform.LocalSoftwareKeyboardController
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.heading
import androidx.compose.ui.semantics.liveRegion
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import androidx.lifecycle.viewmodel.compose.viewModel
import io.github.vrubelroman.chesspenguin.R
import io.github.vrubelroman.chesspenguin.data.DownloadView
import io.github.vrubelroman.chesspenguin.data.Source
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import uniffi.mobile_api.AccountLookup
import uniffi.mobile_api.OnlineAccount
import uniffi.mobile_api.OnlineFailure
import uniffi.mobile_api.OnlineProblem
import uniffi.mobile_api.Site
import uniffi.mobile_api.findAccount
import uniffi.mobile_api.onlineDatabase
import uniffi.mobile_api.onlineTargets
import uniffi.mobile_api.validNickname
import java.io.File
import kotlin.math.ceil
/// Lichess gives about this many games a second to an anonymous export.
private const val LICHESS_GAMES_PER_SECOND = 20.0
fun siteName(s: Site): String = when (s) {
Site.LICHESS -> "Lichess"
Site.CHESS_COM -> "Chess.com"
}
/// "1 234 games" in the language of the interface.
@Composable
fun gamesText(n: Long): String {
val k = n.coerceAtMost(Int.MAX_VALUE.toLong()).toInt()
return pluralStringResource(R.plurals.games_count, k, groupDigits(k))
}
/// Seconds Lichess needs for `games` games.
private fun lichessSeconds(games: Long): Double = games / LICHESS_GAMES_PER_SECOND
/// What went wrong, in words for a chess player (android-ui.md §23.4).
@Composable
fun onlineProblemText(f: OnlineFailure): String {
val site = f.site?.let(::siteName) ?: "—"
return when (f.problem) {
OnlineProblem.NETWORK -> stringResource(R.string.online_err_network, site)
OnlineProblem.RATE_LIMITED -> stringResource(R.string.online_err_rate, site)
OnlineProblem.UNEXPECTED -> stringResource(R.string.online_err_unexpected, site)
OnlineProblem.DISK -> stringResource(R.string.online_err_disk)
OnlineProblem.BUSY -> stringResource(R.string.online_err_busy)
}
}
/// The short form, for the subtitle of a database and the snackbar (§23.3).
fun problemShort(res: android.content.res.Resources, f: OnlineFailure): String {
val site = f.site?.let(::siteName)
return when {
site != null && f.problem == OnlineProblem.NETWORK -> res.getString(R.string.online_short_network, site)
site != null && f.problem == OnlineProblem.RATE_LIMITED -> res.getString(R.string.online_short_rate, site)
else -> res.getString(R.string.online_short_failed)
}
}
@Composable
fun onlineProblemShort(f: OnlineFailure): String = problemShort(androidx.compose.ui.platform.LocalResources.current, f)
/// What a running download is doing: "Lichess: 1 200 of about 6 541 · about 5 min left",
/// "Chess.com: month 12 of 84 · 340 games".
@Composable
fun downloadProgressText(v: DownloadView): String {
val s = v.state
val account = v.accounts.getOrNull(s.account.toInt())
val games = s.accountGames.toLong()
return when (account?.site) {
Site.LICHESS -> {
val total = account.games?.toLong() ?: 0
if (total > games) {
val minutes = ceil(lichessSeconds(total - games) / 60.0).toInt().coerceAtLeast(1)
stringResource(R.string.online_progress_lichess, groupDigits(games.toInt()), groupDigits(total.toInt()), minutes)
} else {
stringResource(R.string.online_progress_count, "Lichess", gamesText(games))
}
}
Site.CHESS_COM -> if (s.monthsTotal > 0u) {
stringResource(R.string.online_progress_chesscom, s.monthsDone.toInt(), s.monthsTotal.toInt(), gamesText(games))
} else {
stringResource(R.string.online_progress_count, "Chess.com", gamesText(games))
}
null -> stringResource(R.string.online_downloading, groupDigits(s.added.toInt()))
}
}
/// How a finished download went: "Done: 473 games" the first time, "+12, 1 246 games in
/// all" later.
@Composable
fun downloadResultText(v: DownloadView): String {
val s = v.state
s.failure?.let { return onlineProblemText(it) }
val total = s.total?.toLong() ?: 0
return when {
s.cancelled -> stringResource(R.string.online_stopped, gamesText(total))
total == 0L -> stringResource(R.string.online_no_games)
s.added == 0UL -> stringResource(R.string.online_no_new, gamesText(total))
v.fresh -> stringResource(R.string.online_done, gamesText(total))
else -> stringResource(R.string.online_added, groupDigits(s.added.toInt()), gamesText(total))
}
}
/// The share of the whole download done, when it is known: each account is an equal part
/// (Lichess counted by its games, Chess.com by months).
fun downloadShare(v: DownloadView): Float? {
val s = v.state
val i = s.account.toInt()
val account = v.accounts.getOrNull(i) ?: return null
val part = when (account.site) {
Site.LICHESS -> account.games?.takeIf { it > 0UL }?.let { (s.accountGames.toDouble() / it.toDouble()).toFloat() }
Site.CHESS_COM -> s.monthsTotal.takeIf { it > 0u }?.let { s.monthsDone.toFloat() / it.toFloat() }
} ?: return null
return ((i + part.coerceIn(0f, 1f)) / v.accounts.size).coerceIn(0f, 1f)
}
/// The search of the screen: kept when the phone is turned (android-ui.md §23.2).
class OnlineSearch : ViewModel() {
var found by mutableStateOf<Map<Site, AccountLookup>?>(null)
var chosen by mutableStateOf(setOf<Site>())
var searching by mutableStateOf(false)
fun find(forLichess: String, forChessCom: String) {
if (searching) return
searching = true
viewModelScope.launch {
val result = withContext(Dispatchers.IO) {
val li = async { findAccount(Site.LICHESS, forLichess) }
val cc = async { findAccount(Site.CHESS_COM, forChessCom) }
mapOf(Site.LICHESS to li.await(), Site.CHESS_COM to cc.await())
}
found = result
chosen = result.filterValues { it is AccountLookup.Found }.keys
searching = false
}
}
fun forget() {
found = null
}
}
/// A nickname is shown as wrong only for a character it may not have or when it is too
/// long; a short one is still being typed.
private fun badNick(nick: String): Boolean {
val t = nick.trim()
return t.length > 30 || t.any { !(it.isLetterOrDigit() && it.code < 128) && it != '_' && it != '-' }
}
/// "Games from Lichess and Chess.com" (android-ui.md §23.2): a nickname, what was found on
/// each site, the download and how it goes.
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun OnlineScreen(onBack: () -> Unit, onOpen: (String) -> Unit) {
val app = app()
val downloads = app.downloads
val views by downloads.views.collectAsState()
val entries by app.library.entries.collectAsState()
val search: OnlineSearch = viewModel()
val keyboard = LocalSoftwareKeyboardController.current
var nick by rememberSaveable { mutableStateOf("") }
// A different nickname on Chess.com, once asked for.
var other by rememberSaveable { mutableStateOf<String?>(null) }
var together by rememberSaveable { mutableStateOf(true) }
// The databases this screen started downloading; the found accounts are hidden then,
// until the next search.
var started by rememberSaveable { mutableStateOf(listOf<String>()) }
var launched by rememberSaveable { mutableStateOf(false) }
val nickOk = validNickname(nick)
val otherOk = other?.let { it.isBlank() || validNickname(it) } ?: true
fun find() {
if (!nickOk || !otherOk) return
keyboard?.hide()
launched = false
val forLichess = nick.trim()
search.find(forLichess, other?.trim()?.takeIf { it.isNotEmpty() } ?: forLichess)
}
val found = search.found
val accounts: List<OnlineAccount> = found.orEmpty()
.filterKeys { it in search.chosen }
.values.mapNotNull { (it as? AccountLookup.Found)?.account }
val merge = together && accounts.size > 1
// Where the games go, and how many are there already; read again when a download ends.
val ended = started.count { views[it]?.state?.running == false }
val targets by produceState(emptyList<Pair<String, Long?>>(), accounts, merge, ended) {
value = withContext(Dispatchers.IO) {
if (accounts.isEmpty()) {
emptyList()
} else {
onlineTargets(downloads.dir.path, accounts, merge).map { t ->
t.path to (if (t.exists) onlineDatabase(t.path)?.games?.toLong() else null)
}
}
}
}
// A database's name as on the list (it may have been renamed), else its file's.
fun nameOf(path: String): String {
val file = File(path).name
return entries.firstOrNull { it.source == Source.Online && it.location == file }?.name ?: file.removeSuffix(".pgn")
}
Scaffold(
topBar = {
TopAppBar(
navigationIcon = { IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Rounded.ArrowBack, stringResource(R.string.back)) } },
title = { Text(stringResource(R.string.online_title)) },
)
},
) { padding ->
Column(
Modifier
.fillMaxSize()
.padding(padding)
.imePadding()
.verticalScroll(rememberScrollState())
.navigationBarsPadding()
.padding(horizontal = 16.dp, vertical = 8.dp),
) {
Text(stringResource(R.string.online_intro), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
Spacer(Modifier.height(16.dp))
NickField(
value = nick,
label = stringResource(if (other == null) R.string.online_nick else R.string.online_nick_lichess),
bad = badNick(nick),
onChange = {
nick = it
search.forget()
},
onDone = ::find,
)
if (other == null) {
TextButton(onClick = { other = "" }, contentPadding = PaddingValues(0.dp)) { Text(stringResource(R.string.online_other)) }
} else {
Spacer(Modifier.height(8.dp))
NickField(
value = other.orEmpty(),
label = stringResource(R.string.online_other_nick),
bad = badNick(other.orEmpty()),
onChange = {
other = it
search.forget()
},
onDone = ::find,
)
TextButton(onClick = {
other = null
search.forget()
}, contentPadding = PaddingValues(0.dp)) { Text(stringResource(R.string.online_same_nick)) }
}
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End, verticalAlignment = Alignment.CenterVertically) {
if (search.searching) {
CircularProgressIndicator(Modifier.size(20.dp), strokeWidth = 2.dp)
Spacer(Modifier.size(12.dp))
Text(stringResource(R.string.online_searching), style = MaterialTheme.typography.bodyMedium, modifier = Modifier.weight(1f))
}
val enabled = nickOk && otherOk && !search.searching
// After a search the main button of the screen is "Download".
if (found != null && !launched) {
OutlinedButton(onClick = ::find, enabled = enabled) { Text(stringResource(R.string.online_find)) }
} else {
Button(onClick = ::find, enabled = enabled) { Text(stringResource(R.string.online_find)) }
}
}
if (found != null && !launched) {
Spacer(Modifier.height(16.dp))
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant)
Spacer(Modifier.height(8.dp))
for (site in listOf(Site.LICHESS, Site.CHESS_COM)) {
val r = found[site] ?: continue
FoundRow(site, r, site in search.chosen, onToggle = { on -> search.chosen = if (on) search.chosen + site else search.chosen - site }, onRetry = ::find)
}
if (found.values.count { it is AccountLookup.Found } > 1 && search.chosen.size > 1) {
Row(
Modifier
.fillMaxWidth()
.heightIn(min = 64.dp)
.toggleable(value = together, role = Role.Switch, onValueChange = { together = it }),
verticalAlignment = Alignment.CenterVertically,
) {
Column(Modifier.weight(1f)) {
Text(stringResource(R.string.online_merge), style = MaterialTheme.typography.bodyLarge)
Text(stringResource(R.string.online_merge_hint), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
Switch(checked = together, onCheckedChange = null)
}
}
for ((path, games) in targets) {
val name = nameOf(path)
Text(
if (games != null) {
stringResource(R.string.online_into_existing, name, gamesText(games))
} else {
stringResource(R.string.online_into_new, name)
},
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(vertical = 4.dp),
)
}
if (accounts.isNotEmpty()) {
Row(Modifier.fillMaxWidth().padding(top = 8.dp), horizontalArrangement = Arrangement.End) {
Button(onClick = {
val groups = onlineTargets(downloads.dir.path, accounts, merge)
started = groups.map { downloads.start(it.accounts, it.path).id }
launched = true
}) { Text(stringResource(R.string.online_download)) }
}
}
}
// The downloads started here: how they go, then how they went.
for (id in started) {
val v = views[id] ?: continue
Spacer(Modifier.height(16.dp))
DownloadCard(
name = entries.firstOrNull { it.id == id }?.name ?: v.accounts.joinToString(" + ") { it.username },
view = v,
onStop = { downloads.cancel(id) },
onOpen = if (!v.state.running && (v.state.total ?: 0UL) > 0UL && entries.any { it.id == id }) ({ onOpen(id) }) else null,
)
}
}
}
}
@Composable
private fun NickField(value: String, label: String, bad: Boolean, onChange: (String) -> Unit, onDone: () -> Unit) {
OutlinedTextField(
value = value,
onValueChange = onChange,
label = { Text(label) },
placeholder = { Text(stringResource(R.string.online_nick_hint)) },
singleLine = true,
isError = bad,
supportingText = if (bad) ({ Text(stringResource(R.string.online_nick_rule)) }) else null,
keyboardOptions = KeyboardOptions(
capitalization = KeyboardCapitalization.None,
autoCorrectEnabled = false,
keyboardType = KeyboardType.Ascii,
imeAction = ImeAction.Search,
),
keyboardActions = KeyboardActions(onSearch = { onDone() }),
modifier = Modifier.fillMaxWidth(),
)
}
/// What one site gave for the nickname: the account to tick, "no such player", or why it
/// did not answer.
@Composable
private fun FoundRow(site: Site, r: AccountLookup, checked: Boolean, onToggle: (Boolean) -> Unit, onRetry: () -> Unit) {
when (r) {
is AccountLookup.Found -> {
val a = r.account
val lichess = a.games?.toLong()
val detail = when {
lichess != null -> {
val upTo = pluralStringResource(R.plurals.games_up_to, lichess.coerceAtMost(Int.MAX_VALUE.toLong()).toInt(), groupDigits(lichess.toInt()))
val secs = lichessSeconds(lichess)
if (secs < 60) {
stringResource(R.string.online_lichess_quick, upTo)
} else {
stringResource(R.string.online_lichess_found, upTo, ceil(secs / 60.0).toInt())
}
}
a.months != null -> stringResource(R.string.online_chesscom_found, a.months!!.toInt())
else -> ""
}
Row(
Modifier
.fillMaxWidth()
.heightIn(min = 64.dp)
.toggleable(value = checked, role = Role.Checkbox, onValueChange = onToggle),
verticalAlignment = Alignment.CenterVertically,
) {
Checkbox(checked = checked, onCheckedChange = null)
Column(Modifier.weight(1f).padding(start = 12.dp)) {
Text("${siteName(site)} · ${a.username}", style = MaterialTheme.typography.bodyLarge)
if (detail.isNotEmpty()) {
Text(detail, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
}
}
}
AccountLookup.NotFound -> Text(
stringResource(R.string.online_not_found, siteName(site)),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.heightIn(min = 48.dp).padding(start = 36.dp, top = 12.dp),
)
is AccountLookup.Failed -> Column(Modifier.padding(start = 36.dp, top = 8.dp)) {
Text(onlineProblemText(r.failure), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.error)
TextButton(onClick = onRetry, contentPadding = PaddingValues(0.dp)) { Text(stringResource(R.string.online_try_again)) }
}
}
}
/// A download started on this screen: its progress and Stop, then its result and Open.
@Composable
private fun DownloadCard(name: String, view: DownloadView, onStop: () -> Unit, onOpen: (() -> Unit)?) {
val s = view.state
Column(Modifier.fillMaxWidth()) {
Text(name, style = MaterialTheme.typography.titleMedium, modifier = Modifier.semantics { heading() })
Spacer(Modifier.height(4.dp))
if (s.running) {
// Not a live region: it changes a few times a second (TalkBack would not stop).
Text(downloadProgressText(view), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
Spacer(Modifier.height(8.dp))
val share = downloadShare(view)
if (share != null) {
LinearProgressIndicator(progress = { share }, modifier = Modifier.fillMaxWidth())
} else {
LinearProgressIndicator(Modifier.fillMaxWidth())
}
Spacer(Modifier.height(8.dp))
Text(stringResource(R.string.online_leave), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
OutlinedButton(onClick = onStop, modifier = Modifier.padding(top = 8.dp)) { Text(stringResource(R.string.online_stop)) }
}
} else {
Text(
downloadResultText(view),
style = MaterialTheme.typography.bodyMedium,
color = if (s.failure != null) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.semantics { liveRegion = LiveRegionMode.Polite },
)
if (onOpen != null) {
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
Button(onClick = onOpen, modifier = Modifier.padding(top = 8.dp)) { Text(stringResource(R.string.online_open)) }
}
}
}
}
}

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

@ -0,0 +1,668 @@
package io.github.vrubelroman.chesspenguin.ui
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.awaitEachGesture
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
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.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
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.rounded.ChevronRight
import androidx.compose.material.icons.rounded.Close
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.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.drawscope.clipRect
import androidx.compose.ui.input.pointer.pointerInput
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.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.stateDescription
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
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
import io.github.vrubelroman.chesspenguin.theme.LocalChessColors
import io.github.vrubelroman.chesspenguin.theme.Tabular
import io.github.vrubelroman.chesspenguin.theme.nagColor
import uniffi.mobile_api.GameData
import uniffi.mobile_api.MoveJudgement
import uniffi.mobile_api.ReviewMove
import uniffi.mobile_api.ReviewState
import uniffi.mobile_api.SideReview
import kotlin.math.roundToInt
/// 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).
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
fun judgementName(j: MoveJudgement): String = stringResource(
when (j) {
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
},
)
@Composable
private fun judgementPlural(j: MoveJudgement): String = stringResource(
when (j) {
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 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? {
var n = node
while (true) {
points[n]?.let { return it }
n = game.nodes.getOrNull(n)?.parent?.toInt() ?: return null
}
}
/// "91%", or "—" when the accuracy is not known yet.
private fun percent(a: Double?): String = a?.let { "${it.roundToInt()}%" } ?: "—"
/// The analysis between the board and the notation (§21.3): what is going on or what the
/// current move was, and the evaluation graph.
@Composable
fun ReviewPanel(
state: ReviewState,
cursor: Int?,
mark: ReviewMove?,
preparing: Boolean,
notation: (String) -> AnnotatedString,
onIndex: (Int) -> Unit,
onBest: (ReviewMove) -> Unit,
onReport: () -> Unit,
onStop: () -> Unit,
onResume: () -> Unit,
cursorLabel: String? = null,
showGraph: Boolean = true,
) {
val dark = LocalChessColors.current.dark
Column(Modifier.fillMaxWidth().background(MaterialTheme.colorScheme.surfaceContainerLow)) {
// 48 dp: every button here and the error row itself are touch targets (§21.3).
Row(
Modifier.fillMaxWidth().height(48.dp).padding(start = 16.dp, end = 4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
val textStyle = MaterialTheme.typography.bodyMedium
val report: @Composable () -> Unit = {
TextButton(onClick = onReport) { Text(stringResource(R.string.review_report)) }
}
when {
state.running -> {
Text(
stringResource(R.string.review_progress, state.done.toInt(), state.total.toInt()),
style = textStyle.merge(Tabular),
modifier = Modifier.weight(1f),
)
IconButton(onClick = onStop) { Icon(Icons.Rounded.Close, stringResource(R.string.review_stop)) }
}
preparing -> Text(
stringResource(R.string.preparing_engine),
style = textStyle,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.weight(1f),
)
mark != null -> {
val c = judgementColor(mark.judgement, dark)
val name = judgementName(mark.judgement)
val canShow = mark.best?.steps?.isNotEmpty() == true
// Without a line (evaluations from the PGN) the better move is not named.
val better = mark.bestLabel.takeIf { it.isNotEmpty() && canShow }?.let { notation(it) }
// The template around the move ("{move} was better", "лучше было {move}").
val betterText = better?.let { stringResource(R.string.review_better, "\u0000").split('\u0000') }
val link = MaterialTheme.colorScheme.primary
val text = buildAnnotatedString {
withStyle(SpanStyle(color = c, fontWeight = FontWeight.Bold)) { append(judgementSymbol(mark.judgement) + " " + name) }
if (better != null && betterText != null) {
append(" · ")
append(betterText.first())
// The move in the link color: the row can be tapped (§21.3).
withStyle(SpanStyle(color = link, fontWeight = FontWeight.Medium)) { append(better) }
append(betterText.getOrElse(1) { "" })
}
}
Box(
Modifier
.weight(1f)
.height(48.dp)
.then(if (canShow) Modifier.clickable(onClickLabel = stringResource(R.string.review_show_best)) { onBest(mark) } else Modifier),
contentAlignment = Alignment.CenterStart,
) {
Text(text, style = textStyle, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
report()
}
state.failure != null -> {
Text(stringResource(R.string.review_failed), style = textStyle, color = MaterialTheme.colorScheme.error, modifier = Modifier.weight(1f))
TextButton(onClick = onResume) { Text(stringResource(R.string.review_resume)) }
report()
}
// Made with other engine settings (before the fixed search): made again.
state.stale -> {
Text(
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),
)
TextButton(onClick = onResume) { Text(stringResource(R.string.review_fill)) }
report()
}
else -> {
val spoken = stringResource(R.string.review_accuracy_of, percent(state.white.accuracy), percent(state.black.accuracy))
Row(
Modifier.weight(1f).clearAndSetSemantics { contentDescription = spoken },
verticalAlignment = Alignment.CenterVertically,
) {
Text(stringResource(R.string.review_accuracy), style = textStyle, color = MaterialTheme.colorScheme.onSurfaceVariant)
Spacer(Modifier.width(10.dp))
SideDot(white = true)
Text(percent(state.white.accuracy), style = textStyle.merge(Tabular), fontWeight = FontWeight.Medium, modifier = Modifier.padding(start = 6.dp))
Spacer(Modifier.width(14.dp))
SideDot(white = false)
Text(percent(state.black.accuracy), style = textStyle.merge(Tabular), fontWeight = FontWeight.Medium, modifier = Modifier.padding(start = 6.dp))
}
report()
}
}
}
if (showGraph) {
EvalGraph(state, cursor, cursorLabel, onIndex, Modifier.fillMaxWidth().height(40.dp).padding(start = 16.dp, end = 16.dp, bottom = 8.dp))
}
}
}
/// A circle in a side's color, outlined so the white one shows on a light background.
@Composable
private fun SideDot(white: Boolean, size: Int = 12) {
Box(
Modifier
.size(size.dp)
.clip(CircleShape)
.background(if (white) Color(0xFFF5F5F0) else Color(0xFF26282B))
.border(1.dp, MaterialTheme.colorScheme.outline, CircleShape),
)
}
/// White's chance of winning along the main line (§21.3), as on the desktop: light area
/// for White, dark for Black, the curve, the errors as dots, the phases and the current
/// move. A tap or a drag goes to a move.
@Composable
fun EvalGraph(state: ReviewState, cursor: Int?, cursorLabel: String?, onIndex: (Int) -> Unit, modifier: Modifier) {
val chess = LocalChessColors.current
val dark = chess.dark
// In the light theme a shade darker than the panel, so that White's area shows.
val bg = if (dark) MaterialTheme.colorScheme.surfaceContainerHighest else Color(0xFFDCDFE3)
val whiteFill = if (dark) Color(0xFF969696) else Color(0xFFFFFFFF)
val blackFill = if (dark) Color(0xFF0A0A0A) else Color(0xFF464646)
val curve = Color(0xFFE07B1F)
val midColor = MaterialTheme.colorScheme.outline
val phaseColor = MaterialTheme.colorScheme.onSurfaceVariant
val description = stringResource(R.string.review_graph)
val now = cursor?.let { state.points.getOrNull(it) }
val spokenState = now?.eval?.takeIf { it.isNotEmpty() }?.let { e ->
stringResource(R.string.review_graph_state, cursorLabel ?: stringResource(R.string.review_start_position), e)
}
val points = state.points
val n = points.size
val pick by rememberUpdatedState(onIndex)
Canvas(
modifier
.clip(RoundedCornerShape(6.dp))
.background(bg)
.semantics {
contentDescription = description
spokenState?.let { stateDescription = it }
}
.pointerInput(n) {
if (n < 2) return@pointerInput
val pad = 6.dp.toPx()
fun index(x: Float): Int {
val t = ((x - pad) / (size.width - 2 * pad)).coerceIn(0f, 1f)
return (t * (n - 1)).roundToInt()
}
awaitEachGesture {
val down = awaitFirstDown()
var last = index(down.position.x)
pick(last)
down.consume()
while (true) {
val event = awaitPointerEvent()
val change = event.changes.firstOrNull { it.id == down.id } ?: break
if (!change.pressed) break
val i = index(change.position.x)
if (i != last) {
last = i
pick(i)
}
change.consume()
}
}
},
) {
if (n < 2) return@Canvas
val padX = 6.dp.toPx()
val padY = 4.dp.toPx()
val w = size.width - 2 * padX
val h = size.height - 2 * padY
fun x(i: Int) = padX + w * i / (n - 1)
fun y(wp: Float) = padY + h * (1f - wp / 100f)
val mid = y(50f)
// Advantage areas between the curve and the middle line: one outline per run of
// evaluated positions, drawn light above the middle and dark below it (one shape,
// so no seams between the moves).
val area = Path()
var open = false
var lastX = 0f
points.forEachIndexed { i, p ->
val wp = p.whiteWin
if (wp == null) {
if (open) {
area.lineTo(lastX, mid)
area.close()
open = false
}
} else {
if (!open) {
area.moveTo(x(i), mid)
open = true
}
area.lineTo(x(i), y(wp))
lastX = x(i)
}
}
if (open) {
area.lineTo(lastX, mid)
area.close()
}
clipRect(bottom = mid) { drawPath(area, whiteFill) }
clipRect(top = mid) { drawPath(area, blackFill) }
drawLine(midColor.copy(alpha = 0.6f), Offset(padX, mid), Offset(size.width - padX, mid), 1.dp.toPx())
// Phase boundaries, without labels: at this height they would cover the curve
// (§21.3); the report has the accuracy per phase.
listOfNotNull(state.middlegame?.toInt(), state.endgame?.toInt()).filter { it in 1 until n }.forEach { i ->
drawLine(phaseColor.copy(alpha = 0.5f), Offset(x(i), 0f), Offset(x(i), size.height), 1.dp.toPx())
}
// The curve, broken where positions are not evaluated yet.
val stroke = Stroke(width = 1.6.dp.toPx())
var path: Path? = null
var count = 0
fun flush() {
if (count > 1) path?.let { drawPath(it, curve, style = stroke) }
path = null
count = 0
}
points.forEachIndexed { i, p ->
val wp = p.whiteWin
if (wp == null) {
flush()
} else {
val px = x(i)
val py = y(wp)
val current = path
if (current == null) {
path = Path().apply { moveTo(px, py) }
} else {
current.lineTo(px, py)
}
count++
}
}
flush()
// The errors on top of everything but the current move.
points.forEachIndexed { i, p ->
val j = p.judgement ?: return@forEachIndexed
val wp = p.whiteWin ?: return@forEachIndexed
drawCircle(judgementColor(j, dark), 3.5.dp.toPx(), Offset(x(i), y(wp)))
}
if (cursor != null && cursor in 0 until n) {
drawLine(curve, Offset(x(cursor), 0f), Offset(x(cursor), size.height), 1.5.dp.toPx())
}
}
}
/// 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?,
npsPerProcess: Long,
onStart: (full: Boolean) -> Unit,
onDismiss: () -> Unit,
) {
ModalBottomSheet(onDismissRequest = onDismiss) {
Column(Modifier.fillMaxWidth().navigationBarsPadding().padding(start = 24.dp, end = 24.dp, bottom = 24.dp)) {
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(12.dp))
val total = state?.positions?.toInt() ?: 0
val missing = state?.missing?.toInt() ?: 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
// 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),
style = MaterialTheme.typography.bodyMedium.merge(Tabular),
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
if (partial) {
Spacer(Modifier.height(4.dp))
Text(
stringResource(R.string.review_partial, total - missing, total),
style = MaterialTheme.typography.bodyMedium.merge(Tabular),
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
Spacer(Modifier.height(24.dp))
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {
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)) }
}
}
}
}
/// The report (§21.5): White and Black side by side, as on Lichess; a count above zero
/// goes to the next such move of that player.
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
@Composable
fun ReviewSheet(
state: ReviewState,
white: String,
black: String,
onError: (white: Boolean, MoveJudgement) -> Unit,
onAgain: () -> Unit,
onHide: () -> Unit,
onDismiss: () -> Unit,
) {
// Opened whole: nothing in it should hide below the edge (§21.5).
ModalBottomSheet(onDismissRequest = onDismiss, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)) {
Column(Modifier.fillMaxWidth().verticalScroll(rememberScrollState()).navigationBarsPadding().padding(start = 24.dp, end = 16.dp, bottom = 24.dp)) {
Text(stringResource(R.string.review_report_menu), style = MaterialTheme.typography.titleLarge)
Spacer(Modifier.height(16.dp))
val dark = LocalChessColors.current.dark
val variant = MaterialTheme.colorScheme.onSurfaceVariant
// Player names over the two columns.
ReportRow(
label = {},
white = { PlayerHead(white, true) },
black = { PlayerHead(black, false) },
height = null,
)
ReportRow(
label = { Text(stringResource(R.string.review_accuracy), style = MaterialTheme.typography.bodyLarge) },
white = { ReportNumber(percent(state.white.accuracy), MaterialTheme.typography.headlineSmall) },
black = { ReportNumber(percent(state.black.accuracy), MaterialTheme.typography.headlineSmall) },
)
val next = stringResource(R.string.review_next)
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 && !unknown
val shown = if (unknown) "\u2014" else count.toString()
Row(
Modifier
.fillMaxWidth()
.height(48.dp)
.then(
if (active) {
Modifier
.clickable(onClickLabel = next) { onError(isWhite, j) }
.semantics {
role = Role.Button
contentDescription = "$label, $side, $count"
}
} else {
Modifier.clearAndSetSemantics { contentDescription = "$label, $side, $shown" }
},
),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.End,
) {
Text(
shown,
style = MaterialTheme.typography.titleMedium.merge(Tabular),
color = if (active) c else variant,
)
Box(Modifier.width(24.dp), contentAlignment = Alignment.CenterEnd) {
if (active) Icon(Icons.Rounded.ChevronRight, null, tint = variant, modifier = Modifier.size(20.dp))
}
}
}
val whiteSide = stringResource(R.string.tag_white)
val blackSide = stringResource(R.string.tag_black)
ReportRow(
label = {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(judgementSymbol(j), color = c, fontWeight = FontWeight.Bold, modifier = Modifier.width(28.dp))
Text(label, style = MaterialTheme.typography.bodyLarge)
}
},
white = { cell(true, state.white.inaccuraciesOf(j), whiteSide) },
black = { cell(false, state.black.inaccuraciesOf(j), blackSide) },
)
}
ReportRow(
label = { Text(stringResource(R.string.review_acpl), style = MaterialTheme.typography.bodyMedium, color = variant) },
white = { ReportNumber(state.white.acpl?.toString() ?: "\u2014") },
black = { ReportNumber(state.black.acpl?.toString() ?: "\u2014") },
height = null,
)
listOf(
Triple(R.string.review_opening, state.white.opening, state.black.opening),
Triple(R.string.review_middlegame, state.white.middlegame, state.black.middlegame),
Triple(R.string.review_endgame, state.white.endgame, state.black.endgame),
).filter { it.second != null || it.third != null }.forEach { (res, w, b) ->
ReportRow(
label = { Text(stringResource(res), style = MaterialTheme.typography.bodyMedium, color = variant) },
white = { ReportNumber(percent(w)) },
black = { ReportNumber(percent(b)) },
height = 40,
)
}
Spacer(Modifier.height(12.dp))
Text(
if (state.nodes == 0UL) {
stringResource(R.string.review_source_pgn)
} else {
stringResource(R.string.review_source, state.engine, compactCount(state.nodes))
},
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)) }
// 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)) }
}
}
}
}
}
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.
@Composable
private fun ReportRow(
label: @Composable () -> Unit,
white: @Composable () -> Unit,
black: @Composable () -> Unit,
height: Int? = 48,
) {
Row(
Modifier.fillMaxWidth().then(if (height != null) Modifier.height(height.dp) else Modifier.padding(vertical = 4.dp)),
verticalAlignment = Alignment.CenterVertically,
) {
Box(Modifier.weight(1f)) { label() }
Box(Modifier.width(96.dp), contentAlignment = Alignment.CenterEnd) { white() }
Box(Modifier.width(96.dp), contentAlignment = Alignment.CenterEnd) { black() }
}
}
/// A player over a column: the side's circle and the surname, up to two lines; the full
/// name for TalkBack.
@Composable
private fun PlayerHead(name: String, white: Boolean) {
Row(
Modifier.padding(start = 4.dp).semantics(mergeDescendants = true) { contentDescription = name },
verticalAlignment = Alignment.CenterVertically,
) {
SideDot(white, 12)
Text(
name.substringBefore(',').trim(),
style = MaterialTheme.typography.labelLarge,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(start = 8.dp),
)
}
}
@Composable
private fun ReportNumber(text: String, style: TextStyle = MaterialTheme.typography.bodyLarge) {
Text(text, style = style.merge(Tabular), fontWeight = FontWeight.Medium, modifier = Modifier.padding(end = 24.dp))
}
/// 250 000 → "250k", 1 000 000 → "1M", 1 500 000 → "1.5M" (as on the desktop).
private fun compactCount(n: ULong): String {
val v = n.toLong()
return when {
v >= 1_000_000 && v % 100_000 == 0L -> if (v % 1_000_000 == 0L) "${v / 1_000_000}M" else "%.1fM".format(java.util.Locale.ROOT, v / 1e6)
v >= 1000 -> "${v / 1000}k"
else -> v.toString()
}
}

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

@ -0,0 +1,440 @@
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
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.rememberScrollState
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
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.RadioButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
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.graphics.takeOrElse
import androidx.compose.ui.input.nestedscroll.nestedScroll
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
/// One screen of groups, changes apply at once (android-ui.md §9). The board and the
/// pieces are chosen on a screen of their own, with a board to see them on.
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SettingsScreen(onBack: () -> Unit, onAbout: () -> Unit, onBoardStyle: () -> Unit) {
val app = app()
val prefs by app.settings.prefs.collectAsState()
val files = app.engineFiles
val net by files.state.collectAsState()
val set = app.settings::update
var choice by remember { mutableStateOf<Choice?>(null) }
var deleting by remember { mutableStateOf(false) }
var sheet by remember { mutableStateOf(false) }
val lang = uiLanguage()
val scroll = TopAppBarDefaults.pinnedScrollBehavior()
val snackbar = remember { androidx.compose.material3.SnackbarHostState() }
UpdateMessages(snackbar)
val size = (BuildConfig.NET_SIZE / 1_000_000).toInt()
val themeNames = listOf(
Theme.System to stringResource(R.string.theme_system),
Theme.Light to stringResource(R.string.theme_light),
Theme.Dark to stringResource(R.string.theme_dark),
)
val notationNames = buildList {
add(Notation.Latin to stringResource(R.string.notation_latin))
add(Notation.Figurines to stringResource(R.string.notation_figurines))
// Only a language with letters of its own (not English, Uzbek, Kazakh; move-notation.md §2.1).
if (localLetters(lang) != null) add(Notation.Local to stringResource(R.string.notation_local))
}
val secondsNames = listOf(
10 to stringResource(R.string.seconds, 10),
20 to stringResource(R.string.seconds, 20),
60 to stringResource(R.string.one_minute),
0 to stringResource(R.string.no_limit),
)
val cores = Runtime.getRuntime().availableProcessors()
Scaffold(
modifier = Modifier.nestedScroll(scroll.nestedScrollConnection),
snackbarHost = { androidx.compose.material3.SnackbarHost(snackbar) },
topBar = {
TopAppBar(
title = { Text(stringResource(R.string.settings)) },
navigationIcon = {
IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Rounded.ArrowBack, stringResource(R.string.back)) }
},
scrollBehavior = scroll,
)
},
) { 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, icon = Icons.AutoMirrored.Rounded.Notes) {
choice = Choice(
R.string.notation,
notationNames.map { it.second },
notationNames.indexOf(notationNow),
hint = R.string.notation_hint,
) { i -> set { it.copy(notation = notationNames[i].first) } }
}
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))
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) }
}
}
val context = LocalContext.current
val languageNames = LANGUAGES.map {
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)], 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), Icons.Rounded.Memory)
net == NetState.Ready -> {
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, 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, icon = Icons.Rounded.Memory) { sheet = true }
}
// 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 ?: "", 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}", 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), 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,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp),
)
Spacer(Modifier.height(16.dp))
// A newer version of the app, even with its card hidden (android-ui.md §25.5).
Cards {
Item(stringResource(R.string.about), aboutUpdateLine(), valueColor = MaterialTheme.colorScheme.primary, icon = Icons.Rounded.Info, onClick = onAbout)
}
}
}
choice?.let { c ->
AlertDialog(
onDismissRequest = { choice = null },
title = { Text(stringResource(c.title)) },
text = {
Column {
c.options.forEachIndexed { i, label ->
Row(
Modifier
.fillMaxWidth()
.heightIn(min = 48.dp)
.selectable(selected = i == c.selected, role = Role.RadioButton) {
c.pick(i)
choice = null
},
verticalAlignment = Alignment.CenterVertically,
) {
RadioButton(selected = i == c.selected, onClick = null)
Text(label, Modifier.padding(start = 16.dp), style = MaterialTheme.typography.bodyLarge)
}
}
c.hint?.let {
Spacer(Modifier.height(8.dp))
Text(stringResource(it), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
}
},
confirmButton = { TextButton(onClick = { choice = null }) { Text(stringResource(R.string.cancel)) } },
)
}
if (sheet) {
EngineSheet(
state = net,
metered = remember(sheet) { files.metered() },
onDownload = { files.prepare() },
onCancel = {
files.cancel()
sheet = false
},
onDismiss = { sheet = false },
)
}
LaunchedEffect(net) { if (net == NetState.Ready) sheet = false }
if (deleting) {
AlertDialog(
onDismissRequest = { deleting = false },
text = { Text(stringResource(R.string.engine_delete_question)) },
confirmButton = {
TextButton(onClick = {
files.delete()
deleting = false
}) { Text(stringResource(R.string.delete)) }
},
dismissButton = { TextButton(onClick = { deleting = false }) { Text(stringResource(R.string.cancel)) } },
)
}
}
/// «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
private fun Group(title: String) {
Text(
title,
style = MaterialTheme.typography.labelLarge,
color = MaterialTheme.colorScheme.primary,
modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 24.dp, bottom = 8.dp),
)
}
/// 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 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
.card()
.heightIn(min = 56.dp)
.then(if (onClick != null) Modifier.clickable(onClick = onClick) else Modifier)
.padding(horizontal = 16.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
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, 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, icon: androidx.compose.ui.graphics.vector.ImageVector? = null, onChange: (Boolean) -> Unit) {
Row(
Modifier
.card()
.heightIn(min = 56.dp)
.selectable(selected = value, role = Role.Switch) { onChange(!value) }
.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) }
}
}
}

View file

@ -0,0 +1,583 @@
package io.github.vrubelroman.chesspenguin.ui
import android.content.Intent
import android.net.Uri
import android.provider.Settings
import android.text.format.DateUtils
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.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.selection.toggleable
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.KeyboardArrowRight
import androidx.compose.material.icons.rounded.Close
import androidx.compose.foundation.layout.offset
import androidx.compose.material3.IconButton
import androidx.compose.material.icons.rounded.SystemUpdateAlt
import androidx.compose.material3.Button
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Icon
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.minimumInteractiveComponentSize
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.SnackbarDuration
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.SnackbarResult
import androidx.compose.material3.Surface
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
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.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.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
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.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import io.github.vrubelroman.chesspenguin.BuildConfig
import io.github.vrubelroman.chesspenguin.R
import io.github.vrubelroman.chesspenguin.data.CheckState
import io.github.vrubelroman.chesspenguin.data.NetState
import io.github.vrubelroman.chesspenguin.data.UpdateMessage
import io.github.vrubelroman.chesspenguin.data.UpdateProblem
import io.github.vrubelroman.chesspenguin.data.UpdateState
import io.github.vrubelroman.chesspenguin.data.UpdateStep
import io.github.vrubelroman.chesspenguin.theme.Tabular
private const val SITE_URL = "https://chess.vrubel.xyz"
private fun mb(bytes: Long) = ((bytes + 999_999) / 1_000_000).toInt()
/// The update the card on «Databases» shows, or null: none known, offers turned off (its
/// ×, or Settings), or the check turned off (unless the user asked for it).
@Composable
fun shownUpdate(): UpdateState? {
val updates = app().updates
val state by updates.state.collectAsState()
val auto by updates.auto.collectAsState()
val offer by updates.offer.collectAsState()
val asked by updates.asked.collectAsState()
val s = state ?: return null
if (!offer) return null
if (!auto && !asked && s is UpdateState.Available) return null
return s
}
/// The card over the list of databases (android-ui.md §25.2): the new version, one
/// button, and × that stops the offers (they come back in Settings → About).
@Composable
fun UpdateCard(state: UpdateState, onDismissed: () -> Unit, modifier: Modifier = Modifier) {
val updates = app().updates
val update = state.update
val title = stringResource(R.string.upd_title, update.version)
val progressOnly = state is UpdateState.Downloading || state is UpdateState.Busy
val downloadingText = when (state) {
is UpdateState.Downloading -> if (state.waitingNetwork) {
title + ", " + stringResource(R.string.upd_waiting_net_short)
} else {
stringResource(R.string.upd_card_downloading, update.version, mb(state.done), mb(update.apkSize))
}
is UpdateState.Busy -> title + ", " + stepText(state.step)
else -> null
}
Surface(
color = MaterialTheme.colorScheme.surfaceContainerHigh,
shape = RoundedCornerShape(12.dp),
modifier = modifier
.fillMaxWidth()
.padding(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 8.dp)
.then(
if (progressOnly) {
Modifier
.clickable(role = Role.Button) { updates.openSheet() }
.clearAndSetSemantics {
contentDescription = downloadingText ?: title
role = Role.Button
onClick { updates.openSheet(); true }
}
} else {
Modifier
},
),
) {
Column(Modifier.padding(start = 16.dp, end = 16.dp, top = 12.dp, bottom = if (progressOnly) 16.dp else 8.dp)) {
Row(verticalAlignment = Alignment.Top) {
Icon(Icons.Rounded.SystemUpdateAlt, null, tint = MaterialTheme.colorScheme.primary, modifier = Modifier.size(24.dp))
Spacer(Modifier.width(16.dp))
Column(Modifier.weight(1f)) {
Text(
title,
style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.Medium,
modifier = Modifier.semantics { heading() },
)
Spacer(Modifier.height(2.dp))
when (state) {
is UpdateState.Available, is UpdateState.NeedsPermission -> Text(
stringResource(R.string.upd_you_have, BuildConfig.VERSION_NAME),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
is UpdateState.Downloading -> {
Spacer(Modifier.height(6.dp))
LinearProgressIndicator(
progress = { state.done.toFloat() / update.apkSize.coerceAtLeast(1) },
modifier = Modifier.fillMaxWidth().height(4.dp),
)
Spacer(Modifier.height(6.dp))
Text(
if (state.waitingNetwork) stringResource(R.string.upd_waiting_net_short) else stringResource(R.string.downloaded_of, mb(state.done), mb(update.apkSize)),
style = MaterialTheme.typography.bodyMedium.merge(Tabular),
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
is UpdateState.Busy -> {
Spacer(Modifier.height(6.dp))
LinearProgressIndicator(Modifier.fillMaxWidth().height(4.dp))
Spacer(Modifier.height(6.dp))
Text(stepText(state.step), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
is UpdateState.Ready -> Text(
stringResource(R.string.upd_ready_short),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
is UpdateState.Failed -> Text(
shortProblem(state.problem),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.error,
)
}
}
if (progressOnly) {
// The whole card opens the sheet.
Icon(Icons.AutoMirrored.Rounded.KeyboardArrowRight, null, tint = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.size(24.dp))
} else {
IconButton(
onClick = {
updates.setOffer(false)
onDismissed()
},
modifier = Modifier.offset(x = 12.dp, y = (-12).dp),
) {
Icon(Icons.Rounded.Close, stringResource(R.string.upd_dismiss_cd), tint = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.size(20.dp))
}
}
}
if (!progressOnly) {
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
when (state) {
is UpdateState.Ready -> FilledTonalButton(onClick = {
updates.openSheet()
updates.install()
}) { Text(stringResource(R.string.upd_install)) }
is UpdateState.Failed -> FilledTonalButton(onClick = { updates.openSheet() }) { Text(stringResource(R.string.upd_more)) }
else -> FilledTonalButton(onClick = {
updates.openSheet()
updates.start()
}) { Text(stringResource(R.string.upd_update)) }
}
}
}
}
}
}
@Composable
private fun stepText(step: UpdateStep): String = stringResource(
when (step) {
UpdateStep.CheckingFile -> R.string.upd_checking_file
UpdateStep.KeepingEngine -> R.string.upd_keeping_engine
UpdateStep.Installing -> R.string.upd_installing
},
)
@Composable
private fun shortProblem(p: UpdateProblem): String = stringResource(
when (p) {
UpdateProblem.NoInternet -> R.string.upd_short_offline
UpdateProblem.NoSpace, UpdateProblem.InstallStorage -> R.string.upd_short_space
UpdateProblem.Corrupt -> R.string.upd_short_corrupt
UpdateProblem.DownloadFailed -> R.string.upd_short_failed
UpdateProblem.BadRelease -> R.string.upd_short_release
UpdateProblem.Conflict, UpdateProblem.Blocked, UpdateProblem.InstallFailed -> R.string.upd_short_install
},
)
/// The «Update» sheet (android-ui.md §25.3), over whatever screen is shown.
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun UpdateSheet() {
val app = app()
val updates = app.updates
val state by updates.state.collectAsState()
val net by app.engineFiles.state.collectAsState()
val games by app.downloads.views.collectAsState()
val context = LocalContext.current
val uri = LocalUriHandler.current
val s = state
if (s == null) {
LaunchedEffect(Unit) { updates.closeSheet() }
return
}
val update = s.update
// Back from the settings with the permission: TalkBack says the download has begun.
val view = androidx.compose.ui.platform.LocalView.current
val granted = stringResource(R.string.upd_perm_granted)
var waited by remember { mutableStateOf(false) }
LaunchedEffect(s is UpdateState.NeedsPermission, s is UpdateState.Downloading) {
if (s is UpdateState.NeedsPermission) waited = true
if (s is UpdateState.Downloading && waited) {
waited = false
@Suppress("DEPRECATION")
view.announceForAccessibility(granted)
}
}
val close = {
updates.closeSheet()
updates.dismissProblem()
}
ModalBottomSheet(onDismissRequest = close, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)) {
Column(
Modifier
.fillMaxWidth()
.verticalScroll(rememberScrollState())
.padding(start = 24.dp, end = 24.dp, bottom = 24.dp),
) {
Text(stringResource(R.string.upd_title, update.version), style = MaterialTheme.typography.titleLarge, modifier = Modifier.semantics { heading() })
Spacer(Modifier.height(4.dp))
Text(
stringResource(R.string.upd_you_have, BuildConfig.VERSION_NAME),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Spacer(Modifier.height(16.dp))
// The engine stays when there is one to keep: in the app's storage, or in a full
// build that keeps it before the install.
val engine = net == NetState.Ready || BuildConfig.NET_BUILT_IN
Text(stringResource(if (engine) R.string.upd_keeps else R.string.upd_keeps_no_engine), style = MaterialTheme.typography.bodyLarge)
Text(stringResource(R.string.upd_closes), style = MaterialTheme.typography.bodyLarge)
if (games.values.any { it.state.running }) {
Spacer(Modifier.height(8.dp))
Text(stringResource(R.string.upd_online_note), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
Spacer(Modifier.height(16.dp))
val live = Modifier.semantics { liveRegion = LiveRegionMode.Polite }
when (s) {
is UpdateState.Available -> Buttons(
secondary = stringResource(R.string.not_now) to close,
primary = stringResource(R.string.upd_update) to { updates.start() },
)
is UpdateState.NeedsPermission -> {
val openSettings = {
updates.permissionAsked()
context.startActivity(
Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, Uri.parse("package:${context.packageName}")),
)
}
if (!s.denied) {
Text(stringResource(R.string.upd_perm_title), style = MaterialTheme.typography.titleMedium, modifier = live)
Spacer(Modifier.height(4.dp))
Text(stringResource(R.string.upd_perm_body), style = MaterialTheme.typography.bodyMedium)
} else {
Text(stringResource(R.string.upd_perm_denied), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.error, modifier = live)
Link(stringResource(R.string.upd_on_site)) { uri.openUri(SITE_URL) }
}
Spacer(Modifier.height(24.dp))
Buttons(
secondary = stringResource(R.string.cancel) to close,
primary = stringResource(R.string.upd_perm_open) to openSettings,
)
}
is UpdateState.Downloading -> {
LinearProgressIndicator(
progress = { s.done.toFloat() / update.apkSize.coerceAtLeast(1) },
modifier = Modifier.fillMaxWidth(),
)
Spacer(Modifier.height(8.dp))
Text(
if (s.waitingNetwork) stringResource(R.string.upd_waiting_net) else stringResource(R.string.downloaded_of, mb(s.done), mb(update.apkSize)),
style = MaterialTheme.typography.bodyMedium.merge(Tabular),
)
Text(stringResource(R.string.upd_leave), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = live)
Spacer(Modifier.height(16.dp))
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
TextButton(onClick = {
updates.cancel()
updates.closeSheet()
}) { Text(stringResource(R.string.cancel_download)) }
}
}
is UpdateState.Busy -> {
LinearProgressIndicator(Modifier.fillMaxWidth())
Spacer(Modifier.height(8.dp))
Text(stepText(s.step), style = MaterialTheme.typography.bodyMedium, modifier = live)
}
is UpdateState.Ready -> {
Text(
stringResource(if (s.aborted) R.string.upd_aborted else R.string.upd_ready),
style = MaterialTheme.typography.bodyMedium,
modifier = live,
)
Spacer(Modifier.height(24.dp))
Buttons(
secondary = stringResource(R.string.not_now) to { updates.closeSheet() },
primary = stringResource(R.string.upd_install) to { updates.install() },
)
}
is UpdateState.Failed -> Problem(s, onRetry = { updates.start() }, onSite = { uri.openUri(SITE_URL) }, onClose = close)
}
}
}
}
@Composable
private fun Problem(s: UpdateState.Failed, onRetry: () -> Unit, onSite: () -> Unit, onClose: () -> Unit) {
val updates = app().updates
val text = when (s.problem) {
UpdateProblem.NoInternet -> stringResource(R.string.no_internet)
UpdateProblem.DownloadFailed -> stringResource(R.string.upd_err_failed)
UpdateProblem.NoSpace -> stringResource(R.string.no_space, mb(updates.needed(s.update)))
UpdateProblem.Corrupt -> stringResource(R.string.upd_err_corrupt)
UpdateProblem.BadRelease -> stringResource(R.string.upd_err_release)
UpdateProblem.InstallStorage -> stringResource(R.string.upd_err_storage, mb(updates.needed(s.update)))
UpdateProblem.Conflict -> stringResource(R.string.upd_err_conflict)
UpdateProblem.Blocked -> stringResource(R.string.upd_err_blocked)
UpdateProblem.InstallFailed -> stringResource(R.string.upd_err_install)
}
Text(text, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.error, modifier = Modifier.semantics { liveRegion = LiveRegionMode.Polite })
val install = s.problem in setOf(UpdateProblem.InstallStorage, UpdateProblem.Conflict, UpdateProblem.Blocked, UpdateProblem.InstallFailed)
val detail = s.detail
if (install && !detail.isNullOrBlank()) {
var open by rememberSaveable { mutableStateOf(false) }
Link(stringResource(R.string.upd_details)) { open = !open }
if (open) {
@Suppress("DEPRECATION")
val clipboard = androidx.compose.ui.platform.LocalClipboardManager.current
Text(detail, fontFamily = FontFamily.Monospace, fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
TextButton(onClick = { clipboard.setText(androidx.compose.ui.text.AnnotatedString(detail)) }) { Text(stringResource(R.string.upd_copy)) }
}
}
Spacer(Modifier.height(24.dp))
val notNow = stringResource(R.string.not_now)
val ok = stringResource(R.string.ok)
val retry = stringResource(R.string.retry)
val site = stringResource(R.string.upd_open_site)
when (s.problem) {
UpdateProblem.NoInternet, UpdateProblem.DownloadFailed, UpdateProblem.InstallStorage -> Buttons(notNow to onClose, retry to onRetry)
UpdateProblem.Corrupt -> Buttons(notNow to onClose, stringResource(R.string.download_again) to onRetry)
UpdateProblem.NoSpace -> Buttons(null, ok to onClose)
UpdateProblem.BadRelease, UpdateProblem.Conflict, UpdateProblem.Blocked -> Buttons(ok to onClose, site to onSite)
UpdateProblem.InstallFailed -> Buttons(site to onSite, retry to onRetry)
}
}
@Composable
private fun Buttons(secondary: Pair<String, () -> Unit>?, primary: Pair<String, () -> Unit>) {
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)) {
secondary?.let { (label, action) -> TextButton(onClick = action) { Text(label) } }
Button(onClick = primary.second) { Text(primary.first) }
}
}
@Composable
private fun Link(text: String, onClick: () -> Unit) {
Row(
Modifier.heightIn(min = 48.dp).clickable(role = Role.Button, onClick = onClick),
verticalAlignment = Alignment.CenterVertically,
) {
Text(text, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.primary)
}
}
/// The «Updates» block of About (android-ui.md §25.5).
@Composable
fun AboutUpdates() {
val updates = app().updates
val state by updates.state.collectAsState()
val check by updates.check.collectAsState()
val auto by updates.auto.collectAsState()
val offer by updates.offer.collectAsState()
val last by updates.lastCheck.collectAsState()
val context = LocalContext.current
Column(Modifier.fillMaxWidth()) {
Text(
stringResource(R.string.upd_group),
style = MaterialTheme.typography.labelLarge,
color = MaterialTheme.colorScheme.primary,
modifier = Modifier.semantics { heading() },
)
Spacer(Modifier.height(8.dp))
val s = state
if (s == null) {
// Said only after a check that got an answer.
if (last > 0 || check == CheckState.Latest) Text(stringResource(R.string.upd_latest), style = MaterialTheme.typography.bodyLarge)
} else {
Text(stringResource(R.string.upd_title, s.update.version), style = MaterialTheme.typography.bodyLarge, fontWeight = FontWeight.Medium)
Text(
stringResource(R.string.upd_you_have, BuildConfig.VERSION_NAME),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
when (s) {
is UpdateState.Downloading -> {
LinearProgressIndicator(progress = { s.done.toFloat() / s.update.apkSize.coerceAtLeast(1) }, modifier = Modifier.fillMaxWidth())
Text(
if (s.waitingNetwork) stringResource(R.string.upd_waiting_net_short) else stringResource(R.string.downloaded_of, mb(s.done), mb(s.update.apkSize)),
style = MaterialTheme.typography.bodyMedium.merge(Tabular),
)
}
is UpdateState.Busy -> {
LinearProgressIndicator(Modifier.fillMaxWidth())
Text(stepText(s.step), style = MaterialTheme.typography.bodyMedium)
}
is UpdateState.Failed -> Text(shortProblem(s.problem), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.error)
else -> {}
}
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
when (s) {
is UpdateState.Ready -> Button(onClick = {
updates.openSheet()
updates.install()
}) { Text(stringResource(R.string.upd_install)) }
is UpdateState.Downloading, is UpdateState.Busy -> TextButton(onClick = { updates.openSheet() }) { Text(stringResource(R.string.upd_more)) }
is UpdateState.Failed -> TextButton(onClick = { updates.openSheet() }) { Text(stringResource(R.string.upd_more)) }
else -> Button(onClick = {
updates.openSheet()
updates.start()
}) { Text(stringResource(R.string.upd_update)) }
}
}
}
// The card on «Databases» (its × turns this off); the check below goes on either way.
Row(
Modifier
.fillMaxWidth()
.heightIn(min = 72.dp)
.toggleable(value = offer, enabled = auto, role = Role.Switch, onValueChange = { updates.setOffer(it) }),
verticalAlignment = Alignment.CenterVertically,
) {
Text(stringResource(R.string.upd_offer), style = MaterialTheme.typography.bodyLarge, modifier = Modifier.weight(1f))
Switch(checked = offer, enabled = auto, onCheckedChange = null)
}
Text(
stringResource(if (auto) R.string.upd_offer_sub else R.string.upd_offer_needs_check),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Row(
Modifier
.fillMaxWidth()
.heightIn(min = 72.dp)
.toggleable(value = auto, role = Role.Switch, onValueChange = { updates.setAuto(it) }),
verticalAlignment = Alignment.CenterVertically,
) {
Text(stringResource(R.string.upd_auto), style = MaterialTheme.typography.bodyLarge, modifier = Modifier.weight(1f))
Switch(checked = auto, onCheckedChange = null)
}
Text(stringResource(R.string.upd_auto_sub), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
if (check == CheckState.Checking) {
Row(Modifier.heightIn(min = 48.dp), verticalAlignment = Alignment.CenterVertically) {
CircularProgressIndicator(Modifier.size(16.dp), strokeWidth = 2.dp)
Spacer(Modifier.width(12.dp))
Text(stringResource(R.string.upd_checking), style = MaterialTheme.typography.bodyMedium)
}
} else {
// Not while an update is downloaded or installed: the check waits for it.
val busy = s is UpdateState.Downloading || s is UpdateState.Busy || s is UpdateState.NeedsPermission
TextButton(onClick = { updates.checkNow() }, enabled = !busy, contentPadding = androidx.compose.foundation.layout.PaddingValues(0.dp)) {
Text(stringResource(R.string.upd_check_now))
}
}
when (check) {
CheckState.Offline -> Text(stringResource(R.string.upd_check_offline), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.error)
CheckState.Failed -> Text(stringResource(R.string.upd_check_failed), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.error)
else -> {}
}
if (last > 0) {
// «today, 14:05» inside the sentence: Android writes it from a capital.
val whenText = DateUtils.getRelativeDateTimeString(context, last, DateUtils.DAY_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0)
.toString().replaceFirstChar { it.lowercaseChar() }
Text(stringResource(R.string.upd_checked, whenText), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
}
}
/// The second line of «About» in Settings while a newer version is known (§25.5).
@Composable
fun aboutUpdateLine(): String? {
val updates = app().updates
val state by updates.state.collectAsState()
val auto by updates.auto.collectAsState()
val asked by updates.asked.collectAsState()
val s = state ?: return null
if (!auto && !asked && s is UpdateState.Available) return null
return when (s) {
is UpdateState.Downloading, is UpdateState.Busy -> stringResource(R.string.s_about_downloading, s.update.version)
is UpdateState.Ready -> stringResource(R.string.s_about_ready, s.update.version)
else -> stringResource(R.string.s_about_available, s.update.version)
}
}
/// Shows the update's messages in a screen's snackbar (only one screen is on at a time).
@Composable
fun UpdateMessages(snackbar: SnackbarHostState) {
val updates = app().updates
val message by updates.message.collectAsState()
val ready = stringResource(R.string.upd_ready_snack)
val install = stringResource(R.string.upd_install)
val cancelled = stringResource(R.string.download_cancelled)
val latest = stringResource(R.string.upd_latest)
val doneText = (message as? UpdateMessage.Updated)?.let { stringResource(R.string.upd_done_snack, it.from, it.to) }
// Marked shown when its snackbar is gone: a screen left meanwhile hands it to the next.
LaunchedEffect(message) {
val m = message ?: return@LaunchedEffect
snackbar.currentSnackbarData?.dismiss()
when (m) {
UpdateMessage.Ready -> {
if (snackbar.showSnackbar(ready, install, duration = SnackbarDuration.Long) == SnackbarResult.ActionPerformed) {
updates.openSheet()
updates.install()
}
}
UpdateMessage.Cancelled -> snackbar.showSnackbar(cancelled)
UpdateMessage.Latest -> snackbar.showSnackbar(latest)
is UpdateMessage.Updated -> snackbar.showSnackbar(doneText ?: "", duration = SnackbarDuration.Long)
}
updates.shown(m)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
</adaptive-icon>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View file

@ -0,0 +1,724 @@
<resources>
<string name="sample_classics">Klassische Partien</string>
<string name="sample_alekhine">Aljechin</string>
<string name="empty_title">Hier erscheinen Ihre Datenbanken</string>
<string name="empty_text">Fügen Sie eine PGN-Datei, eine ChessBase-Datenbank oder ein .zip/.7z-Archiv hinzu – vom Telefon oder aus der Cloud – oder laden Sie Partien von Lichess und Chess.com.</string>
<string name="add_database">Datenbank hinzufügen</string>
<string name="open_samples">Beispielpartien öffnen</string>
<string name="not_opened">noch nicht geöffnet · %1$s</string>
<plurals name="games_count">
<item quantity="one">%1$s Partie</item>
<item quantity="other">%1$s Partien</item>
</plurals>
<string name="games_with_format">%1$s · %2$s</string>
<string name="menu">Menü</string>
<string name="rename">Umbenennen</string>
<string name="remove">Aus der Liste entfernen</string>
<string name="rename_hint">Der Name in der Liste. Die Datei wird nicht geändert.</string>
<string name="cancel">Abbrechen</string>
<string name="save">Speichern</string>
<string name="removed">Datenbank aus der Liste entfernt</string>
<string name="undo">Rückgängig</string>
<string name="back">Zurück</string>
<string name="reading">Wird gelesen…</string>
<string name="open_failed">Datenbank konnte nicht geöffnet werden</string>
<string name="search">Suchen</string>
<string name="search_hint">Spieler, Turnier, Jahr</string>
<string name="nothing_found">Nichts gefunden</string>
<string name="clear">Leeren</string>
<string name="game_of">%1$d von %2$d</string>
<string name="previous_game">Vorherige Partie</string>
<string name="next_game">Nächste Partie</string>
<string name="flip">Brett drehen</string>
<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_description">Brett, Stellung nach %1$s</string>
<string name="board_start">Brett, Ausgangsstellung</string>
<string name="white_won">Weiß hat gewonnen</string>
<string name="black_won">Schwarz hat gewonnen</string>
<string name="draw">Remis</string>
<string name="game_failed">Partie konnte nicht gelesen werden</string>
<string name="engine">Engine</string>
<string name="thinking">Rechnet…</string>
<string name="depth">Tiefe %1$d</string>
<string name="paused">pausiert</string>
<string name="deeper">Tiefer</string>
<string name="more_lines">Mehr Varianten</string>
<string name="fewer_lines">Weniger Varianten</string>
<string name="engine_not_answering">Die Engine antwortet nicht</string>
<string name="engine_not_starting">Die Engine startet auf diesem Telefon nicht</string>
<string name="restart">Neu starten</string>
<string name="engine_line_preview">Engine-Variante · Zug %1$d von %2$d</string>
<string name="close">Schließen</string>
<string name="engine_sheet_title">Stockfish-Engine</string>
<string name="engine_sheet_text">Bewertet die Stellung und zeigt die besten Züge. Funktioniert offline — sie muss nur einmal heruntergeladen werden.</string>
<string name="engine_size">Größe: %1$d MB</string>
<string name="engine_metered">Gerade kein WLAN: Der Download nutzt mobile Daten.</string>
<string name="not_now">Nicht jetzt</string>
<string name="download">Herunterladen</string>
<string name="downloaded_of">%1$d von %2$d MB heruntergeladen</string>
<string name="cancel_download">Abbrechen</string>
<string name="download_cancelled">Download abgebrochen</string>
<string name="engine_ready">Die Engine ist bereit</string>
<string name="no_internet">Kein Internet. Verbinden Sie sich mit einem Netzwerk und versuchen Sie es erneut.</string>
<string name="download_title">ChessPenguin: Stockfish-Engine</string>
<string name="interrupted">Der Download wurde unterbrochen. Bitte versuchen Sie es erneut.</string>
<string name="no_space">Nicht genug Speicherplatz: %1$d MB nötig.</string>
<string name="corrupt">Die Engine-Datei wurde beim Download beschädigt. Laden Sie sie erneut herunter.</string>
<string name="retry">Erneut versuchen</string>
<string name="download_again">Erneut herunterladen</string>
<string name="ok">OK</string>
<string name="preparing_engine">Engine wird vorbereitet…</string>
<string name="settings">Einstellungen</string>
<string name="group_look">Darstellung</string>
<string name="group_engine">Engine</string>
<string name="theme">Design</string>
<string name="theme_system">Systemstandard</string>
<string name="theme_light">Hell</string>
<string name="theme_dark">Dunkel</string>
<string name="notation">Zugnotation</string>
<string name="notation_latin">Englische Buchstaben (K Q R B N)</string>
<string name="notation_figurines">Figurinen</string>
<string name="notation_local">Deutsche Buchstaben (K D T L S)</string>
<string name="notation_hint">Nur zur Anzeige. PGN verwendet immer K Q R B N.</string>
<string name="animation">Figurenanimation</string>
<string name="best_arrow">Pfeil für den besten Zug</string>
<string name="vibration">Vibration</string>
<string name="engine_built_in">Stockfish 19 · eingebaut</string>
<string name="engine_downloaded">Stockfish 19 · heruntergeladen</string>
<string name="engine_missing">Nicht geladen · Herunterladen (%1$d MB)</string>
<string name="engine_downloading">Wird heruntergeladen… %1$d von %2$d MB</string>
<string name="engine_delete">Engine löschen (gibt %1$d MB frei)</string>
<string name="engine_delete_question">Engine löschen? Sie können sie erneut herunterladen.</string>
<string name="delete">Löschen</string>
<string name="lines">Varianten</string>
<string name="time_per_position">Zeit pro Stellung</string>
<string name="seconds">%1$d s</string>
<string name="one_minute">1 min</string>
<string name="no_limit">Unbegrenzt</string>
<string name="threads">Threads</string>
<string name="memory">Speicher</string>
<string name="megabytes">%1$d MB</string>
<string name="engine_battery">Die Engine verbraucht Akku. Sie schaltet sich von selbst aus, wenn Sie die Partie verlassen oder die App in den Hintergrund geht.</string>
<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="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>
<string name="game_info">Partiedaten</string>
<string name="copy_pgn">PGN kopieren</string>
<string name="copy_fen">FEN kopieren</string>
<string name="share_game">Partie teilen</string>
<string name="notes">Hinweise</string>
<string name="engine_state_on">an</string>
<string name="engine_state_off">aus</string>
<string name="engine_state_missing">nicht geladen</string>
<string name="found_of">%1$s von %2$s gefunden</string>
<string name="group_game">Partie</string>
<string name="move_white">%1$d, Weiß, %2$s</string>
<string name="move_black">%1$d, Schwarz, %2$s</string>
<string name="current_move">aktueller Zug</string>
<string name="language">Sprache</string>
<string name="checkmate">Matt</string>
<string name="stalemate">Patt</string>
<string name="pgn_copied">PGN kopiert</string>
<string name="fen_copied">FEN kopiert</string>
<string name="tag_event">Turnier</string>
<string name="tag_site">Ort</string>
<string name="tag_date">Datum</string>
<string name="tag_round">Runde</string>
<string name="tag_white">Weiß</string>
<string name="tag_black">Schwarz</string>
<string name="tag_result">Ergebnis</string>
<string name="tag_white_elo">Elo Weiß</string>
<string name="tag_black_elo">Elo Schwarz</string>
<string name="tag_annotator">Kommentator</string>
<string name="tag_plies">Halbzüge</string>
<string name="open_no_access">Kein Zugriff auf die Datei: Sie wurde verschoben, gelöscht oder die Berechtigung wurde entzogen. Entfernen Sie sie aus der Liste und fügen Sie sie erneut hinzu.</string>
<string name="open_corrupt">Die Datei ist beschädigt oder keine Schachdatenbank.</string>
<string name="open_empty">Im Archiv ist keine PGN- oder ChessBase-Datenbank.</string>
<string name="open_unsupported">Diese Art von Datenbank kann nicht gelesen werden: %1$s</string>
<string name="add_file">Datei</string>
<string name="add_file_hint">PGN, .cbv, .zip oder .7z</string>
<string name="add_folder">Ordner</string>
<string name="add_folder_hint">Alle Datenbanken in einem Ordner, auch ChessBase (.cbh)</string>
<string name="folder_scanning">Datenbanken werden gesucht…</string>
<string name="folder_empty_title">Keine Datenbanken in diesem Ordner</string>
<string name="folder_empty_text">Gefunden werden PGN-Dateien, ChessBase-Datenbanken (.cbh, .cbv) und .zip- oder .7z-Archive – im Ordner und in zwei Ebenen von Unterordnern.</string>
<string name="folder_added">schon in der Liste</string>
<string name="folder_incomplete">die .cbg-Datei fehlt: die Partien lassen sich nicht öffnen</string>
<plurals name="folder_found">
<item quantity="one">%1$d Datenbank in „%2$s“</item>
<item quantity="other">%1$d Datenbanken in „%2$s“</item>
</plurals>
<plurals name="add_chosen">
<item quantity="one">%1$d hinzufügen</item>
<item quantity="other">%1$d hinzufügen</item>
</plurals>
<plurals name="added_count">
<item quantity="one">%1$d Datenbank hinzugefügt</item>
<item quantity="other">%1$d Datenbanken hinzugefügt</item>
</plurals>
<string name="add_tree_hint">Android lässt weder den Speicherstamm noch „Downloads“ selbst auswählen — nur einen Ordner darin.</string>
<string name="pick_another">Anderen wählen</string>
<string name="done">Fertig</string>
<string name="add">Hinzufügen</string>
<string name="choose_all">Alle auswählen</string>
<string name="choose_none">Keine auswählen</string>
<string name="open_missing_part">Die Datei %1$s liegt nicht mehr neben der Datenbank: Sie wurde verschoben oder gelöscht.</string>
<string name="board_and_pieces">Brett und Figuren</string>
<string name="board_brown">Braun</string>
<string name="board_blue">Blau</string>
<string name="board_green">Grün</string>
<string name="board_tournament">Turnier</string>
<string name="board_sand">Sand</string>
<string name="board_coral">Koralle</string>
<string name="board_grey">Grau</string>
<string name="board_purple">Lila</string>
<string name="board_ice">Eis</string>
<string name="board_navy">Marineblau</string>
<string name="board_mint">Minze</string>
<string name="board_emerald">Smaragd</string>
<string name="board_orange">Orange</string>
<string name="board_rose">Rosa</string>
<string name="board_dusk">Dämmerung</string>
<string name="board_night">Nacht</string>
<string name="board_wood">Holz</string>
<string name="board_maple">Ahorn</string>
<string name="board_leather">Leder</string>
<string name="board_marble">Marmor</string>
<string name="board_blue_marble">Blauer Marmor</string>
<string name="board_canvas">Leinwand</string>
<string name="board_metal">Metall</string>
<string name="board_olive">Olive</string>
<string name="board_stone">Stein</string>
<string name="board_green_plastic">Grünes Plastik</string>
<string name="board_purple_diag">Lila Diagonalen</string>
<string name="board_pink_pyramid">Rosa Pyramiden</string>
<string name="board_sketch">Skizze</string>
<string name="board">Brett</string>
<string name="pieces_tab">Figuren</string>
<string name="game_number">Nr. %1$s</string>
<string name="add_paste">PGN aus der Zwischenablage einfügen</string>
<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>
<string name="file_unreadable">Die Datei ließ sich nicht lesen: Sie existiert nicht mehr, oder die App, aus der sie stammt, hat keinen Zugriff gewährt. Öffnen Sie sie erneut.</string>
<string name="file_chessbase_part">Eine ChessBase-Datenbank (.cbh) besteht aus mehreren Dateien, gekommen ist nur eine. Fügen Sie ihren Ordner hinzu: „Datenbank hinzufügen“ → „Ordner“.</string>
<string name="file_copy_failed">Die App konnte keine Kopie der Datei speichern. Prüfen Sie, ob auf dem Telefon Platz frei ist.</string>
<string name="db_copy">Kopie</string>
<string name="removed_copy">Datenbank aus ChessPenguin gelöscht</string>
<!-- Game report (android-ui.md §21) -->
<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_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_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>
<string name="review_accuracy">Genauigkeit</string>
<string name="review_accuracy_of">Genauigkeit: Weiß %1$s, Schwarz %2$s</string>
<string name="review_report">Bericht</string>
<string name="review_better">besser war %1$s</string>
<string name="review_inaccuracy">Ungenauigkeit</string>
<string name="review_mistake">Fehler</string>
<string name="review_blunder">Grober Fehler</string>
<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>
<string name="review_acpl">Durchschnittlicher Centibauernverlust</string>
<string name="review_opening">Eröffnung</string>
<string name="review_middlegame">Mittelspiel</string>
<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_graph_state">%1$s, Bewertung %2$s</string>
<string name="review_start_position">Ausgangsstellung</string>
<plurals name="review_estimate">
<item quantity="one">%1$d Stellung, etwa %2$s</item>
<item quantity="other">%1$d Stellungen, etwa %2$s</item>
</plurals>
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
<string name="online_title">Partien von Lichess und Chess.com</string>
<string name="add_online_hint">Partien beliebiger Spieler per Nickname: eigene, eines Schülers, eines Gegners</string>
<string name="online_intro">Die Partien des Spielers werden zu einer Datenbank auf dem Telefon – zum Suchen, Ansehen und Analysieren. Nur der Nickname ist nötig, keine Anmeldung.</string>
<string name="online_nick">Nickname des Spielers</string>
<string name="online_nick_hint">wie auf der Seite</string>
<string name="online_other">Anderer Nickname auf Chess.com</string>
<string name="online_other_nick">Nickname auf Chess.com</string>
<string name="online_same_nick">Derselbe Nickname</string>
<string name="online_nick_rule">Lateinische Buchstaben, Ziffern, _ und -, 2 bis 30 Zeichen</string>
<string name="online_find">Suchen</string>
<string name="online_searching">Suche auf den Seiten…</string>
<string name="online_lichess_found">%1$s · beim ersten Mal etwa %2$d Min.</string>
<string name="online_chesscom_found">Monate mit Partien: %1$d</string>
<string name="online_not_found">%1$s: kein Spieler mit diesem Nickname – Schreibweise prüfen</string>
<string name="online_merge">Beide Seiten in einer Datenbank zusammenführen</string>
<string name="online_merge_hint">Sonst bekommt jede Seite eine eigene Datenbank</string>
<string name="online_into_new">In die neue Datenbank „%1$s“</string>
<string name="online_into_existing">In „%1$s“ (schon %2$s dort; nur neue Partien kommen dazu)</string>
<string name="online_download">Herunterladen</string>
<string name="online_progress_lichess">Lichess: %1$s von etwa %2$s · noch etwa %3$d Min.</string>
<string name="online_progress_count">%1$s: %2$s</string>
<string name="online_progress_chesscom">Chess.com: Monat %1$d von %2$d · %3$s</string>
<string name="online_stop">Anhalten</string>
<string name="online_added">+%1$s, insgesamt %2$s</string>
<string name="online_no_new">Keine neuen Partien, %1$s in der Datenbank</string>
<string name="online_stopped">Angehalten, %1$s in der Datenbank</string>
<string name="online_no_games">Dort gibt es keine Partien im Standardschach.</string>
<string name="online_open">Datenbank öffnen</string>
<string name="online_try_again">Erneut versuchen</string>
<string name="online_err_network">%1$s antwortet nicht. Prüfen Sie die Internetverbindung und versuchen Sie es erneut.</string>
<string name="online_err_rate">%1$s bittet um eine Pause: zu viele Anfragen hintereinander. Warten Sie eine Minute und versuchen Sie es erneut; Geladenes bleibt erhalten.</string>
<string name="online_err_unexpected">%1$s hat unverständlich geantwortet: die Seite hat sich vielleicht geändert. Versuchen Sie es später oder aktualisieren Sie ChessPenguin.</string>
<string name="online_err_disk">Die Datenbank konnte nicht geschrieben werden: auf dem Telefon ist kein Platz mehr.</string>
<string name="online_err_busy">Diese Datenbank wird bereits geladen.</string>
<string name="online_short_network">%1$s antwortet nicht</string>
<string name="online_short_rate">%1$s bittet um eine Pause</string>
<string name="online_short_failed">Der Download wurde unterbrochen</string>
<string name="online_update">Neue Partien laden</string>
<string name="online_stop_download">Download anhalten</string>
<string name="online_downloading">Wird geladen · %1$s</string>
<string name="online_updated">aktualisiert %1$s</string>
<string name="online_unfinished">unvollständig</string>
<string name="online_removed">Geladene Datenbank gelöscht</string>
<string name="online_nick_lichess">Nickname auf Lichess</string>
<string name="online_lichess_quick">%1$s · beim ersten Mal unter einer Minute</string>
<string name="online_leave">Sie können diesen Bildschirm verlassen: die Datenbank ist in der Liste, der Download läuft weiter.</string>
<string name="online_done">Fertig: %1$s</string>
<string name="online_updated_now">gerade aktualisiert</string>
<string name="online_snack_added">„%1$s“: +%2$s, insgesamt %3$s</string>
<string name="online_snack_none">„%1$s“: keine neuen Partien</string>
<string name="online_snack_failed">„%1$s“: %2$s</string>
<string name="online_open_short">Öffnen</string>
<plurals name="games_up_to">
<item quantity="one">bis zu %1$s Partie</item>
<item quantity="other">bis zu %1$s Partien</item>
</plurals>
<string name="upd_title">Version %1$s ist erschienen</string>
<string name="upd_you_have">Sie haben %1$s</string>
<string name="upd_update">Aktualisieren</string>
<string name="upd_install">Installieren</string>
<string name="upd_keeps">Datenbanken, Einstellungen und die Engine bleiben erhalten.</string>
<string name="upd_keeps_no_engine">Datenbanken und Einstellungen bleiben erhalten.</string>
<string name="upd_closes">ChessPenguin schließt sich während der Installation — öffnen Sie es danach wieder.</string>
<string name="upd_online_note">Partien werden gerade heruntergeladen: Die Installation unterbricht den Download, danach können Sie ihn fortsetzen.</string>
<string name="upd_perm_title">Eine Berechtigung ist nötig</string>
<string name="upd_perm_body">Android installiert Apps außerhalb eines Stores nur mit Ihrer Erlaubnis. Die Einstellungen öffnen sich: Aktivieren Sie den Schalter für ChessPenguin und kehren Sie zurück.</string>
<string name="upd_perm_open">Einstellungen öffnen</string>
<string name="upd_perm_denied">Die Berechtigung ist deaktiviert — ohne sie installiert Android die neue Version nicht.</string>
<string name="upd_perm_granted">Berechtigung erteilt, Download läuft</string>
<string name="upd_on_site">Von der Website herunterladen</string>
<string name="upd_open_site">Website öffnen</string>
<string name="upd_leave">Sie können dieses Fenster schließen: Der Download läuft weiter.</string>
<string name="upd_waiting_net">Kein Netz. Der Download läuft von selbst weiter, sobald das Netz zurück ist.</string>
<string name="upd_waiting_net_short">Wartet auf Netz</string>
<string name="upd_checking_file">Datei wird geprüft…</string>
<string name="upd_keeping_engine">Engine wird gesichert…</string>
<string name="upd_installing">Wird installiert…</string>
<string name="upd_ready">Die neue Version ist heruntergeladen und geprüft.</string>
<string name="upd_ready_short">Heruntergeladen und geprüft</string>
<string name="upd_ready_snack">Die neue Version ist heruntergeladen</string>
<string name="upd_aborted">Installation abgebrochen. Die neue Version ist heruntergeladen — installieren Sie sie, wann es Ihnen passt.</string>
<string name="upd_notification">ChessPenguin-Update</string>
<string name="upd_done_snack">ChessPenguin wurde aktualisiert: %1$s → %2$s</string>
<string name="upd_err_failed">Der Download ist fehlgeschlagen. Versuchen Sie es erneut.</string>
<string name="upd_err_corrupt">Die Datei wurde beim Herunterladen beschädigt und deshalb nicht installiert. Versuchen Sie es erneut.</string>
<string name="upd_err_release">Mit dieser Version stimmt etwas nicht: Die Android-Datei lässt sich nicht prüfen. Laden Sie die neue Version von der Website herunter.</string>
<string name="upd_err_storage">Android hat die neue Version nicht installiert: zu wenig Speicher. Geben Sie %1$d MB frei und versuchen Sie es erneut.</string>
<string name="upd_err_conflict">Android hat die neue Version nicht installiert: Dieses ChessPenguin ist mit einem anderen Schlüssel signiert. Die neue Version lässt sich erst nach dem Entfernen dieser installieren, und dabei gehen die Datenbankliste und die heruntergeladenen Datenbanken verloren.</string>
<string name="upd_err_blocked">Android oder der Schutz des Telefons hat die Installation gestoppt. Laden Sie die neue Version von der Website herunter.</string>
<string name="upd_err_install">Android hat die neue Version nicht installiert. Versuchen Sie es erneut oder laden Sie sie von der Website herunter.</string>
<string name="upd_short_offline">Kein Internet</string>
<string name="upd_short_space">Zu wenig Speicher</string>
<string name="upd_short_corrupt">Die Datei ist beschädigt</string>
<string name="upd_short_install">Von Android nicht installiert</string>
<string name="upd_short_failed">Download fehlgeschlagen</string>
<string name="upd_more">Mehr erfahren</string>
<string name="upd_details">Details</string>
<string name="upd_copy">Kopieren</string>
<string name="upd_group">Updates</string>
<string name="upd_auto">Beim Start nach Updates suchen</string>
<string name="upd_auto_sub">Einmal am Tag fragt ChessPenguin seine Website nach der neuesten Version; die Website zählt laufende Installationen. Gesendet werden nur eine Zufallsnummer dieser Installation, die Version und das System. Die Prüfung läuft auch ohne Angebote.</string>
<string name="upd_offer">Neue Versionen anbieten</string>
<string name="upd_offer_sub">Eine Karte auf dem Bildschirm Datenbanken, wenn eine neue Version erscheint.</string>
<string name="upd_offer_needs_check">Funktioniert, wenn die Update-Prüfung eingeschaltet ist.</string>
<string name="upd_offers_off_snack">Wird nicht mehr angeboten. Einschalten unter Einstellungen, Über</string>
<string name="upd_dismiss_cd">Keine Updates anbieten</string>
<string name="upd_check_now">Jetzt prüfen</string>
<string name="upd_checking">Wird geprüft…</string>
<string name="upd_latest">Sie haben die neueste Version</string>
<string name="upd_checked">Zuletzt geprüft: %1$s</string>
<string name="upd_check_offline">Kein Internet — Updates lassen sich nicht prüfen</string>
<string name="upd_check_failed">Updates konnten nicht geprüft werden: Die Website hat nicht geantwortet. Später erneut versuchen.</string>
<string name="s_about_available">Version %1$s ist erschienen</string>
<string name="s_about_downloading">Version %1$s wird heruntergeladen…</string>
<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

@ -0,0 +1,733 @@
<resources>
<string name="sample_classics">Partidas clásicas</string>
<string name="sample_alekhine">Alekhine</string>
<string name="empty_title">Aquí aparecerán tus bases</string>
<string name="empty_text">Añade un archivo PGN, una base ChessBase o un archivo .zip/.7z — desde el teléfono o la nube — o descarga partidas de Lichess y Chess.com.</string>
<string name="add_database">Añadir base</string>
<string name="open_samples">Abrir partidas de ejemplo</string>
<string name="not_opened">aún sin abrir · %1$s</string>
<plurals name="games_count">
<item quantity="one">%1$s partida</item>
<item quantity="many">%1$s de partidas</item>
<item quantity="other">%1$s partidas</item>
</plurals>
<string name="games_with_format">%1$s · %2$s</string>
<string name="menu">Menú</string>
<string name="rename">Cambiar nombre</string>
<string name="remove">Quitar de la lista</string>
<string name="rename_hint">El nombre en la lista. El archivo no se modifica.</string>
<string name="cancel">Cancelar</string>
<string name="save">Guardar</string>
<string name="removed">Base quitada de la lista</string>
<string name="undo">Deshacer</string>
<string name="back">Atrás</string>
<string name="reading">Leyendo…</string>
<string name="open_failed">No se pudo abrir la base</string>
<string name="search">Buscar</string>
<string name="search_hint">Jugador, torneo, año</string>
<string name="nothing_found">No se encontró nada</string>
<string name="clear">Borrar</string>
<string name="game_of">%1$d de %2$d</string>
<string name="previous_game">Partida anterior</string>
<string name="next_game">Partida siguiente</string>
<string name="flip">Girar el tablero</string>
<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_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>
<string name="black_won">Ganaron las negras</string>
<string name="draw">Tablas</string>
<string name="game_failed">No se pudo leer la partida</string>
<string name="engine">Motor</string>
<string name="thinking">Pensando…</string>
<string name="depth">profundidad %1$d</string>
<string name="paused">en pausa</string>
<string name="deeper">Más profundo</string>
<string name="more_lines">Más líneas</string>
<string name="fewer_lines">Menos líneas</string>
<string name="engine_not_answering">El motor no responde</string>
<string name="engine_not_starting">El motor no arranca en este teléfono</string>
<string name="restart">Reiniciar</string>
<string name="engine_line_preview">Línea del motor · jugada %1$d de %2$d</string>
<string name="close">Cerrar</string>
<string name="engine_sheet_title">Motor Stockfish</string>
<string name="engine_sheet_text">Evalúa la posición y muestra las mejores jugadas. Funciona sin conexión — solo hay que descargarlo una vez.</string>
<string name="engine_size">Tamaño: %1$d MB</string>
<string name="engine_metered">Ahora no hay Wi-Fi: la descarga usará datos móviles.</string>
<string name="not_now">Ahora no</string>
<string name="download">Descargar</string>
<string name="downloaded_of">Descargados %1$d de %2$d MB</string>
<string name="cancel_download">Cancelar</string>
<string name="download_cancelled">Descarga cancelada</string>
<string name="engine_ready">El motor está listo</string>
<string name="no_internet">Sin Internet. Conéctate a una red e inténtalo de nuevo.</string>
<string name="download_title">ChessPenguin: motor Stockfish</string>
<string name="interrupted">La descarga se detuvo. Inténtalo de nuevo.</string>
<string name="no_space">No hay espacio suficiente: se necesitan %1$d MB.</string>
<string name="corrupt">El archivo del motor se dañó durante la descarga. Descárgalo de nuevo.</string>
<string name="retry">Reintentar</string>
<string name="download_again">Descargar de nuevo</string>
<string name="ok">Aceptar</string>
<string name="preparing_engine">Preparando el motor…</string>
<string name="settings">Ajustes</string>
<string name="group_look">Apariencia</string>
<string name="group_engine">Motor</string>
<string name="theme">Tema</string>
<string name="theme_system">Predeterminado del sistema</string>
<string name="theme_light">Claro</string>
<string name="theme_dark">Oscuro</string>
<string name="notation">Notación de jugadas</string>
<string name="notation_latin">Letras inglesas (K Q R B N)</string>
<string name="notation_figurines">Figurines</string>
<string name="notation_local">Letras españolas (R D T A C)</string>
<string name="notation_hint">Solo para mostrar. PGN siempre usa K Q R B N.</string>
<string name="animation">Animación de piezas</string>
<string name="best_arrow">Flecha de la mejor jugada</string>
<string name="vibration">Vibración</string>
<string name="engine_built_in">Stockfish 19 · incluido</string>
<string name="engine_downloaded">Stockfish 19 · descargado</string>
<string name="engine_missing">No descargado · Descargar (%1$d MB)</string>
<string name="engine_downloading">Descargando… %1$d de %2$d MB</string>
<string name="engine_delete">Eliminar el motor (libera %1$d MB)</string>
<string name="engine_delete_question">¿Eliminar el motor? Puedes volver a descargarlo.</string>
<string name="delete">Eliminar</string>
<string name="lines">Líneas</string>
<string name="time_per_position">Tiempo por posición</string>
<string name="seconds">%1$d s</string>
<string name="one_minute">1 min</string>
<string name="no_limit">Sin límite</string>
<string name="threads">Hilos</string>
<string name="memory">Memoria</string>
<string name="megabytes">%1$d MB</string>
<string name="engine_battery">El motor consume batería. Se apaga solo cuando sales de la partida o la aplicación pasa a segundo plano.</string>
<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="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>
<string name="game_info">Datos de la partida</string>
<string name="copy_pgn">Copiar PGN</string>
<string name="copy_fen">Copiar FEN</string>
<string name="share_game">Compartir partida</string>
<string name="notes">Notas</string>
<string name="engine_state_on">activado</string>
<string name="engine_state_off">desactivado</string>
<string name="engine_state_missing">no descargado</string>
<string name="found_of">Encontradas %1$s de %2$s</string>
<string name="group_game">Partida</string>
<string name="move_white">%1$d, blancas, %2$s</string>
<string name="move_black">%1$d, negras, %2$s</string>
<string name="current_move">jugada actual</string>
<string name="language">Idioma</string>
<string name="checkmate">Jaque mate</string>
<string name="stalemate">Ahogado</string>
<string name="pgn_copied">PGN copiado</string>
<string name="fen_copied">FEN copiado</string>
<string name="tag_event">Torneo</string>
<string name="tag_site">Lugar</string>
<string name="tag_date">Fecha</string>
<string name="tag_round">Ronda</string>
<string name="tag_white">Blancas</string>
<string name="tag_black">Negras</string>
<string name="tag_result">Resultado</string>
<string name="tag_white_elo">Elo blancas</string>
<string name="tag_black_elo">Elo negras</string>
<string name="tag_annotator">Comentarista</string>
<string name="tag_plies">Medias jugadas</string>
<string name="open_no_access">Sin acceso al archivo: se movió, se eliminó o se retiró el permiso. Quítalo de la lista y vuelve a añadirlo.</string>
<string name="open_corrupt">El archivo está dañado o no es una base de ajedrez.</string>
<string name="open_empty">El archivo comprimido no contiene ninguna base PGN ni ChessBase.</string>
<string name="open_unsupported">Este tipo de base no se puede leer: %1$s</string>
<string name="add_file">Archivo</string>
<string name="add_file_hint">PGN, .cbv, .zip o .7z</string>
<string name="add_folder">Carpeta</string>
<string name="add_folder_hint">Todas las bases de una carpeta, también ChessBase (.cbh)</string>
<string name="folder_scanning">Buscando bases…</string>
<string name="folder_empty_title">No hay bases en esta carpeta</string>
<string name="folder_empty_text">Se encuentran archivos PGN, bases de ChessBase (.cbh, .cbv) y archivos .zip o .7z, en la carpeta y en dos niveles de subcarpetas.</string>
<string name="folder_added">ya está en la lista</string>
<string name="folder_incomplete">falta el archivo .cbg: las partidas no se pueden abrir</string>
<plurals name="folder_found">
<item quantity="one">%1$d base en «%2$s»</item>
<item quantity="many">%1$d de bases en «%2$s»</item>
<item quantity="other">%1$d bases en «%2$s»</item>
</plurals>
<plurals name="add_chosen">
<item quantity="one">Añadir %1$d</item>
<item quantity="many">Añadir %1$d</item>
<item quantity="other">Añadir %1$d</item>
</plurals>
<plurals name="added_count">
<item quantity="one">%1$d base añadida</item>
<item quantity="many">%1$d de bases añadidas</item>
<item quantity="other">%1$d bases añadidas</item>
</plurals>
<string name="add_tree_hint">Android no deja elegir la raíz del almacenamiento ni «Descargas» en sí: solo una carpeta dentro de ellas.</string>
<string name="pick_another">Elegir otra</string>
<string name="done">Hecho</string>
<string name="add">Añadir</string>
<string name="choose_all">Marcar todas</string>
<string name="choose_none">Desmarcar todas</string>
<string name="open_missing_part">El archivo %1$s ya no está junto a la base: se movió o se borró.</string>
<string name="board_and_pieces">Tablero y piezas</string>
<string name="board_brown">Marrón</string>
<string name="board_blue">Azul</string>
<string name="board_green">Verde</string>
<string name="board_tournament">Torneo</string>
<string name="board_sand">Arena</string>
<string name="board_coral">Coral</string>
<string name="board_grey">Gris</string>
<string name="board_purple">Morado</string>
<string name="board_ice">Hielo</string>
<string name="board_navy">Azul marino</string>
<string name="board_mint">Menta</string>
<string name="board_emerald">Esmeralda</string>
<string name="board_orange">Naranja</string>
<string name="board_rose">Rosa</string>
<string name="board_dusk">Anochecer</string>
<string name="board_night">Noche</string>
<string name="board_wood">Madera</string>
<string name="board_maple">Arce</string>
<string name="board_leather">Cuero</string>
<string name="board_marble">Mármol</string>
<string name="board_blue_marble">Mármol azul</string>
<string name="board_canvas">Lienzo</string>
<string name="board_metal">Metal</string>
<string name="board_olive">Oliva</string>
<string name="board_stone">Piedra</string>
<string name="board_green_plastic">Plástico verde</string>
<string name="board_purple_diag">Diagonales moradas</string>
<string name="board_pink_pyramid">Pirámides rosas</string>
<string name="board_sketch">Boceto</string>
<string name="board">Tablero</string>
<string name="pieces_tab">Piezas</string>
<string name="game_number">N.º %1$s</string>
<string name="add_paste">Pegar PGN del portapapeles</string>
<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>
<string name="file_unreadable">No se pudo leer el archivo: ya no existe o la aplicación de la que viene no dio acceso. Ábralo otra vez.</string>
<string name="file_chessbase_part">Una base de ChessBase (.cbh) consta de varios archivos y solo llegó uno. Añada su carpeta: «Añadir base» → «Carpeta».</string>
<string name="file_copy_failed">La aplicación no pudo guardar una copia del archivo. Compruebe que el teléfono tiene espacio libre.</string>
<string name="db_copy">copia</string>
<string name="removed_copy">Base eliminada de ChessPenguin</string>
<!-- Game report (android-ui.md §21) -->
<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_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_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>
<string name="review_accuracy">Precisión</string>
<string name="review_accuracy_of">Precisión: blancas %1$s, negras %2$s</string>
<string name="review_report">Informe</string>
<string name="review_better">era mejor %1$s</string>
<string name="review_inaccuracy">Imprecisión</string>
<string name="review_mistake">Error</string>
<string name="review_blunder">Error grave</string>
<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>
<string name="review_acpl">Pérdida media de centipeones</string>
<string name="review_opening">Apertura</string>
<string name="review_middlegame">Medio juego</string>
<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_graph_state">%1$s, evaluación %2$s</string>
<string name="review_start_position">Posición inicial</string>
<plurals name="review_estimate">
<item quantity="one">%1$d posición, unos %2$s</item>
<item quantity="many">%1$d posiciones, unos %2$s</item>
<item quantity="other">%1$d posiciones, unos %2$s</item>
</plurals>
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
<string name="online_title">Partidas de Lichess y Chess.com</string>
<string name="add_online_hint">Partidas de cualquier jugador por apodo: las tuyas, de un alumno, de un rival</string>
<string name="online_intro">Las partidas del jugador se convierten en una base en el teléfono, para buscar, ver y analizar. Solo hace falta el apodo, sin iniciar sesión.</string>
<string name="online_nick">Apodo del jugador</string>
<string name="online_nick_hint">como en el sitio</string>
<string name="online_other">Otro apodo en Chess.com</string>
<string name="online_other_nick">Apodo en Chess.com</string>
<string name="online_same_nick">El mismo apodo</string>
<string name="online_nick_rule">Letras latinas, dígitos, _ y -, de 2 a 30 caracteres</string>
<string name="online_find">Buscar</string>
<string name="online_searching">Buscando en los sitios…</string>
<string name="online_lichess_found">%1$s · la primera vez unos %2$d min</string>
<string name="online_chesscom_found">meses con partidas: %1$d</string>
<string name="online_not_found">%1$s: no hay ningún jugador con este apodo; revisa cómo se escribe</string>
<string name="online_merge">Unir ambos sitios en una sola base</string>
<string name="online_merge_hint">Si no, cada sitio tendrá su propia base</string>
<string name="online_into_new">En la nueva base «%1$s»</string>
<string name="online_into_existing">En «%1$s» (ya hay %2$s; solo se añaden las nuevas)</string>
<string name="online_download">Descargar</string>
<string name="online_progress_lichess">Lichess: %1$s de unas %2$s · quedan unos %3$d min</string>
<string name="online_progress_count">%1$s: %2$s</string>
<string name="online_progress_chesscom">Chess.com: mes %1$d de %2$d · %3$s</string>
<string name="online_stop">Detener</string>
<string name="online_added">+%1$s, %2$s en total</string>
<string name="online_no_new">No hay partidas nuevas, %1$s en la base</string>
<string name="online_stopped">Detenido, %1$s en la base</string>
<string name="online_no_games">Allí no hay partidas de ajedrez estándar.</string>
<string name="online_open">Abrir la base</string>
<string name="online_try_again">Reintentar</string>
<string name="online_err_network">%1$s no responde. Comprueba la conexión a internet e inténtalo de nuevo.</string>
<string name="online_err_rate">%1$s pide una pausa: demasiadas solicitudes seguidas. Espera un minuto e inténtalo de nuevo; lo descargado se conserva.</string>
<string name="online_err_unexpected">%1$s respondió de una forma que ChessPenguin no entiende: quizá el sitio cambió. Inténtalo más tarde o actualiza ChessPenguin.</string>
<string name="online_err_disk">No se pudo escribir la base: el teléfono no tiene espacio.</string>
<string name="online_err_busy">Esta base ya se está descargando.</string>
<string name="online_short_network">%1$s no responde</string>
<string name="online_short_rate">%1$s pide una pausa</string>
<string name="online_short_failed">La descarga se interrumpió</string>
<string name="online_update">Descargar partidas nuevas</string>
<string name="online_stop_download">Detener la descarga</string>
<string name="online_downloading">Descargando · %1$s</string>
<string name="online_updated">actualizada %1$s</string>
<string name="online_unfinished">incompleta</string>
<string name="online_removed">Base descargada eliminada</string>
<string name="online_nick_lichess">Apodo en Lichess</string>
<string name="online_lichess_quick">%1$s · la primera vez menos de un minuto</string>
<string name="online_leave">Puedes salir de esta pantalla: la base ya está en la lista y la descarga continúa.</string>
<string name="online_done">Listo: %1$s</string>
<string name="online_updated_now">actualizada ahora mismo</string>
<string name="online_snack_added">«%1$s»: +%2$s, %3$s en total</string>
<string name="online_snack_none">«%1$s»: no hay partidas nuevas</string>
<string name="online_snack_failed">«%1$s»: %2$s</string>
<string name="online_open_short">Abrir</string>
<plurals name="games_up_to">
<item quantity="one">hasta %1$s partida</item>
<item quantity="many">hasta %1$s partidas</item>
<item quantity="other">hasta %1$s partidas</item>
</plurals>
<string name="upd_title">Ha salido la versión %1$s</string>
<string name="upd_you_have">Tienes la %1$s</string>
<string name="upd_update">Actualizar</string>
<string name="upd_install">Instalar</string>
<string name="upd_keeps">Las bases, los ajustes y el motor se conservan.</string>
<string name="upd_keeps_no_engine">Las bases y los ajustes se conservan.</string>
<string name="upd_closes">ChessPenguin se cierra durante la instalación; luego vuelve a abrirlo.</string>
<string name="upd_online_note">Se están descargando partidas: la instalación detendrá la descarga; luego puedes continuarla.</string>
<string name="upd_perm_title">Hace falta un permiso</string>
<string name="upd_perm_body">Android solo instala aplicaciones de fuera de una tienda con tu permiso. Se abrirán los ajustes: activa el interruptor para ChessPenguin y vuelve.</string>
<string name="upd_perm_open">Abrir ajustes</string>
<string name="upd_perm_denied">El permiso está desactivado; sin él, Android no instalará la nueva versión.</string>
<string name="upd_perm_granted">Permiso concedido, descargando</string>
<string name="upd_on_site">Descargar desde la web</string>
<string name="upd_open_site">Abrir la web</string>
<string name="upd_leave">Puedes cerrar esto: la descarga continúa.</string>
<string name="upd_waiting_net">Sin red. La descarga seguirá sola cuando vuelva la red.</string>
<string name="upd_waiting_net_short">Esperando red</string>
<string name="upd_checking_file">Comprobando el archivo…</string>
<string name="upd_keeping_engine">Guardando el motor…</string>
<string name="upd_installing">Instalando…</string>
<string name="upd_ready">La nueva versión está descargada y comprobada.</string>
<string name="upd_ready_short">Descargada y comprobada</string>
<string name="upd_ready_snack">La nueva versión está descargada</string>
<string name="upd_aborted">Instalación cancelada. La nueva versión está descargada: instálala cuando quieras.</string>
<string name="upd_notification">Actualización de ChessPenguin</string>
<string name="upd_done_snack">ChessPenguin se ha actualizado: %1$s → %2$s</string>
<string name="upd_err_failed">La descarga ha fallado. Inténtalo de nuevo.</string>
<string name="upd_err_corrupt">El archivo se dañó al descargarse, así que no se instaló. Inténtalo de nuevo.</string>
<string name="upd_err_release">Algo falla en esta versión: no se puede comprobar el archivo de Android. Descarga la nueva versión en la web.</string>
<string name="upd_err_storage">Android no ha instalado la nueva versión: no hay espacio. Libera %1$d MB e inténtalo de nuevo.</string>
<string name="upd_err_conflict">Android no ha instalado la nueva versión: este ChessPenguin está firmado con otra clave. La nueva versión solo se puede instalar tras desinstalar esta, y al desinstalarla se pierden la lista de bases y las bases descargadas.</string>
<string name="upd_err_blocked">Android o la protección del teléfono detuvo la instalación. Descarga la nueva versión en la web.</string>
<string name="upd_err_install">Android no ha instalado la nueva versión. Inténtalo de nuevo o descárgala en la web.</string>
<string name="upd_short_offline">Sin internet</string>
<string name="upd_short_space">No hay espacio suficiente</string>
<string name="upd_short_corrupt">El archivo se dañó</string>
<string name="upd_short_install">Android no la instaló</string>
<string name="upd_short_failed">La descarga ha fallado</string>
<string name="upd_more">Ver más</string>
<string name="upd_details">Detalles</string>
<string name="upd_copy">Copiar</string>
<string name="upd_group">Actualizaciones</string>
<string name="upd_auto">Buscar actualizaciones al iniciar</string>
<string name="upd_auto_sub">Una vez al día ChessPenguin pregunta a su sitio cuál es la última versión; el sitio cuenta las instalaciones en uso. Solo se envían un número aleatorio de esta instalación, la versión y el sistema. La comprobación sigue aunque las ofertas estén desactivadas.</string>
<string name="upd_offer">Ofrecer nuevas versiones</string>
<string name="upd_offer_sub">Una tarjeta en la pantalla Bases cuando sale una versión nueva.</string>
<string name="upd_offer_needs_check">Funciona con la comprobación de actualizaciones activada.</string>
<string name="upd_offers_off_snack">No lo ofreceremos más. Actívalo en Ajustes, Acerca de</string>
<string name="upd_dismiss_cd">No ofrecer actualizaciones</string>
<string name="upd_check_now">Comprobar ahora</string>
<string name="upd_checking">Comprobando…</string>
<string name="upd_latest">Tienes la última versión</string>
<string name="upd_checked">Última comprobación: %1$s</string>
<string name="upd_check_offline">Sin internet: no se pueden buscar actualizaciones</string>
<string name="upd_check_failed">No se pudieron comprobar las actualizaciones: el sitio no respondió. Inténtalo más tarde.</string>
<string name="s_about_available">Ha salido la versión %1$s</string>
<string name="s_about_downloading">Descargando la versión %1$s…</string>
<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

@ -0,0 +1,733 @@
<resources>
<string name="sample_classics">Parties classiques</string>
<string name="sample_alekhine">Alekhine</string>
<string name="empty_title">Vos bases apparaîtront ici</string>
<string name="empty_text">Ajoutez un fichier PGN, une base ChessBase ou une archive .zip/.7z — depuis le téléphone ou le cloud — ou téléchargez des parties de Lichess et Chess.com.</string>
<string name="add_database">Ajouter une base</string>
<string name="open_samples">Ouvrir les parties d’exemple</string>
<string name="not_opened">pas encore ouverte · %1$s</string>
<plurals name="games_count">
<item quantity="one">%1$s partie</item>
<item quantity="many">%1$s de parties</item>
<item quantity="other">%1$s parties</item>
</plurals>
<string name="games_with_format">%1$s · %2$s</string>
<string name="menu">Menu</string>
<string name="rename">Renommer</string>
<string name="remove">Retirer de la liste</string>
<string name="rename_hint">Le nom dans la liste. Le fichier n’est pas modifié.</string>
<string name="cancel">Annuler</string>
<string name="save">Enregistrer</string>
<string name="removed">Base retirée de la liste</string>
<string name="undo">Annuler</string>
<string name="back">Retour</string>
<string name="reading">Lecture…</string>
<string name="open_failed">Impossible d’ouvrir la base</string>
<string name="search">Rechercher</string>
<string name="search_hint">Joueur, tournoi, année</string>
<string name="nothing_found">Rien trouvé</string>
<string name="clear">Effacer</string>
<string name="game_of">%1$d sur %2$d</string>
<string name="previous_game">Partie précédente</string>
<string name="next_game">Partie suivante</string>
<string name="flip">Retourner l’échiquier</string>
<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_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>
<string name="black_won">Les Noirs ont gagné</string>
<string name="draw">Nulle</string>
<string name="game_failed">Impossible de lire la partie</string>
<string name="engine">Moteur</string>
<string name="thinking">Réflexion…</string>
<string name="depth">profondeur %1$d</string>
<string name="paused">en pause</string>
<string name="deeper">Plus loin</string>
<string name="more_lines">Plus de lignes</string>
<string name="fewer_lines">Moins de lignes</string>
<string name="engine_not_answering">Le moteur ne répond pas</string>
<string name="engine_not_starting">Le moteur ne démarre pas sur ce téléphone</string>
<string name="restart">Redémarrer</string>
<string name="engine_line_preview">Ligne du moteur · coup %1$d sur %2$d</string>
<string name="close">Fermer</string>
<string name="engine_sheet_title">Moteur Stockfish</string>
<string name="engine_sheet_text">Évalue la position et montre les meilleurs coups. Fonctionne hors ligne — il suffit de le télécharger une fois.</string>
<string name="engine_size">Taille : %1$d Mo</string>
<string name="engine_metered">Pas de Wi-Fi pour l’instant : le téléchargement utilisera les données mobiles.</string>
<string name="not_now">Plus tard</string>
<string name="download">Télécharger</string>
<string name="downloaded_of">%1$d sur %2$d Mo téléchargés</string>
<string name="cancel_download">Annuler</string>
<string name="download_cancelled">Téléchargement annulé</string>
<string name="engine_ready">Le moteur est prêt</string>
<string name="no_internet">Pas d’Internet. Connectez-vous à un réseau et réessayez.</string>
<string name="download_title">ChessPenguin : moteur Stockfish</string>
<string name="interrupted">Le téléchargement s’est arrêté. Veuillez réessayer.</string>
<string name="no_space">Espace insuffisant : %1$d Mo nécessaires.</string>
<string name="corrupt">Le fichier du moteur a été endommagé pendant le téléchargement. Téléchargez-le à nouveau.</string>
<string name="retry">Réessayer</string>
<string name="download_again">Télécharger à nouveau</string>
<string name="ok">OK</string>
<string name="preparing_engine">Préparation du moteur…</string>
<string name="settings">Paramètres</string>
<string name="group_look">Apparence</string>
<string name="group_engine">Moteur</string>
<string name="theme">Thème</string>
<string name="theme_system">Par défaut du système</string>
<string name="theme_light">Clair</string>
<string name="theme_dark">Sombre</string>
<string name="notation">Notation des coups</string>
<string name="notation_latin">Lettres anglaises (K Q R B N)</string>
<string name="notation_figurines">Figurines</string>
<string name="notation_local">Lettres françaises (R D T F C)</string>
<string name="notation_hint">Affichage seulement. Le PGN utilise toujours K Q R B N.</string>
<string name="animation">Animation des pièces</string>
<string name="best_arrow">Flèche du meilleur coup</string>
<string name="vibration">Vibration</string>
<string name="engine_built_in">Stockfish 19 · intégré</string>
<string name="engine_downloaded">Stockfish 19 · téléchargé</string>
<string name="engine_missing">Non téléchargé · Télécharger (%1$d Mo)</string>
<string name="engine_downloading">Téléchargement… %1$d sur %2$d Mo</string>
<string name="engine_delete">Supprimer le moteur (libère %1$d Mo)</string>
<string name="engine_delete_question">Supprimer le moteur ? Vous pourrez le télécharger à nouveau.</string>
<string name="delete">Supprimer</string>
<string name="lines">Lignes</string>
<string name="time_per_position">Temps par position</string>
<string name="seconds">%1$d s</string>
<string name="one_minute">1 min</string>
<string name="no_limit">Sans limite</string>
<string name="threads">Threads</string>
<string name="memory">Mémoire</string>
<string name="megabytes">%1$d Mo</string>
<string name="engine_battery">Le moteur consomme de la batterie. Il s’éteint de lui-même quand vous quittez la partie ou que l’application passe en arrière-plan.</string>
<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="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>
<string name="game_info">Détails de la partie</string>
<string name="copy_pgn">Copier le PGN</string>
<string name="copy_fen">Copier la FEN</string>
<string name="share_game">Partager la partie</string>
<string name="notes">Remarques</string>
<string name="engine_state_on">activé</string>
<string name="engine_state_off">désactivé</string>
<string name="engine_state_missing">non téléchargé</string>
<string name="found_of">%1$s trouvées sur %2$s</string>
<string name="group_game">Partie</string>
<string name="move_white">%1$d, Blancs, %2$s</string>
<string name="move_black">%1$d, Noirs, %2$s</string>
<string name="current_move">coup actuel</string>
<string name="language">Langue</string>
<string name="checkmate">Échec et mat</string>
<string name="stalemate">Pat</string>
<string name="pgn_copied">PGN copié</string>
<string name="fen_copied">FEN copiée</string>
<string name="tag_event">Tournoi</string>
<string name="tag_site">Lieu</string>
<string name="tag_date">Date</string>
<string name="tag_round">Ronde</string>
<string name="tag_white">Blancs</string>
<string name="tag_black">Noirs</string>
<string name="tag_result">Résultat</string>
<string name="tag_white_elo">Elo Blancs</string>
<string name="tag_black_elo">Elo Noirs</string>
<string name="tag_annotator">Commentateur</string>
<string name="tag_plies">Demi-coups</string>
<string name="open_no_access">Pas d’accès au fichier : il a été déplacé, supprimé ou son autorisation a été retirée. Retirez-le de la liste et ajoutez-le à nouveau.</string>
<string name="open_corrupt">Le fichier est endommagé ou n’est pas une base d’échecs.</string>
<string name="open_empty">L’archive ne contient aucune base PGN ou ChessBase.</string>
<string name="open_unsupported">Ce type de base ne peut pas être lu : %1$s</string>
<string name="add_file">Fichier</string>
<string name="add_file_hint">PGN, .cbv, .zip ou .7z</string>
<string name="add_folder">Dossier</string>
<string name="add_folder_hint">Toutes les bases d’un dossier, y compris ChessBase (.cbh)</string>
<string name="folder_scanning">Recherche des bases…</string>
<string name="folder_empty_title">Aucune base dans ce dossier</string>
<string name="folder_empty_text">Sont recherchés : fichiers PGN, bases ChessBase (.cbh, .cbv) et archives .zip ou .7z, dans le dossier et deux niveaux de sous-dossiers.</string>
<string name="folder_added">déjà dans la liste</string>
<string name="folder_incomplete">le fichier .cbg manque : les parties ne s’ouvrent pas</string>
<plurals name="folder_found">
<item quantity="one">%1$d base dans « %2$s »</item>
<item quantity="many">%1$d de bases dans « %2$s »</item>
<item quantity="other">%1$d bases dans « %2$s »</item>
</plurals>
<plurals name="add_chosen">
<item quantity="one">Ajouter %1$d</item>
<item quantity="many">Ajouter %1$d</item>
<item quantity="other">Ajouter %1$d</item>
</plurals>
<plurals name="added_count">
<item quantity="one">%1$d base ajoutée</item>
<item quantity="many">%1$d de bases ajoutées</item>
<item quantity="other">%1$d bases ajoutées</item>
</plurals>
<string name="add_tree_hint">Android ne laisse choisir ni la racine du stockage ni « Téléchargements » lui-même — seulement un dossier à l’intérieur.</string>
<string name="pick_another">Choisir un autre</string>
<string name="done">Terminé</string>
<string name="add">Ajouter</string>
<string name="choose_all">Tout cocher</string>
<string name="choose_none">Tout décocher</string>
<string name="open_missing_part">Le fichier %1$s n’est plus à côté de la base : il a été déplacé ou supprimé.</string>
<string name="board_and_pieces">Échiquier et pièces</string>
<string name="board_brown">Marron</string>
<string name="board_blue">Bleu</string>
<string name="board_green">Vert</string>
<string name="board_tournament">Tournoi</string>
<string name="board_sand">Sable</string>
<string name="board_coral">Corail</string>
<string name="board_grey">Gris</string>
<string name="board_purple">Violet</string>
<string name="board_ice">Glace</string>
<string name="board_navy">Marine</string>
<string name="board_mint">Menthe</string>
<string name="board_emerald">Émeraude</string>
<string name="board_orange">Orange</string>
<string name="board_rose">Rose</string>
<string name="board_dusk">Crépuscule</string>
<string name="board_night">Nuit</string>
<string name="board_wood">Bois</string>
<string name="board_maple">Érable</string>
<string name="board_leather">Cuir</string>
<string name="board_marble">Marbre</string>
<string name="board_blue_marble">Marbre bleu</string>
<string name="board_canvas">Toile</string>
<string name="board_metal">Métal</string>
<string name="board_olive">Olive</string>
<string name="board_stone">Pierre</string>
<string name="board_green_plastic">Plastique vert</string>
<string name="board_purple_diag">Diagonales violettes</string>
<string name="board_pink_pyramid">Pyramides roses</string>
<string name="board_sketch">Croquis</string>
<string name="board">Échiquier</string>
<string name="pieces_tab">Pièces</string>
<string name="game_number">N° %1$s</string>
<string name="add_paste">Coller le PGN du presse-papiers</string>
<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>
<string name="file_unreadable">Impossible de lire le fichier : il n’existe plus, ou l’application d’origine n’y a pas donné accès. Réessayez de l’ouvrir.</string>
<string name="file_chessbase_part">Une base ChessBase (.cbh) se compose de plusieurs fichiers, et un seul est arrivé. Ajoutez son dossier : « Ajouter une base » → « Dossier ».</string>
<string name="file_copy_failed">L’application n’a pas pu garder une copie du fichier. Vérifiez qu’il reste de la place sur le téléphone.</string>
<string name="db_copy">copie</string>
<string name="removed_copy">Base supprimée de ChessPenguin</string>
<!-- Game report (android-ui.md §21) -->
<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_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_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>
<string name="review_accuracy">Précision</string>
<string name="review_accuracy_of">Précision : Blancs %1$s, Noirs %2$s</string>
<string name="review_report">Rapport</string>
<string name="review_better">%1$s était meilleur</string>
<string name="review_inaccuracy">Imprécision</string>
<string name="review_mistake">Erreur</string>
<string name="review_blunder">Gaffe</string>
<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>
<string name="review_acpl">Perte moyenne en centipions</string>
<string name="review_opening">Ouverture</string>
<string name="review_middlegame">Milieu de partie</string>
<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_graph_state">%1$s, évaluation %2$s</string>
<string name="review_start_position">Position de départ</string>
<plurals name="review_estimate">
<item quantity="one">%1$d position, environ %2$s</item>
<item quantity="many">%1$d positions, environ %2$s</item>
<item quantity="other">%1$d positions, environ %2$s</item>
</plurals>
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
<string name="online_title">Parties de Lichess et Chess.com</string>
<string name="add_online_hint">Les parties de n\'importe quel joueur par pseudo : les vôtres, d\'un élève, d\'un adversaire</string>
<string name="online_intro">Les parties du joueur deviennent une base sur le téléphone, à chercher, voir et analyser. Seul le pseudo est nécessaire, sans connexion.</string>
<string name="online_nick">Pseudo du joueur</string>
<string name="online_nick_hint">comme sur le site</string>
<string name="online_other">Un autre pseudo sur Chess.com</string>
<string name="online_other_nick">Pseudo sur Chess.com</string>
<string name="online_same_nick">Le même pseudo</string>
<string name="online_nick_rule">Lettres latines, chiffres, _ et -, de 2 à 30 caractères</string>
<string name="online_find">Rechercher</string>
<string name="online_searching">Recherche sur les sites…</string>
<string name="online_lichess_found">%1$s · environ %2$d min la première fois</string>
<string name="online_chesscom_found">mois avec des parties : %1$d</string>
<string name="online_not_found">%1$s : aucun joueur avec ce pseudo — vérifiez l\'orthographe</string>
<string name="online_merge">Réunir les deux sites dans une seule base</string>
<string name="online_merge_hint">Sinon chaque site a sa propre base</string>
<string name="online_into_new">Dans la nouvelle base « %1$s »</string>
<string name="online_into_existing">Dans « %1$s » (déjà %2$s ; seules les nouvelles parties sont ajoutées)</string>
<string name="online_download">Télécharger</string>
<string name="online_progress_lichess">Lichess : %1$s sur environ %2$s · encore environ %3$d min</string>
<string name="online_progress_count">%1$s : %2$s</string>
<string name="online_progress_chesscom">Chess.com : mois %1$d sur %2$d · %3$s</string>
<string name="online_stop">Arrêter</string>
<string name="online_added">+%1$s, %2$s en tout</string>
<string name="online_no_new">Pas de nouvelles parties, %1$s dans la base</string>
<string name="online_stopped">Arrêté, %1$s dans la base</string>
<string name="online_no_games">Aucune partie d\'échecs standard là-bas.</string>
<string name="online_open">Ouvrir la base</string>
<string name="online_try_again">Réessayer</string>
<string name="online_err_network">%1$s ne répond pas. Vérifiez la connexion Internet et réessayez.</string>
<string name="online_err_rate">%1$s demande une pause : trop de requêtes d\'affilée. Attendez une minute et réessayez ; ce qui est téléchargé est conservé.</string>
<string name="online_err_unexpected">%1$s a répondu d\'une façon que ChessPenguin ne comprend pas : le site a peut-être changé. Réessayez plus tard ou mettez ChessPenguin à jour.</string>
<string name="online_err_disk">Impossible d\'écrire la base : le téléphone n\'a plus de place.</string>
<string name="online_err_busy">Cette base est déjà en cours de téléchargement.</string>
<string name="online_short_network">%1$s ne répond pas</string>
<string name="online_short_rate">%1$s demande une pause</string>
<string name="online_short_failed">Le téléchargement s\'est interrompu</string>
<string name="online_update">Télécharger les nouvelles parties</string>
<string name="online_stop_download">Arrêter le téléchargement</string>
<string name="online_downloading">Téléchargement · %1$s</string>
<string name="online_updated">mise à jour %1$s</string>
<string name="online_unfinished">incomplète</string>
<string name="online_removed">Base téléchargée supprimée</string>
<string name="online_nick_lichess">Pseudo sur Lichess</string>
<string name="online_lichess_quick">%1$s · moins d\'une minute la première fois</string>
<string name="online_leave">Vous pouvez quitter cet écran : la base est dans la liste et le téléchargement continue.</string>
<string name="online_done">Terminé : %1$s</string>
<string name="online_updated_now">mise à jour à l\'instant</string>
<string name="online_snack_added">« %1$s » : +%2$s, %3$s en tout</string>
<string name="online_snack_none">« %1$s » : pas de nouvelles parties</string>
<string name="online_snack_failed">« %1$s » : %2$s</string>
<string name="online_open_short">Ouvrir</string>
<plurals name="games_up_to">
<item quantity="one">jusqu\'à %1$s partie</item>
<item quantity="many">jusqu\'à %1$s parties</item>
<item quantity="other">jusqu\'à %1$s parties</item>
</plurals>
<string name="upd_title">La version %1$s est sortie</string>
<string name="upd_you_have">Vous avez %1$s</string>
<string name="upd_update">Mettre à jour</string>
<string name="upd_install">Installer</string>
<string name="upd_keeps">Les bases, les paramètres et le moteur sont conservés.</string>
<string name="upd_keeps_no_engine">Les bases et les paramètres sont conservés.</string>
<string name="upd_closes">ChessPenguin se ferme pendant l’installation — rouvrez-le ensuite.</string>
<string name="upd_online_note">Des parties sont en cours de téléchargement : l’installation va l’interrompre, vous pourrez le reprendre ensuite.</string>
<string name="upd_perm_title">Une autorisation est nécessaire</string>
<string name="upd_perm_body">Android n’installe des applications hors d’une boutique qu’avec votre autorisation. Les paramètres vont s’ouvrir : activez l’interrupteur pour ChessPenguin et revenez.</string>
<string name="upd_perm_open">Ouvrir les paramètres</string>
<string name="upd_perm_denied">L’autorisation est désactivée — sans elle, Android n’installera pas la nouvelle version.</string>
<string name="upd_perm_granted">Autorisation accordée, téléchargement en cours</string>
<string name="upd_on_site">Télécharger sur le site</string>
<string name="upd_open_site">Ouvrir le site</string>
<string name="upd_leave">Vous pouvez fermer : le téléchargement continue.</string>
<string name="upd_waiting_net">Pas de réseau. Le téléchargement reprendra tout seul quand le réseau reviendra.</string>
<string name="upd_waiting_net_short">En attente du réseau</string>
<string name="upd_checking_file">Vérification du fichier…</string>
<string name="upd_keeping_engine">Conservation du moteur…</string>
<string name="upd_installing">Installation…</string>
<string name="upd_ready">La nouvelle version est téléchargée et vérifiée.</string>
<string name="upd_ready_short">Téléchargée et vérifiée</string>
<string name="upd_ready_snack">La nouvelle version est téléchargée</string>
<string name="upd_aborted">Installation annulée. La nouvelle version est téléchargée — installez-la quand vous voulez.</string>
<string name="upd_notification">Mise à jour de ChessPenguin</string>
<string name="upd_done_snack">ChessPenguin est mis à jour : %1$s → %2$s</string>
<string name="upd_err_failed">Le téléchargement a échoué. Réessayez.</string>
<string name="upd_err_corrupt">Le fichier a été endommagé pendant le téléchargement ; il n’a pas été installé. Réessayez.</string>
<string name="upd_err_release">Cette version pose problème : le fichier Android ne peut pas être vérifié. Téléchargez la nouvelle version sur le site.</string>
<string name="upd_err_storage">Android n’a pas installé la nouvelle version : pas assez d’espace. Libérez %1$d Mo et réessayez.</string>
<string name="upd_err_conflict">Android n’a pas installé la nouvelle version : ce ChessPenguin est signé avec une autre clé. La nouvelle version ne peut s’installer qu’après la suppression de celle-ci, et la suppression efface la liste des bases et les bases téléchargées.</string>
<string name="upd_err_blocked">Android ou la protection du téléphone a arrêté l’installation. Téléchargez la nouvelle version sur le site.</string>
<string name="upd_err_install">Android n’a pas installé la nouvelle version. Réessayez ou téléchargez-la sur le site.</string>
<string name="upd_short_offline">Pas d’Internet</string>
<string name="upd_short_space">Pas assez d’espace</string>
<string name="upd_short_corrupt">Le fichier est endommagé</string>
<string name="upd_short_install">Android ne l’a pas installée</string>
<string name="upd_short_failed">Le téléchargement a échoué</string>
<string name="upd_more">En savoir plus</string>
<string name="upd_details">Détails</string>
<string name="upd_copy">Copier</string>
<string name="upd_group">Mises à jour</string>
<string name="upd_auto">Rechercher les mises à jour au démarrage</string>
<string name="upd_auto_sub">Une fois par jour, ChessPenguin demande à son site quelle est la dernière version ; le site compte les installations actives. Seuls un numéro aléatoire de cette installation, la version et le système sont envoyés. La vérification se fait même sans les propositions.</string>
<string name="upd_offer">Proposer les nouvelles versions</string>
<string name="upd_offer_sub">Une carte sur l’écran Bases quand une nouvelle version sort.</string>
<string name="upd_offer_needs_check">Fonctionne quand la vérification des mises à jour est activée.</string>
<string name="upd_offers_off_snack">Nous ne le proposerons plus. Réactivez-le dans Réglages, À propos</string>
<string name="upd_dismiss_cd">Ne pas proposer les mises à jour</string>
<string name="upd_check_now">Vérifier maintenant</string>
<string name="upd_checking">Vérification…</string>
<string name="upd_latest">Vous avez la dernière version</string>
<string name="upd_checked">Dernière vérification : %1$s</string>
<string name="upd_check_offline">Pas d’Internet — impossible de vérifier les mises à jour</string>
<string name="upd_check_failed">Impossible de vérifier les mises à jour : le site n’a pas répondu. Réessayez plus tard.</string>
<string name="s_about_available">La version %1$s est sortie</string>
<string name="s_about_downloading">Téléchargement de la version %1$s…</string>
<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

@ -0,0 +1,733 @@
<resources>
<string name="sample_classics">Partite classiche</string>
<string name="sample_alekhine">Alekhine</string>
<string name="empty_title">Qui compariranno i tuoi database</string>
<string name="empty_text">Aggiungi un file PGN, un database ChessBase o un archivio .zip/.7z — dal telefono o dal cloud — oppure scarica partite da Lichess e Chess.com.</string>
<string name="add_database">Aggiungi database</string>
<string name="open_samples">Apri le partite di esempio</string>
<string name="not_opened">non ancora aperto · %1$s</string>
<plurals name="games_count">
<item quantity="one">%1$s partita</item>
<item quantity="many">%1$s di partite</item>
<item quantity="other">%1$s partite</item>
</plurals>
<string name="games_with_format">%1$s · %2$s</string>
<string name="menu">Menu</string>
<string name="rename">Rinomina</string>
<string name="remove">Rimuovi dall\'elenco</string>
<string name="rename_hint">Il nome nell\'elenco. Il file non viene modificato.</string>
<string name="cancel">Annulla</string>
<string name="save">Salva</string>
<string name="removed">Database rimosso dall\'elenco</string>
<string name="undo">Annulla</string>
<string name="back">Indietro</string>
<string name="reading">Lettura…</string>
<string name="open_failed">Impossibile aprire il database</string>
<string name="search">Cerca</string>
<string name="search_hint">Giocatore, torneo, anno</string>
<string name="nothing_found">Nessun risultato</string>
<string name="clear">Cancella</string>
<string name="game_of">%1$d di %2$d</string>
<string name="previous_game">Partita precedente</string>
<string name="next_game">Partita successiva</string>
<string name="flip">Ruota la scacchiera</string>
<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_description">Scacchiera, posizione dopo %1$s</string>
<string name="board_start">Scacchiera, posizione iniziale</string>
<string name="white_won">Hanno vinto i bianchi</string>
<string name="black_won">Hanno vinto i neri</string>
<string name="draw">Patta</string>
<string name="game_failed">Impossibile leggere la partita</string>
<string name="engine">Motore</string>
<string name="thinking">Sto pensando…</string>
<string name="depth">profondità %1$d</string>
<string name="paused">in pausa</string>
<string name="deeper">Più a fondo</string>
<string name="more_lines">Più linee</string>
<string name="fewer_lines">Meno linee</string>
<string name="engine_not_answering">Il motore non risponde</string>
<string name="engine_not_starting">Il motore non si avvia su questo telefono</string>
<string name="restart">Riavvia</string>
<string name="engine_line_preview">Linea del motore · mossa %1$d di %2$d</string>
<string name="close">Chiudi</string>
<string name="engine_sheet_title">Motore Stockfish</string>
<string name="engine_sheet_text">Valuta la posizione e mostra le mosse migliori. Funziona offline — basta scaricarlo una volta.</string>
<string name="engine_size">Dimensione: %1$d MB</string>
<string name="engine_metered">Ora non c\'è Wi-Fi: il download userà i dati mobili.</string>
<string name="not_now">Non ora</string>
<string name="download">Scarica</string>
<string name="downloaded_of">Scaricati %1$d di %2$d MB</string>
<string name="cancel_download">Annulla</string>
<string name="download_cancelled">Download annullato</string>
<string name="engine_ready">Il motore è pronto</string>
<string name="no_internet">Nessuna connessione Internet. Connettiti a una rete e riprova.</string>
<string name="download_title">ChessPenguin: motore Stockfish</string>
<string name="interrupted">Il download si è interrotto. Riprova.</string>
<string name="no_space">Spazio insufficiente: servono %1$d MB.</string>
<string name="corrupt">Il file del motore si è danneggiato durante il download. Scaricalo di nuovo.</string>
<string name="retry">Riprova</string>
<string name="download_again">Scarica di nuovo</string>
<string name="ok">OK</string>
<string name="preparing_engine">Preparazione del motore…</string>
<string name="settings">Impostazioni</string>
<string name="group_look">Aspetto</string>
<string name="group_engine">Motore</string>
<string name="theme">Tema</string>
<string name="theme_system">Predefinito di sistema</string>
<string name="theme_light">Chiaro</string>
<string name="theme_dark">Scuro</string>
<string name="notation">Notazione delle mosse</string>
<string name="notation_latin">Lettere inglesi (K Q R B N)</string>
<string name="notation_figurines">Figurine</string>
<string name="notation_local">Lettere italiane (R D T A C)</string>
<string name="notation_hint">Solo per la visualizzazione. Il PGN usa sempre K Q R B N.</string>
<string name="animation">Animazione dei pezzi</string>
<string name="best_arrow">Freccia della mossa migliore</string>
<string name="vibration">Vibrazione</string>
<string name="engine_built_in">Stockfish 19 · incluso</string>
<string name="engine_downloaded">Stockfish 19 · scaricato</string>
<string name="engine_missing">Non scaricato · Scarica (%1$d MB)</string>
<string name="engine_downloading">Scaricamento… %1$d di %2$d MB</string>
<string name="engine_delete">Elimina il motore (libera %1$d MB)</string>
<string name="engine_delete_question">Eliminare il motore? Potrai scaricarlo di nuovo.</string>
<string name="delete">Elimina</string>
<string name="lines">Linee</string>
<string name="time_per_position">Tempo per posizione</string>
<string name="seconds">%1$d s</string>
<string name="one_minute">1 min</string>
<string name="no_limit">Nessun limite</string>
<string name="threads">Thread</string>
<string name="memory">Memoria</string>
<string name="megabytes">%1$d MB</string>
<string name="engine_battery">Il motore consuma batteria. Si spegne da solo quando esci dalla partita o l’app va in background.</string>
<string name="about">Informazioni</string>
<string name="build_full">Stockfish incluso</string>
<string name="build_light">Stockfish si scarica nell\'app</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>
<string name="game_info">Dati della partita</string>
<string name="copy_pgn">Copia PGN</string>
<string name="copy_fen">Copia FEN</string>
<string name="share_game">Condividi la partita</string>
<string name="notes">Note</string>
<string name="engine_state_on">attivo</string>
<string name="engine_state_off">disattivato</string>
<string name="engine_state_missing">non scaricato</string>
<string name="found_of">Trovate %1$s di %2$s</string>
<string name="group_game">Partita</string>
<string name="move_white">%1$d, Bianco, %2$s</string>
<string name="move_black">%1$d, Nero, %2$s</string>
<string name="current_move">mossa attuale</string>
<string name="language">Lingua</string>
<string name="checkmate">Scacco matto</string>
<string name="stalemate">Stallo</string>
<string name="pgn_copied">PGN copiato</string>
<string name="fen_copied">FEN copiata</string>
<string name="tag_event">Torneo</string>
<string name="tag_site">Luogo</string>
<string name="tag_date">Data</string>
<string name="tag_round">Turno</string>
<string name="tag_white">Bianco</string>
<string name="tag_black">Nero</string>
<string name="tag_result">Risultato</string>
<string name="tag_white_elo">Elo Bianco</string>
<string name="tag_black_elo">Elo Nero</string>
<string name="tag_annotator">Commentatore</string>
<string name="tag_plies">Semimosse</string>
<string name="open_no_access">Nessun accesso al file: è stato spostato, eliminato o il permesso è stato revocato. Rimuovilo dall\'elenco e aggiungilo di nuovo.</string>
<string name="open_corrupt">Il file è danneggiato o non è un database scacchistico.</string>
<string name="open_empty">Nell\'archivio non c\'è alcun database PGN o ChessBase.</string>
<string name="open_unsupported">Questo tipo di database non può essere letto: %1$s</string>
<string name="add_file">File</string>
<string name="add_file_hint">PGN, .cbv, .zip o .7z</string>
<string name="add_folder">Cartella</string>
<string name="add_folder_hint">Tutti i database di una cartella, anche ChessBase (.cbh)</string>
<string name="folder_scanning">Cerco i database…</string>
<string name="folder_empty_title">Nessun database in questa cartella</string>
<string name="folder_empty_text">Vengono trovati file PGN, database ChessBase (.cbh, .cbv) e archivi .zip o .7z, nella cartella e in due livelli di sottocartelle.</string>
<string name="folder_added">già nell’elenco</string>
<string name="folder_incomplete">manca il file .cbg: le partite non si possono aprire</string>
<plurals name="folder_found">
<item quantity="one">%1$d database in «%2$s»</item>
<item quantity="many">%1$d di database in «%2$s»</item>
<item quantity="other">%1$d database in «%2$s»</item>
</plurals>
<plurals name="add_chosen">
<item quantity="one">Aggiungi %1$d</item>
<item quantity="many">Aggiungi %1$d</item>
<item quantity="other">Aggiungi %1$d</item>
</plurals>
<plurals name="added_count">
<item quantity="one">%1$d database aggiunto</item>
<item quantity="many">%1$d di database aggiunti</item>
<item quantity="other">%1$d database aggiunti</item>
</plurals>
<string name="add_tree_hint">Android non permette di scegliere la radice della memoria né «Download» stessa: solo una cartella al loro interno.</string>
<string name="pick_another">Scegli un’altra</string>
<string name="done">Fatto</string>
<string name="add">Aggiungi</string>
<string name="choose_all">Seleziona tutti</string>
<string name="choose_none">Deseleziona tutti</string>
<string name="open_missing_part">Il file %1$s non è più accanto al database: è stato spostato o eliminato.</string>
<string name="board_and_pieces">Scacchiera e pezzi</string>
<string name="board_brown">Marrone</string>
<string name="board_blue">Blu</string>
<string name="board_green">Verde</string>
<string name="board_tournament">Torneo</string>
<string name="board_sand">Sabbia</string>
<string name="board_coral">Corallo</string>
<string name="board_grey">Grigio</string>
<string name="board_purple">Viola</string>
<string name="board_ice">Ghiaccio</string>
<string name="board_navy">Blu navy</string>
<string name="board_mint">Menta</string>
<string name="board_emerald">Smeraldo</string>
<string name="board_orange">Arancione</string>
<string name="board_rose">Rosa</string>
<string name="board_dusk">Crepuscolo</string>
<string name="board_night">Notte</string>
<string name="board_wood">Legno</string>
<string name="board_maple">Acero</string>
<string name="board_leather">Pelle</string>
<string name="board_marble">Marmo</string>
<string name="board_blue_marble">Marmo blu</string>
<string name="board_canvas">Tela</string>
<string name="board_metal">Metallo</string>
<string name="board_olive">Oliva</string>
<string name="board_stone">Pietra</string>
<string name="board_green_plastic">Plastica verde</string>
<string name="board_purple_diag">Diagonali viola</string>
<string name="board_pink_pyramid">Piramidi rosa</string>
<string name="board_sketch">Schizzo</string>
<string name="board">Scacchiera</string>
<string name="pieces_tab">Pezzi</string>
<string name="game_number">N. %1$s</string>
<string name="add_paste">Incolla PGN dagli appunti</string>
<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>
<string name="file_unreadable">Impossibile leggere il file: non esiste più o l’app da cui proviene non ha concesso l’accesso. Riaprilo.</string>
<string name="file_chessbase_part">Un database ChessBase (.cbh) è fatto di più file, ma ne è arrivato solo uno. Aggiungi la sua cartella: «Aggiungi database» → «Cartella».</string>
<string name="file_copy_failed">L’app non è riuscita a salvare una copia del file. Controlla che sul telefono ci sia spazio libero.</string>
<string name="db_copy">copia</string>
<string name="removed_copy">Database eliminato da ChessPenguin</string>
<!-- Game report (android-ui.md §21) -->
<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_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_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>
<string name="review_accuracy">Precisione</string>
<string name="review_accuracy_of">Precisione: Bianco %1$s, Nero %2$s</string>
<string name="review_report">Resoconto</string>
<string name="review_better">era meglio %1$s</string>
<string name="review_inaccuracy">Imprecisione</string>
<string name="review_mistake">Errore</string>
<string name="review_blunder">Svarione</string>
<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>
<string name="review_acpl">Perdita media in centipedoni</string>
<string name="review_opening">Apertura</string>
<string name="review_middlegame">Mediogioco</string>
<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_graph_state">%1$s, valutazione %2$s</string>
<string name="review_start_position">Posizione iniziale</string>
<plurals name="review_estimate">
<item quantity="one">%1$d posizione, circa %2$s</item>
<item quantity="many">%1$d posizioni, circa %2$s</item>
<item quantity="other">%1$d posizioni, circa %2$s</item>
</plurals>
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
<string name="online_title">Partite da Lichess e Chess.com</string>
<string name="add_online_hint">Partite di qualsiasi giocatore per nickname: le tue, di un allievo, di un avversario</string>
<string name="online_intro">Le partite del giocatore diventano una base sul telefono, da cercare, vedere e analizzare. Serve solo il nickname, senza accesso.</string>
<string name="online_nick">Nickname del giocatore</string>
<string name="online_nick_hint">come sul sito</string>
<string name="online_other">Un altro nickname su Chess.com</string>
<string name="online_other_nick">Nickname su Chess.com</string>
<string name="online_same_nick">Lo stesso nickname</string>
<string name="online_nick_rule">Lettere latine, cifre, _ e -, da 2 a 30 caratteri</string>
<string name="online_find">Cerca</string>
<string name="online_searching">Cerco sui siti…</string>
<string name="online_lichess_found">%1$s · la prima volta circa %2$d min</string>
<string name="online_chesscom_found">mesi con partite: %1$d</string>
<string name="online_not_found">%1$s: nessun giocatore con questo nickname — controlla come è scritto</string>
<string name="online_merge">Unire entrambi i siti in una sola base</string>
<string name="online_merge_hint">Altrimenti ogni sito avrà la sua base</string>
<string name="online_into_new">Nella nuova base «%1$s»</string>
<string name="online_into_existing">In «%1$s» (già %2$s; si aggiungono solo le nuove)</string>
<string name="online_download">Scarica</string>
<string name="online_progress_lichess">Lichess: %1$s di circa %2$s · mancano circa %3$d min</string>
<string name="online_progress_count">%1$s: %2$s</string>
<string name="online_progress_chesscom">Chess.com: mese %1$d di %2$d · %3$s</string>
<string name="online_stop">Ferma</string>
<string name="online_added">+%1$s, %2$s in tutto</string>
<string name="online_no_new">Nessuna partita nuova, %1$s nella base</string>
<string name="online_stopped">Fermato, %1$s nella base</string>
<string name="online_no_games">Lì non ci sono partite di scacchi standard.</string>
<string name="online_open">Apri la base</string>
<string name="online_try_again">Riprova</string>
<string name="online_err_network">%1$s non risponde. Controlla la connessione a internet e riprova.</string>
<string name="online_err_rate">%1$s chiede una pausa: troppe richieste di fila. Aspetta un minuto e riprova; il già scaricato resta.</string>
<string name="online_err_unexpected">%1$s ha risposto in un modo che ChessPenguin non capisce: forse il sito è cambiato. Riprova più tardi o aggiorna ChessPenguin.</string>
<string name="online_err_disk">Impossibile scrivere la base: il telefono non ha spazio.</string>
<string name="online_err_busy">Questa base è già in download.</string>
<string name="online_short_network">%1$s non risponde</string>
<string name="online_short_rate">%1$s chiede una pausa</string>
<string name="online_short_failed">Il download si è interrotto</string>
<string name="online_update">Scarica le partite nuove</string>
<string name="online_stop_download">Ferma il download</string>
<string name="online_downloading">Download in corso · %1$s</string>
<string name="online_updated">aggiornata %1$s</string>
<string name="online_unfinished">incompleta</string>
<string name="online_removed">Base scaricata eliminata</string>
<string name="online_nick_lichess">Nickname su Lichess</string>
<string name="online_lichess_quick">%1$s · la prima volta meno di un minuto</string>
<string name="online_leave">Puoi uscire da questa schermata: la base è già nell\'elenco e il download continua.</string>
<string name="online_done">Fatto: %1$s</string>
<string name="online_updated_now">aggiornata adesso</string>
<string name="online_snack_added">«%1$s»: +%2$s, %3$s in tutto</string>
<string name="online_snack_none">«%1$s»: nessuna partita nuova</string>
<string name="online_snack_failed">«%1$s»: %2$s</string>
<string name="online_open_short">Apri</string>
<plurals name="games_up_to">
<item quantity="one">fino a %1$s partita</item>
<item quantity="many">fino a %1$s partite</item>
<item quantity="other">fino a %1$s partite</item>
</plurals>
<string name="upd_title">È uscita la versione %1$s</string>
<string name="upd_you_have">Hai la %1$s</string>
<string name="upd_update">Aggiorna</string>
<string name="upd_install">Installa</string>
<string name="upd_keeps">Database, impostazioni e motore vengono mantenuti.</string>
<string name="upd_keeps_no_engine">Database e impostazioni restano.</string>
<string name="upd_closes">ChessPenguin si chiude durante l’installazione: poi riaprilo.</string>
<string name="upd_online_note">Si stanno scaricando partite: l’installazione interrompe il download, poi puoi riprenderlo.</string>
<string name="upd_perm_title">Serve un’autorizzazione</string>
<string name="upd_perm_body">Android installa app non provenienti da uno store solo con il tuo permesso. Si apriranno le impostazioni: attiva l’interruttore per ChessPenguin e torna indietro.</string>
<string name="upd_perm_open">Apri impostazioni</string>
<string name="upd_perm_denied">L’autorizzazione è disattivata: senza di essa, Android non installerà la nuova versione.</string>
<string name="upd_perm_granted">Autorizzazione concessa, download in corso</string>
<string name="upd_on_site">Scarica dal sito</string>
<string name="upd_open_site">Apri il sito</string>
<string name="upd_leave">Puoi chiudere: il download continua.</string>
<string name="upd_waiting_net">Nessuna rete. Il download riprenderà da solo quando torna la rete.</string>
<string name="upd_waiting_net_short">In attesa di rete</string>
<string name="upd_checking_file">Controllo del file…</string>
<string name="upd_keeping_engine">Salvataggio del motore…</string>
<string name="upd_installing">Installazione…</string>
<string name="upd_ready">La nuova versione è scaricata e controllata.</string>
<string name="upd_ready_short">Scaricata e controllata</string>
<string name="upd_ready_snack">La nuova versione è scaricata</string>
<string name="upd_aborted">Installazione annullata. La nuova versione è scaricata: installala quando vuoi.</string>
<string name="upd_notification">Aggiornamento di ChessPenguin</string>
<string name="upd_done_snack">ChessPenguin è aggiornato: %1$s → %2$s</string>
<string name="upd_err_failed">Il download non è riuscito. Riprova.</string>
<string name="upd_err_corrupt">Il file si è danneggiato durante lo scaricamento, quindi non è stato installato. Riprova.</string>
<string name="upd_err_release">Qualcosa non va in questa versione: il file per Android non si può controllare. Scarica la nuova versione dal sito.</string>
<string name="upd_err_storage">Android non ha installato la nuova versione: spazio insufficiente. Libera %1$d MB e riprova.</string>
<string name="upd_err_conflict">Android non ha installato la nuova versione: questo ChessPenguin è firmato con un’altra chiave. La nuova versione si può installare solo dopo aver rimosso questa, e rimuovendola si perdono l’elenco dei database e i database scaricati.</string>
<string name="upd_err_blocked">Android o la protezione del telefono ha fermato l’installazione. Scarica la nuova versione dal sito.</string>
<string name="upd_err_install">Android non ha installato la nuova versione. Riprova o scaricala dal sito.</string>
<string name="upd_short_offline">Nessuna connessione</string>
<string name="upd_short_space">Spazio insufficiente</string>
<string name="upd_short_corrupt">Il file si è danneggiato</string>
<string name="upd_short_install">Android non l’ha installata</string>
<string name="upd_short_failed">Download non riuscito</string>
<string name="upd_more">Scopri di più</string>
<string name="upd_details">Dettagli</string>
<string name="upd_copy">Copia</string>
<string name="upd_group">Aggiornamenti</string>
<string name="upd_auto">Cerca aggiornamenti all’avvio</string>
<string name="upd_auto_sub">Una volta al giorno ChessPenguin chiede al suo sito qual è l’ultima versione; il sito conta le installazioni in uso. Vengono inviati solo un numero casuale di questa installazione, la versione e il sistema. Il controllo avviene anche senza le proposte.</string>
<string name="upd_offer">Proponi nuove versioni</string>
<string name="upd_offer_sub">Una scheda nella schermata Database quando esce una nuova versione.</string>
<string name="upd_offer_needs_check">Funziona con il controllo degli aggiornamenti attivo.</string>
<string name="upd_offers_off_snack">Non lo proporremo più. Riattivalo in Impostazioni, Informazioni</string>
<string name="upd_dismiss_cd">Non proporre aggiornamenti</string>
<string name="upd_check_now">Controlla ora</string>
<string name="upd_checking">Controllo in corso…</string>
<string name="upd_latest">Hai l’ultima versione</string>
<string name="upd_checked">Ultimo controllo: %1$s</string>
<string name="upd_check_offline">Nessuna connessione: impossibile cercare aggiornamenti</string>
<string name="upd_check_failed">Impossibile controllare gli aggiornamenti: il sito non ha risposto. Riprova più tardi.</string>
<string name="s_about_available">È uscita la versione %1$s</string>
<string name="s_about_downloading">Scaricamento della versione %1$s…</string>
<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

@ -0,0 +1,725 @@
<resources>
<string name="sample_classics">Классикалық партиялар</string>
<string name="sample_alekhine">Алехин</string>
<string name="empty_title">Базаларыңыз осында пайда болады</string>
<string name="empty_text">PGN файлын, ChessBase базасын немесе .zip/.7z мұрағатын телефоннан не бұлттан қосыңыз, немесе Lichess пен Chess.com-нан партиялар жүктеп алыңыз.</string>
<string name="add_database">База қосу</string>
<string name="open_samples">Үлгі партияларды ашу</string>
<string name="not_opened">әлі ашылмаған · %1$s</string>
<plurals name="games_count">
<item quantity="one">%1$s партия</item>
<item quantity="other">%1$s партия</item>
</plurals>
<string name="games_with_format">%1$s · %2$s</string>
<string name="menu">Мәзір</string>
<string name="rename">Атын өзгерту</string>
<string name="remove">Тізімнен алып тастау</string>
<string name="rename_hint">Тізімдегі атауы. Файл өзгермейді.</string>
<string name="cancel">Бас тарту</string>
<string name="save">Сақтау</string>
<string name="removed">База тізімнен алынды</string>
<string name="undo">Болдырмау</string>
<string name="back">Артқа</string>
<string name="reading">Оқылуда…</string>
<string name="open_failed">Базаны ашу мүмкін болмады</string>
<string name="search">Іздеу</string>
<string name="search_hint">Ойыншы, турнир, жыл</string>
<string name="nothing_found">Ештеңе табылмады</string>
<string name="clear">Тазалау</string>
<string name="game_of">%1$d / %2$d</string>
<string name="previous_game">Алдыңғы партия</string>
<string name="next_game">Келесі партия</string>
<string name="flip">Тақтаны аудару</string>
<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_description">Тақта, %1$s кейінгі позиция</string>
<string name="board_start">Тақта, бастапқы позиция</string>
<string name="white_won">Ақтар жеңді</string>
<string name="black_won">Қаралар жеңді</string>
<string name="draw">Тең ойын</string>
<string name="game_failed">Партияны оқу мүмкін болмады</string>
<string name="engine">Қозғалтқыш</string>
<string name="thinking">Ойлануда…</string>
<string name="depth">тереңдік %1$d</string>
<string name="paused">кідіртілді</string>
<string name="deeper">Тереңірек</string>
<string name="more_lines">Көбірек вариант</string>
<string name="fewer_lines">Азырақ вариант</string>
<string name="engine_not_answering">Қозғалтқыш жауап бермейді</string>
<string name="engine_not_starting">Қозғалтқыш бұл телефонда іске қосылмайды</string>
<string name="restart">Қайта іске қосу</string>
<string name="engine_line_preview">Қозғалтқыш варианты · жүріс %1$d / %2$d</string>
<string name="close">Жабу</string>
<string name="engine_sheet_title">Stockfish қозғалтқышы</string>
<string name="engine_sheet_text">Позицияны бағалап, үздік жүрістерді көрсетеді. Интернетсіз жұмыс істейді — оны бір рет жүктеп алу жеткілікті.</string>
<string name="engine_size">Көлемі: %1$d МБ</string>
<string name="engine_metered">Қазір Wi-Fi жоқ: жүктеу мобильді трафикті пайдаланады.</string>
<string name="not_now">Қазір емес</string>
<string name="download">Жүктеп алу</string>
<string name="downloaded_of">Жүктелді %1$d / %2$d МБ</string>
<string name="cancel_download">Бас тарту</string>
<string name="download_cancelled">Жүктеу тоқтатылды</string>
<string name="engine_ready">Қозғалтқыш дайын</string>
<string name="no_internet">Интернет жоқ. Желіге қосылып, қайталап көріңіз.</string>
<string name="download_title">ChessPenguin: Stockfish қозғалтқышы</string>
<string name="interrupted">Жүктеу тоқтап қалды. Қайталап көріңіз.</string>
<string name="no_space">Орын жетпейді: %1$d МБ керек.</string>
<string name="corrupt">Қозғалтқыш файлы жүктеу кезінде бүлінді. Қайта жүктеп алыңыз.</string>
<string name="retry">Қайталап көру</string>
<string name="download_again">Қайта жүктеу</string>
<string name="ok">OK</string>
<string name="preparing_engine">Қозғалтқыш дайындалуда…</string>
<string name="settings">Баптаулар</string>
<string name="group_look">Сыртқы түрі</string>
<string name="group_engine">Қозғалтқыш</string>
<string name="theme">Тақырып</string>
<string name="theme_system">Жүйедегідей</string>
<string name="theme_light">Ашық</string>
<string name="theme_dark">Қараңғы</string>
<string name="notation">Жүрістер жазбасы</string>
<string name="notation_latin">Латын әріптері (K Q R B N)</string>
<string name="notation_figurines">Фигуралар белгісі</string>
<string name="notation_local">Тілдің әріптері</string>
<string name="notation_hint">Тек көрінісі. PGN-да әрқашан K Q R B N.</string>
<string name="animation">Фигуралар анимациясы</string>
<string name="best_arrow">Үздік жүріс көрсеткісі</string>
<string name="vibration">Діріл</string>
<string name="engine_built_in">Stockfish 19 · кіріктірілген</string>
<string name="engine_downloaded">Stockfish 19 · жүктелген</string>
<string name="engine_missing">Жүктелмеген · Жүктеп алу (%1$d МБ)</string>
<string name="engine_downloading">Жүктелуде… %1$d / %2$d МБ</string>
<string name="engine_delete">Қозғалтқышты жою (%1$d МБ босайды)</string>
<string name="engine_delete_question">Қозғалтқыш жойылсын ба? Оны қайта жүктеп алуға болады.</string>
<string name="delete">Жою</string>
<string name="lines">Варианттар</string>
<string name="time_per_position">Позицияға уақыт</string>
<string name="seconds">%1$d с</string>
<string name="one_minute">1 мин</string>
<string name="no_limit">Шектеусіз</string>
<string name="threads">Ағындар</string>
<string name="memory">Жад</string>
<string name="megabytes">%1$d МБ</string>
<string name="engine_battery">Қозғалтқыш батареяны пайдаланады. Партиядан шыққанда немесе бағдарлама фонға кеткенде ол өзі өшеді.</string>
<string name="about">Бағдарлама туралы</string>
<string name="build_full">Stockfish кіріктірілген</string>
<string name="build_light">Stockfish бағдарлама ішінде жүктеледі</string>
<string name="about_text">Шахмат базалары, партияларды талдау және компьютермен ойын. Файлдарыңыз тек оқылады, ешқашан өзгертілмейді.</string>
<string name="licenses">Лицензиялар мен авторлар</string>
<string name="website">Сайт және бастапқы код</string>
<string name="game_info">Партия мәліметтері</string>
<string name="copy_pgn">PGN көшіру</string>
<string name="copy_fen">FEN көшіру</string>
<string name="share_game">Партиямен бөлісу</string>
<string name="notes">Ескертпелер</string>
<string name="engine_state_on">қосулы</string>
<string name="engine_state_off">өшірулі</string>
<string name="engine_state_missing">жүктелмеген</string>
<string name="found_of">Табылды %1$s / %2$s</string>
<string name="group_game">Партия</string>
<string name="move_white">%1$d, Ақтар, %2$s</string>
<string name="move_black">%1$d, Қаралар, %2$s</string>
<string name="current_move">ағымдағы жүріс</string>
<string name="language">Тіл</string>
<string name="checkmate">Мат</string>
<string name="stalemate">Пат</string>
<string name="pgn_copied">PGN көшірілді</string>
<string name="fen_copied">FEN көшірілді</string>
<string name="tag_event">Турнир</string>
<string name="tag_site">Орны</string>
<string name="tag_date">Күні</string>
<string name="tag_round">Тур</string>
<string name="tag_white">Ақтар</string>
<string name="tag_black">Қаралар</string>
<string name="tag_result">Нәтиже</string>
<string name="tag_white_elo">Ақтардың Elo</string>
<string name="tag_black_elo">Қаралардың Elo</string>
<string name="tag_annotator">Түсініктеме авторы</string>
<string name="tag_plies">Жартылай жүрістер</string>
<string name="open_no_access">Файлға қолжетім жоқ: ол жылжытылған, жойылған немесе рұқсаты қайтарылған. Оны тізімнен алып тастап, қайта қосыңыз.</string>
<string name="open_corrupt">Файл бүлінген немесе шахмат базасы емес.</string>
<string name="open_empty">Мұрағатта PGN немесе ChessBase базасы жоқ.</string>
<string name="open_unsupported">Мұндай базаны оқу мүмкін емес: %1$s</string>
<string name="add_file">Файл</string>
<string name="add_file_hint">PGN, .cbv, .zip немесе .7z</string>
<string name="add_folder">Қалта</string>
<string name="add_folder_hint">Қалтадағы барлық база, ChessBase (.cbh) те</string>
<string name="folder_scanning">Базалар ізделуде…</string>
<string name="folder_empty_title">Бұл қалтада база жоқ</string>
<string name="folder_empty_text">Қалтадан және оның ішіндегі екі деңгейлі қалталардан PGN файлдарын, ChessBase базаларын (.cbh, .cbv) және .zip немесе .7z мұрағаттарын іздейді.</string>
<string name="folder_added">тізімде бар</string>
<string name="folder_incomplete">.cbg файлы жоқ — партияларды ашу мүмкін емес</string>
<plurals name="folder_found">
<item quantity="one">«%2$s» ішінде %1$d база</item>
<item quantity="other">«%2$s» ішінде %1$d база</item>
</plurals>
<plurals name="add_chosen">
<item quantity="one">%1$d қосу</item>
<item quantity="other">%1$d қосу</item>
</plurals>
<plurals name="added_count">
<item quantity="one">%1$d база қосылды</item>
<item quantity="other">%1$d база қосылды</item>
</plurals>
<string name="add_tree_hint">Android бағдарламаларға жад түбірін немесе Downloads қалтасының өзін таңдатпайды — тек олардың ішіндегі қалтаны.</string>
<string name="pick_another">Басқасын таңдау</string>
<string name="done">Дайын</string>
<string name="add">Қосу</string>
<string name="choose_all">Бәрін белгілеу</string>
<string name="choose_none">Белгілерді алу</string>
<string name="open_missing_part">%1$s файлы енді база жанында жоқ: ол жылжытылған немесе жойылған.</string>
<string name="board_and_pieces">Тақта және фигуралар</string>
<string name="board_brown">Қоңыр</string>
<string name="board_blue">Көк</string>
<string name="board_green">Жасыл</string>
<string name="board_tournament">Турнирлік</string>
<string name="board_sand">Құм</string>
<string name="board_coral">Маржан</string>
<string name="board_grey">Сұр</string>
<string name="board_purple">Күлгін</string>
<string name="board_ice">Мұз</string>
<string name="board_navy">Қою көк</string>
<string name="board_mint">Жалбыз</string>
<string name="board_emerald">Зүбәржат</string>
<string name="board_orange">Қызғылт сары</string>
<string name="board_rose">Раушан</string>
<string name="board_dusk">Ымырт</string>
<string name="board_night">Түн</string>
<string name="board_wood">Ағаш</string>
<string name="board_maple">Үйеңкі</string>
<string name="board_leather">Былғары</string>
<string name="board_marble">Мәрмәр</string>
<string name="board_blue_marble">Көк мәрмәр</string>
<string name="board_canvas">Кенеп</string>
<string name="board_metal">Металл</string>
<string name="board_olive">Зәйтүн</string>
<string name="board_stone">Тас</string>
<string name="board_green_plastic">Жасыл пластик</string>
<string name="board_purple_diag">Күлгін диагональдар</string>
<string name="board_pink_pyramid">Қызғылт пирамидалар</string>
<string name="board_sketch">Нобай</string>
<string name="board">Тақта</string>
<string name="pieces_tab">Фигуралар</string>
<string name="game_number">№ %1$s</string>
<string name="add_paste">Алмасу буферінен PGN қою</string>
<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>
<string name="file_unreadable">Файлды оқу мүмкін болмады: ол жоқ болуы мүмкін немесе оны жіберген бағдарлама қолжетім бермеген. Қайта ашып көріңіз.</string>
<string name="file_chessbase_part">ChessBase базасы (.cbh) бірнеше файлдан тұрады, ал тек біреуі келді. Ол жатқан қалтаны қосыңыз: «База қосу» → «Қалта».</string>
<string name="file_copy_failed">Бағдарлама файлдың көшірмесін сақтай алмады. Телефонда бос орын бар екенін тексеріңіз.</string>
<string name="db_copy">көшірме</string>
<string name="removed_copy">База ChessPenguin-нен жойылды</string>
<!-- Game report (android-ui.md §21) -->
<string name="review_menu">Партияны талдау</string>
<string name="review_report_menu">Партия есебі</string>
<string name="review_text">Қозғалтқыш негізгі варианттың әр позициясын бағалайды. Партияның өзі өзгермейді.</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_partial">%2$d позицияның %1$d бағаланып қойған.</string>
<string name="review_progress">Партияны талдау · %1$d / %2$d</string>
<string name="review_stop">Талдауды тоқтату</string>
<string name="review_accuracy">Дәлдік</string>
<string name="review_accuracy_of">Дәлдік: Ақтар %1$s, Қаралар %2$s</string>
<string name="review_report">Есеп</string>
<string name="review_better">%1$s жақсырақ еді</string>
<string name="review_inaccuracy">Дәлсіздік</string>
<string name="review_mistake">Қате</string>
<string name="review_blunder">Өрескел қате</string>
<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>
<string name="review_acpl">Орташа сантипешка шығыны</string>
<string name="review_opening">Дебют</string>
<string name="review_middlegame">Миттельшпиль</string>
<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_graph_state">%1$s, баға %2$s</string>
<string name="review_start_position">Бастапқы позиция</string>
<plurals name="review_estimate">
<item quantity="one">%1$d позиция, шамамен %2$s</item>
<item quantity="other">%1$d позиция, шамамен %2$s</item>
</plurals>
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
<string name="online_title">Lichess және Chess.com партиялары</string>
<string name="add_online_hint">Кез келген ойыншының партиялары лақап аты бойынша: өзіңіздің, оқушының, қарсыластың</string>
<string name="online_intro">Ойыншының партиялары телефоныңызда іздеу, қарау және талдау үшін базаға айналады. Тек лақап ат керек, тіркелгіге кірудің қажеті жоқ.</string>
<string name="online_nick">Ойыншының лақап аты</string>
<string name="online_nick_hint">сайттағыдай</string>
<string name="online_other">Chess.com-да басқа лақап ат</string>
<string name="online_other_nick">Chess.com-дағы лақап ат</string>
<string name="online_same_nick">Сол лақап ат</string>
<string name="online_nick_rule">Латын әріптері, сандар, _ және -, 2-ден 30-ға дейін таңба</string>
<string name="online_find">Табу</string>
<string name="online_searching">Сайттардан ізделуде…</string>
<string name="online_lichess_found">%1$s · алғашқы рет шамамен %2$d мин</string>
<string name="online_chesscom_found">партиялары бар айлар: %1$d</string>
<string name="online_not_found">%1$s: мұндай лақап аты бар ойыншы жоқ — жазылуын тексеріңіз</string>
<string name="online_merge">Екі сайтты бір базаға біріктіру</string>
<string name="online_merge_hint">Әйтпесе әр сайттың өз базасы болады</string>
<string name="online_into_new">Жаңа «%1$s» базасына</string>
<string name="online_into_existing">«%1$s» базасына (онда %2$s бар; тек жаңа партиялар қосылады)</string>
<string name="online_download">Жүктеп алу</string>
<string name="online_progress_lichess">Lichess: %1$s / шамамен %2$s · шамамен %3$d мин қалды</string>
<string name="online_progress_count">%1$s: %2$s</string>
<string name="online_progress_chesscom">Chess.com: ай %1$d / %2$d · %3$s</string>
<string name="online_stop">Тоқтату</string>
<string name="online_added">+%1$s, барлығы %2$s</string>
<string name="online_no_new">Жаңа партия жоқ, базада %1$s</string>
<string name="online_stopped">Тоқтатылды, базада %1$s</string>
<string name="online_no_games">Онда стандартты шахмат партиялары жоқ.</string>
<string name="online_open">Базаны ашу</string>
<string name="online_try_again">Қайталап көру</string>
<string name="online_err_network">%1$s жауап бермейді. Интернет байланысын тексеріп, қайталап көріңіз.</string>
<string name="online_err_rate">%1$s үзіліс сұрайды: қатарынан тым көп сұраныс. Бір минут күтіп, қайталап көріңіз; жүктелгені сақталады.</string>
<string name="online_err_unexpected">%1$s ChessPenguin түсінбейтін жауап берді: сайт өзгерген болуы мүмкін. Кейінірек көріңіз немесе ChessPenguin-ді жаңартыңыз.</string>
<string name="online_err_disk">Базаны жазу мүмкін болмады: телефонда орын таусылды.</string>
<string name="online_err_busy">Бұл база қазір жүктелуде.</string>
<string name="online_short_network">%1$s жауап бермейді</string>
<string name="online_short_rate">%1$s үзіліс сұрайды</string>
<string name="online_short_failed">Жүктеу тоқтап қалды</string>
<string name="online_update">Жаңа партияларды жүктеу</string>
<string name="online_stop_download">Жүктеуді тоқтату</string>
<string name="online_downloading">Жүктелуде · %1$s</string>
<string name="online_updated">жаңартылды %1$s</string>
<string name="online_unfinished">аяқталмаған</string>
<string name="online_removed">Жүктелген база жойылды</string>
<string name="online_nick_lichess">Lichess-тегі лақап ат</string>
<string name="online_lichess_quick">%1$s · алғашқы рет бір минуттан аз</string>
<string name="online_leave">Бұл экраннан шыға беруге болады: база тізімде, жүктеу жалғасады.</string>
<string name="online_done">Дайын: %1$s</string>
<string name="online_updated_now">жаңа ғана жаңартылды</string>
<string name="online_snack_added">«%1$s»: +%2$s, барлығы %3$s</string>
<string name="online_snack_none">«%1$s»: жаңа партия жоқ</string>
<string name="online_snack_failed">«%1$s»: %2$s</string>
<string name="online_open_short">Ашу</string>
<plurals name="games_up_to">
<item quantity="one">%1$s партияға дейін</item>
<item quantity="other">%1$s партияға дейін</item>
</plurals>
<string name="upd_title">%1$s нұсқасы шықты</string>
<string name="upd_you_have">Сізде %1$s</string>
<string name="upd_update">Жаңарту</string>
<string name="upd_install">Орнату</string>
<string name="upd_keeps">Базалар, баптаулар мен қозғалтқыш сақталады.</string>
<string name="upd_keeps_no_engine">Базалар мен баптаулар сақталады.</string>
<string name="upd_closes">Орнату кезінде ChessPenguin жабылады — содан кейін оны қайта ашыңыз.</string>
<string name="upd_online_note">Партиялар жүктелуде: орнату оны тоқтатады; кейін жалғастыруға болады.</string>
<string name="upd_perm_title">Бір рұқсат керек</string>
<string name="upd_perm_body">Android дүкеннен тыс бағдарламаларды тек сіздің рұқсатыңызбен орнатады. Баптаулар ашылады: ChessPenguin үшін ауыстырғышты қосып, қайта оралыңыз.</string>
<string name="upd_perm_open">Баптауларды ашу</string>
<string name="upd_perm_denied">Рұқсат өшірулі — онсыз Android жаңа нұсқаны орнатпайды.</string>
<string name="upd_perm_granted">Рұқсат берілді, жүктелуде</string>
<string name="upd_on_site">Сайттан жүктеп алу</string>
<string name="upd_open_site">Сайтты ашу</string>
<string name="upd_leave">Мұны жаба беруге болады: жүктеу жалғасады.</string>
<string name="upd_waiting_net">Желі жоқ. Желі қалпына келгенде жүктеу өзі жалғасады.</string>
<string name="upd_waiting_net_short">Желі күтілуде</string>
<string name="upd_checking_file">Файл тексерілуде…</string>
<string name="upd_keeping_engine">Қозғалтқыш сақталуда…</string>
<string name="upd_installing">Орнатылуда…</string>
<string name="upd_ready">Жаңа нұсқа жүктелді және тексерілді.</string>
<string name="upd_ready_short">Жүктелді және тексерілді</string>
<string name="upd_ready_snack">Жаңа нұсқа жүктелді</string>
<string name="upd_aborted">Орнату тоқтатылды. Жаңа нұсқа жүктелген — оны қалаған кезде орнатыңыз.</string>
<string name="upd_notification">ChessPenguin жаңартуы</string>
<string name="upd_done_snack">ChessPenguin жаңартылды: %1$s → %2$s</string>
<string name="upd_err_failed">Жүктеу сәтсіз болды. Қайталап көріңіз.</string>
<string name="upd_err_corrupt">Файл жүктеу кезінде бүлінді, сондықтан орнатылмады. Қайталап көріңіз.</string>
<string name="upd_err_release">Бұл шығарылымда ақау бар: Android файлын тексеру мүмкін емес. Жаңа нұсқаны сайттан жүктеп алыңыз.</string>
<string name="upd_err_storage">Android жаңа нұсқаны орнатпады: орын жетпейді. %1$d МБ босатып, қайталап көріңіз.</string>
<string name="upd_err_conflict">Android жаңа нұсқаны орнатпады: бұл ChessPenguin басқа кілтпен қол қойылған. Жаңа нұсқаны тек осыны жойғаннан кейін орнатуға болады, ал жойғанда базалар тізімі мен жүктелген базалар жоғалады.</string>
<string name="upd_err_blocked">Android немесе телефон қорғанысы орнатуды тоқтатты. Жаңа нұсқаны сайттан жүктеп алыңыз.</string>
<string name="upd_err_install">Android жаңа нұсқаны орнатпады. Қайталап көріңіз немесе оны сайттан жүктеп алыңыз.</string>
<string name="upd_short_offline">Интернет жоқ</string>
<string name="upd_short_space">Орын жетпейді</string>
<string name="upd_short_corrupt">Файл бүлінді</string>
<string name="upd_short_install">Android орнатпады</string>
<string name="upd_short_failed">Жүктеу сәтсіз болды</string>
<string name="upd_more">Тағы</string>
<string name="upd_details">Толығырақ</string>
<string name="upd_copy">Көшіру</string>
<string name="upd_group">Жаңартулар</string>
<string name="upd_auto">Іске қосқанда жаңартуларды тексеру</string>
<string name="upd_auto_sub">Күніне бір рет ChessPenguin өз сайтынан соңғы нұсқаны сұрайды; сайт жұмыс істеп тұрған орнатуларды санайды. Тек осы орнатудың кездейсоқ нөмірі, нұсқа және жүйе жіберіледі. Ұсыныстар өшірулі болса да тексеру жүреді.</string>
<string name="upd_offer">Жаңа нұсқаларды ұсыну</string>
<string name="upd_offer_sub">Жаңа нұсқа шыққанда «Базалар» экранындағы карта.</string>
<string name="upd_offer_needs_check">Жаңартуларды тексеру қосулы болғанда жұмыс істейді.</string>
<string name="upd_offers_off_snack">Енді ұсынбаймыз. Қосу — Баптаулар, «Бағдарлама туралы»</string>
<string name="upd_dismiss_cd">Жаңартуларды ұсынбау</string>
<string name="upd_check_now">Қазір тексеру</string>
<string name="upd_checking">Тексерілуде…</string>
<string name="upd_latest">Сізде соңғы нұсқа</string>
<string name="upd_checked">Тексерілді %1$s</string>
<string name="upd_check_offline">Интернет жоқ — жаңартуларды тексеру мүмкін емес</string>
<string name="upd_check_failed">Жаңартуларды тексеру мүмкін болмады: сайт жауап бермеді. Кейінірек көріңіз.</string>
<string name="s_about_available">%1$s нұсқасы шықты</string>
<string name="s_about_downloading">%1$s нұсқасы жүктелуде…</string>
<string name="s_about_ready">%1$s нұсқасы жүктелді</string>
<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

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.ChessPenguin" parent="android:Theme.Material.NoActionBar">
<item name="android:windowBackground">#161718</item>
<item name="android:windowSplashScreenBackground">#161718</item>
<item name="android:windowSplashScreenIconBackgroundColor">@color/ic_launcher_background</item>
</style>
</resources>

View file

@ -0,0 +1,734 @@
<resources>
<string name="sample_classics">Partidas clássicas</string>
<string name="sample_alekhine">Alekhine</string>
<string name="empty_title">Suas bases vão aparecer aqui</string>
<string name="empty_text">Adicione um arquivo PGN, uma base ChessBase ou um arquivo .zip/.7z — do celular ou da nuvem — ou baixe partidas do Lichess e do Chess.com.</string>
<string name="add_database">Adicionar base</string>
<string name="open_samples">Abrir partidas de exemplo</string>
<string name="not_opened">ainda não aberta · %1$s</string>
<plurals name="games_count">
<item quantity="one">%1$s partida</item>
<item quantity="many">%1$s partidas</item>
<item quantity="other">%1$s partidas</item>
</plurals>
<string name="games_with_format">%1$s · %2$s</string>
<string name="menu">Menu</string>
<string name="rename">Renomear</string>
<string name="remove">Remover da lista</string>
<string name="rename_hint">O nome na lista. O arquivo não é alterado.</string>
<string name="cancel">Cancelar</string>
<string name="save">Salvar</string>
<string name="removed">Base removida da lista</string>
<string name="undo">Desfazer</string>
<string name="back">Voltar</string>
<string name="reading">Lendo…</string>
<string name="open_failed">Não foi possível abrir a base</string>
<string name="search">Buscar</string>
<string name="search_hint">Jogador, evento, ano</string>
<string name="nothing_found">Nada encontrado</string>
<string name="clear">Limpar</string>
<string name="game_of">%1$d de %2$d</string>
<string name="previous_game">Partida anterior</string>
<string name="next_game">Próxima partida</string>
<string name="flip">Girar tabuleiro</string>
<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_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>
<string name="black_won">Pretas venceram</string>
<string name="draw">Empate</string>
<string name="game_failed">Não foi possível ler a partida</string>
<string name="engine">Motor</string>
<string name="thinking">Pensando…</string>
<string name="depth">profundidade %1$d</string>
<string name="paused">em pausa</string>
<string name="deeper">Mais fundo</string>
<string name="more_lines">Mais linhas</string>
<string name="fewer_lines">Menos linhas</string>
<string name="engine_not_answering">O motor não está respondendo</string>
<string name="engine_not_starting">O motor não inicia neste celular</string>
<string name="restart">Reiniciar</string>
<string name="engine_line_preview">Linha do motor · lance %1$d de %2$d</string>
<string name="close">Fechar</string>
<string name="engine_sheet_title">Motor Stockfish</string>
<string name="engine_sheet_text">Avalia a posição e mostra os melhores lances. Funciona offline — basta baixar uma vez.</string>
<string name="engine_size">Tamanho: %1$d MB</string>
<string name="engine_metered">Sem Wi-Fi agora: o download usará dados móveis.</string>
<string name="not_now">Agora não</string>
<string name="download">Baixar</string>
<string name="downloaded_of">Baixados %1$d de %2$d MB</string>
<string name="cancel_download">Cancelar</string>
<string name="download_cancelled">Download cancelado</string>
<string name="engine_ready">O motor está pronto</string>
<string name="no_internet">Sem internet. Conecte-se a uma rede e tente de novo.</string>
<string name="download_title">ChessPenguin: motor Stockfish</string>
<string name="interrupted">O download parou. Tente de novo.</string>
<string name="no_space">Espaço insuficiente: são necessários %1$d MB.</string>
<string name="corrupt">O arquivo do motor foi danificado durante o download. Baixe de novo.</string>
<string name="retry">Tentar de novo</string>
<string name="download_again">Baixar de novo</string>
<string name="ok">OK</string>
<string name="preparing_engine">Preparando o motor…</string>
<string name="settings">Configurações</string>
<string name="group_look">Aparência</string>
<string name="group_engine">Motor</string>
<string name="theme">Tema</string>
<string name="theme_system">Padrão do sistema</string>
<string name="theme_light">Claro</string>
<string name="theme_dark">Escuro</string>
<string name="notation">Notação dos lances</string>
<string name="notation_latin">Letras latinas (K Q R B N)</string>
<string name="notation_figurines">Figurinhas</string>
<string name="notation_local">Letras do idioma</string>
<string name="notation_hint">Só na tela. O PGN sempre usa K Q R B N.</string>
<string name="animation">Animação das peças</string>
<string name="best_arrow">Seta do melhor lance</string>
<string name="vibration">Vibração</string>
<string name="engine_built_in">Stockfish 19 · embutido</string>
<string name="engine_downloaded">Stockfish 19 · baixado</string>
<string name="engine_missing">Não baixado · Baixar (%1$d MB)</string>
<string name="engine_downloading">Baixando… %1$d de %2$d MB</string>
<string name="engine_delete">Excluir o motor (libera %1$d MB)</string>
<string name="engine_delete_question">Excluir o motor? Você pode baixá-lo de novo.</string>
<string name="delete">Excluir</string>
<string name="lines">Linhas</string>
<string name="time_per_position">Tempo por posição</string>
<string name="seconds">%1$d s</string>
<string name="one_minute">1 min</string>
<string name="no_limit">Sem limite</string>
<string name="threads">Threads</string>
<string name="memory">Memória</string>
<string name="megabytes">%1$d MB</string>
<string name="engine_battery">O motor gasta bateria. Ele desliga sozinho quando você sai da partida ou o app vai para segundo plano.</string>
<string name="about">Sobre</string>
<string name="build_full">Stockfish embutido</string>
<string name="build_light">Stockfish baixado no app</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>
<string name="game_info">Detalhes da partida</string>
<string name="copy_pgn">Copiar PGN</string>
<string name="copy_fen">Copiar FEN</string>
<string name="share_game">Compartilhar partida</string>
<string name="notes">Notas</string>
<string name="engine_state_on">ligado</string>
<string name="engine_state_off">desligado</string>
<string name="engine_state_missing">não baixado</string>
<string name="found_of">Encontradas %1$s de %2$s</string>
<string name="group_game">Partida</string>
<string name="move_white">%1$d, brancas, %2$s</string>
<string name="move_black">%1$d, pretas, %2$s</string>
<string name="current_move">lance atual</string>
<string name="language">Idioma</string>
<string name="checkmate">Xeque-mate</string>
<string name="stalemate">Afogamento</string>
<string name="pgn_copied">PGN copiado</string>
<string name="fen_copied">FEN copiado</string>
<string name="tag_event">Evento</string>
<string name="tag_site">Local</string>
<string name="tag_date">Data</string>
<string name="tag_round">Rodada</string>
<string name="tag_white">Brancas</string>
<string name="tag_black">Pretas</string>
<string name="tag_result">Resultado</string>
<string name="tag_white_elo">Elo das brancas</string>
<string name="tag_black_elo">Elo das pretas</string>
<string name="tag_annotator">Comentarista</string>
<string name="tag_plies">Meios-lances</string>
<string name="open_no_access">Sem acesso ao arquivo: ele foi movido, excluído ou a permissão foi retirada. Remova-o da lista e adicione de novo.</string>
<string name="open_corrupt">O arquivo está danificado ou não é uma base de xadrez.</string>
<string name="open_empty">Não há base PGN ou ChessBase no arquivo compactado.</string>
<string name="open_unsupported">Este tipo de base não pode ser lido: %1$s</string>
<string name="add_file">Arquivo</string>
<string name="add_file_hint">PGN, .cbv, .zip ou .7z</string>
<string name="add_folder">Pasta</string>
<string name="add_folder_hint">Todas as bases de uma pasta, inclusive ChessBase (.cbh)</string>
<string name="folder_scanning">Procurando bases…</string>
<string name="folder_empty_title">Nenhuma base nesta pasta</string>
<string name="folder_empty_text">Procura arquivos PGN, bases ChessBase (.cbh, .cbv) e arquivos .zip ou .7z na pasta e em até dois níveis de pastas dentro dela.</string>
<string name="folder_added">já está na lista</string>
<string name="folder_incomplete">sem arquivo .cbg — as partidas não podem ser abertas</string>
<plurals name="folder_found">
<item quantity="one">%1$d base em “%2$s”</item>
<item quantity="many">%1$d bases em “%2$s”</item>
<item quantity="other">%1$d bases em “%2$s”</item>
</plurals>
<plurals name="add_chosen">
<item quantity="one">Adicionar %1$d</item>
<item quantity="many">Adicionar %1$d</item>
<item quantity="other">Adicionar %1$d</item>
</plurals>
<plurals name="added_count">
<item quantity="one">%1$d base adicionada</item>
<item quantity="many">%1$d bases adicionadas</item>
<item quantity="other">%1$d bases adicionadas</item>
</plurals>
<string name="add_tree_hint">O Android não deixa os apps escolherem a raiz do armazenamento nem a própria pasta Downloads — só uma pasta dentro delas.</string>
<string name="pick_another">Escolher outra</string>
<string name="done">Concluído</string>
<string name="add">Adicionar</string>
<string name="choose_all">Marcar todas</string>
<string name="choose_none">Desmarcar todas</string>
<string name="open_missing_part">O arquivo %1$s não está mais junto da base: foi movido ou excluído.</string>
<string name="board_and_pieces">Tabuleiro e peças</string>
<string name="board_brown">Marrom</string>
<string name="board_blue">Azul</string>
<string name="board_green">Verde</string>
<string name="board_tournament">Torneio</string>
<string name="board_sand">Areia</string>
<string name="board_coral">Coral</string>
<string name="board_grey">Cinza</string>
<string name="board_purple">Roxo</string>
<string name="board_ice">Gelo</string>
<string name="board_navy">Marinho</string>
<string name="board_mint">Menta</string>
<string name="board_emerald">Esmeralda</string>
<string name="board_orange">Laranja</string>
<string name="board_rose">Rosa</string>
<string name="board_dusk">Crepúsculo</string>
<string name="board_night">Noite</string>
<string name="board_wood">Madeira</string>
<string name="board_maple">Bordo</string>
<string name="board_leather">Couro</string>
<string name="board_marble">Mármore</string>
<string name="board_blue_marble">Mármore azul</string>
<string name="board_canvas">Tela</string>
<string name="board_metal">Metal</string>
<string name="board_olive">Oliva</string>
<string name="board_stone">Pedra</string>
<string name="board_green_plastic">Plástico verde</string>
<string name="board_purple_diag">Diagonal roxa</string>
<string name="board_pink_pyramid">Pirâmide rosa</string>
<string name="board_sketch">Esboço</string>
<string name="board">Tabuleiro</string>
<string name="pieces_tab">Peças</string>
<string name="game_number">Nº %1$s</string>
<string name="add_paste">Colar PGN da área de transferência</string>
<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>
<string name="file_unreadable">Não foi possível ler o arquivo: talvez ele não exista mais, ou o app de onde veio não deu acesso a ele. Tente abri-lo de novo.</string>
<string name="file_chessbase_part">Uma base ChessBase (.cbh) é feita de vários arquivos, e só um chegou. Adicione a pasta onde ela está: \"Adicionar base\" → \"Pasta\".</string>
<string name="file_copy_failed">O app não conseguiu guardar uma cópia do arquivo. Verifique se o celular tem espaço livre.</string>
<string name="db_copy">cópia</string>
<string name="removed_copy">Base excluída do ChessPenguin</string>
<!-- Game report (android-ui.md §21) -->
<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_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_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>
<string name="review_accuracy">Precisão</string>
<string name="review_accuracy_of">Precisão: brancas %1$s, pretas %2$s</string>
<string name="review_report">Relatório</string>
<string name="review_better">%1$s era melhor</string>
<string name="review_inaccuracy">Imprecisão</string>
<string name="review_mistake">Erro</string>
<string name="review_blunder">Erro grave</string>
<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>
<string name="review_acpl">Perda média de centipeões</string>
<string name="review_opening">Abertura</string>
<string name="review_middlegame">Meio-jogo</string>
<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_graph_state">%1$s, avaliação %2$s</string>
<string name="review_start_position">Posição inicial</string>
<plurals name="review_estimate">
<item quantity="one">%1$d posição, cerca de %2$s</item>
<item quantity="many">%1$d posições, cerca de %2$s</item>
<item quantity="other">%1$d posições, cerca de %2$s</item>
</plurals>
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
<string name="online_title">Partidas do Lichess e do Chess.com</string>
<string name="add_online_hint">Partidas de qualquer jogador pelo nick: suas, de um aluno, de um adversário</string>
<string name="online_intro">As partidas do jogador viram uma base no seu celular, para buscar, ver e analisar. Basta o nick, sem login.</string>
<string name="online_nick">Nick do jogador</string>
<string name="online_nick_hint">como no site</string>
<string name="online_other">Outro nick no Chess.com</string>
<string name="online_other_nick">Nick no Chess.com</string>
<string name="online_same_nick">O mesmo nick</string>
<string name="online_nick_rule">Letras latinas, números, _ e -, de 2 a 30 caracteres</string>
<string name="online_find">Buscar</string>
<string name="online_searching">Procurando nos sites…</string>
<string name="online_lichess_found">%1$s · cerca de %2$d min na primeira vez</string>
<string name="online_chesscom_found">meses com partidas: %1$d</string>
<string name="online_not_found">%1$s: nenhum jogador com este nick — confira a grafia</string>
<string name="online_merge">Juntar os dois sites em uma base</string>
<string name="online_merge_hint">Senão cada site recebe uma base própria</string>
<string name="online_into_new">Para a nova base “%1$s”</string>
<string name="online_into_existing">Para “%1$s” (já tem %2$s; só partidas novas são adicionadas)</string>
<string name="online_download">Baixar</string>
<string name="online_progress_lichess">Lichess: %1$s de cerca de %2$s · faltam cerca de %3$d min</string>
<string name="online_progress_count">%1$s: %2$s</string>
<string name="online_progress_chesscom">Chess.com: mês %1$d de %2$d · %3$s</string>
<string name="online_stop">Parar</string>
<string name="online_added">+%1$s, %2$s no total</string>
<string name="online_no_new">Sem partidas novas, %1$s na base</string>
<string name="online_stopped">Parado, %1$s na base</string>
<string name="online_no_games">Não há partidas de xadrez padrão ali.</string>
<string name="online_open">Abrir a base</string>
<string name="online_try_again">Tentar de novo</string>
<string name="online_err_network">%1$s não responde. Verifique a conexão com a internet e tente de novo.</string>
<string name="online_err_rate">%1$s pede uma pausa: muitas solicitações seguidas. Espere um minuto e tente de novo; o que foi baixado fica guardado.</string>
<string name="online_err_unexpected">%1$s respondeu de um jeito que o ChessPenguin não entende: o site pode ter mudado. Tente mais tarde ou atualize o ChessPenguin.</string>
<string name="online_err_disk">Não foi possível gravar a base: o celular está sem espaço.</string>
<string name="online_err_busy">Esta base já está sendo baixada.</string>
<string name="online_short_network">%1$s não responde</string>
<string name="online_short_rate">%1$s pede uma pausa</string>
<string name="online_short_failed">O download parou</string>
<string name="online_update">Baixar partidas novas</string>
<string name="online_stop_download">Parar o download</string>
<string name="online_downloading">Baixando · %1$s</string>
<string name="online_updated">atualizada %1$s</string>
<string name="online_unfinished">não concluída</string>
<string name="online_removed">Base baixada excluída</string>
<string name="online_nick_lichess">Nick no Lichess</string>
<string name="online_lichess_quick">%1$s · menos de um minuto na primeira vez</string>
<string name="online_leave">Você pode sair desta tela: a base está na lista e o download continua.</string>
<string name="online_done">Concluído: %1$s</string>
<string name="online_updated_now">atualizada agora</string>
<string name="online_snack_added">“%1$s”: +%2$s, %3$s no total</string>
<string name="online_snack_none">“%1$s”: sem partidas novas</string>
<string name="online_snack_failed">“%1$s”: %2$s</string>
<string name="online_open_short">Abrir</string>
<plurals name="games_up_to">
<item quantity="one">até %1$s partida</item>
<item quantity="many">até %1$s partidas</item>
<item quantity="other">até %1$s partidas</item>
</plurals>
<string name="upd_title">Saiu a versão %1$s</string>
<string name="upd_you_have">Você tem a %1$s</string>
<string name="upd_update">Atualizar</string>
<string name="upd_install">Instalar</string>
<string name="upd_keeps">Bases, configurações e o motor ficam.</string>
<string name="upd_keeps_no_engine">Bases e configurações ficam.</string>
<string name="upd_closes">O ChessPenguin fecha durante a instalação — depois abra-o de novo.</string>
<string name="upd_online_note">Partidas estão sendo baixadas: instalar interrompe isso; você pode continuar depois.</string>
<string name="upd_perm_title">É preciso uma permissão</string>
<string name="upd_perm_body">O Android só instala apps de fora de uma loja com a sua permissão. As configurações vão abrir: ative a chave para o ChessPenguin e volte.</string>
<string name="upd_perm_open">Abrir configurações</string>
<string name="upd_perm_denied">A permissão está desativada — sem ela o Android não instala a nova versão.</string>
<string name="upd_perm_granted">Permissão concedida, baixando</string>
<string name="upd_on_site">Baixar no site</string>
<string name="upd_open_site">Abrir o site</string>
<string name="upd_leave">Você pode fechar isto: o download continua.</string>
<string name="upd_waiting_net">Sem rede. O download continua sozinho quando a rede voltar.</string>
<string name="upd_waiting_net_short">Aguardando rede</string>
<string name="upd_checking_file">Verificando o arquivo…</string>
<string name="upd_keeping_engine">Guardando o motor…</string>
<string name="upd_installing">Instalando…</string>
<string name="upd_ready">A nova versão foi baixada e verificada.</string>
<string name="upd_ready_short">Baixada e verificada</string>
<string name="upd_ready_snack">A nova versão foi baixada</string>
<string name="upd_aborted">Instalação cancelada. A nova versão está baixada — instale quando quiser.</string>
<string name="upd_notification">Atualização do ChessPenguin</string>
<string name="upd_done_snack">O ChessPenguin foi atualizado: %1$s → %2$s</string>
<string name="upd_err_failed">O download falhou. Tente de novo.</string>
<string name="upd_err_corrupt">O arquivo foi danificado durante o download, por isso não foi instalado. Tente de novo.</string>
<string name="upd_err_release">Há algo errado com esta versão: o arquivo para Android não pode ser verificado. Baixe a nova versão no site.</string>
<string name="upd_err_storage">O Android não instalou a nova versão: espaço insuficiente. Libere %1$d MB e tente de novo.</string>
<string name="upd_err_conflict">O Android não instalou a nova versão: este ChessPenguin foi assinado com outra chave. A nova versão só pode ser instalada depois de remover esta, e ao removê-la perdem-se a lista de bases e as bases baixadas.</string>
<string name="upd_err_blocked">O Android ou a proteção do celular bloqueou a instalação. Baixe a nova versão no site.</string>
<string name="upd_err_install">O Android não instalou a nova versão. Tente de novo ou baixe-a no site.</string>
<string name="upd_short_offline">Sem internet</string>
<string name="upd_short_space">Espaço insuficiente</string>
<string name="upd_short_corrupt">O arquivo foi danificado</string>
<string name="upd_short_install">O Android não instalou</string>
<string name="upd_short_failed">O download falhou</string>
<string name="upd_more">Mais</string>
<string name="upd_details">Detalhes</string>
<string name="upd_copy">Copiar</string>
<string name="upd_group">Atualizações</string>
<string name="upd_auto">Verificar atualizações ao iniciar</string>
<string name="upd_auto_sub">Uma vez por dia o ChessPenguin pergunta ao seu site qual é a versão mais recente; o site conta as instalações em uso. São enviados apenas um número aleatório desta instalação, a versão e o sistema. A verificação continua mesmo sem as ofertas.</string>
<string name="upd_offer">Oferecer novas versões</string>
<string name="upd_offer_sub">Um cartão na tela Bases quando sai uma nova versão.</string>
<string name="upd_offer_needs_check">Funciona com a verificação de atualizações ligada.</string>
<string name="upd_offers_off_snack">Não vamos mais oferecer. Ative em Configurações, Sobre</string>
<string name="upd_dismiss_cd">Não oferecer atualizações</string>
<string name="upd_check_now">Verificar agora</string>
<string name="upd_checking">Verificando…</string>
<string name="upd_latest">Você tem a versão mais recente</string>
<string name="upd_checked">Verificado %1$s</string>
<string name="upd_check_offline">Sem internet — não é possível verificar atualizações</string>
<string name="upd_check_failed">Não foi possível verificar atualizações: o site não respondeu. Tente mais tarde.</string>
<string name="s_about_available">Saiu a versão %1$s</string>
<string name="s_about_downloading">Baixando a versão %1$s…</string>
<string name="s_about_ready">A versão %1$s foi baixada</string>
<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

@ -0,0 +1,757 @@
<resources>
<string name="sample_classics">Классические партии</string>
<string name="sample_alekhine">Алехин</string>
<string name="empty_title">Здесь будут ваши базы</string>
<string name="empty_text">Добавьте файл PGN, базу ChessBase или архив .zip/.7z — с телефона или из облака — или скачайте партии с Lichess и Chess.com.</string>
<string name="add_database">Добавить базу</string>
<string name="open_samples">Открыть примеры партий</string>
<string name="not_opened">ещё не открывалась · %1$s</string>
<plurals name="games_count">
<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="games_with_format">%1$s · %2$s</string>
<string name="menu">Меню</string>
<string name="rename">Переименовать</string>
<string name="remove">Убрать из списка</string>
<string name="rename_hint">Название в списке. Файл не меняется.</string>
<string name="cancel">Отмена</string>
<string name="save">Сохранить</string>
<string name="removed">База убрана из списка</string>
<string name="undo">Вернуть</string>
<string name="back">Назад</string>
<string name="reading">Читаю…</string>
<string name="open_failed">Не удалось открыть базу</string>
<string name="search">Поиск</string>
<string name="search_hint">Игрок, турнир, год</string>
<string name="nothing_found">Ничего не найдено</string>
<string name="clear">Очистить</string>
<string name="game_of">%1$d из %2$d</string>
<string name="previous_game">Предыдущая партия</string>
<string name="next_game">Следующая партия</string>
<string name="flip">Перевернуть доску</string>
<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_description">Доска, позиция после %1$s</string>
<string name="board_start">Доска, начальная позиция</string>
<string name="white_won">Победили белые</string>
<string name="black_won">Победили чёрные</string>
<string name="draw">Ничья</string>
<string name="game_failed">Не удалось прочитать партию</string>
<string name="engine">Движок</string>
<string name="thinking">Считаю…</string>
<string name="depth">гл. %1$d</string>
<string name="paused">пауза</string>
<string name="deeper">Глубже</string>
<string name="more_lines">Больше линий</string>
<string name="fewer_lines">Меньше линий</string>
<string name="engine_not_answering">Движок не отвечает</string>
<string name="engine_not_starting">Движок не запускается на этом телефоне</string>
<string name="restart">Перезапустить</string>
<string name="engine_line_preview">Линия движка · ход %1$d из %2$d</string>
<string name="close">Закрыть</string>
<string name="engine_sheet_title">Движок Stockfish</string>
<string name="engine_sheet_text">Оценивает позицию и показывает лучшие ходы. Работает без интернета — нужно один раз скачать.</string>
<string name="engine_size">Размер: %1$d МБ</string>
<string name="engine_metered">Сейчас нет Wi-Fi: загрузка пойдёт через мобильный интернет.</string>
<string name="not_now">Не сейчас</string>
<string name="download">Скачать</string>
<string name="downloaded_of">Скачано %1$d из %2$d МБ</string>
<string name="cancel_download">Отменить</string>
<string name="download_cancelled">Загрузка отменена</string>
<string name="engine_ready">Движок готов</string>
<string name="no_internet">Нет интернета. Подключитесь к сети и попробуйте ещё раз.</string>
<string name="download_title">ChessPenguin: движок Stockfish</string>
<string name="interrupted">Загрузка остановилась. Попробуйте ещё раз.</string>
<string name="no_space">Не хватает места: нужно %1$d МБ.</string>
<string name="corrupt">Файл движка повреждён при загрузке. Скачайте его ещё раз.</string>
<string name="retry">Повторить</string>
<string name="download_again">Скачать снова</string>
<string name="ok">Понятно</string>
<string name="preparing_engine">Готовлю движок…</string>
<string name="settings">Настройки</string>
<string name="group_look">Внешний вид</string>
<string name="group_engine">Движок</string>
<string name="theme">Тема</string>
<string name="theme_system">Как в системе</string>
<string name="theme_light">Светлая</string>
<string name="theme_dark">Тёмная</string>
<string name="notation">Запись ходов</string>
<string name="notation_latin">Латинские буквы (K Q R B N)</string>
<string name="notation_figurines">Фигурки</string>
<string name="notation_local">Русские буквы (Кр Ф Л С К)</string>
<string name="notation_hint">Только вид на экране. В PGN всегда K Q R B N.</string>
<string name="animation">Анимация фигур</string>
<string name="best_arrow">Стрелка лучшего хода</string>
<string name="vibration">Вибрация</string>
<string name="engine_built_in">Stockfish 19 · встроен</string>
<string name="engine_downloaded">Stockfish 19 · скачан</string>
<string name="engine_missing">Не скачан · Скачать (%1$d МБ)</string>
<string name="engine_downloading">Скачивается… %1$d из %2$d МБ</string>
<string name="engine_delete">Удалить движок (освободит %1$d МБ)</string>
<string name="engine_delete_question">Удалить движок? Его можно скачать снова.</string>
<string name="delete">Удалить</string>
<string name="lines">Линий</string>
<string name="time_per_position">Время на позицию</string>
<string name="seconds">%1$d с</string>
<string name="one_minute">1 мин</string>
<string name="no_limit">Без ограничения</string>
<string name="threads">Потоки</string>
<string name="memory">Память</string>
<string name="megabytes">%1$d МБ</string>
<string name="engine_battery">Движок расходует заряд. Он сам выключается, когда вы выходите из партии или сворачиваете приложение.</string>
<string name="about">О программе</string>
<string name="build_full">Stockfish уже внутри</string>
<string name="build_light">Stockfish скачивается в приложении</string>
<string name="about_text">Шахматные базы, анализ партий и игра с компьютером. Ваши файлы только читаются и никогда не меняются.</string>
<string name="licenses">Лицензии и авторы</string>
<string name="website">Сайт и исходный код</string>
<string name="game_info">Сведения о партии</string>
<string name="copy_pgn">Копировать PGN</string>
<string name="copy_fen">Копировать FEN</string>
<string name="share_game">Поделиться партией</string>
<string name="notes">Замечания</string>
<string name="engine_state_on">включён</string>
<string name="engine_state_off">выключен</string>
<string name="engine_state_missing">не скачан</string>
<string name="found_of">Найдено %1$s из %2$s</string>
<string name="group_game">Партия</string>
<string name="move_white">%1$d, белые, %2$s</string>
<string name="move_black">%1$d, чёрные, %2$s</string>
<string name="current_move">текущий ход</string>
<string name="language">Язык</string>
<string name="checkmate">Мат</string>
<string name="stalemate">Пат</string>
<string name="pgn_copied">PGN скопирован</string>
<string name="fen_copied">FEN скопирован</string>
<string name="tag_event">Турнир</string>
<string name="tag_site">Место</string>
<string name="tag_date">Дата</string>
<string name="tag_round">Тур</string>
<string name="tag_white">Белые</string>
<string name="tag_black">Чёрные</string>
<string name="tag_result">Результат</string>
<string name="tag_white_elo">Эло белых</string>
<string name="tag_black_elo">Эло чёрных</string>
<string name="tag_annotator">Комментатор</string>
<string name="tag_plies">Полуходов</string>
<string name="open_no_access">Нет доступа к файлу: его переместили, удалили или отозвали разрешение. Уберите базу из списка и добавьте снова.</string>
<string name="open_corrupt">Файл повреждён или это не шахматная база.</string>
<string name="open_empty">В архиве нет базы PGN или ChessBase.</string>
<string name="open_unsupported">Такую базу прочитать нельзя: %1$s</string>
<string name="add_file">Файл</string>
<string name="add_file_hint">PGN, .cbv, .zip или .7z</string>
<string name="add_folder">Папка</string>
<string name="add_folder_hint">Все базы в папке, в том числе ChessBase (.cbh)</string>
<string name="folder_scanning">Ищу базы…</string>
<string name="folder_empty_title">В папке нет баз</string>
<string name="folder_empty_text">Подходят файлы PGN, базы ChessBase (.cbh, .cbv) и архивы .zip и .7z — в самой папке и во вложенных папках на два уровня.</string>
<string name="folder_added">уже в списке</string>
<string name="folder_incomplete">нет файла .cbg — партии не открыть</string>
<plurals name="folder_found">
<item quantity="one">В папке «%2$s» найдена %1$d база</item>
<item quantity="few">В папке «%2$s» найдены %1$d базы</item>
<item quantity="many">В папке «%2$s» найдено %1$d баз</item>
<item quantity="other">В папке «%2$s» найдено %1$d базы</item>
</plurals>
<plurals name="add_chosen">
<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>
<plurals name="added_count">
<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="add_tree_hint">Корень памяти и саму «Загрузки» выбрать нельзя — только папку внутри них.</string>
<string name="pick_another">Выбрать другую</string>
<string name="done">Готово</string>
<string name="add">Добавить</string>
<string name="choose_all">Отметить все</string>
<string name="choose_none">Снять все</string>
<string name="open_missing_part">Рядом с базой больше нет файла %1$s: его переместили или удалили.</string>
<string name="board_and_pieces">Доска и фигуры</string>
<string name="board_brown">Коричневая</string>
<string name="board_blue">Синяя</string>
<string name="board_green">Зелёная</string>
<string name="board_tournament">Турнирная</string>
<string name="board_sand">Песочная</string>
<string name="board_coral">Морская</string>
<string name="board_grey">Серая</string>
<string name="board_purple">Фиолетовая</string>
<string name="board_ice">Лёд</string>
<string name="board_navy">Тёмно-синяя</string>
<string name="board_mint">Мята</string>
<string name="board_emerald">Изумруд</string>
<string name="board_orange">Оранжевая</string>
<string name="board_rose">Розовая</string>
<string name="board_dusk">Сумерки</string>
<string name="board_night">Ночь</string>
<string name="board_wood">Дерево</string>
<string name="board_maple">Клён</string>
<string name="board_leather">Кожа</string>
<string name="board_marble">Мрамор</string>
<string name="board_blue_marble">Синий мрамор</string>
<string name="board_canvas">Холст</string>
<string name="board_metal">Металл</string>
<string name="board_olive">Олива</string>
<string name="board_stone">Камень</string>
<string name="board_green_plastic">Зелёный пластик</string>
<string name="board_purple_diag">Фиолетовые диагонали</string>
<string name="board_pink_pyramid">Розовые пирамиды</string>
<string name="board_sketch">Набросок</string>
<string name="board">Доска</string>
<string name="pieces_tab">Фигуры</string>
<string name="game_number">№ %1$s</string>
<string name="add_paste">Вставить PGN из буфера</string>
<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>
<string name="file_unreadable">Файл не прочитался: его уже нет или приложение, из которого он открыт, не дало к нему доступа. Попробуйте открыть его ещё раз.</string>
<string name="file_chessbase_part">База ChessBase (.cbh) состоит из нескольких файлов, а пришёл один. Добавьте папку, где она лежит: «Добавить базу» → «Папка».</string>
<string name="file_copy_failed">Приложению не удалось сохранить копию файла. Проверьте, есть ли на телефоне свободное место.</string>
<string name="db_copy">копия</string>
<string name="removed_copy">База удалена из ChessPenguin</string>
<!-- Game report (android-ui.md §21) -->
<string name="review_menu">Анализ партии</string>
<string name="review_report_menu">Отчёт по партии</string>
<string name="review_text">Движок оценит каждую позицию основной линии. Сама партия не изменится.</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_partial">Уже оценено позиций: %1$d из %2$d.</string>
<string name="review_progress">Анализ партии · %1$d из %2$d</string>
<string name="review_stop">Остановить анализ</string>
<string name="review_accuracy">Точность</string>
<string name="review_accuracy_of">Точность: белые %1$s, чёрные %2$s</string>
<string name="review_report">Отчёт</string>
<string name="review_better">лучше было %1$s</string>
<string name="review_inaccuracy">Неточность</string>
<string name="review_mistake">Ошибка</string>
<string name="review_blunder">Зевок</string>
<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>
<string name="review_acpl">Средняя потеря сантипешек</string>
<string name="review_opening">Дебют</string>
<string name="review_middlegame">Миттельшпиль</string>
<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_graph_state">%1$s, оценка %2$s</string>
<string name="review_start_position">Начальная позиция</string>
<plurals name="review_estimate">
<item quantity="one">Позиций: %1$d, примерно %2$s</item>
<item quantity="few">Позиций: %1$d, примерно %2$s</item>
<item quantity="many">Позиций: %1$d, примерно %2$s</item>
<item quantity="other">Позиций: %1$d, примерно %2$s</item>
</plurals>
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
<string name="online_title">Партии с Lichess и Chess.com</string>
<string name="add_online_hint">Партии любого игрока по нику: свои, ученика, соперника</string>
<string name="online_intro">Партии игрока станут базой на телефоне — искать, смотреть, анализировать. Нужен только ник, входить на сайт не нужно.</string>
<string name="online_nick">Ник игрока</string>
<string name="online_nick_hint">как на сайте</string>
<string name="online_other">На Chess.com другой ник</string>
<string name="online_other_nick">Ник на Chess.com</string>
<string name="online_same_nick">Тот же ник</string>
<string name="online_nick_rule">Латиница, цифры, _ и -, от 2 до 30 символов</string>
<string name="online_find">Найти</string>
<string name="online_searching">Ищу на сайтах…</string>
<string name="online_lichess_found">%1$s · первый раз около %2$d мин</string>
<string name="online_chesscom_found">месяцев с партиями: %1$d</string>
<string name="online_not_found">%1$s: игрока с таким ником нет — проверьте написание</string>
<string name="online_merge">Объединить оба сайта в одну базу</string>
<string name="online_merge_hint">Иначе у каждого сайта будет своя база</string>
<string name="online_into_new">В новую базу «%1$s»</string>
<string name="online_into_existing">В базу «%1$s» (там уже %2$s; добавятся только новые)</string>
<string name="online_download">Скачать</string>
<string name="online_progress_lichess">Lichess: %1$s из примерно %2$s · осталось около %3$d мин</string>
<string name="online_progress_count">%1$s: %2$s</string>
<string name="online_progress_chesscom">Chess.com: месяц %1$d из %2$d · %3$s</string>
<string name="online_stop">Остановить</string>
<string name="online_added">+%1$s, всего %2$s</string>
<string name="online_no_new">Новых партий нет, в базе %1$s</string>
<string name="online_stopped">Остановлено, в базе %1$s</string>
<string name="online_no_games">Партий в обычные шахматы там нет.</string>
<string name="online_open">Открыть базу</string>
<string name="online_try_again">Попробовать ещё раз</string>
<string name="online_err_network">%1$s не отвечает. Проверьте подключение к интернету и попробуйте ещё раз.</string>
<string name="online_err_rate">%1$s просит сделать паузу: слишком много запросов подряд. Подождите минуту и попробуйте снова — скачанное сохранится.</string>
<string name="online_err_unexpected">%1$s ответил непонятно — возможно, сайт что-то поменял. Попробуйте позже или обновите ChessPenguin.</string>
<string name="online_err_disk">Не удалось записать базу: на телефоне не хватает места.</string>
<string name="online_err_busy">Эта база уже скачивается.</string>
<string name="online_short_network">%1$s не отвечает</string>
<string name="online_short_rate">%1$s просит паузу</string>
<string name="online_short_failed">Скачивание прервалось</string>
<string name="online_update">Скачать новые партии</string>
<string name="online_stop_download">Остановить скачивание</string>
<string name="online_downloading">Скачивается · %1$s</string>
<string name="online_updated">обновлено %1$s</string>
<string name="online_unfinished">не докачана</string>
<string name="online_removed">Скачанная база удалена</string>
<string name="online_nick_lichess">Ник на Lichess</string>
<string name="online_lichess_quick">%1$s · первый раз меньше минуты</string>
<string name="online_leave">Можно уйти с этого экрана: база уже в списке, скачивание продолжится.</string>
<string name="online_done">Готово: %1$s</string>
<string name="online_updated_now">обновлено только что</string>
<string name="online_snack_added">«%1$s»: +%2$s, всего %3$s</string>
<string name="online_snack_none">«%1$s»: новых партий нет</string>
<string name="online_snack_failed">«%1$s»: %2$s</string>
<string name="online_open_short">Открыть</string>
<plurals name="games_up_to">
<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="upd_title">Вышла версия %1$s</string>
<string name="upd_you_have">У вас %1$s</string>
<string name="upd_update">Обновить</string>
<string name="upd_install">Установить</string>
<string name="upd_keeps">Базы, настройки и движок останутся.</string>
<string name="upd_keeps_no_engine">Базы и настройки останутся.</string>
<string name="upd_closes">На время установки ChessPenguin закроется — потом откройте его снова.</string>
<string name="upd_online_note">Идёт скачивание партий: установка его остановит, потом его можно продолжить.</string>
<string name="upd_perm_title">Нужно одно разрешение</string>
<string name="upd_perm_body">Android ставит приложения не из магазина только с вашего разрешения. Откроются настройки: включите переключатель для ChessPenguin и вернитесь назад.</string>
<string name="upd_perm_open">Открыть настройки</string>
<string name="upd_perm_denied">Разрешение не включено — без него Android не установит новую версию.</string>
<string name="upd_perm_granted">Разрешение есть, скачиваю</string>
<string name="upd_on_site">Скачать на сайте</string>
<string name="upd_open_site">Открыть сайт</string>
<string name="upd_leave">Лист можно закрыть: загрузка продолжится.</string>
<string name="upd_waiting_net">Нет сети. Загрузка продолжится сама, когда сеть появится.</string>
<string name="upd_waiting_net_short">Ждёт сеть</string>
<string name="upd_checking_file">Проверяю файл…</string>
<string name="upd_keeping_engine">Сохраняю движок…</string>
<string name="upd_installing">Устанавливаю…</string>
<string name="upd_ready">Новая версия скачана и проверена.</string>
<string name="upd_ready_short">Скачана и проверена</string>
<string name="upd_ready_snack">Новая версия скачана</string>
<string name="upd_aborted">Установка отменена. Новая версия скачана — установите её, когда будет удобно.</string>
<string name="upd_notification">Обновление ChessPenguin</string>
<string name="upd_done_snack">ChessPenguin обновлён: %1$s → %2$s</string>
<string name="upd_err_failed">Загрузка не удалась. Попробуйте ещё раз.</string>
<string name="upd_err_corrupt">Файл повредился при скачивании, поэтому не установлен. Попробуйте ещё раз.</string>
<string name="upd_err_release">С этим выпуском что-то не так: файл для Android нельзя проверить. Скачайте новую версию на сайте.</string>
<string name="upd_err_storage">Android не установил новую версию: не хватает места. Освободите %1$d МБ и попробуйте ещё раз.</string>
<string name="upd_err_conflict">Android не установил новую версию: этот ChessPenguin подписан другим ключом. Поставить новую версию можно только после удаления этой, а при удалении пропадут список баз и скачанные базы.</string>
<string name="upd_err_blocked">Установку остановил Android или защита телефона. Скачайте новую версию на сайте.</string>
<string name="upd_err_install">Android не установил новую версию. Попробуйте ещё раз или скачайте её на сайте.</string>
<string name="upd_short_offline">Нет интернета</string>
<string name="upd_short_space">Не хватает места</string>
<string name="upd_short_corrupt">Файл повредился</string>
<string name="upd_short_install">Android не установил</string>
<string name="upd_short_failed">Загрузка не удалась</string>
<string name="upd_more">Подробнее</string>
<string name="upd_details">Подробности</string>
<string name="upd_copy">Копировать</string>
<string name="upd_group">Обновления</string>
<string name="upd_auto">Проверять обновления при запуске</string>
<string name="upd_auto_sub">Раз в день ChessPenguin спрашивает у своего сайта, какая версия последняя; сайт считает работающие установки. Передаются только случайный номер этой установки, версия и система. Проверка идёт и при выключенных предложениях.</string>
<string name="upd_offer">Предлагать новые версии</string>
<string name="upd_offer_sub">Карточка на экране «Базы», когда выходит новая версия.</string>
<string name="upd_offer_needs_check">Работает, когда включена проверка обновлений.</string>
<string name="upd_offers_off_snack">Больше не предлагаем. Включить — в Настройках, «О программе»</string>
<string name="upd_dismiss_cd">Не предлагать обновления</string>
<string name="upd_check_now">Проверить сейчас</string>
<string name="upd_checking">Проверяю…</string>
<string name="upd_latest">У вас последняя версия</string>
<string name="upd_checked">Проверено %1$s</string>
<string name="upd_check_offline">Нет интернета — проверить обновления нельзя</string>
<string name="upd_check_failed">Не удалось проверить обновления: сайт не ответил. Попробуйте позже.</string>
<string name="s_about_available">Вышла версия %1$s</string>
<string name="s_about_downloading">Скачивается версия %1$s…</string>
<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

@ -0,0 +1,723 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="sample_classics">Klassik partiyalar</string>
<string name="sample_alekhine">Alyoxin</string>
<string name="empty_title">Bazalaringiz shu yerda koʻrinadi</string>
<string name="empty_text">PGN fayl, ChessBase bazasi yoki .zip/.7z arxivini — telefoningizdan yoki bulutdan — qoʻshing yoki Lichess va Chess.comdan partiyalarni yuklab oling.</string>
<string name="add_database">Baza qoʻshish</string>
<string name="open_samples">Namuna partiyalarni ochish</string>
<string name="not_opened">hali ochilmagan · %1$s</string>
<plurals name="games_count">
<item quantity="one">%1$s ta partiya</item>
<item quantity="other">%1$s ta partiya</item>
</plurals>
<string name="games_with_format">%1$s · %2$s</string>
<string name="menu">Menyu</string>
<string name="rename">Nomini oʻzgartirish</string>
<string name="remove">Roʻyxatdan olib tashlash</string>
<string name="rename_hint">Roʻyxatdagi nom. Fayl oʻzgarmaydi.</string>
<string name="cancel">Bekor qilish</string>
<string name="save">Saqlash</string>
<string name="removed">Baza roʻyxatdan olib tashlandi</string>
<string name="undo">Qaytarish</string>
<string name="back">Orqaga</string>
<string name="reading">Oʻqilmoqda…</string>
<string name="open_failed">Bazani ochib boʻlmadi</string>
<string name="search">Qidirish</string>
<string name="search_hint">Oʻyinchi, turnir, yil</string>
<string name="nothing_found">Hech narsa topilmadi</string>
<string name="clear">Tozalash</string>
<string name="game_of">%1$d / %2$d</string>
<string name="previous_game">Oldingi partiya</string>
<string name="next_game">Keyingi partiya</string>
<string name="flip">Taxtani aylantirish</string>
<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_description">Taxta, %1$sdan keyingi pozitsiya</string>
<string name="board_start">Taxta, boshlangʻich pozitsiya</string>
<string name="white_won">Oqlar yutdi</string>
<string name="black_won">Qoralar yutdi</string>
<string name="draw">Durang</string>
<string name="game_failed">Partiyani oʻqib boʻlmadi</string>
<string name="engine">Dvigatel</string>
<string name="thinking">Oʻylanmoqda…</string>
<string name="depth">chuqurlik %1$d</string>
<string name="paused">pauza</string>
<string name="deeper">Chuqurroq</string>
<string name="more_lines">Koʻproq liniya</string>
<string name="fewer_lines">Kamroq liniya</string>
<string name="engine_not_answering">Dvigatel javob bermayapti</string>
<string name="engine_not_starting">Dvigatel bu telefonda ishga tushmaydi</string>
<string name="restart">Qayta ishga tushirish</string>
<string name="engine_line_preview">Dvigatel liniyasi · yurish %1$d / %2$d</string>
<string name="close">Yopish</string>
<string name="engine_sheet_title">Stockfish dvigateli</string>
<string name="engine_sheet_text">Pozitsiyani baholaydi va eng yaxshi yurishlarni koʻrsatadi. Internetsiz ishlaydi — faqat bir marta yuklab olish kerak.</string>
<string name="engine_size">Hajmi: %1$d MB</string>
<string name="engine_metered">Hozir Wi-Fi yoʻq: yuklab olish mobil internetdan foydalanadi.</string>
<string name="not_now">Hozir emas</string>
<string name="download">Yuklab olish</string>
<string name="downloaded_of">Yuklab olindi: %1$d / %2$d MB</string>
<string name="cancel_download">Bekor qilish</string>
<string name="download_cancelled">Yuklab olish bekor qilindi</string>
<string name="engine_ready">Dvigatel tayyor</string>
<string name="no_internet">Internet yoʻq. Tarmoqqa ulanib, qayta urinib koʻring.</string>
<string name="download_title">ChessPenguin: Stockfish dvigateli</string>
<string name="interrupted">Yuklab olish toʻxtadi. Qayta urinib koʻring.</string>
<string name="no_space">Joy yetmaydi: %1$d MB kerak.</string>
<string name="corrupt">Dvigatel fayli yuklab olishda shikastlandi. Qayta yuklab oling.</string>
<string name="retry">Qayta urinish</string>
<string name="download_again">Qayta yuklab olish</string>
<string name="ok">OK</string>
<string name="preparing_engine">Dvigatel tayyorlanmoqda…</string>
<string name="settings">Sozlamalar</string>
<string name="group_look">Koʻrinish</string>
<string name="group_engine">Dvigatel</string>
<string name="theme">Mavzu</string>
<string name="theme_system">Tizimdagidek</string>
<string name="theme_light">Yorugʻ</string>
<string name="theme_dark">Qorongʻi</string>
<string name="notation">Yurishlar yozuvi</string>
<string name="notation_latin">Lotin harflari (K Q R B N)</string>
<string name="notation_figurines">Figura belgilari</string>
<string name="notation_local">Til harflari</string>
<string name="notation_hint">Faqat koʻrinish. PGNda doim K Q R B N.</string>
<string name="animation">Figura animatsiyasi</string>
<string name="best_arrow">Eng yaxshi yurish strelkasi</string>
<string name="vibration">Tebranish</string>
<string name="engine_built_in">Stockfish 19 · ichki</string>
<string name="engine_downloaded">Stockfish 19 · yuklab olingan</string>
<string name="engine_missing">Yuklab olinmagan · Yuklab olish (%1$d MB)</string>
<string name="engine_downloading">Yuklab olinmoqda… %1$d / %2$d MB</string>
<string name="engine_delete">Dvigatelni oʻchirish (%1$d MB boʻshaydi)</string>
<string name="engine_delete_question">Dvigatel oʻchirilsinmi? Uni qayta yuklab olish mumkin.</string>
<string name="delete">Oʻchirish</string>
<string name="lines">Liniyalar</string>
<string name="time_per_position">Har pozitsiyaga vaqt</string>
<string name="seconds">%1$d s</string>
<string name="one_minute">1 daq.</string>
<string name="no_limit">Cheklovsiz</string>
<string name="threads">Oqimlar</string>
<string name="memory">Xotira</string>
<string name="megabytes">%1$d MB</string>
<string name="engine_battery">Dvigatel batareyani sarflaydi. Partiyadan chiqqaningizda yoki ilova fonga oʻtganda u oʻzi oʻchadi.</string>
<string name="about">Dastur haqida</string>
<string name="build_full">Stockfish ichki</string>
<string name="build_light">Stockfish ilovada yuklab olinadi</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>
<string name="game_info">Partiya maʼlumotlari</string>
<string name="copy_pgn">PGN nusxalash</string>
<string name="copy_fen">FEN nusxalash</string>
<string name="share_game">Partiyani ulashish</string>
<string name="notes">Eslatmalar</string>
<string name="engine_state_on">yoqiq</string>
<string name="engine_state_off">oʻchiq</string>
<string name="engine_state_missing">yuklab olinmagan</string>
<string name="found_of">Topildi: %1$s / %2$s</string>
<string name="group_game">Partiya</string>
<string name="move_white">%1$d, oqlar, %2$s</string>
<string name="move_black">%1$d, qoralar, %2$s</string>
<string name="current_move">joriy yurish</string>
<string name="language">Til</string>
<string name="checkmate">Mat</string>
<string name="stalemate">Pat</string>
<string name="pgn_copied">PGN nusxalandi</string>
<string name="fen_copied">FEN nusxalandi</string>
<string name="tag_event">Turnir</string>
<string name="tag_site">Joy</string>
<string name="tag_date">Sana</string>
<string name="tag_round">Tur</string>
<string name="tag_white">Oqlar</string>
<string name="tag_black">Qoralar</string>
<string name="tag_result">Natija</string>
<string name="tag_white_elo">Oqlar Elo</string>
<string name="tag_black_elo">Qoralar Elo</string>
<string name="tag_annotator">Izohlovchi</string>
<string name="tag_plies">Yarim yurishlar</string>
<string name="open_no_access">Faylga kirish yoʻq: u koʻchirilgan, oʻchirilgan yoki ruxsat qaytarib olingan. Uni roʻyxatdan olib tashlab, qayta qoʻshing.</string>
<string name="open_corrupt">Fayl shikastlangan yoki shaxmat bazasi emas.</string>
<string name="open_empty">Arxivda PGN yoki ChessBase bazasi yoʻq.</string>
<string name="open_unsupported">Bu turdagi bazani oʻqib boʻlmaydi: %1$s</string>
<string name="add_file">Fayl</string>
<string name="add_file_hint">PGN, .cbv, .zip yoki .7z</string>
<string name="add_folder">Jild</string>
<string name="add_folder_hint">Jilddagi barcha bazalar, ChessBase (.cbh) ham</string>
<string name="folder_scanning">Bazalar qidirilmoqda…</string>
<string name="folder_empty_title">Bu jildda bazalar yoʻq</string>
<string name="folder_empty_text">Jildda va uning ichidagi ikki daraja jildlarda PGN fayllar, ChessBase bazalari (.cbh, .cbv) va .zip yoki .7z arxivlarni qidiradi.</string>
<string name="folder_added">roʻyxatda bor</string>
<string name="folder_incomplete">.cbg fayli yoʻq — partiyalarni ochib boʻlmaydi</string>
<plurals name="folder_found">
<item quantity="one">“%2$s”da %1$d ta baza</item>
<item quantity="other">“%2$s”da %1$d ta baza</item>
</plurals>
<plurals name="add_chosen">
<item quantity="one">%1$d tasini qoʻshish</item>
<item quantity="other">%1$d tasini qoʻshish</item>
</plurals>
<plurals name="added_count">
<item quantity="one">%1$d ta baza qoʻshildi</item>
<item quantity="other">%1$d ta baza qoʻshildi</item>
</plurals>
<string name="add_tree_hint">Android ilovalarga xotiraning ildizini yoki Downloads jildining oʻzini tanlashga ruxsat bermaydi — faqat ularning ichidagi jildni.</string>
<string name="pick_another">Boshqasini tanlash</string>
<string name="done">Tayyor</string>
<string name="add">Qoʻshish</string>
<string name="choose_all">Hammasini belgilash</string>
<string name="choose_none">Belgilarni olib tashlash</string>
<string name="open_missing_part">%1$s fayli endi baza yonida emas: u koʻchirilgan yoki oʻchirilgan.</string>
<string name="board_and_pieces">Taxta va figuralar</string>
<string name="board_brown">Jigarrang</string>
<string name="board_blue">Koʻk</string>
<string name="board_green">Yashil</string>
<string name="board_tournament">Turnir</string>
<string name="board_sand">Qum</string>
<string name="board_coral">Marjon</string>
<string name="board_grey">Kulrang</string>
<string name="board_purple">Binafsha</string>
<string name="board_ice">Muz</string>
<string name="board_navy">Toʻq koʻk</string>
<string name="board_mint">Yalpiz</string>
<string name="board_emerald">Zumrad</string>
<string name="board_orange">Toʻq sariq</string>
<string name="board_rose">Atirgul</string>
<string name="board_dusk">Shom</string>
<string name="board_night">Tun</string>
<string name="board_wood">Yogʻoch</string>
<string name="board_maple">Zarang</string>
<string name="board_leather">Charm</string>
<string name="board_marble">Marmar</string>
<string name="board_blue_marble">Koʻk marmar</string>
<string name="board_canvas">Mato</string>
<string name="board_metal">Metall</string>
<string name="board_olive">Zaytun</string>
<string name="board_stone">Tosh</string>
<string name="board_green_plastic">Yashil plastik</string>
<string name="board_purple_diag">Binafsha diagonal</string>
<string name="board_pink_pyramid">Pushti piramida</string>
<string name="board_sketch">Eskiz</string>
<string name="board">Taxta</string>
<string name="pieces_tab">Figuralar</string>
<string name="game_number">№ %1$s</string>
<string name="add_paste">Almashish buferidan PGN qoʻyish</string>
<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>
<string name="file_unreadable">Faylni oʻqib boʻlmadi: u yoʻqolgan boʻlishi yoki u kelgan ilova unga kirishga ruxsat bermagan boʻlishi mumkin. Uni qayta ochib koʻring.</string>
<string name="file_chessbase_part">ChessBase bazasi (.cbh) bir nechta fayldan iborat, lekin faqat bittasi keldi. U turgan jildni qoʻshing: \"Baza qoʻshish\" → \"Jild\".</string>
<string name="file_copy_failed">Ilova fayl nusxasini saqlay olmadi. Telefonda boʻsh joy borligini tekshiring.</string>
<string name="db_copy">nusxa</string>
<string name="removed_copy">Baza ChessPenguindan oʻchirildi</string>
<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_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_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>
<string name="review_accuracy">Aniqlik</string>
<string name="review_accuracy_of">Aniqlik: oqlar %1$s, qoralar %2$s</string>
<string name="review_report">Hisobot</string>
<string name="review_better">%1$s yaxshiroq edi</string>
<string name="review_inaccuracy">Noaniqlik</string>
<string name="review_mistake">Xato</string>
<string name="review_blunder">Qoʻpol xato</string>
<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>
<string name="review_acpl">Oʻrtacha santipeshka yoʻqotish</string>
<string name="review_opening">Debyut</string>
<string name="review_middlegame">Mittelshpil</string>
<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_graph_state">%1$s, baho %2$s</string>
<string name="review_start_position">Boshlangʻich pozitsiya</string>
<plurals name="review_estimate">
<item quantity="one">%1$d ta pozitsiya, taxminan %2$s</item>
<item quantity="other">%1$d ta pozitsiya, taxminan %2$s</item>
</plurals>
<string name="online_title">Lichess va Chess.com partiyalari</string>
<string name="add_online_hint">Istalgan oʻyinchining partiyalari taxallus boʻyicha: oʻzingizniki, shogirdingizniki, raqibingizniki</string>
<string name="online_intro">Oʻyinchining partiyalari telefoningizda qidirish, koʻrish va tahlil uchun bazaga aylanadi. Faqat taxallus kerak, hisobga kirish shart emas.</string>
<string name="online_nick">Oʻyinchi taxallusi</string>
<string name="online_nick_hint">saytdagidek</string>
<string name="online_other">Chess.comda boshqa taxallus</string>
<string name="online_other_nick">Chess.comdagi taxallus</string>
<string name="online_same_nick">Oʻsha taxallus</string>
<string name="online_nick_rule">Lotin harflari, raqamlar, _ va -, 2 dan 30 gacha belgi</string>
<string name="online_find">Topish</string>
<string name="online_searching">Saytlarda qidirilmoqda…</string>
<string name="online_lichess_found">%1$s · birinchi marta taxminan %2$d daq.</string>
<string name="online_chesscom_found">partiyali oylar: %1$d</string>
<string name="online_not_found">%1$s: bunday taxallusli oʻyinchi yoʻq — yozilishini tekshiring</string>
<string name="online_merge">Ikkala saytni bitta bazaga birlashtirish</string>
<string name="online_merge_hint">Aks holda har bir sayt uchun alohida baza boʻladi</string>
<string name="online_into_new">Yangi “%1$s” bazasiga</string>
<string name="online_into_existing">“%1$s” bazasiga (unda allaqachon %2$s; faqat yangi partiyalar qoʻshiladi)</string>
<string name="online_download">Yuklab olish</string>
<string name="online_progress_lichess">Lichess: %1$s / taxminan %2$s · taxminan %3$d daq. qoldi</string>
<string name="online_progress_count">%1$s: %2$s</string>
<string name="online_progress_chesscom">Chess.com: oy %1$d / %2$d · %3$s</string>
<string name="online_stop">Toʻxtatish</string>
<string name="online_added">+%1$s, jami %2$s</string>
<string name="online_no_new">Yangi partiyalar yoʻq, bazada %1$s</string>
<string name="online_stopped">Toʻxtatildi, bazada %1$s</string>
<string name="online_no_games">U yerda klassik shaxmat partiyalari yoʻq.</string>
<string name="online_open">Bazani ochish</string>
<string name="online_try_again">Qayta urinish</string>
<string name="online_err_network">%1$s javob bermayapti. Internet aloqasini tekshirib, qayta urinib koʻring.</string>
<string name="online_err_rate">%1$s tanaffus soʻrayapti: ketma-ket juda koʻp soʻrov. Bir daqiqa kutib, qayta urinib koʻring; yuklab olingani saqlanadi.</string>
<string name="online_err_unexpected">%1$s ChessPenguin tushunmaydigan tarzda javob berdi: sayt oʻzgargan boʻlishi mumkin. Keyinroq urinib koʻring yoki ChessPenguinni yangilang.</string>
<string name="online_err_disk">Bazani yozib boʻlmadi: telefonda joy qolmadi.</string>
<string name="online_err_busy">Bu baza allaqachon yuklab olinmoqda.</string>
<string name="online_short_network">%1$s javob bermayapti</string>
<string name="online_short_rate">%1$s tanaffus soʻrayapti</string>
<string name="online_short_failed">Yuklab olish toʻxtadi</string>
<string name="online_update">Yangi partiyalarni yuklab olish</string>
<string name="online_stop_download">Yuklab olishni toʻxtatish</string>
<string name="online_downloading">Yuklab olinmoqda · %1$s</string>
<string name="online_updated">yangilangan: %1$s</string>
<string name="online_unfinished">tugallanmagan</string>
<string name="online_removed">Yuklab olingan baza oʻchirildi</string>
<string name="online_nick_lichess">Lichessdagi taxallus</string>
<string name="online_lichess_quick">%1$s · birinchi marta bir daqiqadan kam</string>
<string name="online_leave">Bu ekrandan chiqishingiz mumkin: baza roʻyxatda, yuklab olish davom etadi.</string>
<string name="online_done">Tayyor: %1$s</string>
<string name="online_updated_now">hozirgina yangilandi</string>
<string name="online_snack_added">“%1$s”: +%2$s, jami %3$s</string>
<string name="online_snack_none">“%1$s”: yangi partiyalar yoʻq</string>
<string name="online_snack_failed">“%1$s”: %2$s</string>
<string name="online_open_short">Ochish</string>
<plurals name="games_up_to">
<item quantity="one">%1$s tagacha partiya</item>
<item quantity="other">%1$s tagacha partiya</item>
</plurals>
<string name="upd_title">%1$s versiyasi chiqdi</string>
<string name="upd_you_have">Sizda %1$s</string>
<string name="upd_update">Yangilash</string>
<string name="upd_install">Oʻrnatish</string>
<string name="upd_keeps">Bazalar, sozlamalar va dvigatel saqlanadi.</string>
<string name="upd_keeps_no_engine">Bazalar va sozlamalar saqlanadi.</string>
<string name="upd_closes">Oʻrnatish vaqtida ChessPenguin yopiladi — soʻng uni qayta oching.</string>
<string name="upd_online_note">Partiyalar yuklab olinmoqda: oʻrnatish uni toʻxtatadi; keyinroq davom ettirish mumkin.</string>
<string name="upd_perm_title">Bitta ruxsat kerak</string>
<string name="upd_perm_body">Android doʻkondan tashqaridagi ilovalarni faqat sizning ruxsatingiz bilan oʻrnatadi. Sozlamalar ochiladi: ChessPenguin uchun kalitni yoqing va qayting.</string>
<string name="upd_perm_open">Sozlamalarni ochish</string>
<string name="upd_perm_denied">Ruxsat oʻchiq — usiz Android yangi versiyani oʻrnatmaydi.</string>
<string name="upd_perm_granted">Ruxsat berildi, yuklab olinmoqda</string>
<string name="upd_on_site">Saytdan yuklab olish</string>
<string name="upd_open_site">Saytni ochish</string>
<string name="upd_leave">Buni yopishingiz mumkin: yuklab olish davom etadi.</string>
<string name="upd_waiting_net">Tarmoq yoʻq. Tarmoq tiklanganda yuklab olish oʻzi davom etadi.</string>
<string name="upd_waiting_net_short">Tarmoq kutilmoqda</string>
<string name="upd_checking_file">Fayl tekshirilmoqda…</string>
<string name="upd_keeping_engine">Dvigatel saqlanmoqda…</string>
<string name="upd_installing">Oʻrnatilmoqda…</string>
<string name="upd_ready">Yangi versiya yuklab olindi va tekshirildi.</string>
<string name="upd_ready_short">Yuklab olindi va tekshirildi</string>
<string name="upd_ready_snack">Yangi versiya yuklab olindi</string>
<string name="upd_aborted">Oʻrnatish bekor qilindi. Yangi versiya yuklab olingan — istalgan vaqtda oʻrnating.</string>
<string name="upd_notification">ChessPenguin yangilanishi</string>
<string name="upd_done_snack">ChessPenguin yangilandi: %1$s → %2$s</string>
<string name="upd_err_failed">Yuklab olib boʻlmadi. Qayta urinib koʻring.</string>
<string name="upd_err_corrupt">Fayl yuklab olishda shikastlandi, shuning uchun oʻrnatilmadi. Qayta urinib koʻring.</string>
<string name="upd_err_release">Bu nashrda muammo bor: Android faylini tekshirib boʻlmaydi. Yangi versiyani saytdan yuklab oling.</string>
<string name="upd_err_storage">Android yangi versiyani oʻrnatmadi: joy yetmaydi. %1$d MB boʻshatib, qayta urinib koʻring.</string>
<string name="upd_err_conflict">Android yangi versiyani oʻrnatmadi: bu ChessPenguin boshqa kalit bilan imzolangan. Yangi versiyani faqat bunisini oʻchirgandan keyin oʻrnatish mumkin, oʻchirilganda esa bazalar roʻyxati va yuklab olingan bazalar yoʻqoladi.</string>
<string name="upd_err_blocked">Android yoki telefon himoyasi oʻrnatishni toʻxtatdi. Yangi versiyani saytdan yuklab oling.</string>
<string name="upd_err_install">Android yangi versiyani oʻrnatmadi. Qayta urinib koʻring yoki saytdan yuklab oling.</string>
<string name="upd_short_offline">Internet yoʻq</string>
<string name="upd_short_space">Joy yetmaydi</string>
<string name="upd_short_corrupt">Fayl shikastlandi</string>
<string name="upd_short_install">Android oʻrnatmadi</string>
<string name="upd_short_failed">Yuklab olib boʻlmadi</string>
<string name="upd_more">Yana</string>
<string name="upd_details">Batafsil</string>
<string name="upd_copy">Nusxalash</string>
<string name="upd_group">Yangilanishlar</string>
<string name="upd_auto">Ishga tushganda yangilanishlarni tekshirish</string>
<string name="upd_auto_sub">ChessPenguin kuniga bir marta oʻz saytidan eng soʻnggi versiyani soʻraydi; sayt ishlayotgan oʻrnatmalarni sanaydi. Faqat shu oʻrnatmaning tasodifiy raqami, versiya va tizim yuboriladi. Takliflar oʻchiq boʻlsa ham tekshiruv davom etadi.</string>
<string name="upd_offer">Yangi versiyalarni taklif qilish</string>
<string name="upd_offer_sub">Yangi versiya chiqqanda «Bazalar» ekranida karta.</string>
<string name="upd_offer_needs_check">Yangilanishlarni tekshirish yoqilganda ishlaydi.</string>
<string name="upd_offers_off_snack">Endi taklif qilmaymiz. Yoqish — Sozlamalar, «Dastur haqida»</string>
<string name="upd_dismiss_cd">Yangilanishlarni taklif qilmaslik</string>
<string name="upd_check_now">Hozir tekshirish</string>
<string name="upd_checking">Tekshirilmoqda…</string>
<string name="upd_latest">Sizda eng soʻnggi versiya</string>
<string name="upd_checked">Tekshirildi: %1$s</string>
<string name="upd_check_offline">Internet yoʻq — yangilanishlarni tekshirib boʻlmaydi</string>
<string name="upd_check_failed">Yangilanishlarni tekshirib boʻlmadi: sayt javob bermadi. Keyinroq urinib koʻring.</string>
<string name="s_about_available">%1$s versiyasi chiqdi</string>
<string name="s_about_downloading">%1$s versiyasi yuklab olinmoqda…</string>
<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

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- The background of the adaptive icon (android-ui.md §10.7). -->
<color name="ic_launcher_background">#EAF2F9</color>
</resources>

View file

@ -0,0 +1,737 @@
<resources>
<string name="app_name" translatable="false">ChessPenguin</string>
<string name="sample_classics">Classic games</string>
<string name="sample_alekhine">Alekhine</string>
<string name="empty_title">Your databases will appear here</string>
<string name="empty_text">Add a PGN file, a ChessBase database or a .zip/.7z archive — from your phone or the cloud — or download games from Lichess and Chess.com.</string>
<string name="add_database">Add database</string>
<string name="open_samples">Open sample games</string>
<string name="not_opened">not opened yet · %1$s</string>
<plurals name="games_count">
<item quantity="one">%1$s game</item>
<item quantity="other">%1$s games</item>
</plurals>
<string name="games_with_format">%1$s · %2$s</string>
<string name="menu">Menu</string>
<string name="rename">Rename</string>
<string name="remove">Remove from list</string>
<string name="rename_hint">The name in the list. The file is not changed.</string>
<string name="cancel">Cancel</string>
<string name="save">Save</string>
<string name="removed">Database removed from the list</string>
<string name="undo">Undo</string>
<string name="back">Back</string>
<string name="reading">Reading…</string>
<string name="open_failed">Could not open the database</string>
<string name="search">Search</string>
<string name="search_hint">Player, event, year</string>
<string name="nothing_found">Nothing found</string>
<string name="clear">Clear</string>
<string name="game_of">%1$d of %2$d</string>
<string name="previous_game">Previous game</string>
<string name="next_game">Next game</string>
<string name="flip">Flip board</string>
<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_description">Board, position after %1$s</string>
<string name="board_start">Board, starting position</string>
<string name="white_won">White won</string>
<string name="black_won">Black won</string>
<string name="draw">Draw</string>
<string name="game_failed">Could not read the game</string>
<string name="engine">Engine</string>
<string name="thinking">Thinking…</string>
<string name="depth">depth %1$d</string>
<string name="paused">paused</string>
<string name="deeper">Deeper</string>
<string name="more_lines">More lines</string>
<string name="fewer_lines">Fewer lines</string>
<string name="engine_not_answering">The engine is not responding</string>
<string name="engine_not_starting">The engine does not start on this phone</string>
<string name="restart">Restart</string>
<string name="engine_line_preview">Engine line · move %1$d of %2$d</string>
<string name="close">Close</string>
<string name="engine_sheet_title">Stockfish engine</string>
<string name="engine_sheet_text">Evaluates the position and shows the best moves. Works offline — it only has to be downloaded once.</string>
<string name="engine_size">Size: %1$d MB</string>
<string name="engine_metered">No Wi-Fi now: the download will use mobile data.</string>
<string name="not_now">Not now</string>
<string name="download">Download</string>
<string name="downloaded_of">Downloaded %1$d of %2$d MB</string>
<string name="cancel_download">Cancel</string>
<string name="download_cancelled">Download cancelled</string>
<string name="engine_ready">The engine is ready</string>
<string name="no_internet">No internet. Connect to a network and try again.</string>
<string name="download_title">ChessPenguin: Stockfish engine</string>
<string name="interrupted">The download stopped. Please try again.</string>
<string name="no_space">Not enough space: %1$d MB needed.</string>
<string name="corrupt">The engine file was damaged during the download. Download it again.</string>
<string name="retry">Try again</string>
<string name="download_again">Download again</string>
<string name="ok">OK</string>
<string name="preparing_engine">Preparing the engine…</string>
<string name="settings">Settings</string>
<string name="group_look">Appearance</string>
<string name="group_engine">Engine</string>
<string name="theme">Theme</string>
<string name="theme_system">System default</string>
<string name="theme_light">Light</string>
<string name="theme_dark">Dark</string>
<string name="notation">Move notation</string>
<string name="notation_latin">Latin letters (K Q R B N)</string>
<string name="notation_figurines">Figurines</string>
<string name="notation_local">Letters of the language</string>
<string name="notation_hint">Display only. PGN always uses K Q R B N.</string>
<string name="animation">Piece animation</string>
<string name="best_arrow">Best-move arrow</string>
<string name="vibration">Vibration</string>
<string name="engine_built_in">Stockfish 19 · built in</string>
<string name="engine_downloaded">Stockfish 19 · downloaded</string>
<string name="engine_missing">Not downloaded · Download (%1$d MB)</string>
<string name="engine_downloading">Downloading… %1$d of %2$d MB</string>
<string name="engine_delete">Delete the engine (frees %1$d MB)</string>
<string name="engine_delete_question">Delete the engine? You can download it again.</string>
<string name="delete">Delete</string>
<string name="lines">Lines</string>
<string name="time_per_position">Time per position</string>
<string name="seconds">%1$d s</string>
<string name="one_minute">1 min</string>
<string name="no_limit">No limit</string>
<string name="threads">Threads</string>
<string name="memory">Memory</string>
<string name="megabytes">%1$d MB</string>
<string name="engine_battery">The engine uses the battery. It turns off by itself when you leave the game or the app goes to the background.</string>
<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="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>
<string name="game_info">Game details</string>
<string name="copy_pgn">Copy PGN</string>
<string name="copy_fen">Copy FEN</string>
<string name="share_game">Share game</string>
<string name="notes">Notes</string>
<string name="engine_state_on">on</string>
<string name="engine_state_off">off</string>
<string name="engine_state_missing">not downloaded</string>
<string name="found_of">Found %1$s of %2$s</string>
<string name="group_game">Game</string>
<string name="move_white">%1$d, White, %2$s</string>
<string name="move_black">%1$d, Black, %2$s</string>
<string name="current_move">current move</string>
<string name="language">Language</string>
<string name="checkmate">Checkmate</string>
<string name="stalemate">Stalemate</string>
<string name="pgn_copied">PGN copied</string>
<string name="fen_copied">FEN copied</string>
<string name="tag_event">Event</string>
<string name="tag_site">Site</string>
<string name="tag_date">Date</string>
<string name="tag_round">Round</string>
<string name="tag_white">White</string>
<string name="tag_black">Black</string>
<string name="tag_result">Result</string>
<string name="tag_white_elo">White Elo</string>
<string name="tag_black_elo">Black Elo</string>
<string name="tag_annotator">Annotator</string>
<string name="tag_plies">Plies</string>
<string name="open_no_access">No access to the file: it was moved, deleted or its permission was taken back. Remove it from the list and add it again.</string>
<string name="open_corrupt">The file is damaged or is not a chess database.</string>
<string name="open_empty">There is no PGN or ChessBase database in the archive.</string>
<string name="open_unsupported">This kind of database cannot be read: %1$s</string>
<string name="add_file">File</string>
<string name="add_file_hint">PGN, .cbv, .zip or .7z</string>
<string name="add_folder">Folder</string>
<string name="add_folder_hint">Every database in a folder, ChessBase (.cbh) too</string>
<string name="folder_scanning">Looking for databases…</string>
<string name="folder_empty_title">No databases in this folder</string>
<string name="folder_empty_text">Looks for PGN files, ChessBase databases (.cbh, .cbv) and .zip or .7z archives in the folder and two levels of folders inside it.</string>
<string name="folder_added">already on the list</string>
<string name="folder_incomplete">no .cbg file — the games can’t be opened</string>
<plurals name="folder_found">
<item quantity="one">%1$d database in “%2$s”</item>
<item quantity="other">%1$d databases in “%2$s”</item>
</plurals>
<plurals name="add_chosen">
<item quantity="one">Add %1$d</item>
<item quantity="other">Add %1$d</item>
</plurals>
<plurals name="added_count">
<item quantity="one">%1$d database added</item>
<item quantity="other">%1$d databases added</item>
</plurals>
<string name="add_tree_hint">Android won’t let apps pick the storage root or Downloads itself — only a folder inside them.</string>
<string name="pick_another">Pick another</string>
<string name="done">Done</string>
<string name="add">Add</string>
<string name="choose_all">Tick all</string>
<string name="choose_none">Untick all</string>
<string name="open_missing_part">The file %1$s is not beside the database any more: it was moved or deleted.</string>
<string name="board_and_pieces">Board and pieces</string>
<string name="board_brown">Brown</string>
<string name="board_blue">Blue</string>
<string name="board_green">Green</string>
<string name="board_tournament">Tournament</string>
<string name="board_sand">Sand</string>
<string name="board_coral">Coral</string>
<string name="board_grey">Grey</string>
<string name="board_purple">Purple</string>
<string name="board_ice">Ice</string>
<string name="board_navy">Navy</string>
<string name="board_mint">Mint</string>
<string name="board_emerald">Emerald</string>
<string name="board_orange">Orange</string>
<string name="board_rose">Rose</string>
<string name="board_dusk">Dusk</string>
<string name="board_night">Night</string>
<string name="board_wood">Wood</string>
<string name="board_maple">Maple</string>
<string name="board_leather">Leather</string>
<string name="board_marble">Marble</string>
<string name="board_blue_marble">Blue marble</string>
<string name="board_canvas">Canvas</string>
<string name="board_metal">Metal</string>
<string name="board_olive">Olive</string>
<string name="board_stone">Stone</string>
<string name="board_green_plastic">Green plastic</string>
<string name="board_purple_diag">Purple diagonal</string>
<string name="board_pink_pyramid">Pink pyramid</string>
<string name="board_sketch">Sketch</string>
<string name="board">Board</string>
<string name="board_ic" translatable="false">IC</string>
<string name="board_ncf" translatable="false">NCF</string>
<string name="pieces_tab">Pieces</string>
<string name="game_number">No. %1$s</string>
<string name="add_paste">Paste PGN from the clipboard</string>
<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>
<string name="file_unreadable">The file could not be read: it may be gone, or the app it came from did not give access to it. Try opening it again.</string>
<string name="file_chessbase_part">A ChessBase database (.cbh) is made of several files, and only one came. Add the folder it is in: \"Add database\" → \"Folder\".</string>
<string name="file_copy_failed">The app could not keep a copy of the file. Check that the phone has free space.</string>
<string name="db_copy">copy</string>
<string name="removed_copy">Database deleted from ChessPenguin</string>
<!-- Game report (android-ui.md §21) -->
<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_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_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>
<string name="review_accuracy">Accuracy</string>
<string name="review_accuracy_of">Accuracy: White %1$s, Black %2$s</string>
<string name="review_report">Report</string>
<string name="review_better">%1$s was better</string>
<string name="review_inaccuracy">Inaccuracy</string>
<string name="review_mistake">Mistake</string>
<string name="review_blunder">Blunder</string>
<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>
<string name="review_acpl">Average centipawn loss</string>
<string name="review_opening">Opening</string>
<string name="review_middlegame">Middlegame</string>
<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_graph_state">%1$s, evaluation %2$s</string>
<string name="review_start_position">Start position</string>
<plurals name="review_estimate">
<item quantity="one">%1$d position, about %2$s</item>
<item quantity="other">%1$d positions, about %2$s</item>
</plurals>
<!-- Games from Lichess and Chess.com (android-ui.md §23) -->
<string name="online_title">Games from Lichess and Chess.com</string>
<string name="add_online_hint">Any player\'s games by nickname: yours, a pupil\'s, an opponent\'s</string>
<string name="online_intro">The player\'s games become a database on your phone, to search, view and analyse. Only the nickname is needed, no login.</string>
<string name="online_nick">Player\'s nickname</string>
<string name="online_nick_hint">as on the site</string>
<string name="online_other">A different nickname on Chess.com</string>
<string name="online_other_nick">Nickname on Chess.com</string>
<string name="online_same_nick">The same nickname</string>
<string name="online_nick_rule">Latin letters, digits, _ and -, 2 to 30 characters</string>
<string name="online_find">Find</string>
<string name="online_searching">Looking on the sites…</string>
<string name="online_lichess_found">%1$s · about %2$d min the first time</string>
<string name="online_chesscom_found">months with games: %1$d</string>
<string name="online_not_found">%1$s: no player with this nickname — check the spelling</string>
<string name="online_merge">Merge both sites into one database</string>
<string name="online_merge_hint">Otherwise each site gets a database of its own</string>
<string name="online_into_new">Into the new database “%1$s”</string>
<string name="online_into_existing">Into “%1$s” (%2$s there already; only new games are added)</string>
<string name="online_download">Download</string>
<string name="online_progress_lichess">Lichess: %1$s of about %2$s · about %3$d min left</string>
<string name="online_progress_count">%1$s: %2$s</string>
<string name="online_progress_chesscom">Chess.com: month %1$d of %2$d · %3$s</string>
<string name="online_stop">Stop</string>
<string name="online_added">+%1$s, %2$s in all</string>
<string name="online_no_new">No new games, %1$s in the database</string>
<string name="online_stopped">Stopped, %1$s in the database</string>
<string name="online_no_games">No games of standard chess there.</string>
<string name="online_open">Open the database</string>
<string name="online_try_again">Try again</string>
<string name="online_err_network">%1$s does not answer. Check the internet connection and try again.</string>
<string name="online_err_rate">%1$s asks for a pause: too many requests in a row. Wait a minute and try again; what is downloaded is kept.</string>
<string name="online_err_unexpected">%1$s answered in a way ChessPenguin does not understand: the site may have changed. Try later or update ChessPenguin.</string>
<string name="online_err_disk">Could not write the database: the phone is out of space.</string>
<string name="online_err_busy">This database is being downloaded already.</string>
<string name="online_short_network">%1$s does not answer</string>
<string name="online_short_rate">%1$s asks for a pause</string>
<string name="online_short_failed">The download stopped</string>
<string name="online_update">Download new games</string>
<string name="online_stop_download">Stop the download</string>
<string name="online_downloading">Downloading · %1$s</string>
<string name="online_updated">updated %1$s</string>
<string name="online_unfinished">not finished</string>
<string name="online_removed">Downloaded database deleted</string>
<string name="online_nick_lichess">Nickname on Lichess</string>
<string name="online_lichess_quick">%1$s · under a minute the first time</string>
<string name="online_leave">You can leave this screen: the database is on the list and the download goes on.</string>
<string name="online_done">Done: %1$s</string>
<string name="online_updated_now">updated just now</string>
<string name="online_snack_added">“%1$s”: +%2$s, %3$s in all</string>
<string name="online_snack_none">“%1$s”: no new games</string>
<string name="online_snack_failed">“%1$s”: %2$s</string>
<string name="online_open_short">Open</string>
<plurals name="games_up_to">
<item quantity="one">up to %1$s game</item>
<item quantity="other">up to %1$s games</item>
</plurals>
<string name="upd_title">Version %1$s is out</string>
<string name="upd_you_have">You have %1$s</string>
<string name="upd_update">Update</string>
<string name="upd_install">Install</string>
<string name="upd_keeps">Databases, settings and the engine stay.</string>
<string name="upd_keeps_no_engine">Databases and settings stay.</string>
<string name="upd_closes">ChessPenguin closes while it installs — then open it again.</string>
<string name="upd_online_note">Games are downloading: installing stops it; you can continue it later.</string>
<string name="upd_perm_title">One permission is needed</string>
<string name="upd_perm_body">Android installs apps from outside a store only with your permission. Settings will open: turn the switch on for ChessPenguin and come back.</string>
<string name="upd_perm_open">Open settings</string>
<string name="upd_perm_denied">The permission is off — without it Android won’t install the new version.</string>
<string name="upd_perm_granted">Permission granted, downloading</string>
<string name="upd_on_site">Download from the website</string>
<string name="upd_open_site">Open the website</string>
<string name="upd_leave">You can close this: the download goes on.</string>
<string name="upd_waiting_net">No network. The download goes on by itself when the network is back.</string>
<string name="upd_waiting_net_short">Waiting for network</string>
<string name="upd_checking_file">Checking the file…</string>
<string name="upd_keeping_engine">Keeping the engine…</string>
<string name="upd_installing">Installing…</string>
<string name="upd_ready">The new version is downloaded and checked.</string>
<string name="upd_ready_short">Downloaded and checked</string>
<string name="upd_ready_snack">The new version is downloaded</string>
<string name="upd_aborted">Installation cancelled. The new version is downloaded — install it whenever you like.</string>
<string name="upd_notification">ChessPenguin update</string>
<string name="upd_done_snack">ChessPenguin is updated: %1$s → %2$s</string>
<string name="upd_err_failed">The download failed. Try again.</string>
<string name="upd_err_corrupt">The file got damaged while downloading, so it was not installed. Try again.</string>
<string name="upd_err_release">Something is wrong with this release: the Android file cannot be checked. Download the new version from the website.</string>
<string name="upd_err_storage">Android did not install the new version: not enough space. Free %1$d MB and try again.</string>
<string name="upd_err_conflict">Android did not install the new version: this ChessPenguin is signed with a different key. The new version can only be installed after removing this one, and removing it loses the list of databases and the downloaded databases.</string>
<string name="upd_err_blocked">Android or the phone’s protection stopped the installation. Download the new version from the website.</string>
<string name="upd_err_install">Android did not install the new version. Try again or download it from the website.</string>
<string name="upd_short_offline">No internet</string>
<string name="upd_short_space">Not enough space</string>
<string name="upd_short_corrupt">The file got damaged</string>
<string name="upd_short_install">Android did not install it</string>
<string name="upd_short_failed">The download failed</string>
<string name="upd_more">More</string>
<string name="upd_details">Details</string>
<string name="upd_copy">Copy</string>
<string name="upd_group">Updates</string>
<string name="upd_auto">Check for updates at start</string>
<string name="upd_auto_sub">Once a day ChessPenguin asks its site which version is the latest; the site counts installations that run. Only a random number of this installation, the version and the system are sent. The check runs even with offers off.</string>
<string name="upd_offer">Offer new versions</string>
<string name="upd_offer_sub">A card on the Databases screen when a new version is out.</string>
<string name="upd_offer_needs_check">Works when the update check is on.</string>
<string name="upd_offers_off_snack">We won’t offer it again. Turn it on in Settings, About</string>
<string name="upd_dismiss_cd">Don’t offer updates</string>
<string name="upd_check_now">Check now</string>
<string name="upd_checking">Checking…</string>
<string name="upd_latest">You have the latest version</string>
<string name="upd_checked">Checked %1$s</string>
<string name="upd_check_offline">No internet — cannot check for updates</string>
<string name="upd_check_failed">Could not check for updates: the site did not answer. Try later.</string>
<string name="s_about_available">Version %1$s is out</string>
<string name="s_about_downloading">Downloading version %1$s…</string>
<string name="s_about_ready">Version %1$s is downloaded</string>
<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,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- The window before Compose draws, and the Android 12 splash screen (§10.7). -->
<style name="Theme.ChessPenguin" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:windowBackground">#FFFFFF</item>
<item name="android:windowSplashScreenBackground">#FFFFFF</item>
<item name="android:windowSplashScreenIconBackgroundColor">@color/ic_launcher_background</item>
</style>
</resources>

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