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>
This commit is contained in:
parent
3e69a5d57c
commit
30eac472ff
13 changed files with 501 additions and 32 deletions
|
|
@ -2,6 +2,22 @@
|
|||
|
||||
Статус: реализовано 2026-10-17, `crates/uci`. Без зависимостей от egui и chess-core; единственная зависимость — `thiserror`.
|
||||
|
||||
## Автомат и транспорты (2026-10-30, веб-версия)
|
||||
|
||||
Протокол — автомат без ввода-вывода (`protocol.rs`: `Handshake` — `uci`/`uciok`, `isready`/`readyok`;
|
||||
`Session` — поиски, их границы, отложенные `setoption`; `Link` — «записать строку», «отдать событие»). Ему
|
||||
передают строки движка, команды и текущее время; он пишет строки, отдаёт события и называет свой следующий
|
||||
дедлайн, но сам не ждёт. Транспорты:
|
||||
|
||||
- **процесс** (`process.rs`, не для браузера) — как описано ниже: потоки чтения, супервизор ждёт `recv_timeout`
|
||||
до дедлайна автомата;
|
||||
- **Web Worker** (`worker.rs`, только для браузера) — строка UCI — одно сообщение `postMessage`; дедлайны —
|
||||
таймеры `setTimeout`; `quit` — `terminate()`. Рукопожатие не блокирует: `Engine::start_worker(WorkerConfig)`
|
||||
→ `Starting`, `poll()` каждый кадр отдаёт `EngineHandle` после `readyok`. Тесты — `tests/worker.rs` с
|
||||
поддельным движком на JS в headless Firefox (`apps/web/check/uci-worker.mjs`).
|
||||
|
||||
Граница поисков (`isready`/`readyok` после `bestmove`) — свойство автомата, поэтому одна для обоих транспортов.
|
||||
|
||||
## Выбор реализации
|
||||
|
||||
- **std, без tokio.** `std::process::Command` (без shell), два потока чтения (stdout, stderr), поток-супервизор с машиной состояний, `std::sync::mpsc`. UI опрашивает события `try_recv`/`drain_events` в каждом кадре, супервизор после каждого события вызывает `Waker` (`ctx.request_repaint`). Tokio не нужен остальному приложению; одному движку достаточно трёх потоков, а ожидания с таймаутом покрываются `recv_timeout`. crossbeam-channel не понадобился: все входы супервизора (команды UI и строки stdout) идут в один канал.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue