diff --git a/crates/mobile-api/uniffi.toml b/crates/mobile-api/uniffi.toml index 2d84624..72d3319 100644 --- a/crates/mobile-api/uniffi.toml +++ b/crates/mobile-api/uniffi.toml @@ -1,9 +1,3 @@ # Kotlin bindings for Android: the cleaner of the system on Android 13+, JNA before. [bindings.kotlin] android = true - -# Swift bindings for the iPhone app (iosApp/scripts/build-bindings.sh). -[bindings.swift] -module_name = "MobileAPI" -ffi_module_name = "MobileAPIFFI" -link_frameworks = ["CoreFoundation", "IOKit"] diff --git a/docs/decisions.md b/docs/decisions.md index 0c6e002..4ca09b8 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -566,14 +566,6 @@ PGN для точного выбора пометок, минимальная г Владелец уточнил: подготовка строится от его стороны против выбранного соперника. Поэтому соперник белыми означает чёрные внизу (`flipped = true`), соперник чёрными — белые внизу (`flipped = false`). Прежняя реализация с цветом соперника вниз была неверной интерпретацией и исправлена. Ручной переворот доски остаётся доступным; обе стартовые ориентации и ручной flip проверены на эмуляторе и приняты независимым ревью (`docs/qa/android-prep-orientation.md`). -## iPhone: начало iOS-версии (2026-11-30) - -Владелец поручил создать проект под iOS и начать с iPhone по образу Android. Это отменяет прежнюю отсрочку задачи 7. iPad не входит в текущий этап: его решение и интерфейс будут сделаны отдельной командой позже и будут ближе к desktop. - -Первый проверяемый срез — `iosApp/` на SwiftUI с общей `mobile-api` через UniFFI: открытие комплектной PGN-базы, список баз и партий, доска с навигацией и переворотом. Движок, игра, редактирование и Stockfish в этот срез не входят. Сборка/приёмка на iPhone Simulator обязательна на macOS/Xcode; генерация Swift-биндингов и доступные Rust-проверки на Linux не заменяют её. - -2026-12-01 владелец решил пока держать iOS в отдельной ветке `feature/iphone-app` и опубликовать её только в Forgejo (`origin`). В `main` и GitHub без отдельного решения не переносим. - ## Android: список игроков с плоскими строками (2026-11-29) Владелец выбрал улучшенный экран Players по варианту B+: плоские строки 72 dp вместо двух плашек White/Black у каждого игрока. Если ненулевой цвет один, касание строки сразу открывает подготовку этим цветом; если доступны оба, открывается короткий лист с двумя действиями по 64 dp и без дополнительного подтверждения. Нулевой цвет остаётся видимым текстом, но не отдельной disabled-кнопкой. Поиск, точные имена, счётчики и возврат в подготовку сохраняются. Проект — `docs/design/android-players-improvement.md`. По ремарке владельца 2026-11-29 лист озаглавлен «Подготовиться к %1$s» (без двоеточия), действия названы «Против белых» и «Против чёрных», чтобы цвет не читался как цвет самого пользователя (`docs/qa/android-color-sheet-wording.md`). diff --git a/docs/design/iphone-app.md b/docs/design/iphone-app.md deleted file mode 100644 index e39e37d..0000000 --- a/docs/design/iphone-app.md +++ /dev/null @@ -1,465 +0,0 @@ -# ChessPenguin для iPhone: первый технический срез - -Дата: 2026-11-30. Статус: спецификация дизайнера для реализации; приложение и приёмка на iPhone Simulator ещё не выполнялись. Изменяется только этот документ. - -Основание — решение владельца в `docs/decisions.md` «iPhone: начало iOS-версии» и задача 7 в `docs/dev/tasks.md`: `iosApp/`, SwiftUI, iOS 16+, общий `crates/mobile-api` через UniFFI, комплектная PGN-база, цепочка «Базы → Партии → Партия», доска с навигацией, переворотом и long press. **iPad, игра с компьютером, play, редактор, импорт, Stockfish, живой Engine и Review в этот срез не входят.** Отдельной светлой темы в срезе нет. - -## 0. Задача и границы - -**Задача среза одной фразой:** на iPhone открыть комплектную базу и спокойно читать аннотированную партию — сначала людей и результат, затем доску, ходы, комментарии и ветки. - -Первый экран доказывает полный путь, а не набор заглушек: - -```text -Комплектная PGN → список баз → список партий → доска и нотация -``` - -В срез входят: - -- одна комплектная база `examples/classics.pgn` в списке баз; архитектура списка не привязана к одному элементу; -- список её партий, полные имена игроков, Elo, результат, событие, год и ECO; -- предыдущая/следующая партия в том же порядке списка; -- только просмотр дерева `GameData`: начальная позиция, ход назад/вперёд, переход по касанию SAN, развилки, переворот; -- основная линия, комментарии, NAG, варианты и результат; -- тёмная мобильная тема Android, safe area, Dynamic Type, VoiceOver и базовая поддержка аппаратной клавиатуры. - -Не показывать и не делать доступными через accessibility-tree: - -- **Engine и Review: ни кнопок, ни пустых слотов, ни пунктов меню, ни надписей «скоро»**. Они появятся только вместе с работающей реализацией на следующем этапе; -- Play/New game, настройки, добавление/переименование/удаление базы, Players/подготовку; -- поиск, сортировку, фильтры и быстрый бегунок — для небольшой комплектной базы они не нужны для проверки среза; -- копирование, Share, редактирование тегов/ходов/комментариев, сохранение и любые диалоги несохранённых изменений; -- специальную раскладку iPad. Первый срез ограничен портретной ориентацией iPhone; это не решение для будущего продукта на iPad. - -Если действие не реализовано, его визуального и семантического placeholder нет. Пустое место специально под будущие кнопки тоже не резервируется. - -## 1. Что проверено в материалах - -Просмотрены сами изображения, а не только имена файлов. - -| Материал | Что подтверждено визуально | Что переносим | -|---|---|---| -| `website/shots/raw/phone/01-home.png` | Тёмный фон, синие подписи групп, карточки баз с цветной плашкой формата 40 dp, название и число партий в двух строках | Спокойная полка баз без dashboard-стилистики. Play, FAB и меню снимка не входят в срез | -| `website/shots/raw/phone/02-games.png` | Плотный вертикальный список; номер на поле слева, белые и чёрные на отдельных строках, кружки сторон, синяя плашка победителя, тонкий разделитель, событие · год и ECO справа | Структура строки 80 dp и приоритет «игроки → результат → контекст» | -| `website/shots/raw/phone/03-game.png` | Две строки заголовка; чёрные над доской, белые под ней; доска во всю ширину; комментарий как отдельный блок; вариант с вертикальной линией; текущий `Nc3` выделен синим | Компоновка партии и чтение аннотаций. На снимке старая нижняя панель с ⏮/⏭ | -| `docs/screenshots/android.jpg` | Та же система на четырёх экранах Android рядом: список, партия, настройка игры и выбор соперника | Только первые два предметных экрана; игровые экраны не являются объёмом среза | -| `docs/screenshots/library.png`, `docs/screenshots/game.png` | Общие с Android тёмный фон, синее выделение, зелёная доска, блоки комментариев и вариантов | Общий визуальный род продукта; настольная компоновка не копируется на телефон | -| `designExample/reference.png`, `список баз и партий выбранной базы.png`, `списко партий.png`, `доска.png`, `панель ходов с коментариями.png`, `панель ходов с ответвлениями.png` | Исходный смысл данных: список партий, доска, табличная основная линия и варианты сплошным текстом | Предметная иерархия, а не оформление стороннего ChessBase и не его ресурсы | - -Проверен актуальный Compose, не только старые проектные документы: - -- `Navigation.kt`: `Databases → Games(db) → GameAt(db, place, query)`; соседняя партия меняет `place`, а не наращивает стек; -- `DatabasesScreen.kt`, `Common.kt`: строка базы 72 dp, плашка 40 dp, карточки групп с полями 12 dp и зазором 2 dp; -- `GamesScreen.kt`: строка 80 dp, постраничное чтение `GameRow`, последняя открытая строка отмечается отдельно; -- `GameScreen.kt`: плашки игроков 36 dp, доска во всю ширину, нотация под ней, панель 72 dp; -- `Notation.kt`: основная линия в две колонки, комментарии и варианты полноширинными блоками, текущий узел по `id`, а не по номеру строки; -- `Board.kt`, `BoardStyle.kt`: квадратная Canvas, координаты внутри клеток, последний ход, Merida и зелёная доска; -- `theme/Color.kt`, `Type.kt`: действующие RGB-токены ниже; -- `crates/mobile-api/src/lib.rs`: `GameRow`, `Tag`, `MoveNode`, `GameData`, `Database.rows/rowsOf/game`; для отображения не нужен второй шахматный движок в Swift. - -**Расхождение снимка и текущего Android.** В `03-game.png` шесть слотов: Engine, Flip, ⏮, ◀, ▶, ⏭. В актуальном `GameScreen.kt` и решении 2.5.2 пять: Engine, Flip, ◀, ▶, Review; удержание ◀/▶ заменяет отдельные ⏮/⏭. Для iPhone берём актуальную модель взаимодействия, но в первом срезе оставляем только реально работающие **Flip, ◀, ▶**. - -## 2. Пользовательский путь и сохранение контекста - -### 2.1. Навигация SwiftUI - -```text -NavigationStack - DatabaseListRoute - └─ GamesRoute(databaseID) - └─ GameRoute(databaseID, place) -``` - -- `NavigationStack` и value-based `NavigationLink`; не три независимых полноэкранных cover. -- Холодный запуск всегда показывает «Базы». При обычном уходе приложения в фон и возврате текущий стек, узел и ориентация доски сохраняются. -- Назад: «Партия → Партии → Базы». Системный edge-swipe и стандартный chevron назад делают одно и то же. -- ‹ › вверху партии меняют `place` внутри существующего `GameRoute`; стек не растёт. Новая партия открывается в узле `0`, переворот сохраняется. -- После возвращения в «Партии» сохраняются порядок и прокрутка. Последняя открытая партия, включая открытую через ‹ ›, видима и отмечена на время этого посещения списка. -- Повторное открытие партии из списка начинается с исходной позиции. Возврат из фона — не повторное открытие: текущий узел не сбрасывается. -- Отдельного preview движка в срезе нет, поэтому нет и особого выхода из PV. Не имитировать его ради будущего Engine. - -### 2.2. Модель состояния - -- `LibraryStore`, `GamesStore`, `GameStore` — `@MainActor ObservableObject`; тяжёлые вызовы Rust выполняет actor/repository вне главного потока. -- В `GamesStore`: стабильный `databaseID`, порядок индексов партий, `lastOpenedPlace`, состояние прокрутки. -- В `GameStore`: `GameData`, `currentNodeID`, `flipped`, `place`; идентичность позиции — **`MoveNode.id`**, не номер видимой строки и не SAN. -- Запросы списка и партии имеют generation/token. Поздний ответ прежней базы или прежнего `place` не может заменить новый экран. -- `GameData` загружается только для открытой партии. Список читает `GameRow` страницами по 100 (`rows` или `rowsOf`), не разбирает все партии заранее. - -## 3. Маппинг Compose → SwiftUI - -| Android Compose | SwiftUI на iOS 16 | Требование | -|---|---|---| -| `MainNavigation`, `NavDisplay` | `NavigationStack`, enum `Route: Hashable` | Один стек и системный назад | -| `Scaffold`, `TopAppBar` | `.navigationBarTitleDisplayMode(.inline)`, `ToolbarItem`, `.toolbarBackground(CP.surface, for: .navigationBar)` | Не использовать крупный iOS-заголовок 34 pt; сохранить компактность Android | -| `LazyColumn` баз и партий | `List` с собственными row-view и скрытыми системными separators/background | Не полагаться на него как на доказательство виртуализации: paging `GameRow` и профиль памяти обязательны отдельно | -| `KindBadge` | `ZStack` + `RoundedRectangle(cornerRadius: 10)` + `Text("PGN")` | 40×40 pt, те же RGB | -| `GameRowView` | Один `Button` с `GameRowContent`; `.buttonStyle(.plain)` | Вся строка нажимается; номер, кружки и ECO не становятся отдельными кнопками | -| `PlayerLine`, `SideDisc`, `ResultTile` | Общие `PlayerLineView`, `SideDisc`, `ResultTile` | Одно правило в списке и у доски | -| `Board` на `Canvas` | `Canvas` для клеток, подсветки, координат, стрелок и меток; `Image` для 12 фигур Merida | Размеры в pt, рендер с учётом `displayScale`; никакого hit testing фигур в read-only | -| `Notation`, `MovesRow`, `MoveCell` | `ScrollViewReader` + `LazyVStack`; `MoveRowView`, отдельный `Button` для каждого хода | `scrollTo(id)` по `MoveNode.id`, не по индексу `LazyVStack` | -| `variationText` с link annotations | Не один псевдоинтерактивный `Text`: собственный `Layout` для переноса токенов, где ход — отдельный `Button`, текст — `Text` | На iOS 16 не обещать hit testing фрагментов одного `Text`; перенос и VoiceOver проверяются на Simulator | -| `Forks` | Горизонтальный `ScrollView` + `HStack` кнопок-чипов | Первый child — продолжение текущей линии | -| `bottomBar`, `navigationBarsPadding` | `.safeAreaInset(edge: .bottom, spacing: 0)` с собственной панелью 72 pt | Кнопки выше home indicator; фон продолжается до нижнего края | -| `MaterialTheme.colorScheme` | `CPColor` semantic tokens в Asset Catalog или Swift extension | Не подменять палитру `Color(uiColor: .systemBackground)` | -| `displaySan` | Общий Swift formatter только отображения | В срезе Latin SAN; данные Rust не меняются | - -Для фигур использовать уже проверенные `apps/desktop/assets/pieces/merida/{w,b}{K,Q,R,B,N,P}.svg`; происхождение — Armando Hernandez Marroquin, GPLv2+, зафиксировано в `THIRD_PARTY_NOTICES.md`. Способ упаковки выбирает разработчик после визуальной проверки всех 12 SVG в Xcode (Asset Catalog SVG либо воспроизводимая конвертация в векторные PDF). Не скачивать другой набор и не копировать ресурсы неизвестного происхождения. Лицензия и сами исходники идут в bundle так же осмысленно, как в Android. - -## 4. Визуальные токены - -### 4.1. Только тёмная тема - -Корень получает `.preferredColorScheme(.dark)`; launch screen и фон за navigation bar тоже `#161718`, чтобы не было белой вспышки. Текст status bar светлый. - -| Роль | HEX | -|---|---| -| `background`, `surface` | `#161718` | -| `surfaceContainerLow` — карточки баз, комментарии | `#1F2022` | -| `surfaceContainer` — нижняя панель, последняя открытая строка | `#232427` | -| `surfaceContainerHigh` — плашка ничьей и результата в конце | `#2A2C2F` | -| `onSurface` | `#E8E8E8` | -| `onSurfaceVariant` | `#A3A7AD` | -| `outline` | `#4A4D52` | -| `outlineVariant` | `#2E3033` | -| `primary` | `#62AEE6` | -| `onPrimary` | `#0B2A40` | -| `primaryContainer` | `#1A4566` | -| `onPrimaryContainer` | `#D6E8F6` | -| `error` / `errorContainer` | `#F28B82` / `#5C1A14` | -| текущий ход | `#005C80`, текст `onSurface`, скругление 6 pt | -| комментарий | `#9EC4E0` | -| последний ход на доске | `#9BC700`, alpha `0x69` | -| светлая / тёмная клетка Green | `#FFFFDD` / `#86A666` | -| PGN badge: фон / текст | `#384660` / `#89B4FA` | -| кружок белых / чёрных | `#FFFFFF` / `#0E0F10`, кольцо 1 pt `onSurfaceVariant` | - -NAG берёт действующие Android-значения, не старую таблицу из общего desktop-документа: - -| NAG | `!` | `?` | `!!` | `??` | `!?` | `?!` | -|---|---|---|---|---|---|---| -| Цвет | `#81B64C` | `#FFA459` | `#26C2A3` | `#FA412D` | `#EA45D8` | `#56B4E9` | - -На выделенном ходе NAG становится `onSurface`: цветной знак на синей заливке не используется как единственный носитель смысла. Disabled — `onSurface` с alpha 0,38; позиция кнопки при этом не меняется. - -Никаких градиентов, теней карточек, фоновых изображений, декоративных KPI и новых цветных контейнеров. Фактура возможна только у доски, но в первом срезе используется плоская Green. - -### 4.2. Типографика - -Системный шрифт Apple, без встраивания Roboto/Ubuntu. Значения ниже — **размеры по умолчанию в pt**, не фиксированные пиксели. Для ролей используются Dynamic-Type-relative стили; где нужны точные 14/15/17 pt — `@ScaledMetric(relativeTo:)` или эквивалентный проверенный modifier. Один только `Font.system(size:)` без проверки масштабирования не считается реализацией Dynamic Type. - -| Роль | Размер/leading по умолчанию | Насыщенность | -|---|---:|---| -| Заголовок «ChessPenguin», пустое состояние | 22/28 | regular | -| Заголовок партии | 16/20 | medium | -| Имя базы, игрок в списке | 16/24 | regular; победитель medium | -| Вторая строка, Elo, подробности | 14/20 | regular | -| Кнопки/чипы | 14/20 | medium | -| Номер партии, ECO, маленькая подпись | 12/16 | medium у ECO | -| Ход основной линии | 17/24 | bold | -| Номер хода | 15/24 | regular | -| Комментарий | 15/22 | regular | -| Вариант | 15/28 | regular | -| Координаты доски | 10/12 | medium | - -Числа, счётчики, Elo, результат и номера — `.monospacedDigit()`. Имя сначала полное из PGN; если не помещается — `Surname F. I.` по правилу Android `shortName`; только затем многоточие. VoiceOver всегда получает полное имя. - -## 5. Экраны и геометрия - -Сетка 4 pt: 4, 8, 12, 16, 24, 32. Обычные цели касания не меньше 44×44 pt; у Android-эталона 48 dp, поэтому здесь основные кнопки также делаем не уже 48 pt, где позволяет ширина. - -### 5.1. «Базы» - -**Задача экрана:** выбрать источник партий; главная информация — имя базы, формат и число партий. - -```text -┌──────────────────────────────────────┐ -│ ChessPenguin │ navigation bar 44 -├──────────────────────────────────────┤ -│ Файлы │ 48 -│ ┌──────────────────────────────────┐ │ -│ │ [PGN] Classic games │ │ 72 -│ │ 100 games · PGN │ │ -│ └──────────────────────────────────┘ │ -└──────────────────────────────────────┘ -``` - -- Заголовок только `ChessPenguin`; шестерёнки нет. -- Заголовок группы «Файлы» слева 16 pt, `primary`, 14 pt medium. «+ Добавить» отсутствует. -- Карточка: поля экрана 12 pt, фон `surfaceContainerLow`. У единственной базы все углы 16 pt; у группы внешние 16, соседние 4, зазор 2 pt. -- Строка 72 pt: 12 pt до badge, badge 40×40, 12 pt до текста. Название 16/24 одной строкой с многоточием; под ним «100 партий · PGN», 14/20. Число — medium `onSurface`, остальное — `onSurfaceVariant`. -- Справа стандартный тонкий `chevron.right` `onSurfaceVariant`, поскольку строка ведёт глубже; меню ⋮ нет. Вся строка — одна кнопка, а не только chevron. -- Подпись второй строки занимает место и во время чтения: появление числа не меняет высоту строки. -- Нажатие открывает «Партии». Long press ничего не открывает. - -Пустая отладочная/аварийная библиотека: пингвин 96 pt, «Здесь будут ваши базы», пояснение и одна работающая кнопка «Открыть примеры партий», которая повторно загружает комплектный PGN. Кнопки импорта нет. - -### 5.2. «Партии» - -**Задача экрана:** найти нужную партию по людям и результату; плотность важнее декоративных карточек. - -Верхняя панель: стандартный назад, название базы одной строкой и под ним «100 партий». Поиск, Players и меню не показываются. - -```text -16 │ № │12│●│8│ Morphy, Paul │8│[1]│16 - │ │ │○│ │ Duke Karl / Count Isouard │ │ 0 │ - │ │ │ │ Paris Opera · 1858 │8│C41│ - └───┴──┴──┴────────────────────────────────────── -``` - -Геометрия обычной строки: - -- **80 pt = 6 + 24 + 24 + 20 + 6**; при Dynamic Type растёт по реальному leading. -- Номер — фактический номер записи PGN (`GameRow.index + 1`), не место после будущей фильтрации. Колонка единой ширины по самому большому номеру базы; выравнивание вправо, baseline белых. После неё 12 pt. -- Кружок стороны 8 pt, после него 8 pt. Имя и Elo занимают оставшуюся ширину, результат — отдельная колонка минимум 24 pt. -- Результат: у победителя `1` в плашке минимум 24×20, радиус 6, `primaryContainer/onPrimaryContainer`; проигрыш `0` без плашки; ничья `½` у обоих на `surfaceContainerHigh`; `*` — пустая колонка той же ширины. -- Подробности начинаются под именем, через 16 pt после кружка. «Событие · год» обрезается раньше ECO. ECO — отдельная рамка минимум 32×16, радиус 4, 1 pt `outline`, поля 4 pt. -- Разделитель 1 pt `outlineVariant` по низу, от колонки кружков до 16 pt справа. У последней строки нет. -- Этюд с названием в `White` и без `Black`: название занимает две строки, кружков сторон нет; высота не скачет. -- Заглушка страницы повторяет все три строки и разделитель той же высоты; пустой прозрачный прямоугольник заглушкой не считается. - -Последняя открытая строка отличается от **текущей позиции в партии**: фон `surfaceContainer` и левая полоса 3 pt `primary`, VoiceOver добавляет «Открыта последней». Нажатие снова открывает её с исходной позиции. - -### 5.3. «Партия» - -**Задача экрана:** доска и чтение аннотированной линии; игроки и результат остаются видны у самой доски, а навигация — под большим пальцем. - -#### Портретная компоновка - -```text -┌──────────────────────────────────────┐ -│ ← Paris Opera · 1858 ‹ › │ navigation bar 44 -│ 7 of 100 │ -│ ○ Duke Karl / Count Isouard 0 │ 36 -│ │ -│ ДОСКА W × W │ W = ширина экрана -│ │ -│ ● Morphy, Paul 1 │ 36 -│ 7 … Qe7 │ -│ 8 [Nc3] │ нотация, оставшаяся высота -│ ┌ Morphy prefers development… ┐ │ -│ │ 8.Qxb7 Qb4+ … only trades queens.│ │ -├──────────────────────────────────────┤ -│ ⇅ ◀ ▶ │ 72 + bottom safe area -└──────────────────────────────────────┘ -``` - -- Заголовок: `Event · year`, fallback `Site`, затем имя базы. Вторая строка — `N из M`, затем тур, если он известен. Заголовок не является кнопкой «Сведения»: такого экрана в срезе нет. -- Справа только тонкие ‹ › предыдущей/следующей партии, каждая цель не меньше 44×44. Меню ⋮ нет. На первой/последней партии соответствующая кнопка disabled и остаётся на месте. -- Плашка игрока: минимум 36 pt, поля 16 pt; кружок 12 pt, 8 pt до имени; Elo через 8 pt; результат справа в колонке 24 pt. Фон общий `surface`, без карточки и рамки. -- При обычной ориентации чёрные сверху, белые снизу; после Flip плашки меняются местами вместе с доской. Плашки существуют и при неизвестных именах, поэтому доска не прыгает. -- Доска квадратная, **без боковых полей и скругления**. Размер не зависит от Dynamic Type, комментариев и развилок. -- Ниже — только нотация и, на развилке, строка «Дальше». Никаких пустых Engine/Review-панелей. - -Иллюстративный бюджет для 390×844 pt с safe area 47/34 и navigation bar 44: - -```text -844 − 47 − 44 − 36 − 390 − 36 − 72 − 34 = 185 pt нотации -``` - -Это объяснение сетки, а не разрешение hardcode safe area. Высоты берутся из реальных `safeAreaInsets` окна. - -#### Доска - -- Парсится только placement из `MoveNode.fen`; шахматные правила повторно в Swift не реализуются. -- Координаты внутри крайних клеток, 10 pt, цветом противоположной клетки; при Flip обновляются вместе с mapping клеток. -- Последний ход подсвечивает `fromSquare` и `toSquare`. В узле `0` подсветки нет. -- Поддержать данные, которые `mobile-api` уже отдаёт для viewer: `marks` (`[%cal]`, `[%csl]`), `end == checkmate/stalemate`, NAG-badge текущего узла. Цвета и прозрачность — как Android `Board.kt`. -- Доска read-only: касание не выделяет фигуру, не ставит точек ходов и не вызывает ripple. Свайпов по доске нет. -- Короткий шаг ◀/▶ может анимировать фигуру 250 мс; прыжок по SAN, к границе и смена партии — сразу. При Reduce Motion любые перемещения мгновенные. -- Рендер проверяется на `displayScale` ×2 и ×3: диагонали Merida, координаты и линии не должны быть размыты или обрезаны. - -#### Нотация - -- Основная линия — строки минимум 48 pt: номер 40 pt, белые и чёрные поровну. Вся ячейка — `Button`; видимая заливка только вокруг SAN + NAG с полями 8×6 и радиусом 6. -- Если белого хода нет, а чёрный есть, в ячейке белых `…`; пустая ячейка чёрных остаётся пустой. -- Комментарий: внешние поля 16×4, фон `surfaceContainerLow`, радиус 12, внутренние поля 12×8. Текст переносится естественно, без ограничения числа строк. -- Вариант: блок без заливки, слева линия 2 pt `outlineVariant`, начало в 16 pt от края, текст через 12 pt. Вложенные RAV остаются в круглых скобках в потоке; ветки не сворачиваются. Каждый ход — отдельно доступный `Button`. -- Активный узел выделяется `#005C80`; VoiceOver произносит «текущий ход». Это не то же состояние, что последняя открытая строка списка или продолжение на развилке. -- При смене позиции активный ход должен быть виден. Если он за пределами или на краю viewport — прокрутка примерно на одну треть сверху, 200 мс; при Reduce Motion мгновенно. Ручная прокрутка не отменяется до следующего явного шага. -- Последний узел линии не выдаётся за конец всей партии, если есть альтернативные ветки. Результат `1-0 · White won` / `½-½ · Draw` — отдельная центрированная плашка `surfaceContainerHigh` после основной линии. -- Если две колонки физически не вмещают SAN при текущем Dynamic Type, основная линия переходит в тот же переносимый поток токенов, что вариант. Горизонтальной прокрутки нотации нет. - -#### Развилка - -Если `currentNode.children.count > 1`, непосредственно над нижней панелью появляется строка 48 pt «Дальше:»: - -- первый чип — `children[0]`, залит `primaryContainer`; остальные — контурные; -- каждый чип содержит номер и SAN, цель не ниже 44 pt; -- при переполнении прокручивается только этот ряд; -- ▶ всегда эквивалентен первому чипу; выбор другого чипа меняет текущую ветку, не переписывает PGN; -- строка отнимает высоту только у нотации. Её появление/исчезновение происходит после явного перехода пользователя, доска и нижняя панель не двигаются. - -#### Нижняя панель первого среза - -Фон `surfaceContainer`, верхний разделитель 1 pt `outlineVariant`. Контент 72 pt, ниже него фон продолжается в bottom safe area; кнопки в home indicator не попадают. - -| Слот | Относительная ширина | Иконка SF Symbols | Действие | -|---|---:|---|---| -| Flip | 48 | `arrow.up.arrow.down`, 24 pt | Перевернуть доску и плашки | -| ◀ | 78 | `play.fill`, 32 pt, отражённый | Один узел к `parent` | -| ▶ | 78 | `play.fill`, 32 pt | Один узел к `children[0]` | - -`HStack(spacing: 0)` распределяет всю ширину пропорционально `48:78:78`; на 390 pt это примерно 92/149/149 pt. ◀/▶ намеренно шире Flip. Каждая зона занимает весь слот × 72 pt, не только видимая иконка. - -- В начале ◀ disabled, в конце текущей ветки ▶ disabled; слоты не исчезают. -- **Короткое касание** выполняется при отпускании до long-press timeout и даёт ровно один шаг. -- **Удержание ◀** — один переход к узлу `0`; **удержание ▶** — к концу текущей ветки по первым children. Сначала обычный шаг не выполняется, автоповтора нет. -- Движение/отмена касания не вызывает действие. Если композиция `TapGesture` и `LongPressGesture` не доказывает эту взаимоисключимость на Simulator, используется один `UIControl` через `UIViewRepresentable`, а не две независимо срабатывающие кнопки. -- VoiceOver: отдельные действия «В начало линии» и «В конец линии» через `.accessibilityAction(named:)`; удержание — не единственный способ. -- `.accessibilityHint` у ◀/▶ объясняет удержание. Дополнительный каждодневный snackbar не нужен. - -**Будущее расширение, не объём реализации:** когда Engine и Review действительно появятся, используется актуальная пропорция Android `60:48:78:78:96` для `Engine:Flip:◀:▶:Review`. В первом срезе их слоты не рисуются, поэтому панель имеет только три рабочих действия. Изменение пропорций будет изменением версии продукта, а не внезапным скачком при загрузке данных. - -## 6. Safe area, малый экран и Dynamic Type - -### 6.1. Safe area - -- Корневой `CP.background` рисуется под системными областями; содержимое — нет. -- Navigation bar управляется системой; доска не попадает под status bar или Dynamic Island. -- Нижняя панель добавляется через `safeAreaInset`, поэтому нотация заканчивается выше кнопок, а не прячется под ними. -- Фон нижней панели расширяется только визуально `.ignoresSafeArea(edges: .bottom)`; интерактивная область остаётся выше home indicator. -- На списках нижний content inset 16 pt плюс системный safe area; последняя строка не прилипает к home indicator. - -### 6.2. Маленький поддерживаемый iPhone - -Минимальная визуальная проверка — iPhone SE (3-го поколения), 375×667 pt, ×2, портрет. Доска остаётся 375×375; обе плашки и панель 72 остаются, нотация получает оставшееся место и прокручивается. Нельзя уменьшать доску ради комментария или крупного шрифта. - -### 6.3. Dynamic Type - -- Все текстовые роли масштабируются; размер доски, 40 pt badge, кружки и иконки не раздуваются пропорционально тексту. -- Строки баз, партий и плашки игроков имеют только **минимальную** высоту 72/80/36; текст может увеличить её. Плашки результата и ECO остаются на своих строках. -- Имя может сокращаться и заканчиваться многоточием, но результат, ECO, номер и доступная кнопка не обрезаются. -- Плашка игрока остаётся однострочной по имени; полный текст доступен VoiceOver. Длинный комментарий переносится без потолка высоты. -- При accessibility-категориях основная нотация переходит к потоку; нижняя панель не получает вторую строку. -- Проверка минимум на `Large` (default), `xxxLarge`, `accessibility2`; `accessibility5` — отдельный smoke-тест переполнения. Не заявлять поддержку только по успешному Preview в Xcode. - -## 7. Accessibility и клавиатура - -### 7.1. VoiceOver - -| Элемент | Чтение | -|---|---| -| Строка базы | «Classic games, 100 партий, PGN, кнопка» | -| Строка партии | «№ 7. Белые: Morphy, Paul. Чёрные: Duke Karl / Count Isouard. 1-0, победили белые. Paris Opera, 1858, C41, кнопка»; полные имена | -| Плашка | «Чёрные: Duke Karl / Count Isouard, проигрыш»; кружок отдельно не читается | -| Доска | Один элемент: «Начальная позиция» или «Позиция после 8.Nc3»; custom action «Описать позицию» перечисляет фигуры сторонами | -| Ход | «8, белые, Nc3, текущий ход, кнопка»; NAG читается словами | -| ‹ › | «Предыдущая партия» / «Следующая партия» | -| Flip | «Перевернуть доску» | -| ◀ ▶ | «Предыдущий ход» / «Следующий ход», hint про удержание, custom actions к границам | - -Новый ход после ◀/▶ объявляется через `UIAccessibility.post(notification: .announcement)` только по явному действию пользователя; автопрокрутка и фоновая загрузку не озвучиваются. Прогресс не объявляется каждым кадром. - -Порядок обхода: navigation bar → верхняя плашка → доска → нижняя плашка → нотация → развилка → Flip → ◀ → ▶. Отсутствующие Engine/Review в дереве не встречаются. - -### 7.2. Аппаратная клавиатура и фокус - -Для iOS 16 системное Full Keyboard Access остаётся основным способом обхода; видимый системный фокус не отключается. У собственных кнопок дополнительная рамка фокуса 2 pt `primary`, не только смена tint. - -| Где | Клавиша | Действие | -|---|---|---| -| Списки | Tab / Shift+Tab, Enter или Space | Системный обход, открыть сфокусированную строку | -| Партия | ← / → | Один ход назад/вперёд | -| Партия | Shift+← / Shift+→ | Начало/конец текущей линии, альтернатива long press | -| Партия | F | Flip | -| Партия | Escape | Назад к списку партий | -| Везде | системный голосовой/клавиатурный доступ | Не перехватывается приложением | - -На iOS 16 привязку реализовать поддерживаемым `UIKeyCommand`/кнопочным shortcut API, а не переносить непроверенный новый SwiftUI API. Если Simulator не передаёт конкретную клавишу, это фиксируется как ограничение проверки, а не объявляется работающим. - -## 8. Матрица состояний - -| Состояние | Требуемое поведение | -|---|---| -| Первый запуск | Одна комплектная «Classic games», без искусственного splash/spinner; открытие по явному касанию может показать ProgressView | -| Пустая библиотека | Объяснение + рабочее «Открыть примеры партий»; нет Add/Play/Settings | -| Чтение базы | Вторая строка уже занята; «Читаю…» вместо числа. Не подменять неизвестное число нулём | -| Пустая база | «В этой базе нет партий» и назад; не открывать фиктивную партию | -| Ошибка базы | Название ошибки, понятная причина, «Повторить» если повторный вызов реально выполняется, назад | -| Чтение страницы партий | Заглушки той же геометрии, номер и разделители не прыгают | -| Чтение партии | Резервируются navigation bar, две плашки и квадрат доски; вместо фальшивой стартовой позиции нейтральный квадрат/ProgressView | -| Ошибка партии | Сообщение в области нотации, назад работает; не показывать старую `GameData` как новую | -| Длинные имена/событие | Полное → короткое имя → многоточие; результат и ECO не страдают | -| Длинный комментарий/глубокий RAV | Перенос, собственный поток токенов, без горизонтального скролла и потери кликабельности SAN | -| Развилка | Строка 48 меняет только высоту нотации после явного перехода | -| Малый iPhone | Доска и панель сохраняют размеры; нотация прокручивается; ничего не перекрыто safe area | -| Большая база | `GameRow` страницами по 100, `GameData` только при открытии. Специальный быстрый бегунок не добавлять; производительность не объявлять без Instruments | -| Несохранённые изменения | Неприменимо: viewer ничего не редактирует. Появление Save/Undo означает выход за объём | -| Фон/возврат | Стек, узел, Flip и видимая прокрутка сохраняются; повторный старый async-ответ отбрасывается | -| ×2 / ×3 HiDPI | Векторные фигуры/иконки, ровные 1 pt разделители, отсутствие обрезанных координат | -| Engine/Review отсутствуют | Нет кнопок, labels, accessibility elements, жестов и пустых панелей; Stockfish не запускается | - -## 9. Требования разработчику - -1. Собрать именно путь `Bundle → openBytes → Database.rows/game`, не переписывая PGN и chess rules на Swift. Вызовы `openBytes`, `rowsOf`, `game` не выполнять на главном потоке. -2. Комплектный `classics.pgn` остаётся read-only. Не создавать ради среза собственную базу и не вызывать `GameSession`, `ownSave`, engine/review API. -3. Разделить стабильные domain IDs и presentation layout. Смена `currentNodeID` не пересоздаёт `NavigationStack`; смена партии через ‹ › не добавляет route. -4. Перенести Android `layout(GameData)` как чистую, тестируемую модель элементов нотации: `comment`, `moveRow`, `variation`, `result`, плюс `where[nodeID]`. Не хранить `current` как номер элемента списка. -5. Сделать общие `SideDisc`, `ResultTile`, `PlayerLineView`, `MoveButton`, `BottomBarButton`, чтобы список и партия не разошлись по размерам. -6. Для варианта реализовать проверяемый wrapping `Layout`: токены текста и кнопок переносятся, parentheses сохраняются, касание попадает именно в SAN. Не использовать URL-links как обходной путь. -7. Отдельно протестировать жест ◀/▶: tap отпусканием, long press без предварительного tap, cancellation, disabled и VoiceOver actions. -8. Все числа форматировать локально и `.monospacedDigit()`; 100 — как `100`, большие числа — с локализованным разделителем групп. -9. Не добавлять сторонний UI/svg/шахматный пакет без проверки происхождения. SF Symbols использовать вместо копирования Material Icons. -10. Ограничить target первого среза iPhone + Portrait. Не включать iPad destination «для будущего» в этой задаче. - -## 10. Приёмка позже на macOS / iPhone Simulator - -Генерация Swift bindings, Rust tests и Linux screenshots **не заменяют** эту приёмку. Нужны macOS, Xcode, реальная сборка `iosApp/` и iPhone Simulator. Ревьюер — отдельный человек/агент, не автор реализации. - -### 10.1. Функциональные критерии - -1. **Комплектная база.** Холодный запуск → «Classic games», `100 games · PGN`; открытие → 100 строк, первая «McDonnell, Alexander / La Bourdonnais, Louis-Charles Mahe de», `0-1`, `London m4 · 1834`, `B32`. «Paris Opera» — запись с `GameRow.index = 6`, то есть №7: «Morphy, Paul / Duke Karl / Count Isouard», `1-0`, `Paris Opera · 1858`, `C41`. Сам PGN не изменять. -2. **Начало.** Открыть первую партию: «London m4 · 1834», «1 из 100», узел `0`, ни один ход не выделен; ◀ disabled, ▶ enabled. Для сценариев аннотации открыть Opera: «Paris Opera · 1858», «7 из 100». -3. **Ходы.** 20 коротких касаний ▶ дают ровно 20 переходов, без повторов. ◀ возвращает строго к `parent`; на первом узле варианта — к позиции перед развилкой. -4. **Long press.** Удержание ▶ идёт в конец текущей линии без предварительного шага; удержание ◀ — в `0`. Нет автоповтора, двойного срабатывания и действия после отменённого касания. -5. **Аннотация.** Пример Opera с `8.Nc3`: доска соответствует узлу, `Nc3` выделен, видны «Morphy prefers development to material.» и вариант `8.Qxb7 Qb4+ … only trades queens.` Касание SAN внутри варианта выбирает правильный `MoveNode.id`. -6. **Ветка.** На позиции с несколькими children видны «Дальше» и все продолжения; ▶ равен первому чипу, другой чип ведёт в свою ветку. Возврат назад не стирает ветку. -7. **Flip.** Меняются mapping клеток, координаты и плашки; текущий узел и прокрутка нотации не меняются. -8. **Соседние партии.** ‹ › следуют порядку списка; на границах disabled; каждая новая партия в `0`; стек не растёт; Flip сохраняется. -9. **Возврат.** После нескольких ‹ › назад возвращает в прежнюю прокрутку списка; отмечена именно последняя открытая партия. Повторный tap открывает её в `0`. -10. **Read-only.** До и после сценария checksum bundled `classics.pgn` не меняется; нет Save/Undo/меню редактирования и вызовов записи. -11. **Отсутствие заглушек.** Визуально и через Accessibility Inspector нет Engine/Review/Play/Add/Settings. Stockfish не входит в bundle и не запускается. - -### 10.2. Визуальные доказательства - -Эталонные устройства: - -- современный iPhone с notch/Dynamic Island, портрет, ×3 — например 390×844 pt; -- iPhone SE (3-го поколения), 375×667 pt, ×2 — узкий и низкий случай. - -Минимальный набор, без декоративных серий: - -| Снимок | Устройство/масштаб | Состояние | Что доказывает | -|---|---|---|---| -| `01-library.png` | Современный iPhone, ×3, Large | Заполненные базы | Токены, 72 pt, badge, safe area | -| `02-games.png` | То же | Заполненный список, первая партия | 80 pt, имена/результат/ECO, разделители | -| `03-game.png` | То же | Opera, `8.Nc3`, комментарий и вариант | Доска W×W, плашки, выделение, три нижних действия | -| `04-game-se.png` | SE, ×2, Large | Та же позиция | Низкая нотация, отсутствие перекрытий | -| `05-games-ax2.png` | Современный iPhone, ×3, accessibility2 | Длинные имена и заполненный список | Dynamic Type, результат/ECO без обрезки | -| `06-empty.png` | Современный iPhone, ×3 | Отладочная пустая библиотека | Единственное реальное действие, отсутствие мёртвых кнопок | -| `07-error.png` | Современный iPhone, ×3 | Отладочная ошибка чтения партии | Ошибка без фальшивой доски и скачка геометрии | - -Дополнительно фиксируется короткая последовательность **открытие → ▶ → long press ▶ → long press ◀ → назад**: на снимках или в отчёте с координатами board/player bars/bottom bar. Их размеры не меняются; меняются только позиция, выделенный SAN и состояние кнопок. Последняя открытая строка на возврате видна. - -Каждый verdict содержит путь к снимку, модель Simulator, версию iOS, pt/scale, Dynamic Type и состояние. Сравнение идёт с `01-home.png`, `02-games.png`, `03-game.png` Android по **системе и геометрии**, а с desktop `library.png`/`game.png` — по общей палитре и предметной иерархии. Пиксельного совпадения с Android не требуется из-за SF Symbols и системного шрифта. - -Дефект записывать конкретно: экран/состояние, ожидаемая и фактическая координата или переполнение, шаги воспроизведения, снимок. «Выглядит похоже» без доказательств не является приёмкой. - -### 10.3. Accessibility и надёжность - -- VoiceOver проходит весь порядок из §7.1; custom actions границ работают без жеста; отдельные кружки и декоративные иконки не читаются. -- Full Keyboard Access и маппинг §7.2 проверяются с hardware keyboard Simulator; фокус виден на тёмном фоне. -- `xxxLarge`, `accessibility2`, затем smoke `accessibility5`: нет перекрытий, второй нижней строки или горизонтальной нотации. -- Reduce Motion убирает анимации; Increase Contrast не делает текущий ход неотличимым от обычного (заливка + VoiceOver + форма плашки). -- Повторное открытие базы, быстрые ‹ ›, уход в фон во время чтения и поздние async-ответы не показывают старую партию под новым заголовком. -- Проверка памяти/процессора делается Instruments на списке; красивый снимок не доказывает paging и отсутствие блокировки main thread. - -## 11. Что передать тестировщику - -- Сценарии §10.1 и матрицу §8 как обязательные регрессии первого среза. -- Отдельно проверить взаимоисключимость tap/long press и custom actions VoiceOver — это наиболее рискованный жест. -- Отдельно проверить hit testing каждого SAN в многострочном RAV и стабильность `nodeID` после возврата из ветки. -- Сравнить ширину слотов и отсутствие скачков на SE и современном iPhone; Engine/Review искать также в Accessibility Inspector, а не только глазами. -- Проверить ошибку/пустоту через debug fixtures, не изменяя поставляемый PGN. -- Любую поддержку больших баз, всех Dynamic Type или производительность отмечать только после фактического прогона; заранее PASS не ставить. diff --git a/docs/dev/tasks.md b/docs/dev/tasks.md index 2849341..4b74d6d 100644 --- a/docs/dev/tasks.md +++ b/docs/dev/tasks.md @@ -71,11 +71,10 @@ - Связано с №4 и №5. ### 7. Версия для iPhone / iPad -- **Статус:** в работе с 2026-11-30, ветка `feature/iphone-app`: сначала iPhone по образу Android; iPad отдельной следующей командой и ближе к desktop. +- **Статус:** отложено (2026-10-24): владелец сделает, если программа станет популярной. - **Добавлено:** 2026-10-24. - **Почему:** пользователь из рассылки не смог попробовать — у него iPhone. - **Мысли:** ядро на Rust уже общее (UniFFI умеет Swift); нужен интерфейс на SwiftUI, аккаунт Apple Developer (99 $/год) и проверка App Store; Stockfish на iOS разрешён (есть в App Store у других). Большая отдельная работа. -- **Первый срез:** `iosApp/`, SwiftUI на iOS 16+, UniFFI к общему `mobile-api`; комплектная PGN-база, базы → партии → доска с навигацией/переворотом/long press, тёмная мобильная визуальная система. Без движка, игры и редактора до отдельных этапов. Созданы проект, XCTest-таргет и настоящие Swift-биндинги; повторная генерация идемпотентна, PGN — байтовая копия, `mobile-api` — 33 passed / 0 failed / 2 ignored, структурные проверки и Clippy зелёные. На Linux проверены генерация Swift-биндингов и Rust-сборка; независимая структурная приёмка Д1–Д10 пройдена (`docs/qa/iphone-structural.md`). Сборка и UI-приёмка на iPhone Simulator обязательна на macOS/Xcode и пока не выполнялась. ### 8. Нужна ли строка быстрого поиска, когда есть панель фильтров? - **Статус:** решено (2026-10-25): оставить оба. Аналитик и дизайнер (`docs/research/library-layout.md`, `docs/design/library-layout.md`): поиск ищет слово по всем полям сразу («вафин 2025») и виден, когда фильтры скрыты (узкое окно, доска поиска); в узком поле подсказка короткая «🔍 Поиск». diff --git a/docs/qa/iphone-fixes.md b/docs/qa/iphone-fixes.md deleted file mode 100644 index 9043d77..0000000 --- a/docs/qa/iphone-fixes.md +++ /dev/null @@ -1,111 +0,0 @@ -# iPhone: исправления структурной QA - -Дата: 2026-11-30. Исходный отчёт `docs/qa/iphone-structural.md` не изменён. Коммитов нет. - -## Что исправлено - -- **Д1:** `GameView.load` захватывает `requestedPlace`; после `await` success/error применяются только при совпадении с текущим `place`. Общая с View `GameLoadState` отбрасывает поздние ответы; race закреплён XCTest. -- **Д2:** `NotationModel` строит основную двухколоночную линию и все alternative-subtree с `visited`, `indent`, comments/result и `entryByNode[MoveNode.id]`. `NotationView` использует эту модель; SAN вариантов — отдельные кнопки в token-flow, включая вложенные RAV. -- **Д3:** спецификация приведена к фактическим 100 записям; Opera — `index = 6`, №7. PGN не изменён. -- **Д4:** `nextGameRowPage` ограничивает страницы 100 записей; первая страница больше не использует `rows(0, len)`. Footer `GamesView` запрашивает следующую страницу по достижении конца. Общее число партий отделено от числа загруженных строк. -- **Д5:** ←/→, Shift+←/→, F, Escape зарегистрированы через iOS 16 `keyboardShortcut` и вызывают реальный `perform(GameCommand)`; Escape использует `dismiss`. -- **Д6:** вся строка имеет отдельный accessibility label с полными именами, сторонами, результатом, событием/годом/ECO и last-opened. `ResultTile` больше не скрыт; дочерние элементы заменяются осмысленной строкой целиком. -- **Д7:** `BoardView` получает `MoveNode`; `BoardAnnotationModel` переносит marks/end/NAG. Добавлены стрелки, круги, NAG-badge и локализованные checkmate/stalemate. -- **Д8:** Green исправлен на `#FFFFDD / #86A666`. -- **Д9:** toolbar next больше не зависит от `rows.count`: `showNext` через `NextGameRequest` при необходимости выполняет `await loadNextPage()`, проверяет исходный `place` после await и вызывает прежний `show(next)` с guards/`lastOpened`. Disabled определяется только `totalGames`; previous не изменён. -- **Д10:** `AppModel.nextPageTask` теперь разделяет одну in-flight загрузку: повторный footer/Next ожидает тот же `Task`, второй loader не создаётся. Task и `isLoadingPage` очищаются после завершения; guards database identity и `rows.count == page.start` сохранены. - -## Тестовые модели - -`iosApp/ChessPenguinTests` содержит пять исходников, включая общие PGN fixtures. Тесты адресуют race A→B→late-A, границы страниц 100/100/50, переходы next 100→101 и 200→201, concurrent footer+Next с одним delayed loader и двумя ожиданиями, Opera/Qxb7, вложенные RAV, malformed cycle, FEN/flip, marks/NAG/checkmate, keyboard mapping и accessibility. `project.yml` содержит `ChessPenguinTests` и подключает его к схеме приложения. - -**XCTest на этом Linux-хосте не запускались:** Swift toolchain, Xcode и Simulator отсутствуют. - -## Фактические проверки - -### Генерация моста - -```text -$ iosApp/scripts/build-bindings.sh -Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.42s -Swift UniFFI bindings: /home/vrubel/services/chessBaseLinux/iosApp/Generated/MobileAPI -Host is not macOS: skipped iOS targets and XCFramework (no iOS build was attempted). -Binding regeneration: byte-identical outputs -``` - -### Rust-ворота - -```text -$ cargo fmt --all -- --check -# exit 0, вывода нет -$ cargo clippy -p mobile-api --all-targets -- -D warnings -Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.08s -$ cargo test -p mobile-api --locked -test result: ok. 33 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out -Doc-tests mobile_api: ok -``` - -### Структурные проверки и ресурсы - -```text -project.yml: application + unit-test target; 5 XCTest source files -localization: 35 EN/RU keys match; all production/test references resolve -PGN unchanged: 72704 bytes; SHA-256 52fbe73d40d90382d9d79d8c9d2c7e9af2e749f34f18de3a49d18bfe7ad1200a -fixture docs: 100 games; Opera index 6 / row 7; stale 38-game criteria absent -paging: first/next pages use model; footer requests next page; no eager rows(0,len) -race + keyboard: requestedPlace guards on success/error; six hardware shortcuts call perform -notation: full variation renderer + visited + stable IDs + Opera/nested/cycle XCTest -board: MoveNode marks/NAG/end consumed; flip/marks/badge/end XCTest -accessibility: whole-row result label; ResultTile is not hidden -board colors: Green #FFFFDD / #86A666 -assets: 13 JSON files parsed -bash syntax: OK -``` - -Дополнительный Linux mirror нового traversal применён к дампу реальной Opera из независимого probe (это не запуск Swift): - -```text -opera_nodes 50 rendered 49 unique 49 expected 49 -missing [] duplicates 0 -Qxb7_ids [20, 29] all_rendered True -``` - -Временный Rust probe проверил PGN, используемый XCTest для badge/mate/nested RAV (это не XCTest). Первый составной вариант fixture дал `Qh4+` без `end`, то есть не был матом; его разделили на отдельную NAG-партию и канонический fool's mate. Исправленный fixture уже в тестах, повторный probe: - -```text -mate_nodes=3 first_nags=[1] first_badge_square=Some("e4") -mate_nodes=5 last_san=Qh4# last_end=checkmate -nested_nodes=6 sans=["", "e4", "d4", "d5", "c5", "e5"] -``` - -## Д9: фактическая повторная проверка - -```text -D9 structure: next async loads missing page, guards origin, then show(next); previous/lastOpened preserved -XCTest model: 100→101 and 200→201 page transitions + final boundary -project.yml + test source: valid -bash syntax: OK -``` - -Повторная генерация UniFFI завершилась с `Binding regeneration: byte-identical outputs`; host снова честно пропустил iOS/XCFramework. `cargo fmt --check`, `cargo clippy -p mobile-api --all-targets -- -D warnings` и `cargo test -p mobile-api --locked` прошли: **33 passed, 0 failed, 2 ignored**. Swift/XCTest по-прежнему не запускались. - -## Д10: фактическая повторная проверка - -```text -D10 AppModel: shared in-flight nextPageTask; repeat callers await; cleanup after completion; identity guards retained -GameView: Next still awaits page loader before guarded show(next) -XCTest: concurrent footer+Next, one delayed loader, Next is awaited before footer and sees 200 rows, show(100) guard passes -project.yml: unit-test target retained -bash syntax: OK -``` - -UniFFI снова сгенерирован с `Binding regeneration: byte-identical outputs`; iOS/XCFramework на Linux не выполнялись. `cargo fmt --check`, clippy и `cargo test -p mobile-api --locked` прошли: **33 passed, 0 failed, 2 ignored**. Асинхронный XCTest с реальным scheduler по-прежнему pending macOS. - -## Pending macOS / Simulator - -1. `xcodegen generate`, Swift compile всех production/test files, XCTest и окончательная UniFFI/XCFramework link. -2. UI-проявление race retry/place и реальные async-тайминги, включая одновременные footer+Next во время активной загрузки страницы: один loader, оба ждут, затем Next показывает запрошенную партию. -3. Все касания SAN в многострочных вариантах, выделение/scroll текущего `MoveNode.id`, Dynamic Type и отсутствие переполнений. -4. Передача hardware keys Simulator, Full Keyboard Access, фактическая речь VoiceOver. -5. Визуальная проверка стрелок/кругов/badge/checkmate/stalemate, Green, ×2/×3 и safe area. -6. Paging после записи 100 на базе больше 100 и toolbar next на `place=99` и `place=199` (переходы 100→101 и 200→201): комплектный PGN ровно 100 записей, поэтому нужен отдельный debug fixture на 250 без изменения поставляемого PGN. Память/CPU заявлять только после Instruments. diff --git a/docs/qa/iphone-structural.md b/docs/qa/iphone-structural.md deleted file mode 100644 index 9e41f56..0000000 --- a/docs/qa/iphone-structural.md +++ /dev/null @@ -1,477 +0,0 @@ -# Независимая структурная QA первого iPhone-среза - -Дата: 2026-11-30. Исполнитель: независимый tester, не автор реализации. - -**Вердикт: структурный срез не принят.** Подтверждены гонка с подменой открытой партии и потеря вариантов в нотации; всего ниже оформлено 7 дефектов приложения и 1 дефект приёмочных данных. **Swift compile, Xcode build и Simulator PASS не выставляются:** на машине нет Xcode, XcodeGen и Swift toolchain. - -## Окружение и граница доказательств - -Обозначение **О-1** для дефектов ниже: - -- Linux x86_64, CachyOS, kernel `7.3.6-3-cachyos`; `rustc 1.99.1`, `cargo 1.99.1`; -- базовый `HEAD`: `a37c6a78f451c82f665d7908bd927460c088a863`, поверх него — незакоммиченный iPhone-срез из рабочего дерева; `MARKETING_VERSION` в `iosApp/project.yml` — `2.5.2`; -- `xcodebuild`, `swift`, `xcodegen` через `command -v` не найдены; -- production не изменялся, пользовательский PGN не перезаписывался, коммитов не было. Разрешённые записи: этот отчёт и `/tmp/opencode/qa-iphone/`; -- слова «подтверждено» ниже относятся к выполненным Linux-командам, исходным состояниям и управляемым чередованиям. Они не означают наблюдение на iPhone. - -## Фактически проверено - -### 1. Обязательная генерация моста - -Самостоятельно выполнено из корня: - -```sh -iosApp/scripts/build-bindings.sh -``` - -Результат: **exit 0**. Скрипт собрал host `mobile-api`, заново сгенерировал Swift/header/module map и честно завершился с сообщением: - -```text -Host is not macOS: skipped iOS targets and XCFramework (no iOS build was attempted). -``` - -SHA-256 четырёх файлов до и после генерации совпали попарно; в том числе: - -```text -3590ebd857c8171c18c68fdb68c1a320d0d8801999d2d70779d264829feb1dda MobileAPI.swift -c08c02850a8f32fa8b203fc3271cc1f9b725c5f3fdc845a4ee284ecadf29aa55 MobileAPIFFI.h -e4fa7efecc9539a8b2a2f2d070137f478e17a95d79f65c04a83d217bfe96647b MobileAPIFFI.modulemap -e4fa7efecc9539a8b2a2f2d070137f478e17a95d79f65c04a83d217bfe96647b module.modulemap -``` - -Проверено по фактически сгенерированному `MobileAPI.swift`: экспортируются `openBytes(name:bytes:)`, `Database.rows`, `rowsOf`, `game`, `len`; `GameData`, `GameRow`, `MoveNode`, `Mark` соответствуют Rust-записям; `Database.deinit` вызывает `uniffi_mobile_api_fn_free_database`. Это проверка наличия и воспроизводимости моста, **не проверка Apple link/ABI**. - -Журнал: `/tmp/opencode/qa-iphone/build-bindings.log`. - -### 2. Rust-тесты общего API - -```sh -cargo test -p mobile-api --locked -``` - -Результат: **exit 0; 33 passed, 0 failed, 2 ignored; doc-tests 0**. Игнорированы сценарии Maia/Rodent, требующие внешних весов/движка. Среди выполненных — дерево, комментарии/варианты, FEN, paging самого Rust API, метки и сохранность PGN. - -Журнал: `/tmp/opencode/qa-iphone/cargo-test-mobile-api.log`. - -### 3. Независимый probe реальных данных - -Создан временный крейт `/tmp/opencode/qa-iphone/probe`, вызывающий публичный `mobile-api`, а не повторяющий отчёт разработчика. Выполнено: - -```sh -cargo generate-lockfile -CARGO_TARGET_DIR=/home/vrubel/services/chessBaseLinux/target cargo run --locked --quiet -``` - -Проверены: - -- `classics.pgn`: `len = 100`; первая строка — McDonnell–La Bourdonnais; Opera имеет `index = 6`, то есть является записью №7; -- Opera: 50 узлов, корректные `id/parent/children/FEN`; у `Rd8#` мост отдаёт `end = "checkmate"`; -- алгоритм `mainLineIDs`, воспроизведенный непосредственно по Swift-коду, включает 33 хода основной линии и оставляет вне нотации 16 реальных узлов вариантов Opera: `4…dxe5`, `8.Qxb7 Qb4+ 9.Qxb4 Bxb4+`, ветки `9…Nbd7` и вложенные продолжения; -- отдельный PGN с `SetUp=1`, FEN `8/8/4k3/8/8/8/8/4K3 b - - 0 0`: корень имеет очередь чёрных, `1…Kd6` имеет `parent = 0`, `white = false`, `moveNumber = 1`, корректные `from=e6`, `to=d6` и FEN после хода; -- отдельный двухуровневый RAV: все узлы и родители приходят через Rust, но Swift-алгоритм основной линии опускает всё поддерево `1.d4`. - -Журнал: `/tmp/opencode/qa-iphone/mobile-probe.log`. Временные PGN созданы только в памяти probe; исходные файлы не менялись. - -### 4. Структурные проверки Swift и управляемая гонка - -Запущен `/tmp/opencode/qa-iphone/structural_checks.py` (**exit 0**). Он проверил: - -- eager-вызов `rows(start: 0, count: database.len())` и отсутствие paging в `AppModel`; -- отсутствие request/generation token и запись `loadedPlace = place` после `await`; -- first-child-only нотацию и отсутствие variation renderer; -- наличие FEN-гвардов на 8 рядов/64 клетки и flip mapping `63 - visualIndex`; -- управляемое чередование «retry A для партии 0 → переход к партии 1 → ответ B для партии 1 → поздний ответ A». Конечное состояние воспроизведено как: - -```text -final_place=1 loadedPlace=1 game=GAME_0 -stale_retry_displayed_as_new_place=True -``` - -Это детерминированная модель именно состояний `GameView.load/show`, а не симулятор SwiftUI. Журнал: `/tmp/opencode/qa-iphone/structural-checks.log`. - -### 5. Проект, ресурсы, локализация и поверхность записи - -- `bash -n iosApp/scripts/build-bindings.sh` — exit 0. -- `project.yml` разобран PyYAML: iOS 16.0, `TARGETED_DEVICE_FAMILY = "1"`, только `UIInterfaceOrientationPortrait`, dark UI, generated Swift и XCFramework подключены декларативно. -- Все `Contents.json` разобраны; оба `Localizable.stringsdict` разобраны `plistlib`; EN/RU имеют одинаковые 29 ключей `Localizable.strings`, отдельно присутствует `games_count` с plural rules. -- Все 12 ожидаемых фигур `w/b × KQRBNP` существуют; referenced PNG существуют, каждый имеет PNG signature и размер 256×256. -- `cmp -s examples/classics.pgn iosApp/ChessPenguin/Resources/classics.pgn` — **exit 0**. Общий SHA-256: `52fbe73d40d90382d9d79d8c9d2c7e9af2e749f34f18de3a49d18bfe7ad1200a`. -- В handwritten Swift найден единственный файловый ввод `Data(contentsOf:)` для bundled URL и `openBytes`; вызовов `ownSave`, `ownCreate`, `GameSession`, запуска Analyzer/Stockfish и API записи нет. -- Проверены `project.yml`, оба module map, notices, asset references и отсутствие внешних Swift package/CocoaPods dependencies. - -Журналы: `/tmp/opencode/qa-iphone/resources.log`, `syntax-resource-checks.log`, `surface-checks.log`. - -## Дефекты - -### Д-1. Поздний retry отображает прежнюю партию под номером новой - -- **Серьёзность:** высокая — пользователь видит неверную партию и её доску под заголовком `N of M`. -- **Окружение/версия:** О-1; гонка воспроизведена управляемым порядком завершения запросов. На Simulator дополнительно требуется подтверждение UI-проявления. -- **Шаги:** (1) открыть партию 0 и получить ошибку загрузки; (2) нажать «Повторить», не дожидаясь ответа A нажать toolbar «следующая партия»; (3) дать запросу B партии 1 завершиться первым, а retry A — последним. -- **Ожидаемо:** A отброшен по идентификатору запроса/места; остаются `GameData` партии 1 и `loadedPlace = 1`. -- **Фактически:** retry создан отдельным `Task { await load() }` и не отменяется сменой `.task(id: place)`. `load()` не сохраняет requested place/token. После `await` он присваивает `game = loaded`, но `loadedPlace = place` уже читает новое значение 1. Контрольный прогон завершился `game=GAME_0`, `loadedPlace=1`; `shownGame` считает такую партию валидной для экрана 1. -- **Файл/строка:** `iosApp/ChessPenguin/GameView.swift:47-50` (retry), `95` (отдельный `.task`), `112-126` (запись после await), `129-133` (`show`), `17-19` (`shownGame`). -- **Минимальный пример:** `/tmp/opencode/qa-iphone/structural_checks.py`, сценарий `check_retry_race`; его фактический вывод приведён выше. Обычный переход ‹ › имеет cancellation guard, но он не охватывает самостоятельный retry Task. - -### Д-2. Варианты PGN не выводятся; после выбора ветки текущий ход исчезает из нотации - -- **Серьёзность:** высокая — нарушен центральный сценарий чтения аннотированной партии и дерева. -- **Окружение/версия:** О-1; дефект доказан реальным `GameData` Opera и прямым анализом рендер-модели. -- **Шаги:** открыть Opera (фактически запись №7) → дойти до `7…Qe7` → в «Дальше» выбрать `8.Qxb7` → продолжить `8…Qb4+`. -- **Ожидаемо:** в нотации виден кликабельный вариант `8.Qxb7 Qb4+ 9.Qxb4 Bxb4+ … only trades queens.`; выбранный `MoveNode.id` присутствует и выделяется. -- **Фактически:** `NotationView` строит строки только по `children.first` от корня. `ForEach(movePairs(game))` не получает ни одного variation node. После выбора id 20 доска меняется, но ячейки `move-20` не существует, выделять и прокручивать нечего. В Opera опущены 16 узлов; `README.md:14` фактически признаёт сокращение дерева, но это противоречит назначенному объёму. -- **Файл/строка:** `iosApp/ChessPenguin/NotationView.swift:11-24`, `27-49`, `64-78`, `99-102`, `106-139`; `iosApp/ChessPenguin/GameView.swift:38-44`; критерий — `docs/design/iphone-app.md:22-23`, `277`, `400`, `416`, `462`. -- **Минимальный пример:** `1. e4 (1. d4 1... d5) 1... e5 *`. Rust probe возвращает обе ветки; Swift main-line IDs — только `e4,e5`. Реальный лог Opera: `omitted_from_swift_notation=[… (20,"Qxb7"), (21,"Qb4+"), …]`. - -### Д-3. Приёмочный fixture не соответствует спецификации: 100 партий вместо 38, Opera не первая - -- **Серьёзность:** средняя — сценарии холодного запуска и первой партии из §10.1 невозможно принять в записанном виде. -- **Окружение/версия:** О-1; tracked `examples/classics.pgn` и его байтовая копия в bundle. -- **Шаги:** выполнить временный probe либо `grep -c '^\[Event ' examples/classics.pgn`; прочитать первый заголовок и найти `[Event "Paris Opera"]`. -- **Ожидаемо:** по `docs/design/iphone-app.md:412-413` — 38 партий, первая Morphy–Duke Karl/Count Isouard, `1 of 38` на Opera. -- **Фактически:** 100 заголовков Event; `Database.len() = 100`; первая запись — McDonnell–La Bourdonnais, London m4, `0-1`, B32; Opera — index 6/строка №7. Следовательно, UI, использующий настоящие `rows`, покажет 100 и другую первую партию. -- **Файл/строка:** `docs/design/iphone-app.md:182`, `190`, `201`, `232`, `412-413`; `examples/classics.pgn:1-7` и `112-120`. -- **Минимальный пример:** `/tmp/opencode/qa-iphone/mobile-probe.log`: `classics_len=100`, `opera_index=6`. Нужно согласовать исправление критериев или отдельный fixture; существующий PGN самостоятельно не менять. - -### Д-4. Список не ленивый: при открытии материализуются все `GameRow` - -- **Серьёзность:** средняя структурная; эффект по памяти/времени на больших базах здесь **не измерялся**. -- **Окружение/версия:** О-1; статически подтверждённый путь вызова, текущий bundle содержит 100 записей. -- **Шаги:** холодный запуск → `DatabasesView.task` → `AppModel.loadSample`. -- **Ожидаемо:** `GameRow` читаются страницами по 100 по мере показа; `GameData` загружается только для открытой партии. -- **Фактически:** до показа списка выполняется один `rows(start: 0, count: database.len())`; все строки сохраняются в `@Published rows`, после чего `GamesView` перебирает весь массив. `rowsOf` и следующая страница не используются. `GameData`, наоборот, загружается отдельно — эта часть ленивая. -- **Файл/строка:** `iosApp/ChessPenguin/AppModel.swift:26-28`, `39-47`; `iosApp/ChessPenguin/LibraryViews.swift:74-90`; требование — `docs/design/iphone-app.md:87`, `387`, `395`. -- **Минимальный пример:** строка `database.rows(start: 0, count: database.len())` в `AppModel.swift:45`; структурный check напечатал `all_rows_materialized_at_open=True pages_of_100=False`. Производительность не объявляется ни PASS, ни FAIL. - -### Д-5. Не реализованы назначенные аппаратные клавиши партии - -- **Серьёзность:** средняя — отсутствует заявленный способ навигации и альтернатива long press для клавиатуры. -- **Окружение/версия:** О-1; проверка отсутствия обработчиков во всех handwritten Swift. Передача клавиш Simulator отдельно не проверялась. -- **Шаги:** на экране партии с hardware keyboard нажать ←/→, Shift+←/→, F или Escape. -- **Ожидаемо:** соответственно один ход, границы линии, Flip, назад по `docs/design/iphone-app.md:356-369`. -- **Фактически:** ни `UIKeyCommand`, ни `keyboardShortcut`, ни `onKeyPress` в `iosApp/ChessPenguin/*.swift` нет; собственной реализации этих действий для клавиатуры не существует. Это не утверждение о системном Tab/Full Keyboard Access. -- **Файл/строка:** `iosApp/ChessPenguin/ChessPenguinApp.swift:17-34` и `GameView.swift:26-96` — view/команды не регистрируют клавиши; handlers отсутствуют во всём каталоге. -- **Минимальный пример:** `grep -RInE 'UIKeyCommand|keyboardShortcut|onKeyPress' iosApp/ChessPenguin --include='*.swift'` не даёт совпадений. - -### Д-6. Результат партии исключён из accessibility-дерева строки списка - -- **Серьёзность:** средняя — VoiceOver не получает результат, хотя это основная информация строки. -- **Окружение/версия:** О-1; подтверждены модификаторы accessibility в исходнике, звук VoiceOver не записывался. -- **Шаги:** открыть список партий с VoiceOver и обойти строку с результатом `1-0`, `0-1` или `1/2-1/2`. -- **Ожидаемо:** полные имена, стороны и результат читаются в единой строке кнопки. -- **Фактически:** результат передаётся только в `ResultTile`, а весь `ResultTile` помечен `.accessibilityHidden(true)`. У внешнего `Button` нет собственного `accessibilityLabel`/`accessibilityValue` с результатом; `sideResult` больше в accessibility-текст не попадает. -- **Файл/строка:** `iosApp/ChessPenguin/SharedViews.swift:50-68`; `iosApp/ChessPenguin/LibraryViews.swift:76-83`, `121-122`, `155-176`; ожидаемое чтение — `docs/design/iphone-app.md:343-350`. -- **Минимальный пример:** строка с `row.result = "1-0"`: оба значения `1` и `0` существуют только внутри скрытых `ResultTile`; альтернативного семантического текста результата в коде нет. - -### Д-7. Мост отдаёт marks/end, но доска их полностью игнорирует - -- **Серьёзность:** средняя — теряются учебные стрелки/подсветки и индикация мата/пата на доске. -- **Окружение/версия:** О-1; Rust-поля подтверждены тестом и probe, отсутствие потребителя — прямым чтением Swift. -- **Шаги:** открыть узел с `[%cal]/[%csl]` или финальный `Rd8#` в Opera. -- **Ожидаемо:** Board использует `MoveNode.marks`, `end == checkmate/stalemate` и NAG-badge согласно `docs/design/iphone-app.md:267`. -- **Фактически:** `GameView` передаёт в `BoardView` только FEN, flip, from/to и description. Сам `BoardView` не имеет входов `marks`, `end` или NAG и рисует только клетки, last move, фигуры и координаты. При этом у реального `Rd8#` probe получил `end="checkmate"`; Rust unit-test подтверждает прохождение marks через API. -- **Файл/строка:** `iosApp/ChessPenguin/GameView.swift:30-36`; `iosApp/ChessPenguin/BoardView.swift:56-98`, `101-144`; источник данных — `crates/mobile-api/src/lib.rs:149-163`, `544-563`. -- **Минимальный пример:** `1. f3 e5 2. g4 Qh4# 0-1` для `end`; `1. e4 {[%cal Ge2e4]}` для marks. Данные доходят до `MoveNode`, но нет кода, который мог бы их отобразить. - -### Д-8. Цвета доски не соответствуют назначенной теме Green - -- **Серьёзность:** низкая, визуальная; токенное расхождение доказано без снимка. -- **Окружение/версия:** О-1; сравнение Swift, действующего Android и назначенной спецификации. -- **Шаги:** сравнить `Theme.boardLight/boardDark` с Green из спецификации/Android. -- **Ожидаемо:** `#FFFFDD / #86A666`. -- **Фактически:** `#F0D9B5 / #B58863`. README утверждает повторение Android BoardStyle, но Android `Green` задаёт `rgb(255,255,221) / rgb(134,166,102)`. -- **Файл/строка:** `iosApp/ChessPenguin/Theme.swift:30-31`; `androidApp/app/src/main/java/io/github/vrubelroman/chesspenguin/data/BoardStyle.kt:41`; `docs/design/iphone-app.md:133`, `145`. -- **Минимальный пример:** значения HEX выше. Реальный рендер, контраст и HiDPI на Simulator не оценивались. - -## Не подтвердилось - -- **Ошибка Rust-части FEN/parent для чёрных:** не подтвердилась. Probe с black-to-move и fullmove=0 вернул правильные root/child, SAN, сторону, from/to и FEN. Swift Board имеет guards рядов/64 клеток и согласованный flip mapping. Это не заменяет визуальную сверку фигур на iPhone. -- **Устаревшие или неидемпотентные сгенерированные биндинги:** не подтвердилось; повторная генерация сохранила все четыре SHA-256. -- **Пропавшие ключи EN/RU, битые stringsdict/asset JSON, отсутствующие PNG:** не подтвердилось перечисленными парсерами и проверками 12 комплектов. -- **Изменение bundled PGN во время выполненных команд:** не подтвердилось; копия побайтово равна оригиналу, handwritten Swift содержит только чтение. Сценарий checksum «до/после UI» на устройстве ещё не выполнялся. -- **Блокировка главного потока вызовами `openBytes`, `rows`, `game`:** не подтвердилась по коду — все три вызова находятся в `Task.detached`. Фактический Main Thread Checker/Instruments не запускался. -- **Постоянная утечка `Database`:** не подтвердилась по сгенерированному коду — есть `deinit → free_database`, AppModel намеренно владеет одной базой. Временное удержание базы непрерванными detached-задачами и реальные графы памяти Instruments не проверялись. -- **Дополнительная гонка обычных быстрых ‹ ›:** не подтверждена статически: `.task(id: place)` имеет cancellation checks, а `shownGame` сверяет `loadedPlace`. Найденный Д-1 относится к отдельному retry Task и не должен быть «заметён» этим пунктом. - -## Непроверенное на macOS / iPhone Simulator — явный список - -1. `xcodegen generate`, компиляция всех Swift-файлов, доступность конкретных SwiftUI API на iOS 16, импорт Clang module и отсутствие конфликтов module maps. -2. `rustup target add`, `cargo check` и `cargo rustc --crate-type staticlib` для всех трёх Apple targets; `lipo`; `xcodebuild -create-xcframework`; окончательный link с `CoreFoundation`/`IOKit`. -3. Любой запуск приложения, cold start, NavigationStack/edge-swipe, восстановление из фона, реальные async-тайминги и UI-проявление Д-1. -4. Tap/long press/cancellation, отсутствие предварительного tap у long press, disabled states и VoiceOver custom actions. -5. Визуальные FEN/flip/координаты, SVG→PNG качество на ×2/×3, safe area, SE 375×667, современный ×3, Dynamic Type и Reduce Motion. -6. Фактическая речь VoiceOver, порядок обхода, Full Keyboard Access и передача hardware keys Simulator. -7. Прокрутка списка после возврата, видимость lastOpened, отсутствие скачков доски/панели и взаимодействие с развилками. -8. Память, CPU, Main Thread Checker и Instruments на списке; эффект Д-4 на больших входах и отсутствие утечек/задержек detached tasks. -9. Подпись, запуск на физическом iPhone и поведение при реальных ошибках чтения/фоновых завершениях. - -## Оценка рисков остатка - -- **Высокий:** нет даже доказательства, что проект компилируется и линкуется на Apple toolchain; количество потенциальных платформенных ошибок после Linux-проверок не ограничено. -- **Высокий:** Д-2 закрывает не весь назначенный просмотр дерева, а Д-1 нарушает идентичность показанной партии. Их нельзя заменять зелёными Rust-тестами: тесты подтверждают данные, но не Swift-состояние/рендер. -- **Средний:** отсутствуют Swift/XCTest targets для `BoardPosition`, `movePairs`, навигации и генерации запросов; управляемые гонки и вложенные RAV сейчас не закреплены регрессиями на стороне приложения. -- **Средний:** accessibility, жесты и Dynamic Type имеют только структурную проверку; Simulator может выявить дополнительные дефекты, включая поведение составного gesture и layout. -- **Средний/латентный:** eager `GameRow` на текущих 100 записях не даёт основания заявлять деградацию, но архитектура больших баз уже отклоняется от требования; измерения проводить после исправления сценария и на macOS/Instruments. -- **Низкий:** ресурсы и локализация структурно целы, но это не доказывает их включение в итоговый `.app` без фактической Xcode-сборки. - -**Итог:** сначала устранить Д-1/Д-2 и согласовать Д-3, затем выполнить обязательный macOS/Xcode прогон по всему списку выше. Ни один пункт Simulator/визуальной приёмки этим отчётом не закрыт. - ---- - -# Повторный вердикт после `iphone-fixes.md` — 2026-11-30 - -Этот раздел добавлен при повторной независимой проверке текущего `iosApp`. Раздел первого прохода выше сохранён как история и описывает прежнюю версию исходников. `docs/qa/iphone-fixes.md` прочитан как заявление разработчика, а не использован как доказательство. - -## Итог повторной проверки - -**Полный structural PASS не выставляется.** По фактически выполненным проверкам: - -- **Д1, Д2, Д3, Д5, Д6, Д7, Д8 — структурно исправлены (PASS);** -- **Д4 — исправлено eager-чтение и реализованы страницы 100/100/50, но обнаружена оставшаяся граница навигации ‹ › на незагруженную страницу (Д9 ниже);** -- текущий комплектный PGN ровно из 100 партий не затрагивается Д9; для базы больше 100 записей дефект воспроизводится структурно; -- **Swift compile, XCTest, Xcode build и Simulator по-прежнему не выполнялись.** На хосте повторно подтверждено отсутствие `xcodebuild`, `swift`, `xcodegen`. - -Окружение повторной проверки (**О-2**): то же Linux x86_64/CachyOS, `rustc 1.99.1`, `cargo 1.99.1`, базовый `HEAD a37c6a78f451c82f665d7908bd927460c088a863` и текущее незакоммиченное дерево с исправлениями. Production не изменялся; новые проверки и probe находятся в `/tmp/opencode/qa-iphone/retest/`. - -## Независимо выполненные повторные проверки - -### Мост и Rust - -Повторно запущены самостоятельно: - -```sh -iosApp/scripts/build-bindings.sh -cargo test -p mobile-api --locked -``` - -- генерация — **exit 0**; SHA-256 всех четырёх generated-файлов до/после снова совпали; -- Linux-ветка скрипта явно пропустила iOS targets/XCFramework; -- Rust — **33 passed / 0 failed / 2 ignored**, doc-tests 0; -- в актуальном generated Swift присутствуют `openBytes`, `rows`, `game`, `MoveNode.marks/end`; оба module map равны. - -Журналы: `/tmp/opencode/qa-iphone/retest/build-bindings.log`, `cargo-test-mobile-api.log`. - -### Собственный probe дерева и данных - -Создан новый `/tmp/opencode/qa-iphone/retest/probe` с независимым executable mirror нового traversal. Это не повторный запуск тестов разработчика и не XCTest. Результаты: - -```text -classics_len=100 -opera_index=6 opera_row=7 -opera_nodes=50 rendered=49 unique=49 expected=49 missing=[] unexpected=[] duplicates=0 -qxb7_ids=[20, 29] all_rendered=true -labels=["8.Qxb7", "Qb4+", "10.Qxb7?!", "Qb4"] -nested_nodes=6 rendered=5 unique=5 expected=5 missing=[] unexpected=[] duplicates=0 -nested_labels=["1.e4", "1.d4", "d5", "1…c5", "1…e5"] parentheses=2 -cycle_rendered=[1] -paging_total=250 pages=100/100/50 boundary_indices=Some(0)/Some(100)/Some(200) -RETEST_PROBE_ASSERTIONS=OK -``` - -Дополнительно на реальных данных `mobile-api` проверено: - -- `[%cal Ge2e4,Rd7d5] [%csl Yd5]` даёт две стрелки и один square mark с ожидаемыми координатами; -- `1. e4 $1` даёт `nags=[1]`, `toSquare=e4`; -- `1. f3 e5 2. g4 Qh4# 0-1` даёт последний `san=Qh4#`, `end=checkmate`; -- сгенерированная только в памяти база из 250 одноходовых PGN подтверждает страницы Rust API 100/100/50 и индексы 0/100/200. - -Журнал: `/tmp/opencode/qa-iphone/retest/mobile-probe.log`. - -### Собственные structural checks - -Запущен `/tmp/opencode/qa-iphone/retest/structural_checks.py` (**exit 0**), не использующий XCTest как доказательство: - -- модель retry A → место B → late-A success/failure оставила `GAME_B/place1`; оба поздних исхода отброшены; -- независимые границы `nextGameRowPage`: 100/100/50, ровно 100, 0, отрицательные и выход за total; -- проверено отсутствие прежнего `rows(0, database.len())`, первая страница через модель, footer `loadNextPage`, append и guards; -- найдены все шесть `keyboardShortcut`, их `perform(GameCommand)` и реальные `stepBack/stepForward/go/goToEnd/flip/dismiss`; -- accessibility label целой строки содержит результат; `ResultTile` больше не скрыт; -- `BoardAnnotationModel` и `BoardView` соединены для arrows/circles/NAG 1…6/checkmate/stalemate; -- Green равен `0xFFFFDD / 0x86A666`. - -Журнал: `/tmp/opencode/qa-iphone/retest/structural-checks.log`. - -### Проект, тесты, локализация и ресурсы - -- `project.yml` разобран независимо: application target, `ChessPenguinTests` типа `bundle.unit-test`, dependency на приложение и `scheme.testTargets = [ChessPenguinTests]`; существуют ровно 5 XCTest-исходников. -- EN/RU: по **35 ключей**, наборы равны; все production/test references разрешаются, printf-placeholders парные, оба stringsdict валидны. -- Все 13 asset `Contents.json` разобраны. -- PGN: **72704 байта**, `cmp` успешен, SHA-256 прежний `52fbe73d40d90382d9d79d8c9d2c7e9af2e749f34f18de3a49d18bfe7ad1200a`. -- В спецификации остались 100 записей, Opera `index=6`/№7; прежних критериев `38 games`, `38 партий`, `1 of 38`, `1 из 38` нет. Единственное текстовое `38` относится к alpha `0,38`. - -## Матрица закрытия Д1–Д8 - -| Дефект | Повторный verdict | Собственное доказательство | -|---|---|---| -| Д1, retry race | **PASS, структурно** | `requestedPlace` захвачен до await; success/error имеют cancellation + current-place guards; `GameLoadState` повторно проверяет requested/current. Поздние success и failure A отброшены в моей модели. | -| Д2, дерево/Qxb7/nested RAV | **PASS, структурно** | Opera 49/49 уникальных reachable nodes, оба `Qxb7`; nested 5/5, две скобки; cycle не зацикливается. Каждый SAN связан с `NotationMoveButton` и стабильным `move-`. | -| Д3, fixture 100/Opera №7 | **PASS** | Rust `len=100`, `opera_index=6`; спецификация и фактические PGN совпадают, PGN не изменён. | -| Д4, paging | **ЧАСТИЧНО** | Eager-запрос устранён, страницы и footer подтверждены. Открыт Д9: ‹ › не запрашивает и не принимает место за пределами уже загруженных `rows`. | -| Д5, keyboard | **PASS, структурно** | Шесть shortcuts и реальные actions присутствуют. Фактическая доставка клавиш остаётся macOS-проверкой. | -| Д6, accessibility result | **PASS, структурно** | Целая кнопка имеет собственный label с именами/сторонами/результатом/контекстом/lastOpened; скрытие `ResultTile` удалено. Речь VoiceOver не проверялась. | -| Д7, marks/end/NAG | **PASS, структурно** | Реальные данные моста + модель arrows/circles/badge/ending + потребители в Board. Визуальная геометрия не проверялась. | -| Д8, Green | **PASS** | Токены `#FFFFDD/#86A666` совпали с назначенными. | - -## Оставшийся дефект Д9 (граница исправления Д4) - -- **Серьёзность:** средняя структурная, только для базы больше 100 записей; на поставляемых 100 не проявляется. -- **Окружение/версия:** О-2; воспроизведено на модели состояния 250 total/100 loaded и подтверждено прямыми условиями текущего Swift. Simulator-наблюдения не было. -- **Шаги:** (1) открыть debug-базу на 250 партий, имея загруженной первую страницу 100; (2) открыть запись `place=99` до завершения загрузки следующей страницы; (3) попытаться перейти ‹ › к записи `place=100`. -- **Ожидаемо:** переход к следующей партии в порядке списка либо явный запрос/состояние загрузки следующей страницы с последующим переходом. -- **Фактически:** кнопка следующей партии disabled, потому что условие сравнивает `place + 1` с `model.rows.count = 100`, хотя `totalGames = 250`. Даже прямой `show(100)` не проходит второй guard `model.rows.indices.contains(100)`. `GameView` сам `loadNextPage()` не вызывает. Если footer уже загрузил страницу, кнопка позже разблокируется; до загрузки, при её отсутствии или ошибке переход из экрана партии недоступен и ошибки страницы там нет. -- **Файл/строка:** `iosApp/ChessPenguin/GameView.swift:86-90` (disabled), `131-135` (`show`); загрузка существует только в `AppModel.swift:72-92` и footer `LibraryViews.swift:93-105`. -- **Минимальный пример:** `/tmp/opencode/qa-iphone/retest/structural_checks.py` вывел: - - ```text - boundary_place=99 loaded_rows=100 totalGames=250 next_disabled=True show_place_100_accepted=False - REMAINING_PAGING_NEIGHBOR_BOUNDARY=CONFIRMED - ``` - - Rust probe той же проверки подтвердил, что API способен вернуть `rows(100,100)` с индекса 100: ограничение находится в Swift-навигации, не в мосте. - -## Что остаётся обязательным на macOS / Simulator - -1. `xcodegen generate`; фактическая компиляция production и всех 5 test files; окончательная UniFFI/staticlib/XCFramework link. Наличие test target в YAML не доказывает компиляцию XCTest. -2. `xcodebuild test` на доступном iPhone Simulator: выполнить, а не только прочитать XCTest для race, pages, Opera/nested/cycle, FEN/flip, marks/NAG/end, keyboard/accessibility. -3. Отдельный debug fixture **больше 100** (например, 250), не меняя bundled PGN: footer 100→200→250, открытие №100 во время загрузки и после ошибки, ‹ › через границу 100/101, повтор и отмена запросов. Это одновременно проверит UI-проявление Д9. -4. Контролируемые задержки retry/place на живом UI: late success и late failure не должны менять партию, заголовок или ошибку нового места. -5. Касания каждого SAN в `8.Qxb7…` и вложенном RAV, выделение/scroll по `MoveNode.id`, многострочный `FlowLayout`, Dynamic Type и отсутствие переполнений. -6. Hardware keys и Full Keyboard Access; фактическая речь VoiceOver для полного имени, результата, lastOpened, текущего хода и board ending. -7. Визуальная приёмка arrows/circles/NAG/checkmate/stalemate, Green, FEN/flip, ×2/×3, safe area; tap/long press/cancellation и Reduce Motion. -8. Instruments/Main Thread Checker для paging и полного дерева; память/CPU и отсутствие утечек detached tasks не объявлять по Linux-модели. - -**Повторный итог:** заявленные исправления в основном подтверждены независимо, но полный structural PASS блокирует Д9. После его исправления всё равно обязательны перечисленные macOS/Xcode/XCTest/Simulator проверки; ни одна из них этим разделом не отмечена выполненной. - ---- - -# Итоговая проверка исправления Д9 — 2026-11-30 - -Проверен текущий код с `NextGameRequest` и `GameView.showNext`. Предыдущие разделы оставлены как историю соответствующих версий. - -## Вердикт - -- **Исходный Д9 закрыт структурно:** кнопка Next теперь ограничена только `totalGames`; `NextGameRequest` определяет необходимость страницы; независимые модели подтвердили переходы **100→101** и **200→201**, уже загруженный переход 101→102 и отмену перехода при смене origin во время ожидания. -- **Полный structural PASS всё ещё не выставляется:** независимая проверка разделяемой с footer загрузки воспроизвела новый граничный дефект **Д10** — Next во время уже активного `loadNextPage` теряется и после завершения страницы не выполняется. -- Swift compile, XCTest, Xcode build и Simulator **не запускались и PASS не получали**. - -Окружение (**О-3**): прежний Linux x86_64/CachyOS, `rustc 1.99.1`, `cargo 1.99.1`, текущее незакоммиченное дерево на базовом `HEAD a37c6a78f451c82f665d7908bd927460c088a863`. Новые проверки: `/tmp/opencode/qa-iphone/final/`; production не изменялся. - -## Фактические проверки исправления - -Повторно выполнены: - -```sh -iosApp/scripts/build-bindings.sh -cargo test -p mobile-api --locked -``` - -Генерация завершилась с **exit 0**, четыре generated SHA-256 до/после совпали; Linux-ветка не имитировала Apple targets. Rust: **33 passed / 0 failed / 2 ignored**, doc-tests 0. Журналы — `final/build-bindings.log`, `final/cargo-test-mobile-api.log`. - -Собственный `/tmp/opencode/qa-iphone/final/next_game_checks.py` проверил исходные условия Swift и управляемые асинхронные чередования, а не XCTest разработчика: - -```text -next_request_boundaries_and_source_wiring=OK -direct_100_to_101: rows=200 final_place=101 -direct_200_to_201: rows=250 final_place=201 -already_loaded_101_to_102: final_place=102 loading=False -origin_changed_during_wait: final_place=99 rows=200 -next_while_footer_loading_before_completion: final_place=100 rows=100 -next_while_footer_loading_after_completion: final_place=100 rows=200 -REMAINING_SHARED_PAGE_WAIT_RACE=CONFIRMED -NOMINAL_D9_BOUNDARIES=PASS; CONCURRENT_FOOTER_CASE=OPEN -``` - -Здесь номера `final_place` человеческие (place + 1): в последних двух строках осталась открыта партия №100 (`place=99`) при 100, затем 200 загруженных строках. Журнал: `/tmp/opencode/qa-iphone/final/next-game-checks.log`. - -## Оставшийся дефект Д10: `await loadNextPage` не ждёт уже активную страницу - -- **Серьёзность:** низкая — один Next во время загрузки молча теряется; после её завершения повторный tap возможен. Неверная партия не открывается. -- **Окружение/версия:** О-3; воспроизведено управляемой моделью текущих `AppModel`/`GameView`, без Simulator. -- **Шаги:** (1) в списке footer начал загрузку второй страницы; (2) до её завершения открыть партию №100 (`place=99`, 100 loaded/250 total) и нажать Next; (3) дождаться завершения footer-запроса. -- **Ожидаемо:** `showNext` остаётся в ожидании уже идущей страницы либо повторно проверяет загруженность после неё и затем открывает №101 (`place=100`). -- **Фактически:** `showNext` вызывает `await model.loadNextPage()`, но у `AppModel` guard `!isLoadingPage` немедленно возвращает новый вызов, не присоединяясь к текущей работе. Пока `rows.count` ещё 100, origin guard проходит, а `show(100)` отклоняется собственным `rows.indices.contains` guard. Footer позже доводит rows до 200, но уже завершённый `showNext` не повторяет переход: пользователь остаётся на №100. -- **Файл/строка:** `iosApp/ChessPenguin/AppModel.swift:72-85` (ранний guard и настоящее ожидание только первого вызова), `GameView.swift:131-147` (`await`, origin guard и одноразовый `show`). Footer использует тот же метод в `LibraryViews.swift:93-105`. -- **Минимальный пример:** сценарий `shared` в `/tmp/opencode/qa-iphone/final/next_game_checks.py`; фактический вывод приведён выше. Прямой Next без уже активной загрузки работает, поэтому этот дефект не отменяет закрытие исходного Д9. - -## Обязательная проверка на macOS после доработки - -1. Выполнить `xcodegen generate`, Swift compile production/tests и `xcodebuild test`; существование XCTest 100→101/200→201 в исходнике не считается его запуском. -2. На debug-базе 250 с управляемой задержкой страницы проверить оба порядка: **Next сам начинает загрузку** и **footer уже грузит страницу, затем Next**. Во втором случае после одного tap должна открыться №101; повторный tap не должен требоваться. -3. Там же проверить ошибку/повтор страницы, смену origin во время ожидания и быстрые последовательные Next через 100/101 и 200/201. -4. Все ранее перечисленные Simulator-проверки retry race, полного RAV, keyboard/VoiceOver, marks/end, Green, жестов, Dynamic Type, safe area и Instruments остаются обязательными. - -**Итоговый статус:** Д1–Д9 подтверждены исправленными на своих определённых сценариях; полный structural verdict удерживается только из-за воспроизведённого Д10 и отсутствия обязательного macOS/Simulator прогона. - ---- - -# Общий вердикт после shared `nextPageTask` — 2026-11-30 - -## Structural PASS для независимо проверенного объёма Д1–Д10 - -**Д10 закрыт. По совокупности независимых проходов Д1–Д10 получают Linux structural PASS.** В проверенных чередованиях shared task, cleanup, identity, second call, origin и cancellation новых гонок не подтвердилось. - -Это **не** приёмка скомпилированного приложения и **не** Simulator PASS: Swift compile, XCTest, Xcode build и Simulator в этой проверке не выполнялись. Обязательный macOS-остаток перечислен ниже. - -Окружение (**О-4**): Linux x86_64/CachyOS, `rustc 1.99.1`, `cargo 1.99.1`, текущее незакоммиченное дерево на базовом `HEAD a37c6a78f451c82f665d7908bd927460c088a863`. Production не изменялся; новые проверки и журналы — `/tmp/opencode/qa-iphone/final2/`. - -## Независимая проверка shared task - -Сначала по исходнику подтверждено: - -- повторный caller входит в `if let nextPageTask` и ждёт тот же handle вместо возврата по `isLoadingPage`; -- `nextPageTask = task` установлен до `await task.value`; запуск `performNextPageLoad` содержит единственный вызов `rowLoader`; -- `defer` после активной работы сбрасывает и `isLoadingPage`, и `nextPageTask`; -- после loader сохранены guards `self.database === database` и `rows.count == page.start`; -- `showNext` сохраняет cancellation/origin guard перед одноразовым `show(request.toPlace)`; -- delayed concurrent XCTest существует, но сам по себе не использовался как доказательство выполнения. - -Затем запущен собственный управляемый probe `/tmp/opencode/qa-iphone/final2/shared_page_checks.py` (**exit 0**). Он моделирует reentrancy MainActor и независимое ожидание shared handle, включая отмену waiter без отмены общей работы. Фактический вывод: - -```text -source_shared_task_cleanup_identity_guards=OK -footer_plus_duplicate_plus_next: loader_calls=1 rows=200 human_place=101 task_cleared=True loading=False -second_call_new_page: loader_calls=2 rows=250 human_place=201 task_cleared=True -error_cleanup_then_retry: loader_calls=2 rows=200 error=None task_cleared=True -database_identity_guard_then_second_call: loader_calls=2 rows=200 database=DB_B task_cleared=True -origin_changed_while_shared_wait: rows=200 human_place=99 -cancelled_next_waiter_shared_continues: loader_calls=1 rows=200 human_place=100 task_cleared=True -SHARED_TASK_BEHAVIORAL_ASSERTIONS=OK -D10_AND_CLEANUP_IDENTITY_SECOND_CALL=STRUCTURAL_PASS -``` - -Проверенные смыслы: - -1. **Footer + duplicate footer + Next:** три ожидающих вызова, один loader и один append; Next после общего завершения открывает №101 без повторного tap. Это закрывает исходный Д10. -2. **Second call после cleanup:** следующий вызов не ждёт старый handle и не пропускает страницу; второй loader доводит 200→250, Next открывает №201. Вызов при `rows == totalGames` нового loader не создаёт. -3. **Ошибка и retry:** неверный размер результата оставляет rows неизменными, выставляет page error и очищает handle/loading; повторный вызов запускает новый loader и успешно добавляет страницу. -4. **Identity:** результат старой базы не добавляется после смены identity; cleanup выполняется, следующий вызов для новой базы работает. Отдельно в исходнике сохранён guard изменившегося `rows.count`. -5. **Origin:** пока shared task выполняется, пользователь может уйти с исходного места; завершение загрузки не вызывает нежелательный переход. -6. **Cancellation:** отмена одного ожидающего Next не отменяет shared loader и не открывает партию; остальной waiter получает завершённую страницу, handle очищается. - -Журнал: `/tmp/opencode/qa-iphone/final2/shared-page-checks.log`. - -## Повторные мост и Rust - -Выполнены на текущем дереве: - -```sh -iosApp/scripts/build-bindings.sh -cargo test -p mobile-api --locked -``` - -- bindings — **exit 0**, все четыре generated SHA-256 до/после совпали; Apple targets на Linux не имитировались; -- Rust — **33 passed / 0 failed / 2 ignored**, doc-tests 0. - -Журналы: `/tmp/opencode/qa-iphone/final2/build-bindings.log`, `cargo-test-mobile-api.log`. - -## Неподтверждённое и обязательный macOS-остаток - -Новых структурных дефектов в перечисленных выше сценариях **не подтвердилось**, но это не исключает особенности реального Swift runtime и UI. До продуктовой приёмки обязательны: - -1. `xcodegen generate`, компиляция production/tests, окончательная UniFFI/XCFramework link и фактический `xcodebuild test`, включая delayed concurrent XCTest. -2. Живой сценарий на debug-базе 250: footer начинает загрузку → один Next во время неё → ровно один loader и переход №100→№101; затем №200→№201. Отдельно — retry после ошибки и быстрые повторные Next. -3. Отмена view/waiter во время shared load, смена origin, уход в фон и возврат; проверить реальные cancellation-тайминги SwiftUI, не только модель. -4. Instruments/Main Thread Checker: активный task временно удерживает model/loader до завершения работы; подтвердить освобождение после success/error/cancellation и отсутствие накопления задач. Заявлять об утечках или их отсутствии только по модели нельзя. -5. Все прежние Simulator-критерии: retry race, полное RAV-дерево и касания SAN, keyboard/VoiceOver, marks/NAG/checkmate/stalemate, Green, жесты, Dynamic Type, safe area и HiDPI. - -**Общий итог:** назначенный Linux structural срез Д1–Д10 принят. Следующий обязательный этап — реальная сборка, XCTest и UI/память на macOS/Simulator; эти пункты остаются открытыми и не заменяются данным PASS. diff --git a/iosApp/.gitignore b/iosApp/.gitignore deleted file mode 100644 index 14a8859..0000000 --- a/iosApp/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# Generated by XcodeGen / Xcode; rebuild locally on macOS. -/ChessPenguin.xcodeproj/ -/Frameworks/ -/DerivedData/ - -# Xcode user-specific state and macOS metadata. -xcuserdata/ -*.xcuserstate -.DS_Store diff --git a/iosApp/ChessPenguin/AppModel.swift b/iosApp/ChessPenguin/AppModel.swift deleted file mode 100644 index 68a7511..0000000 --- a/iosApp/ChessPenguin/AppModel.swift +++ /dev/null @@ -1,140 +0,0 @@ -import Foundation - -enum AppRoute: Hashable { - case games - case game(place: Int) -} - -private enum AppModelError: LocalizedError { - case sampleMissing - case databaseNotOpen - case invalidGame - case invalidPage - - var errorDescription: String? { - switch self { - case .sampleMissing, .databaseNotOpen: - return String(localized: "sample_missing") - case .invalidGame: - return String(localized: "invalid_game") - case .invalidPage: - return String(localized: "open_failed") - } - } -} - -@MainActor -final class AppModel: ObservableObject { - typealias RowLoader = @MainActor (Database, UInt32, UInt32) async -> [GameRow] - - @Published var path: [AppRoute] = [] - @Published private(set) var database: Database? - @Published private(set) var rows: [GameRow] = [] - @Published private(set) var totalGames = 0 - @Published private(set) var isLoading = false - @Published private(set) var isLoadingPage = false - @Published private(set) var loadError: String? - @Published private(set) var pageError: String? - @Published var lastOpened: Int? - - private var nextPageTask: Task? - private let rowLoader: RowLoader - - init( - database: Database? = nil, - rows: [GameRow] = [], - totalGames: Int = 0, - rowLoader: RowLoader? = nil - ) { - self.database = database - self.rows = rows - self.totalGames = totalGames - self.rowLoader = rowLoader ?? AppModel.loadRowsDetached - } - - private static func loadRowsDetached(database: Database, start: UInt32, count: UInt32) async -> [GameRow] { - await Task.detached(priority: .userInitiated) { - database.rows(start: start, count: count) - }.value - } - - var canLoadMore: Bool { rows.count < totalGames } - - func loadSample() async { - guard database == nil, !isLoading else { return } - isLoading = true - loadError = nil - pageError = nil - defer { isLoading = false } - - do { - let opened = try await Task.detached(priority: .userInitiated) { - guard let url = Bundle.main.url(forResource: "classics", withExtension: "pgn") else { - throw AppModelError.sampleMissing - } - let bytes = try Data(contentsOf: url) - let database = try openBytes(name: "classics.pgn", bytes: bytes) - let total = Int(database.len()) - guard let page = nextGameRowPage(loaded: 0, total: total), - let count = UInt32(exactly: page.count) else { - return (database, total, [GameRow]()) - } - let rows = database.rows(start: 0, count: count) - return (database, total, rows) - }.value - database = opened.0 - totalGames = opened.1 - rows = opened.2 - } catch { - rows = [] - totalGames = 0 - loadError = error.localizedDescription - } - } - - func loadNextPage() async { - if let nextPageTask { - await nextPageTask.value - return - } - guard let database, canLoadMore else { return } - guard let page = nextGameRowPage(loaded: rows.count, total: totalGames), - let start = UInt32(exactly: page.start), let count = UInt32(exactly: page.count) else { - pageError = AppModelError.invalidPage.localizedDescription - return - } - - let task = Task { @MainActor [weak self] in - guard let self else { return } - await self.performNextPageLoad(database: database, page: page, start: start, count: count) - } - nextPageTask = task - await task.value - } - - private func performNextPageLoad(database: Database, page: GameRowPage, start: UInt32, count: UInt32) async { - isLoadingPage = true - pageError = nil - defer { - isLoadingPage = false - nextPageTask = nil - } - - let next = await rowLoader(database, start, count) - guard self.database === database, rows.count == page.start else { return } - guard next.count == page.count else { - pageError = AppModelError.invalidPage.localizedDescription - return - } - rows.append(contentsOf: next) - } - - func game(atPlace place: Int) async throws -> GameData { - guard let database else { throw AppModelError.databaseNotOpen } - guard rows.indices.contains(place) else { throw AppModelError.invalidGame } - let index = rows[place].index - return try await Task.detached(priority: .userInitiated) { - try database.game(index: index) - }.value - } -} diff --git a/iosApp/ChessPenguin/BoardAnnotations.swift b/iosApp/ChessPenguin/BoardAnnotations.swift deleted file mode 100644 index 0d1b0a1..0000000 --- a/iosApp/ChessPenguin/BoardAnnotations.swift +++ /dev/null @@ -1,95 +0,0 @@ -import Foundation - -enum BoardMarkColor: String, Equatable { - case red = "R" - case green = "G" - case blue = "B" - case yellow = "Y" - case other - - init(_ letter: String) { - self = BoardMarkColor(rawValue: letter) ?? .other - } - - var rgb: UInt32 { - switch self { - case .red: return 0x882020 - case .green: return 0x15781B - case .blue: return 0x003088 - case .yellow: return 0xE68F00 - case .other: return 0x787878 - } - } -} - -struct BoardArrowModel: Equatable { - let from: Int - let to: Int - let color: BoardMarkColor -} - -struct BoardCircleModel: Equatable, Identifiable { - let id: Int - let square: Int - let color: BoardMarkColor -} - -struct BoardBadgeModel: Equatable { - let square: Int - let text: String - let rgb: UInt32 -} - -enum BoardEnding: String, Equatable { - case checkmate - case stalemate -} - -struct BoardAnnotationModel: Equatable { - let arrows: [BoardArrowModel] - let circles: [BoardCircleModel] - let badge: BoardBadgeModel? - let ending: BoardEnding? - - init(node: MoveNode?) { - var arrows: [BoardArrowModel] = [] - var circles: [BoardCircleModel] = [] - for (offset, mark) in (node?.marks ?? []).enumerated() { - guard let from = squareIndex(mark.from) else { continue } - let color = BoardMarkColor(mark.color) - if let destination = mark.to, let to = squareIndex(destination) { - arrows.append(BoardArrowModel(from: from, to: to, color: color)) - } else { - circles.append(BoardCircleModel(id: offset, square: from, color: color)) - } - } - self.arrows = arrows - self.circles = circles - self.ending = node.flatMap { BoardEnding(rawValue: $0.end) } - - if let node, let square = squareIndex(node.toSquare), - let nag = node.nags.first(where: { (1...6).contains($0) }), - let badge = BoardAnnotationModel.badge(for: nag, square: square) { - self.badge = badge - } else { - self.badge = nil - } - } - - private static func badge(for nag: UInt8, square: Int) -> BoardBadgeModel? { - switch nag { - case 1: return BoardBadgeModel(square: square, text: "!", rgb: 0x81B64C) - case 2: return BoardBadgeModel(square: square, text: "?", rgb: 0xFFA459) - case 3: return BoardBadgeModel(square: square, text: "!!", rgb: 0x26C2A3) - case 4: return BoardBadgeModel(square: square, text: "??", rgb: 0xFA412D) - case 5: return BoardBadgeModel(square: square, text: "!?", rgb: 0xEA45D8) - case 6: return BoardBadgeModel(square: square, text: "?!", rgb: 0x56B4E9) - default: return nil - } - } -} - -func visualSquareIndex(_ index: Int, flipped: Bool) -> Int? { - guard (0..<64).contains(index) else { return nil } - return flipped ? 63 - index : index -} diff --git a/iosApp/ChessPenguin/BoardView.swift b/iosApp/ChessPenguin/BoardView.swift deleted file mode 100644 index 3013144..0000000 --- a/iosApp/ChessPenguin/BoardView.swift +++ /dev/null @@ -1,253 +0,0 @@ -import SwiftUI - -struct BoardPosition { - /// Pieces in FEN order, a8 first. Nil is an empty square. - let squares: [Character?] - - init?(fen: String) { - guard let placement = fen.split(separator: " ").first else { return nil } - let ranks = placement.split(separator: "/", omittingEmptySubsequences: false) - guard ranks.count == 8 else { return nil } - - var parsed: [Character?] = [] - parsed.reserveCapacity(64) - for rank in ranks { - var rankCount = 0 - for symbol in rank { - guard symbol.isASCII else { return nil } - if let digit = symbol.wholeNumberValue { - guard (1...8).contains(digit) else { return nil } - rankCount += digit - for _ in 0.. Int? { - guard let name else { return nil } - let bytes = Array(name.utf8) - guard bytes.count == 2 else { return nil } - let file = Int(bytes[0]) - 97 - let rank = Int(bytes[1]) - 48 - guard (0..<8).contains(file), (1...8).contains(rank) else { return nil } - return (8 - rank) * 8 + file -} - -private func pieceAssetName(_ piece: Character) -> String? { - let white = piece.isUppercase - guard let uppercase = piece.uppercased().first else { return nil } - switch uppercase { - case "K", "Q", "R", "B", "N", "P": - return "\(white ? "w" : "b")\(uppercase)" - default: - return nil - } -} - -private extension BoardMarkColor { - var color: Color { Color(rgb: rgb).opacity(170.0 / 255.0) } -} - -struct BoardView: View { - let node: MoveNode? - let flipped: Bool - let description: String - - var body: some View { - let annotations = BoardAnnotationModel(node: node) - Group { - if let position = BoardPosition(fen: node?.fen ?? "") { - GeometryReader { geometry in - let side = min(geometry.size.width, geometry.size.height) - let cell = side / 8 - ZStack { - VStack(spacing: 0) { - ForEach(0..<8, id: \.self) { row in - HStack(spacing: 0) { - ForEach(0..<8, id: \.self) { column in - BoardSquare( - visualIndex: row * 8 + column, - cell: cell, - position: position, - flipped: flipped, - highlighted: [squareIndex(node?.fromSquare), squareIndex(node?.toSquare)], - circles: annotations.circles - ) - } - } - } - } - BoardArrows(arrows: annotations.arrows, cell: cell, flipped: flipped) - if let badge = annotations.badge { - BoardBadge(badge: badge, cell: cell, flipped: flipped) - } - if let ending = annotations.ending { - Text(ending == .checkmate ? L10n.checkmate : L10n.stalemate) - .font(.headline) - .foregroundStyle(Theme.onSurface) - .padding(.horizontal, 16) - .padding(.vertical, 8) - .background(Theme.containerHigh.opacity(0.94)) - .clipShape(RoundedRectangle(cornerRadius: 8)) - } - } - .frame(width: side, height: side) - .frame(maxWidth: .infinity, maxHeight: .infinity) - } - } else { - Text(String(localized: "invalid_position")) - .foregroundStyle(Theme.error) - .frame(maxWidth: .infinity, maxHeight: .infinity) - .background(Theme.containerLow) - } - } - .frame(maxWidth: .infinity) - .aspectRatio(1, contentMode: .fit) - .accessibilityElement(children: .ignore) - .accessibilityLabel(description) - } -} - -private struct BoardSquare: View { - let visualIndex: Int - let cell: CGFloat - let position: BoardPosition - let flipped: Bool - let highlighted: [Int?] - let circles: [BoardCircleModel] - - private let files = Array("abcdefgh") - - var body: some View { - let index = flipped ? 63 - visualIndex : visualIndex - let light = (index / 8 + index % 8) % 2 == 0 - let isHighlighted = highlighted.contains { $0 == index } - let coordinateColor = light ? Theme.boardDark : Theme.boardLight - - ZStack(alignment: .topLeading) { - Rectangle().fill(light ? Theme.boardLight : Theme.boardDark) - if isHighlighted { - Rectangle().fill(Theme.lastMove) - } - if let piece = position.squares[index], let asset = pieceAssetName(piece) { - Image(asset) - .resizable() - .interpolation(.high) - .aspectRatio(contentMode: .fit) - .padding(max(0, cell * 0.04)) - } - ForEach(circles.filter { $0.square == index }) { mark in - Circle() - .stroke(mark.color.color, lineWidth: max(1, cell * 0.08)) - .frame(width: cell * 0.9, height: cell * 0.9) - } - if visualIndex % 8 == 0 { - Text(String(8 - index / 8)) - .font(.system(size: max(8, cell * 0.18), weight: .medium)) - .foregroundStyle(coordinateColor) - .padding(2) - } - if visualIndex / 8 == 7 { - Text(String(files[index % 8])) - .font(.system(size: max(8, cell * 0.18), weight: .medium)) - .foregroundStyle(coordinateColor) - .frame(width: cell, height: cell, alignment: .bottomTrailing) - .padding(2) - } - } - .frame(width: cell, height: cell) - } -} - -private struct BoardArrows: View { - let arrows: [BoardArrowModel] - let cell: CGFloat - let flipped: Bool - - var body: some View { - Canvas { context, _ in - for arrow in arrows { - guard let from = squareCenter(arrow.from, cell: cell, flipped: flipped), - let to = squareCenter(arrow.to, cell: cell, flipped: flipped) else { continue } - drawArrow(context: &context, from: from, to: to, color: arrow.color.color) - } - } - .allowsHitTesting(false) - } - - private func squareCenter(_ index: Int, cell: CGFloat, flipped: Bool) -> CGPoint? { - guard let visual = visualSquareIndex(index, flipped: flipped) else { return nil } - return CGPoint(x: CGFloat(visual % 8) * cell + cell / 2, y: CGFloat(visual / 8) * cell + cell / 2) - } - - private func drawArrow(context: inout GraphicsContext, from: CGPoint, to: CGPoint, color: Color) { - let dx = to.x - from.x - let dy = to.y - from.y - let length = hypot(dx, dy) - guard length > 1 else { return } - let direction = CGPoint(x: dx / length, y: dy / length) - let normal = CGPoint(x: -direction.y, y: direction.x) - let start = from + direction * (cell * 0.2) - let tip = to - direction * (cell * 0.12) - let base = tip - direction * (cell * 0.42) - - var shaft = Path() - shaft.move(to: start) - shaft.addLine(to: base) - context.stroke(shaft, with: .color(color), style: StrokeStyle(lineWidth: cell * 0.16, lineCap: .round)) - - var head = Path() - head.move(to: tip) - head.addLine(to: base + normal * (cell * 0.38)) - head.addLine(to: base - normal * (cell * 0.38)) - head.closeSubpath() - context.fill(head, with: .color(color)) - } -} - -private struct BoardBadge: View { - let badge: BoardBadgeModel - let cell: CGFloat - let flipped: Bool - - var body: some View { - GeometryReader { _ in - if let visual = visualSquareIndex(badge.square, flipped: flipped) { - let size = max(18, cell * 0.42) - Text(badge.text) - .font(.system(size: size * 0.52, weight: .black)) - .foregroundStyle(Color.white) - .frame(width: size, height: size) - .background(Color(rgb: badge.rgb)) - .clipShape(Circle()) - .overlay(Circle().stroke(Color.white, lineWidth: max(1, cell * 0.025))) - .position( - x: CGFloat(visual % 8) * cell + cell * 0.82, - y: CGFloat(visual / 8) * cell + cell * 0.18 - ) - } - } - .allowsHitTesting(false) - } -} - -private func + (lhs: CGPoint, rhs: CGPoint) -> CGPoint { - CGPoint(x: lhs.x + rhs.x, y: lhs.y + rhs.y) -} - -private func - (lhs: CGPoint, rhs: CGPoint) -> CGPoint { - CGPoint(x: lhs.x - rhs.x, y: lhs.y - rhs.y) -} - -private func * (lhs: CGPoint, rhs: CGFloat) -> CGPoint { - CGPoint(x: lhs.x * rhs, y: lhs.y * rhs) -} diff --git a/iosApp/ChessPenguin/ChessPenguinApp.swift b/iosApp/ChessPenguin/ChessPenguinApp.swift deleted file mode 100644 index b86d526..0000000 --- a/iosApp/ChessPenguin/ChessPenguinApp.swift +++ /dev/null @@ -1,34 +0,0 @@ -import SwiftUI - -@main -struct ChessPenguinApp: App { - @StateObject private var model = AppModel() - - var body: some Scene { - WindowGroup { - RootView() - .environmentObject(model) - .preferredColorScheme(.dark) - .tint(Theme.primary) - } - } -} - -private struct RootView: View { - @EnvironmentObject private var model: AppModel - - var body: some View { - NavigationStack(path: $model.path) { - DatabasesView() - .navigationDestination(for: AppRoute.self) { route in - switch route { - case .games: - GamesView() - case .game(let place): - GameView(startPlace: place) - } - } - } - .background(Theme.background.ignoresSafeArea()) - } -} diff --git a/iosApp/ChessPenguin/GameCommands.swift b/iosApp/ChessPenguin/GameCommands.swift deleted file mode 100644 index 73def88..0000000 --- a/iosApp/ChessPenguin/GameCommands.swift +++ /dev/null @@ -1,30 +0,0 @@ -import Foundation - -enum GameCommand: Equatable { - case previousMove - case nextMove - case startOfLine - case endOfLine - case flip - case back -} - -enum GameKeyboardKey: Equatable { - case leftArrow - case rightArrow - case shiftLeftArrow - case shiftRightArrow - case f - case escape -} - -func gameCommand(for key: GameKeyboardKey) -> GameCommand { - switch key { - case .leftArrow: return .previousMove - case .rightArrow: return .nextMove - case .shiftLeftArrow: return .startOfLine - case .shiftRightArrow: return .endOfLine - case .f: return .flip - case .escape: return .back - } -} diff --git a/iosApp/ChessPenguin/GameLoadState.swift b/iosApp/ChessPenguin/GameLoadState.swift deleted file mode 100644 index 3510e91..0000000 --- a/iosApp/ChessPenguin/GameLoadState.swift +++ /dev/null @@ -1,53 +0,0 @@ -import Foundation - -/// Result of one game request. Both the request and the current visible place must match: -/// a retry is not tied to SwiftUI's `.task(id:)` cancellation and may finish later. -struct GameLoadState { - private(set) var game: Game? - private(set) var loadedPlace: Int? - private(set) var failure: String? - - mutating func begin() { - failure = nil - } - - @discardableResult - mutating func succeed(requestedPlace: Int, currentPlace: Int, game loaded: Game) -> Bool { - guard requestedPlace == currentPlace else { return false } - game = loaded - loadedPlace = requestedPlace - failure = nil - return true - } - - @discardableResult - mutating func fail(requestedPlace: Int, currentPlace: Int, message: String) -> Bool { - guard requestedPlace == currentPlace else { return false } - game = nil - loadedPlace = requestedPlace - failure = message - return true - } -} - -struct GameRowPage: Equatable { - let start: Int - let count: Int -} - -func nextGameRowPage(loaded: Int, total: Int, pageSize: Int = 100) -> GameRowPage? { - guard pageSize > 0, loaded >= 0, total >= 0, loaded < total else { return nil } - return GameRowPage(start: loaded, count: min(pageSize, total - loaded)) -} - -struct NextGameRequest: Equatable { - let fromPlace: Int - let toPlace: Int - let needsNextPage: Bool -} - -func nextGameRequest(fromPlace: Int, totalGames: Int, loadedRows: Int) -> NextGameRequest? { - let next = fromPlace + 1 - guard fromPlace >= 0, loadedRows >= 0, next < totalGames else { return nil } - return NextGameRequest(fromPlace: fromPlace, toPlace: next, needsNextPage: next >= loadedRows) -} diff --git a/iosApp/ChessPenguin/GameView.swift b/iosApp/ChessPenguin/GameView.swift deleted file mode 100644 index 1bcc5ec..0000000 --- a/iosApp/ChessPenguin/GameView.swift +++ /dev/null @@ -1,346 +0,0 @@ -import SwiftUI - -struct GameView: View { - @EnvironmentObject private var model: AppModel - @Environment(\.dismiss) private var dismiss - - @State private var place: Int - @State private var loadState = GameLoadState() - @State private var current = 0 - @State private var flipped = false - - init(startPlace: Int) { - _place = State(initialValue: startPlace) - } - - private var shownGame: GameData? { - loadState.loadedPlace == place ? loadState.game : nil - } - - private var currentNode: MoveNode? { - guard let shownGame, shownGame.nodes.indices.contains(current) else { return nil } - return shownGame.nodes[current] - } - - var body: some View { - VStack(spacing: 0) { - if let game = shownGame { - PlayerBar(game: game, white: flipped) - BoardView( - node: currentNode ?? game.nodes.first, - flipped: flipped, - description: boardDescription - ) - PlayerBar(game: game, white: !flipped) - if let node = currentNode, node.children.count > 1 { - ForkBar(nodes: node.children.compactMap { child in - let id = Int(child) - return game.nodes.indices.contains(id) ? game.nodes[id] : nil - }, onMove: go) - } - NotationView(game: game, current: current, onMove: go) - .frame(maxWidth: .infinity, maxHeight: .infinity) - .layoutPriority(1) - } else if loadState.loadedPlace == place, let failure = loadState.failure { - ErrorMessage(title: L10n.gameFailed, detail: failure) { - Task { await load() } - } - .frame(maxWidth: .infinity, maxHeight: .infinity) - } else { - VStack(spacing: 12) { - ProgressView() - Text(L10n.reading).foregroundStyle(Theme.onSurfaceVariant) - } - .frame(maxWidth: .infinity, maxHeight: .infinity) - } - } - .background(Theme.background) - .background { GameKeyboardCommands(perform: perform) } - .safeAreaInset(edge: .bottom) { - MoveControls( - canBack: currentNode?.parent != nil, - canForward: currentNode?.children.isEmpty == false, - onFlip: { flipped.toggle() }, - onBack: stepBack, - onForward: stepForward, - onStart: { go(to: 0) }, - onEnd: goToEnd - ) - } - .navigationBarTitleDisplayMode(.inline) - .toolbar { - ToolbarItem(placement: .principal) { - VStack(spacing: 0) { - Text(eventTitle).font(.headline).lineLimit(1) - Text(L10n.gameOf(place + 1, model.totalGames)) - .font(.caption.monospacedDigit()) - .foregroundStyle(Theme.onSurfaceVariant) - } - } - ToolbarItemGroup(placement: .navigationBarTrailing) { - Button { show(place - 1) } label: { - Image(systemName: "chevron.left") - } - .disabled(place <= 0) - .accessibilityLabel(L10n.previousGame) - Button { Task { await showNext() } } label: { - Image(systemName: "chevron.right") - } - .disabled(place + 1 >= model.totalGames) - .accessibilityLabel(L10n.nextGame) - } - } - .task(id: place) { await load() } - } - - private var eventTitle: String { - if let game = shownGame { - let event = joinedKnown([game.tag("Event"), game.tag("Date").flatMap(pgnYear)]) - if !event.isEmpty { return event } - if let site = known(game.tag("Site") ?? "") { return site } - } - return L10n.classics - } - - private var boardDescription: String { - guard let node = currentNode, current != 0 else { return L10n.boardStart } - var description = L10n.boardAfter(moveLabel(node)) - switch BoardEnding(rawValue: node.end) { - case .checkmate: description += " · \(L10n.checkmate)" - case .stalemate: description += " · \(L10n.stalemate)" - case nil: break - } - return description - } - - private func load() async { - let requestedPlace = place - loadState.begin() - do { - let loaded = try await model.game(atPlace: requestedPlace) - guard !Task.isCancelled, place == requestedPlace else { return } - guard loadState.succeed(requestedPlace: requestedPlace, currentPlace: place, game: loaded) else { return } - current = 0 - model.lastOpened = requestedPlace - } catch { - guard !Task.isCancelled, place == requestedPlace else { return } - loadState.fail(requestedPlace: requestedPlace, currentPlace: place, message: error.localizedDescription) - } - } - - private func showNext() async { - guard let request = nextGameRequest( - fromPlace: place, - totalGames: model.totalGames, - loadedRows: model.rows.count - ) else { return } - if request.needsNextPage { - await model.loadNextPage() - } - guard !Task.isCancelled, place == request.fromPlace else { return } - show(request.toPlace) - } - - private func show(_ newPlace: Int) { - guard newPlace >= 0, newPlace < model.totalGames, model.rows.indices.contains(newPlace) else { return } - place = newPlace - model.lastOpened = newPlace - } - - private func go(to id: Int) { - guard let game = shownGame, game.nodes.indices.contains(id) else { return } - current = id - } - - private func stepBack() { - guard let parent = currentNode?.parent else { return } - go(to: Int(parent)) - } - - private func stepForward() { - guard let child = currentNode?.children.first else { return } - go(to: Int(child)) - } - - private func goToEnd() { - guard let game = shownGame else { return } - var at = current - var visited: Set = [at] - for _ in 0.. Void - - var body: some View { - Group { - Button { perform(gameCommand(for: .leftArrow)) } label: { EmptyView() } - .keyboardShortcut(.leftArrow, modifiers: []) - Button { perform(gameCommand(for: .rightArrow)) } label: { EmptyView() } - .keyboardShortcut(.rightArrow, modifiers: []) - Button { perform(gameCommand(for: .shiftLeftArrow)) } label: { EmptyView() } - .keyboardShortcut(.leftArrow, modifiers: .shift) - Button { perform(gameCommand(for: .shiftRightArrow)) } label: { EmptyView() } - .keyboardShortcut(.rightArrow, modifiers: .shift) - Button { perform(gameCommand(for: .f)) } label: { EmptyView() } - .keyboardShortcut("f", modifiers: []) - Button { perform(gameCommand(for: .escape)) } label: { EmptyView() } - .keyboardShortcut(.escape, modifiers: []) - } - .frame(width: 0, height: 0) - .opacity(0) - .allowsHitTesting(false) - .accessibilityHidden(true) - } -} - -private func moveLabel(_ node: MoveNode) -> String { - let number = node.white ? "\(node.moveNumber)." : "\(node.moveNumber)…" - return number + node.san + node.nagSymbols -} - -private struct PlayerBar: View { - let game: GameData - let white: Bool - - var body: some View { - let name = white ? game.tag("White") : game.tag("Black") - let elo = white ? game.tag("WhiteElo") : game.tag("BlackElo") - let knownName = known(name ?? "") - HStack(spacing: 8) { - SideDisc(white: white) - Text(knownName ?? (white ? L10n.white : L10n.black)) - .font(.subheadline.weight(knownName == nil ? .regular : .medium)) - .foregroundStyle(knownName == nil ? Theme.onSurfaceVariant : Theme.onSurface) - .lineLimit(1) - .frame(maxWidth: .infinity, alignment: .leading) - if let elo = knownElo(elo ?? "") { - Text(elo).font(.subheadline.monospacedDigit()).foregroundStyle(Theme.onSurfaceVariant) - } - Text(sideResult(game.result, white: white) ?? "") - .font(.subheadline.monospacedDigit()) - .foregroundStyle(Theme.onSurfaceVariant) - .frame(width: 24) - } - .padding(.horizontal, 16) - .frame(minHeight: 36) - } -} - -private struct ForkBar: View { - let nodes: [MoveNode] - let onMove: (Int) -> Void - - var body: some View { - ScrollView(.horizontal, showsIndicators: false) { - HStack(spacing: 8) { - Text(L10n.nextMoves).font(.subheadline).foregroundStyle(Theme.onSurfaceVariant) - ForEach(Array(nodes.enumerated()), id: \.element.id) { offset, node in - Button(moveLabel(node)) { onMove(Int(node.id)) } - .buttonStyle(.bordered) - .tint(offset == 0 ? Theme.primary : Theme.onSurfaceVariant) - } - } - .padding(.horizontal, 16) - } - .frame(height: 48) - } -} - -private struct MoveControls: View { - let canBack: Bool - let canForward: Bool - let onFlip: () -> Void - let onBack: () -> Void - let onForward: () -> Void - let onStart: () -> Void - let onEnd: () -> Void - - var body: some View { - VStack(spacing: 0) { - Divider().background(Theme.outlineVariant) - HStack(spacing: 0) { - Button(action: onFlip) { - VStack(spacing: 2) { - Image(systemName: "arrow.up.arrow.down") - Text(L10n.flip).font(.caption2) - } - .frame(maxWidth: .infinity, minHeight: 56) - } - .accessibilityLabel(L10n.flip) - LongPressControl( - icon: "play.fill", - label: L10n.moveBack, - hint: L10n.moveBackHint, - longLabel: L10n.toStart, - enabled: canBack, - mirrored: true, - action: onBack, - longAction: onStart - ) - LongPressControl( - icon: "play.fill", - label: L10n.moveForward, - hint: L10n.moveForwardHint, - longLabel: L10n.toEnd, - enabled: canForward, - mirrored: false, - action: onForward, - longAction: onEnd - ) - } - .frame(height: 64) - } - .background(Theme.container.ignoresSafeAreaEdges(.bottom)) - } -} - -private struct LongPressControl: View { - let icon: String - let label: String - let hint: String - let longLabel: String - let enabled: Bool - let mirrored: Bool - let action: () -> Void - let longAction: () -> Void - - var body: some View { - Image(systemName: icon) - .font(.title2) - .scaleEffect(x: mirrored ? -1 : 1) - .foregroundStyle(enabled ? Theme.onSurface : Theme.onSurface.opacity(0.38)) - .frame(maxWidth: .infinity, maxHeight: .infinity) - .contentShape(Rectangle()) - .gesture( - LongPressGesture(minimumDuration: 0.45) - .onEnded { _ in longAction() } - .exclusively(before: TapGesture().onEnded { _ in action() }) - ) - .disabled(!enabled) - .accessibilityElement(children: .ignore) - .accessibilityLabel(label) - .accessibilityHint(hint) - .accessibilityAddTraits(.isButton) - .accessibilityAction(named: Text(longLabel), longAction) - } -} diff --git a/iosApp/ChessPenguin/LibraryViews.swift b/iosApp/ChessPenguin/LibraryViews.swift deleted file mode 100644 index 9e2ac81..0000000 --- a/iosApp/ChessPenguin/LibraryViews.swift +++ /dev/null @@ -1,191 +0,0 @@ -import SwiftUI - -struct DatabasesView: View { - @EnvironmentObject private var model: AppModel - - var body: some View { - ScrollView { - VStack(alignment: .leading, spacing: 8) { - Text(L10n.files) - .font(.subheadline.weight(.medium)) - .foregroundStyle(Theme.primary) - .padding(.horizontal, 16) - .padding(.top, 8) - - if let error = model.loadError { - ErrorMessage(title: L10n.openFailed, detail: error) { - Task { await model.loadSample() } - } - .frame(minHeight: 300) - } else { - Button { - model.path.append(.games) - } label: { - HStack(spacing: 12) { - Text("PGN") - .font(.caption.weight(.medium)) - .foregroundStyle(Theme.pgnBadgeText) - .frame(width: 40, height: 40) - .background(Theme.pgnBadge) - .clipShape(RoundedRectangle(cornerRadius: 10)) - VStack(alignment: .leading, spacing: 4) { - Text(L10n.classics).foregroundStyle(Theme.onSurface) - if model.isLoading { - Text(L10n.reading).font(.subheadline).foregroundStyle(Theme.onSurfaceVariant) - } else { - Text("\(L10n.games(model.totalGames)) · PGN") - .font(.subheadline) - .foregroundStyle(Theme.onSurfaceVariant) - } - } - Spacer() - if model.isLoading { - ProgressView() - } else { - Image(systemName: "chevron.right").foregroundStyle(Theme.onSurfaceVariant) - } - } - .padding(12) - .background(Theme.containerLow) - .clipShape(RoundedRectangle(cornerRadius: 16)) - } - .buttonStyle(.plain) - .disabled(model.database == nil) - .padding(.horizontal, 12) - } - } - } - .background(Theme.background) - .navigationTitle(L10n.appName) - .task { await model.loadSample() } - } -} - -struct GamesView: View { - @EnvironmentObject private var model: AppModel - - var body: some View { - Group { - if model.rows.isEmpty { - Text(L10n.emptyDatabase) - .foregroundStyle(Theme.onSurfaceVariant) - .frame(maxWidth: .infinity, maxHeight: .infinity) - } else { - ScrollView { - LazyVStack(spacing: 0) { - ForEach(Array(model.rows.enumerated()), id: \.element.index) { place, row in - Button { - model.lastOpened = place - model.path.append(.game(place: place)) - } label: { - GameListRow(row: row, number: Int(row.index) + 1, lastOpened: model.lastOpened == place) - } - .buttonStyle(.plain) - .accessibilityElement(children: .ignore) - .accessibilityLabel(gameRowAccessibility(row: row, number: Int(row.index) + 1, lastOpened: model.lastOpened == place)) - if place + 1 < model.rows.count { - Divider() - .background(Theme.outlineVariant) - .padding(.leading, 68) - .padding(.trailing, 16) - } - } - if model.canLoadMore || model.isLoadingPage || model.pageError != nil { - VStack(spacing: 8) { - if let error = model.pageError { - Text(error).foregroundStyle(Theme.error) - Button(L10n.retry) { Task { await model.loadNextPage() } } - } else { - ProgressView() - Text(L10n.reading).foregroundStyle(Theme.onSurfaceVariant) - } - } - .frame(maxWidth: .infinity, minHeight: 80) - .task(id: model.rows.count) { await model.loadNextPage() } - } - } - } - } - } - .background(Theme.background) - .navigationBarTitleDisplayMode(.inline) - .toolbar { - ToolbarItem(placement: .principal) { - VStack(spacing: 0) { - Text(L10n.classics).font(.headline) - Text(L10n.games(model.totalGames)).font(.caption).foregroundStyle(Theme.onSurfaceVariant) - } - } - } - } -} - -private struct GameListRow: View { - let row: GameRow - let number: Int - let lastOpened: Bool - - var body: some View { - HStack(alignment: .top, spacing: 12) { - Text("\(number)") - .font(.caption.monospacedDigit()) - .foregroundStyle(Theme.onSurfaceVariant) - .frame(width: 28, alignment: .trailing) - .padding(.top, 4) - VStack(spacing: 0) { - ListPlayer(name: row.white, elo: row.whiteElo, result: sideResult(row.result, white: true), white: true) - ListPlayer(name: row.black, elo: row.blackElo, result: sideResult(row.result, white: false), white: false) - HStack(spacing: 8) { - Text(joinedKnown([row.event, pgnYear(row.date)])) - .font(.subheadline) - .foregroundStyle(Theme.onSurfaceVariant) - .lineLimit(1) - .frame(maxWidth: .infinity, alignment: .leading) - if let eco = known(row.eco) { - Text(eco) - .font(.caption2.monospacedDigit()) - .foregroundStyle(Theme.onSurfaceVariant) - .padding(.horizontal, 4) - .frame(minWidth: 32, minHeight: 16) - .overlay(RoundedRectangle(cornerRadius: 4).stroke(Theme.outline, lineWidth: 1)) - } - } - .frame(height: 20) - .padding(.leading, 16) - } - } - .padding(.horizontal, 16) - .padding(.vertical, 6) - .frame(maxWidth: .infinity, minHeight: 80, alignment: .leading) - .background(lastOpened ? Theme.container : Color.clear) - .overlay(alignment: .leading) { - if lastOpened { - Theme.primary.frame(width: 3) - } - } - .contentShape(Rectangle()) - } -} - -private struct ListPlayer: View { - let name: String - let elo: String - let result: String? - let white: Bool - - var body: some View { - HStack(spacing: 8) { - SideDisc(white: white, size: 8) - Text(known(name) ?? "?") - .foregroundStyle(known(name) == nil ? Theme.onSurfaceVariant : Theme.onSurface) - .fontWeight(result == "1" ? .medium : .regular) - .lineLimit(1) - .frame(maxWidth: .infinity, alignment: .leading) - if let elo = knownElo(elo) { - Text(elo).font(.subheadline.monospacedDigit()).foregroundStyle(Theme.onSurfaceVariant) - } - ResultTile(result: result) - } - .frame(height: 24) - } -} diff --git a/iosApp/ChessPenguin/NotationModel.swift b/iosApp/ChessPenguin/NotationModel.swift deleted file mode 100644 index afe7470..0000000 --- a/iosApp/ChessPenguin/NotationModel.swift +++ /dev/null @@ -1,264 +0,0 @@ -import Foundation - -struct NotationMove: Equatable, Identifiable { - let id: Int - let label: String -} - -struct NotationMoveRow: Equatable, Identifiable { - let id: String - let number: UInt32 - let white: NotationMove? - let black: NotationMove? - let indent: Int -} - -struct NotationComment: Equatable, Identifiable { - let id: String - let text: String - let indent: Int -} - -enum NotationToken: Equatable, Identifiable { - case move(NotationMove) - case comment(id: String, text: String) - case punctuation(id: String, text: String) - - var id: String { - switch self { - case .move(let move): return "move-\(move.id)" - case .comment(let id, _), .punctuation(let id, _): return id - } - } -} - -struct NotationVariation: Equatable, Identifiable { - let id: String - let startNodeID: Int - let tokens: [NotationToken] - let indent: Int -} - -struct NotationResult: Equatable, Identifiable { - let id: String - let text: String - let indent: Int -} - -enum NotationEntry: Equatable, Identifiable { - case comment(NotationComment) - case moves(NotationMoveRow) - case variation(NotationVariation) - case result(NotationResult) - - var id: String { - switch self { - case .comment(let entry): return entry.id - case .moves(let entry): return entry.id - case .variation(let entry): return entry.id - case .result(let entry): return entry.id - } - } - - var indent: Int { - switch self { - case .comment(let entry): return entry.indent - case .moves(let entry): return entry.indent - case .variation(let entry): return entry.indent - case .result(let entry): return entry.indent - } - } -} - -/// Complete PGN presentation: a two-column main line and every alternative subtree as -/// clickable tokens. IDs are MoveNode.id, never visible row offsets. -struct NotationModel { - let entries: [NotationEntry] - let entryByNode: [Int: String] - - var moveIDs: [Int] { - entries.flatMap { entry -> [Int] in - switch entry { - case .moves(let row): - return [row.white?.id, row.black?.id].compactMap { $0 } - case .variation(let variation): - return variation.tokens.compactMap { - if case .move(let move) = $0 { return move.id } - return nil - } - case .comment, .result: - return [] - } - } - } - - init(game: GameData) { - var entries: [NotationEntry] = [] - var entryByNode: [Int: String] = [:] - var visited: Set = [0] - - if let root = game.nodes.first, !root.commentAfter.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { - entries.append(.comment(NotationComment( - id: "comment-root-after", - text: root.commentAfter, - indent: 0 - ))) - } - - var pendingRow: PendingRow? - func flushRow() { - guard let row = pendingRow else { return } - let entry = NotationMoveRow( - id: row.id, - number: row.number, - white: row.white.map { NotationMove(id: $0, label: game.nodes[$0].san + game.nodes[$0].nagSymbols) }, - black: row.black.map { NotationMove(id: $0, label: game.nodes[$0].san + game.nodes[$0].nagSymbols) }, - indent: 0 - ) - entries.append(.moves(entry)) - if let white = row.white { entryByNode[white] = row.id } - if let black = row.black { entryByNode[black] = row.id } - pendingRow = nil - } - - var parent = 0 - for _ in 0.., - entryByNode: inout [Int: String] - ) -> NotationVariation? { - var tokens: [NotationToken] = [] - - func appendComment(_ text: String, suffix: String) { - guard !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return } - tokens.append(.comment(id: "\(entryID)-comment-\(suffix)-\(tokens.count)", text: text)) - } - - func appendPunctuation(_ text: String) { - tokens.append(.punctuation(id: "\(entryID)-punctuation-\(tokens.count)", text: text)) - } - - func line(first: Int) { - var id = first - var showNumber = true - for _ in 0.. Void - - var body: some View { - let notation = NotationModel(game: game) - ScrollViewReader { proxy in - ScrollView { - LazyVStack(alignment: .leading, spacing: 0) { - Color.clear.frame(height: 1).id("move-0") - ForEach(notation.entries) { entry in - switch entry { - case .comment(let comment): - CommentBlock(text: comment.text, indent: comment.indent) - case .moves(let row): - MoveRowView(row: row, current: current, onMove: onMove) - case .variation(let variation): - VariationView(variation: variation, current: current, onMove: onMove) - case .result(let result): - Text(result.text) - .font(.subheadline.weight(.medium)) - .padding(.horizontal, 16) - .padding(.vertical, 8) - .background(Theme.containerHigh) - .clipShape(RoundedRectangle(cornerRadius: 8)) - .frame(maxWidth: .infinity) - .padding(16) - } - } - } - .padding(.bottom, 8) - } - .onAppear { scroll(to: current, proxy: proxy) } - .onChange(of: current) { id in scroll(to: id, proxy: proxy) } - } - .background(Theme.background) - } - - private func scroll(to id: Int, proxy: ScrollViewProxy) { - withAnimation(.easeInOut(duration: 0.2)) { - proxy.scrollTo("move-\(id)", anchor: .center) - } - } -} - -private struct MoveRowView: View { - let row: NotationMoveRow - let current: Int - let onMove: (Int) -> Void - - var body: some View { - HStack(spacing: 0) { - Text("\(row.number)") - .font(.subheadline.monospacedDigit()) - .foregroundStyle(Theme.onSurfaceVariant) - .frame(width: 40, alignment: .trailing) - .padding(.trailing, 8) - MoveCell(move: row.white, emptyPlaceholder: "…", current: current, onMove: onMove) - MoveCell(move: row.black, emptyPlaceholder: "", current: current, onMove: onMove) - } - .frame(minHeight: 48) - .padding(.leading, CGFloat(row.indent * 16)) - } -} - -private struct MoveCell: View { - let move: NotationMove? - let emptyPlaceholder: String - let current: Int - let onMove: (Int) -> Void - - var body: some View { - Group { - if let move { - NotationMoveButton(move: move, current: current, onMove: onMove) - .frame(maxWidth: .infinity, minHeight: 44, alignment: .leading) - } else { - Text(emptyPlaceholder) - .foregroundStyle(Theme.onSurfaceVariant) - .padding(.horizontal, 12) - .frame(maxWidth: .infinity, minHeight: 44, alignment: .leading) - } - } - } -} - -private struct NotationMoveButton: View { - let move: NotationMove - let current: Int - let onMove: (Int) -> Void - - var body: some View { - Button { - onMove(move.id) - } label: { - Text(move.label) - .font(.body.weight(.bold)) - .foregroundStyle(Theme.onSurface) - .padding(.horizontal, 8) - .padding(.vertical, 6) - .background(current == move.id ? Theme.currentMove : Color.clear) - .clipShape(RoundedRectangle(cornerRadius: 6)) - } - .buttonStyle(.plain) - .frame(minHeight: 44) - .id("move-\(move.id)") - .accessibilityValue(current == move.id ? L10n.currentMove : "") - .accessibilityAddTraits(current == move.id ? .isSelected : []) - } -} - -private struct VariationView: View { - let variation: NotationVariation - let current: Int - let onMove: (Int) -> Void - - var body: some View { - HStack(alignment: .top, spacing: 12) { - Rectangle() - .fill(Theme.outlineVariant) - .frame(width: 2) - .frame(maxHeight: .infinity) - FlowLayout(spacing: 4) { - ForEach(variation.tokens) { token in - switch token { - case .move(let move): - NotationMoveButton(move: move, current: current, onMove: onMove) - case .comment(_, let text): - Text(text) - .font(.subheadline.italic()) - .foregroundStyle(Theme.comment) - .padding(.vertical, 6) - case .punctuation(_, let text): - Text(text) - .font(.body) - .foregroundStyle(Theme.onSurfaceVariant) - .padding(.vertical, 6) - } - } - } - .frame(maxWidth: .infinity, alignment: .leading) - } - .padding(.leading, CGFloat(16 + variation.indent * 16)) - .padding(.trailing, 16) - .padding(.vertical, 4) - } -} - -private struct CommentBlock: View { - let text: String - let indent: Int - - var body: some View { - Text(text) - .font(.subheadline) - .foregroundStyle(Theme.comment) - .padding(.horizontal, 12) - .padding(.vertical, 8) - .frame(maxWidth: .infinity, alignment: .leading) - .background(Theme.containerLow) - .clipShape(RoundedRectangle(cornerRadius: 12)) - .padding(.leading, CGFloat(16 + indent * 16)) - .padding(.trailing, 16) - .padding(.vertical, 4) - } -} - -/// iOS 16 token flow: every SAN remains its own Button even across lines and nested RAV. -private struct FlowLayout: Layout { - let spacing: CGFloat - - func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout Void) -> CGSize { - let available = max(0, proposal.width ?? 0) - var x: CGFloat = 0 - var y: CGFloat = 0 - var lineHeight: CGFloat = 0 - var contentWidth: CGFloat = 0 - - for subview in subviews { - let size = fittingSize(of: subview, available: available) - if x > 0, x + spacing + size.width > available { - x = 0 - y += lineHeight + spacing - lineHeight = 0 - } - if x > 0 { x += spacing } - x += size.width - lineHeight = max(lineHeight, size.height) - contentWidth = max(contentWidth, x) - } - return CGSize(width: proposal.width ?? contentWidth, height: y + lineHeight) - } - - func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout Void) { - var x = bounds.minX - var y = bounds.minY - var lineHeight: CGFloat = 0 - - for subview in subviews { - let size = fittingSize(of: subview, available: bounds.width) - if x > bounds.minX, x + spacing + size.width > bounds.maxX { - x = bounds.minX - y += lineHeight + spacing - lineHeight = 0 - } - if x > bounds.minX { x += spacing } - subview.place(at: CGPoint(x: x, y: y), proposal: ProposedViewSize(size)) - x += size.width - lineHeight = max(lineHeight, size.height) - } - } - - private func fittingSize(of subview: LayoutSubview, available: CGFloat) -> CGSize { - let intrinsic = subview.sizeThatFits(ProposedViewSize(width: nil, height: nil)) - guard available > 0, intrinsic.width > available else { return intrinsic } - return subview.sizeThatFits(ProposedViewSize(width: available, height: nil)) - } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/Contents.json b/iosApp/ChessPenguin/Resources/Pieces.xcassets/Contents.json deleted file mode 100644 index d8b757a..0000000 --- a/iosApp/ChessPenguin/Resources/Pieces.xcassets/Contents.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "info" : { "author" : "xcode", "version" : 1 } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bB.imageset/Contents.json b/iosApp/ChessPenguin/Resources/Pieces.xcassets/bB.imageset/Contents.json deleted file mode 100644 index b35a09e..0000000 --- a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bB.imageset/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "images" : [ - { "filename" : "bB.png", "idiom" : "universal", "scale" : "1x" } - ], - "info" : { "author" : "xcode", "version" : 1 } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bB.imageset/bB.png b/iosApp/ChessPenguin/Resources/Pieces.xcassets/bB.imageset/bB.png deleted file mode 100644 index b94e702..0000000 Binary files a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bB.imageset/bB.png and /dev/null differ diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bK.imageset/Contents.json b/iosApp/ChessPenguin/Resources/Pieces.xcassets/bK.imageset/Contents.json deleted file mode 100644 index 3064bec..0000000 --- a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bK.imageset/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "images" : [ - { "filename" : "bK.png", "idiom" : "universal", "scale" : "1x" } - ], - "info" : { "author" : "xcode", "version" : 1 } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bK.imageset/bK.png b/iosApp/ChessPenguin/Resources/Pieces.xcassets/bK.imageset/bK.png deleted file mode 100644 index 42f86a5..0000000 Binary files a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bK.imageset/bK.png and /dev/null differ diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bN.imageset/Contents.json b/iosApp/ChessPenguin/Resources/Pieces.xcassets/bN.imageset/Contents.json deleted file mode 100644 index 279e06b..0000000 --- a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bN.imageset/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "images" : [ - { "filename" : "bN.png", "idiom" : "universal", "scale" : "1x" } - ], - "info" : { "author" : "xcode", "version" : 1 } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bN.imageset/bN.png b/iosApp/ChessPenguin/Resources/Pieces.xcassets/bN.imageset/bN.png deleted file mode 100644 index ee1df1c..0000000 Binary files a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bN.imageset/bN.png and /dev/null differ diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bP.imageset/Contents.json b/iosApp/ChessPenguin/Resources/Pieces.xcassets/bP.imageset/Contents.json deleted file mode 100644 index ea7a15a..0000000 --- a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bP.imageset/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "images" : [ - { "filename" : "bP.png", "idiom" : "universal", "scale" : "1x" } - ], - "info" : { "author" : "xcode", "version" : 1 } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bP.imageset/bP.png b/iosApp/ChessPenguin/Resources/Pieces.xcassets/bP.imageset/bP.png deleted file mode 100644 index 7e6f815..0000000 Binary files a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bP.imageset/bP.png and /dev/null differ diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bQ.imageset/Contents.json b/iosApp/ChessPenguin/Resources/Pieces.xcassets/bQ.imageset/Contents.json deleted file mode 100644 index 071bf67..0000000 --- a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bQ.imageset/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "images" : [ - { "filename" : "bQ.png", "idiom" : "universal", "scale" : "1x" } - ], - "info" : { "author" : "xcode", "version" : 1 } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bQ.imageset/bQ.png b/iosApp/ChessPenguin/Resources/Pieces.xcassets/bQ.imageset/bQ.png deleted file mode 100644 index 9cd24d3..0000000 Binary files a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bQ.imageset/bQ.png and /dev/null differ diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bR.imageset/Contents.json b/iosApp/ChessPenguin/Resources/Pieces.xcassets/bR.imageset/Contents.json deleted file mode 100644 index e58fbb3..0000000 --- a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bR.imageset/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "images" : [ - { "filename" : "bR.png", "idiom" : "universal", "scale" : "1x" } - ], - "info" : { "author" : "xcode", "version" : 1 } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bR.imageset/bR.png b/iosApp/ChessPenguin/Resources/Pieces.xcassets/bR.imageset/bR.png deleted file mode 100644 index 382326b..0000000 Binary files a/iosApp/ChessPenguin/Resources/Pieces.xcassets/bR.imageset/bR.png and /dev/null differ diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wB.imageset/Contents.json b/iosApp/ChessPenguin/Resources/Pieces.xcassets/wB.imageset/Contents.json deleted file mode 100644 index 06b1dbb..0000000 --- a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wB.imageset/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "images" : [ - { "filename" : "wB.png", "idiom" : "universal", "scale" : "1x" } - ], - "info" : { "author" : "xcode", "version" : 1 } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wB.imageset/wB.png b/iosApp/ChessPenguin/Resources/Pieces.xcassets/wB.imageset/wB.png deleted file mode 100644 index cc55acd..0000000 Binary files a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wB.imageset/wB.png and /dev/null differ diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wK.imageset/Contents.json b/iosApp/ChessPenguin/Resources/Pieces.xcassets/wK.imageset/Contents.json deleted file mode 100644 index 44e63b7..0000000 --- a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wK.imageset/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "images" : [ - { "filename" : "wK.png", "idiom" : "universal", "scale" : "1x" } - ], - "info" : { "author" : "xcode", "version" : 1 } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wK.imageset/wK.png b/iosApp/ChessPenguin/Resources/Pieces.xcassets/wK.imageset/wK.png deleted file mode 100644 index 565590c..0000000 Binary files a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wK.imageset/wK.png and /dev/null differ diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wN.imageset/Contents.json b/iosApp/ChessPenguin/Resources/Pieces.xcassets/wN.imageset/Contents.json deleted file mode 100644 index c1ba7ea..0000000 --- a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wN.imageset/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "images" : [ - { "filename" : "wN.png", "idiom" : "universal", "scale" : "1x" } - ], - "info" : { "author" : "xcode", "version" : 1 } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wN.imageset/wN.png b/iosApp/ChessPenguin/Resources/Pieces.xcassets/wN.imageset/wN.png deleted file mode 100644 index 1800a64..0000000 Binary files a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wN.imageset/wN.png and /dev/null differ diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wP.imageset/Contents.json b/iosApp/ChessPenguin/Resources/Pieces.xcassets/wP.imageset/Contents.json deleted file mode 100644 index 7e9c1a6..0000000 --- a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wP.imageset/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "images" : [ - { "filename" : "wP.png", "idiom" : "universal", "scale" : "1x" } - ], - "info" : { "author" : "xcode", "version" : 1 } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wP.imageset/wP.png b/iosApp/ChessPenguin/Resources/Pieces.xcassets/wP.imageset/wP.png deleted file mode 100644 index 793be1c..0000000 Binary files a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wP.imageset/wP.png and /dev/null differ diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wQ.imageset/Contents.json b/iosApp/ChessPenguin/Resources/Pieces.xcassets/wQ.imageset/Contents.json deleted file mode 100644 index 48a1af6..0000000 --- a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wQ.imageset/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "images" : [ - { "filename" : "wQ.png", "idiom" : "universal", "scale" : "1x" } - ], - "info" : { "author" : "xcode", "version" : 1 } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wQ.imageset/wQ.png b/iosApp/ChessPenguin/Resources/Pieces.xcassets/wQ.imageset/wQ.png deleted file mode 100644 index 09722c8..0000000 Binary files a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wQ.imageset/wQ.png and /dev/null differ diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wR.imageset/Contents.json b/iosApp/ChessPenguin/Resources/Pieces.xcassets/wR.imageset/Contents.json deleted file mode 100644 index 6cb6a52..0000000 --- a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wR.imageset/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "images" : [ - { "filename" : "wR.png", "idiom" : "universal", "scale" : "1x" } - ], - "info" : { "author" : "xcode", "version" : 1 } -} diff --git a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wR.imageset/wR.png b/iosApp/ChessPenguin/Resources/Pieces.xcassets/wR.imageset/wR.png deleted file mode 100644 index 41c65b9..0000000 Binary files a/iosApp/ChessPenguin/Resources/Pieces.xcassets/wR.imageset/wR.png and /dev/null differ diff --git a/iosApp/ChessPenguin/Resources/THIRD_PARTY_NOTICES.txt b/iosApp/ChessPenguin/Resources/THIRD_PARTY_NOTICES.txt deleted file mode 100644 index d03a939..0000000 --- a/iosApp/ChessPenguin/Resources/THIRD_PARTY_NOTICES.txt +++ /dev/null @@ -1,11 +0,0 @@ -ChessPenguin is licensed under GPL-3.0-or-later. - -Bundled cburnett chess pieces -Author: Colin M.L. Burnett -License: GPLv2+ -Source: https://github.com/lichess-org/lila/tree/cd2656d2787a766ba743da8da1dd3b24975e6329/public/piece/cburnett - -The SVG files were rendered unmodified into 256×256 PNG images for the iOS asset catalog. The source SVG files and the complete project notices remain in apps/desktop/assets/pieces/cburnett and THIRD_PARTY_NOTICES.md. - -Bundled games -classics.pgn is an unmodified copy of examples/classics.pgn from the ChessPenguin repository. diff --git a/iosApp/ChessPenguin/Resources/classics.pgn b/iosApp/ChessPenguin/Resources/classics.pgn deleted file mode 100644 index 8e741d0..0000000 --- a/iosApp/ChessPenguin/Resources/classics.pgn +++ /dev/null @@ -1,2012 +0,0 @@ -[Event "London m4"] -[Site "London"] -[Date "1834.??.??"] -[Round "62"] -[White "McDonnell, Alexander"] -[Black "La Bourdonnais, Louis-Charles Mahe de"] -[Result "0-1"] -[ECO "B32"] -[PlyCount "74"] -[Annotator "ChessPenguin sample"] - -1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. Nxd4 e5 5. Nxc6 bxc6 6. Bc4 Nf6 7. Bg5 Be7 8. -Qe2 d5 9. Bxf6 Bxf6 10. Bb3 O-O 11. O-O a5 12. exd5 cxd5 13. Rd1 d4 14. c4 Qb6 -15. Bc2 Bb7 16. Nd2 Rae8 17. Ne4 Bd8 18. c5 Qc6 19. f3 Be7 20. Rac1 f5 21. Qc4+ -Kh8 22. Ba4 Qh6 23. Bxe8 fxe4 24. c6 exf3 25. Rc2 Qe3+ 26. Kh1 Bc8 27. Bd7 f2 -28. Rf1 d3 29. Rc3 Bxd7 30. cxd7 e4 31. Qc8 Bd8 32. Qc4 Qe1 33. Rc1 d2 34. Qc5 -Rg8 35. Rd1 e3 36. Qc3 Qxd1 37. Rxd1 e2 0-1 - - -[Event "Paris m"] -[Site "Paris"] -[Date "1843.??.??"] -[Round "5"] -[White "Saint-Amant, Pierre Charles Fournier de"] -[Black "Staunton, Howard"] -[Result "0-1"] -[ECO "C00"] -[PlyCount "78"] -[Annotator "ChessPenguin sample"] - -1. e4 c5 2. f4 e6 3. Nf3 Nc6 4. c3 d5 5. e5 Qb6 6. Bd3 Bd7 7. Bc2 Rc8 8. O-O -Nh6 9. h3 Be7 10. Kh2 f5 11. a3 a5 12. a4 Nf7 13. d4 h6 14. Re1 g6 15. Na3 cxd4 -16. Nxd4 Nxd4 17. cxd4 g5 18. Nb5 Bxb5 19. axb5 Rc4 20. Bd3 Rc8 21. Be2 gxf4 -22. Rf1 Ng5 23. Bxf4 Ne4 24. Rc1 Rxc1 25. Qxc1 Kd7 26. Qe3 Bg5 27. Bd3 Rg8 28. -Bxe4 dxe4 29. Bxg5 hxg5 30. Qb3 g4 31. Rd1 gxh3 32. Qxh3 Qd8 33. d5 Kc8 34. -Qc3+ Kb8 35. d6 f4 36. Qc5 e3 37. Qc2 Qh4+ 38. Kg1 Rc8 39. Qe2 Rh8 0-1 - - -[Event "London casual game"] -[Site "London ENG"] -[Date "1851.06.21"] -[Round "?"] -[White "Anderssen, Adolf"] -[Black "Kieseritzky, Lionel"] -[Result "1-0"] -[ECO "C33"] -[PlyCount "45"] -[Annotator "ChessPenguin sample"] - -{The "Immortal Game".} 1. e4 e5 2. f4 exf4 3. Bc4 Qh4+ 4. Kf1 b5 5. Bxb5 Nf6 6. -Nf3 Qh6 7. d3 Nh5 8. Nh4 Qg5 9. Nf5 c6 10. g4 Nf6 11. Rg1 $1 cxb5 12. h4 Qg6 -13. h5 Qg5 14. Qf3 Ng8 15. Bxf4 Qf6 16. Nc3 Bc5 17. Nd5 Qxb2 18. Bd6 $3 {White -gives up both rooks.} Bxg1 (18... Qxa1+ 19. Ke2 Bxg1 20. Nxg7+ Kd8 21. Qf6+ {is -similar.}) 19. e5 $1 Qxa1+ 20. Ke2 Na6 21. Nxg7+ Kd8 22. Qf6+ $3 Nxf6 23. Be7# -1-0 - - -[Event "Endgame study"] -[Site "?"] -[Date "????.??.??"] -[Round "?"] -[White "White to move"] -[Black "Opposition"] -[Result "1-0"] -[SetUp "1"] -[FEN "4k3/8/4K3/4P3/8/8/8/8 w - - 0 1"] -[PlyCount "7"] -[Annotator "ChessPenguin sample"] - -{A starting position from FEN. With the king on the sixth rank in front of -its pawn, White wins whoever is to move.} 1. Kd6 (1. Kf6 Kf8 2. e6 Ke8 3. e7 Kd7 -4. Kf7 {also wins.}) 1... Kd8 2. e6 Ke8 3. e7 Kf7 4. Kd7 1-0 - - -[Event "Berlin casual game"] -[Site "Berlin GER"] -[Date "1852.??.??"] -[Round "?"] -[White "Anderssen, Adolf"] -[Black "Dufresne, Jean"] -[Result "1-0"] -[ECO "C52"] -[PlyCount "47"] -[Annotator "ChessPenguin sample"] - -{The "Evergreen Game".} 1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. b4 {The Evans Gambit.} -Bxb4 5. c3 Ba5 6. d4 exd4 7. O-O d3 8. Qb3 Qf6 9. e5 Qg6 10. Re1 Nge7 11. Ba3 -b5 12. Qxb5 Rb8 13. Qa4 Bb6 14. Nbd2 Bb7 15. Ne4 Qf5 16. Bxd3 Qh5 17. Nf6+ $1 -gxf6 18. exf6 Rg8 19. Rad1 $3 Qxf3 20. Rxe7+ $1 Nxe7 (20... Kd8 21. Rxd7+ Kc8 -22. Rd8+ Kxd8 23. Bf5+ Qxd1 24. Qxd1+ {wins.}) 21. Qxd7+ $3 Kxd7 22. Bf5+ Ke8 -23. Bd7+ Kf8 24. Bxe7# 1-0 - - -[Event "USA-01.Congress"] -[Site "New York"] -[Date "1857.??.??"] -[Round "6"] -[White "Paulsen, Louis"] -[Black "Morphy, Paul"] -[Result "0-1"] -[ECO "C48"] -[PlyCount "56"] -[Annotator "ChessPenguin sample"] - -1. e4 e5 2. Nf3 Nc6 3. Nc3 Nf6 4. Bb5 Bc5 5. O-O O-O 6. Nxe5 Re8 7. Nxc6 dxc6 -8. Bc4 b5 9. Be2 Nxe4 10. Nxe4 Rxe4 11. Bf3 Re6 12. c3 Qd3 13. b4 Bb6 14. a4 -bxa4 15. Qxa4 Bd7 16. Ra2 Rae8 17. Qa6 Qxf3 18. gxf3 Rg6+ 19. Kh1 Bh3 20. Rd1 -Bg2+ 21. Kg1 Bxf3+ 22. Kf1 Bg2+ 23. Kg1 Bh3+ 24. Kh1 Bxf2 25. Qf1 Bxf1 26. Rxf1 -Re2 27. Ra1 Rh6 28. d4 Be3 0-1 - - -[Event "Paris Opera"] -[Site "Paris FRA"] -[Date "1858.??.??"] -[Round "?"] -[White "Morphy, Paul"] -[Black "Duke Karl / Count Isouard"] -[Result "1-0"] -[ECO "C41"] -[PlyCount "33"] -[Annotator "ChessPenguin sample"] - -{The "Opera Game": a model of rapid development and open lines.} 1. e4 e5 2. Nf3 -d6 3. d4 Bg4 $6 {Pinning the knight, but Black will have to give up the bishop -pair.} 4. dxe5 Bxf3 (4... dxe5 5. Qxd8+ Kxd8 6. Nxe5 {wins a pawn.}) 5. Qxf3 -dxe5 6. Bc4 {Threatening Qxf7#.} Nf6 7. Qb3 $1 {A double attack on f7 and b7.} -Qe7 8. Nc3 {Morphy prefers development to material.} (8. Qxb7 Qb4+ 9. Qxb4 Bxb4+ -{only trades queens.}) 8... c6 9. Bg5 b5 $2 {Black wants to chase the bishop, but opens lines towards his own king.} -(9... Nbd7 {is the healthy move:} 10. O-O-O {keeps the pressure on d7.} (10. Qxb7 $6 Qb4+ -11. Qxb4 Bxb4 {[%csl Gb4] and Black is fine.}) 10... h6 11. Bh4 $14) 10. Nxb5 $1 -{[%cal Gb5d6,Gc4f7] The knight sacrifice opens the c-file and the a4-e8 diagonal.} cxb5 11. -Bxb5+ Nbd7 12. O-O-O {[%csl Rd7][%cal Gd1d7,Gb5d7] All of White's pieces aim at d7.} Rd8 -13. Rxd7 $1 Rxd7 14. Rd1 Qe6 15. Bxd7+ Nxd7 16. Qb8+ $3 {[%cal Gb3b8,Gd1d8] The famous -queen sacrifice.} Nxb8 17. Rd8# {[%csl Re8] A model of rapid development.} -1-0 - - -[Event "London m5"] -[Site "London"] -[Date "1858.??.??"] -[Round "?"] -[White "Bird, Henry Edward"] -[Black "Morphy, Paul"] -[Result "0-1"] -[ECO "C41"] -[PlyCount "58"] -[Annotator "ChessPenguin sample"] - -1. e4 e5 2. Nf3 d6 3. d4 f5 4. Nc3 fxe4 5. Nxe4 d5 6. Ng3 e4 7. Ne5 Nf6 8. Bg5 -Bd6 9. Nh5 O-O 10. Qd2 Qe8 11. g4 Nxg4 12. Nxg4 Qxh5 13. Ne5 Nc6 14. Be2 Qh3 -15. Nxc6 bxc6 16. Be3 Rb8 17. O-O-O Rxf2 18. Bxf2 Qa3 19. c3 Qxa2 20. b4 Qa1+ -21. Kc2 Qa4+ 22. Kb2 Bxb4 23. cxb4 Rxb4+ 24. Qxb4 Qxb4+ 25. Kc2 e3 26. Bxe3 -Bf5+ 27. Rd3 Qc4+ 28. Kd2 Qa2+ 29. Kd1 Qb1+ 0-1 - - -[Event "London mt"] -[Site "London"] -[Date "1862.??.??"] -[Round "?"] -[White "Steinitz, William"] -[Black "Mongredien, Augustus"] -[Result "1-0"] -[ECO "B01"] -[PlyCount "57"] -[Annotator "ChessPenguin sample"] - -1. e4 d5 2. exd5 Qxd5 3. Nc3 Qd8 4. d4 e6 5. Nf3 Nf6 6. Bd3 Be7 7. O-O O-O 8. -Be3 b6 9. Ne5 Bb7 10. f4 Nbd7 11. Qe2 Nd5 12. Nxd5 exd5 13. Rf3 f5 14. Rh3 g6 -15. g4 fxg4 16. Rxh7 Nxe5 17. fxe5 Kxh7 18. Qxg4 Rg8 19. Qh5+ Kg7 20. Qh6+ Kf7 -21. Qh7+ Ke6 22. Qh3+ Kf7 23. Rf1+ Ke8 24. Qe6 Rg7 25. Bg5 Qd7 26. Bxg6+ Rxg6 -27. Qxg6+ Kd8 28. Rf8+ Qe8 29. Qxe8# 1-0 - - -[Event "London International Masters"] -[Site "London"] -[Date "1883.05.05"] -[Round "6.2"] -[White "Zukertort, Johannes Hermann"] -[Black "Blackburne, Joseph Henry"] -[Result "1-0"] -[ECO "A13"] -[PlyCount "65"] -[Annotator "ChessPenguin sample"] - -{London 1883, the tournament Zukertort won ahead of Steinitz. His masterpiece: -28.Qb4!! offers the queen, which Black cannot take.} 1. c4 e6 2. e3 Nf6 3. Nf3 -b6 4. Be2 Bb7 5. O-O d5 6. d4 Bd6 7. Nc3 O-O 8. b3 Nbd7 9. Bb2 Qe7 10. Nb5 Ne4 -11. Nxd6 cxd6 12. Nd2 Ndf6 13. f3 Nxd2 14. Qxd2 dxc4 15. Bxc4 d5 16. Bd3 Rfc8 -17. Rae1 Rc7 18. e4 Rac8 19. e5 Ne8 20. f4 g6 21. Re3 f5 22. exf6 Nxf6 23. f5 -Ne4 24. Bxe4 dxe4 25. fxg6 Rc2 26. gxh7+ Kh8 27. d5+ e5 28. Qb4 R8c5 29. Rf8+ -Kxh7 30. Qxe4+ Kg7 31. Bxe5+ Kxf8 32. Bg7+ Kg8 33. Qxe7 1-0 - - -[Event "Amsterdam VAS Int-01 Masters"] -[Site "Amsterdam"] -[Date "1889.08.26"] -[Round "1"] -[White "Lasker, Emanuel"] -[Black "Bauer, Johann Hermann"] -[Result "1-0"] -[ECO "A03"] -[PlyCount "75"] -[Annotator "ChessPenguin sample"] - -{Amsterdam 1889: the classic double bishop sacrifice. Bxh7+ and Bxg7 strip the -black king of its pawns.} 1. f4 d5 2. e3 Nf6 3. b3 e6 4. Bb2 Be7 5. Bd3 b6 6. -Nf3 Bb7 7. Nc3 Nbd7 8. O-O O-O 9. Ne2 c5 10. Ng3 Qc7 11. Ne5 Nxe5 12. Bxe5 Qc6 -13. Qe2 a6 14. Nh5 Nxh5 15. Bxh7+ Kxh7 16. Qxh5+ Kg8 17. Bxg7 Kxg7 18. Qg4+ Kh7 -19. Rf3 e5 20. Rh3+ Qh6 21. Rxh6+ Kxh6 22. Qd7 Bf6 23. Qxb7 Kg7 24. Rf1 Rab8 -25. Qd7 Rfd8 26. Qg4+ Kf8 27. fxe5 Bg7 28. e6 Rb7 29. Qg6 f6 30. Rxf6+ Bxf6 31. -Qxf6+ Ke8 32. Qh8+ Ke7 33. Qg7+ Kxe6 34. Qxb7 Rd6 35. Qxa6 d4 36. exd4 cxd4 37. -h4 d3 38. Qxd3 1-0 - - -[Event "World Championship 4th"] -[Site "Havana"] -[Date "1892.??.??"] -[Round "4"] -[White "Steinitz, William"] -[Black "Chigorin, Mikhail"] -[Result "1-0"] -[ECO "C65"] -[PlyCount "55"] -[Annotator "ChessPenguin sample"] - -1. e4 e5 2. Nf3 Nc6 3. Bb5 Nf6 4. d3 d6 5. c3 g6 6. Nbd2 Bg7 7. Nf1 O-O 8. Ba4 -Nd7 9. Ne3 Nc5 10. Bc2 Ne6 11. h4 Ne7 12. h5 d5 13. hxg6 fxg6 14. exd5 Nxd5 15. -Nxd5 Qxd5 16. Bb3 Qc6 17. Qe2 Bd7 18. Be3 Kh8 19. O-O-O Rae8 20. Qf1 a5 21. d4 -exd4 22. Nxd4 Bxd4 23. Rxd4 Nxd4 24. Rxh7+ Kxh7 25. Qh1+ Kg7 26. Bh6+ Kf6 27. -Qh4+ Ke5 28. Qxd4+ 1-0 - - -[Event "Hastings International Masters"] -[Site "Hastings"] -[Date "1895.08.17"] -[Round "10"] -[White "Steinitz, William"] -[Black "Von Bardeleben, Curt"] -[Result "1-0"] -[ECO "C54"] -[PlyCount "49"] -[Annotator "ChessPenguin sample"] - -{Hastings 1895. Steinitz keeps Black's king in the centre and finishes with a -famous combination in which his rook gives check after check. Von Bardeleben is -said to have left the hall rather than resign.} 1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 -4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Bg5 Be7 -11. Bxd5 Bxd5 12. Nxd5 Qxd5 13. Bxe7 Nxe7 14. Re1 f6 15. Qe2 Qd7 16. Rac1 c6 -17. d5 cxd5 18. Nd4 Kf7 19. Ne6 Rhc8 20. Qg4 g6 21. Ng5+ Ke8 22. Rxe7+ Kf8 23. -Rf7+ Kg8 24. Rg7+ Kh8 25. Rxh7+ 1-0 - - -[Event "Hastings"] -[Site "Hastings"] -[Date "1895.??.??"] -[Round "?"] -[White "Pillsbury, Harry Nelson"] -[Black "Tarrasch, Siegbert"] -[Result "1-0"] -[ECO "D55"] -[PlyCount "103"] -[Annotator "ChessPenguin sample"] - -1. d4 d5 2. c4 e6 3. Nc3 Nf6 4. Bg5 Be7 5. Nf3 Nbd7 6. Rc1 O-O 7. e3 b6 8. cxd5 -exd5 9. Bd3 Bb7 10. O-O c5 11. Re1 c4 12. Bb1 a6 13. Ne5 b5 14. f4 Re8 15. Qf3 -Nf8 16. Ne2 Ne4 17. Bxe7 Rxe7 18. Bxe4 dxe4 19. Qg3 f6 20. Ng4 Kh8 21. f5 Qd7 -22. Rf1 Rd8 23. Rf4 Qd6 24. Qh4 Rde8 25. Nc3 Bd5 26. Nf2 Qc6 27. Rf1 b4 28. Ne2 -Qa4 29. Ng4 Nd7 30. R4f2 Kg8 31. Nc1 c3 32. b3 Qc6 33. h3 a5 34. Nh2 a4 35. g4 -axb3 36. axb3 Ra8 37. g5 Ra3 38. Ng4 Bxb3 39. Rg2 Kh8 40. gxf6 gxf6 41. Nxb3 -Rxb3 42. Nh6 Rg7 43. Rxg7 Kxg7 44. Qg3+ Kxh6 45. Kh1 Qd5 46. Rg1 Qxf5 47. Qh4+ -Qh5 48. Qf4+ Qg5 49. Rxg5 fxg5 50. Qd6+ Kh5 51. Qxd7 c2 52. Qxh7# 1-0 - - -[Event "Hastings"] -[Site "Hastings"] -[Date "1895.??.??"] -[Round "?"] -[White "Pillsbury, Harry Nelson"] -[Black "Gunsberg, Isidor"] -[Result "1-0"] -[ECO "D94"] -[PlyCount "79"] -[Annotator "ChessPenguin sample"] - -1. d4 d5 2. c4 c6 3. e3 g6 4. Nc3 Bg7 5. Nf3 Nf6 6. Bd3 O-O 7. Ne5 dxc4 8. Bxc4 -Nd5 9. f4 Be6 10. Qb3 b5 11. Bxd5 Bxd5 12. Nxd5 Qxd5 13. Qxd5 cxd5 14. Nd3 Nd7 -15. Bd2 Rfc8 16. Ke2 e6 17. Rhc1 Bf8 18. Rxc8 Rxc8 19. Rc1 Rxc1 20. Bxc1 Bd6 -21. Bd2 Kf8 22. Bb4 Ke7 23. Bc5 a6 24. b4 f6 25. g4 Bxc5 26. bxc5 Nb8 27. f5 g5 -28. Nb4 a5 29. c6 Kd6 30. fxe6 Nxc6 31. Nxc6 Kxc6 32. e4 dxe4 33. d5+ Kd6 34. -Ke3 b4 35. Kxe4 a4 36. Kd4 h5 37. gxh5 a3 38. Kc4 f5 39. h6 f4 40. h7 1-0 - - -[Event "St Petersburg Four Masters"] -[Site "St Petersburg"] -[Date "1896.01.04"] -[Round "4.1"] -[White "Pillsbury, Harry Nelson"] -[Black "Lasker, Emanuel"] -[Result "0-1"] -[ECO "D50"] -[PlyCount "64"] -[Annotator "ChessPenguin sample"] - -{St Petersburg 1895/96. Lasker answers Pillsbury's attack with the rook -sacrifice 17...Rxc3!! and hunts the white king.} 1. d4 d5 2. c4 e6 3. Nc3 Nf6 -4. Nf3 c5 5. Bg5 cxd4 6. Qxd4 Nc6 7. Qh4 Be7 8. O-O-O Qa5 9. e3 Bd7 10. Kb1 h6 -11. cxd5 exd5 12. Nd4 O-O 13. Bxf6 Bxf6 14. Qh5 Nxd4 15. exd4 Be6 16. f4 Rac8 -17. f5 Rxc3 18. fxe6 Ra3 19. exf7+ Rxf7 20. bxa3 Qb6+ 21. Bb5 Qxb5+ 22. Ka1 Rc7 -23. Rd2 Rc4 24. Rhd1 Rc3 25. Qf5 Qc4 26. Kb2 Rxa3 27. Qe6+ Kh7 28. Kxa3 Qc3+ -29. Ka4 b5+ 30. Kxb5 Qc4+ 31. Ka5 Bd8+ 32. Qb6 Bxb6# 0-1 - - -[Event "Cambridge Springs"] -[Site "Cambridge"] -[Date "1904.??.??"] -[Round "3"] -[White "Lasker, Emanuel"] -[Black "Napier, William Ewart"] -[Result "1-0"] -[ECO "B72"] -[PlyCount "69"] -[Annotator "ChessPenguin sample"] - -1. e4 c5 2. Nc3 Nc6 3. Nf3 g6 4. d4 cxd4 5. Nxd4 Bg7 6. Be3 d6 7. h3 Nf6 8. g4 -O-O 9. g5 Ne8 10. h4 Nc7 11. f4 e5 12. Nde2 d5 13. exd5 Nd4 14. Nxd4 Nxd5 15. -Nf5 Nxc3 16. Qxd8 Rxd8 17. Ne7+ Kh8 18. h5 Re8 19. Bc5 gxh5 20. Bc4 exf4 21. -Bxf7 Ne4 22. Bxe8 Bxb2 23. Rb1 Bc3+ 24. Kf1 Bg4 25. Bxh5 Bxh5 26. Rxh5 Ng3+ 27. -Kg2 Nxh5 28. Rxb7 a5 29. Rb3 Bg7 30. Rh3 Ng3 31. Kf3 Ra6 32. Kxf4 Ne2+ 33. Kf5 -Nc3 34. a3 Na4 35. Be3 1-0 - - -[Event "Lodz"] -[Site "Lodz"] -[Date "1907.12.26"] -[Round "?"] -[White "Rotlewi, Georg A"] -[Black "Rubinstein, Akiba"] -[Result "0-1"] -[ECO "D40"] -[PlyCount "50"] -[Annotator "ChessPenguin sample"] - -{Lodz 1907, "Rubinstein's Immortal". After 22...Rxc3! and 23...Rd2!! Black's -queen is left hanging, and the bishops and rooks finish the attack.} 1. d4 d5 -2. Nf3 e6 3. e3 c5 4. c4 Nc6 5. Nc3 Nf6 6. dxc5 Bxc5 7. a3 a6 8. b4 Bd6 9. Bb2 -O-O 10. Qd2 Qe7 11. Bd3 dxc4 12. Bxc4 b5 13. Bd3 Rd8 14. Qe2 Bb7 15. O-O Ne5 -16. Nxe5 Bxe5 17. f4 Bc7 18. e4 Rac8 19. e5 Bb6+ 20. Kh1 Ng4 21. Be4 Qh4 22. g3 -Rxc3 23. gxh4 Rd2 24. Qxd2 Bxe4+ 25. Qg2 Rh3 0-1 - - -[Event "St Petersburg"] -[Site "St Petersburg"] -[Date "1909.??.??"] -[Round "?"] -[White "Rubinstein, Akiba"] -[Black "Lasker, Emanuel"] -[Result "1-0"] -[ECO "D32"] -[PlyCount "79"] -[Annotator "ChessPenguin sample"] - -1. d4 d5 2. Nf3 Nf6 3. c4 e6 4. Bg5 c5 5. cxd5 exd5 6. Nc3 cxd4 7. Nxd4 Nc6 8. -e3 Be7 9. Bb5 Bd7 10. Bxf6 Bxf6 11. Nxd5 Bxd4 12. exd4 Qg5 13. Bxc6 Bxc6 14. -Ne3 O-O-O 15. O-O Rhe8 16. Rc1 Rxe3 17. Rxc6+ bxc6 18. Qc1 Rxd4 19. fxe3 Rd7 -20. Qxc6+ Kd8 21. Rf4 f5 22. Qc5 Qe7 23. Qxe7+ Kxe7 24. Rxf5 Rd1+ 25. Kf2 Rd2+ -26. Kf3 Rxb2 27. Ra5 Rb7 28. Ra6 Kf8 29. e4 Rc7 30. h4 Kf7 31. g4 Kf8 32. Kf4 -Ke7 33. h5 h6 34. Kf5 Kf7 35. e5 Rb7 36. Rd6 Ke7 37. Ra6 Kf7 38. Rd6 Kf8 39. -Rc6 Kf7 40. a3 1-0 - - -[Event "Wien"] -[Site "Vienna"] -[Date "1910.??.??"] -[Round "?"] -[White "Reti, Richard"] -[Black "Tartakower, Saviely"] -[Result "1-0"] -[ECO "B15"] -[PlyCount "21"] -[Annotator "ChessPenguin sample"] - -{Vienna 1910, a miniature everyone should know: 9.Qd8+!! Kxd8 10.Bg5++ and mate -next move.} 1. e4 c6 2. d4 d5 3. Nc3 dxe4 4. Nxe4 Nf6 5. Qd3 e5 6. dxe5 Qa5+ 7. -Bd2 Qxe5 8. O-O-O Nxe4 9. Qd8+ Kxd8 10. Bg5+ Kc7 11. Bd8# 1-0 - - -[Event "San Sebastian"] -[Site "San Sebastian"] -[Date "1911.??.??"] -[Round "1"] -[White "Capablanca, Jose Raul"] -[Black "Bernstein, Ossip"] -[Result "1-0"] -[ECO "C66"] -[PlyCount "67"] -[Annotator "ChessPenguin sample"] - -1. e4 e5 2. Nf3 Nc6 3. Bb5 Nf6 4. O-O Be7 5. Nc3 d6 6. Bxc6+ bxc6 7. d4 exd4 8. -Nxd4 Bd7 9. Bg5 O-O 10. Re1 h6 11. Bh4 Nh7 12. Bxe7 Qxe7 13. Qd3 Rab8 14. b3 -Ng5 15. Rad1 Qe5 16. Qe3 Ne6 17. Nce2 Qa5 18. Nf5 Nc5 19. Ned4 Kh7 20. g4 Rbe8 -21. f3 Ne6 22. Ne2 Qxa2 23. Neg3 Qxc2 24. Rc1 Qb2 25. Nh5 Rh8 26. Re2 Qe5 27. -f4 Qb5 28. Nfxg7 Nc5 29. Nxe8 Bxe8 30. Qc3 f6 31. Nxf6+ Kg6 32. Nh5 Rg8 33. f5+ -Kg5 34. Qe3+ 1-0 - - -[Event "DSB Kongress-18 Meisterturnier-17"] -[Site "Breslau"] -[Date "1912.07.20"] -[Round "6"] -[White "Levitsky, Stepan Mikhailovich"] -[Black "Marshall, Frank James"] -[Result "0-1"] -[ECO "C10"] -[PlyCount "46"] -[Annotator "ChessPenguin sample"] - -{Breslau 1912. Legend says the spectators showered the board with gold coins -after 23...Qg3!!: every capture of the queen loses.} 1. e4 e6 2. d4 d5 3. Nc3 -c5 4. Nf3 Nc6 5. exd5 exd5 6. Be2 Nf6 7. O-O Be7 8. Bg5 O-O 9. dxc5 Be6 10. Nd4 -Bxc5 11. Nxe6 fxe6 12. Bg4 Qd6 13. Bh3 Rae8 14. Qd2 Bb4 15. Bxf6 Rxf6 16. Rad1 -Qc5 17. Qe2 Bxc3 18. bxc3 Qxc3 19. Rxd5 Nd4 20. Qh5 Ref8 21. Re5 Rh6 22. Qg5 -Rxh3 23. Rc5 Qg3 0-1 - - -[Event "London blitz"] -[Site "London (City of London CC)"] -[Date "1912.10.29"] -[Round "?"] -[White "Lasker, Edward"] -[Black "Thomas, George Alan"] -[Result "1-0"] -[ECO "A83"] -[PlyCount "35"] -[Annotator "ChessPenguin sample"] - -{London 1912, the most famous king hunt: after the queen sacrifice 11.Qxh7+!! -the black king is driven from g8 all the way down the board and mated.} 1. d4 -e6 2. Nf3 f5 3. Nc3 Nf6 4. Bg5 Be7 5. Bxf6 Bxf6 6. e4 fxe4 7. Nxe4 b6 8. Ne5 -O-O 9. Bd3 Bb7 10. Qh5 Qe7 11. Qxh7+ Kxh7 12. Nxf6+ Kh6 13. Neg4+ Kg5 14. h4+ -Kf4 15. g3+ Kf3 16. Be2+ Kg2 17. Rh2+ Kg1 18. Kd2# 1-0 - - -[Event "St Petersburg f"] -[Site "St Petersburg"] -[Date "1914.??.??"] -[Round "?"] -[White "Lasker, Emanuel"] -[Black "Capablanca, Jose Raul"] -[Result "1-0"] -[ECO "C68"] -[PlyCount "83"] -[Annotator "ChessPenguin sample"] - -1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Bxc6 dxc6 5. d4 exd4 6. Qxd4 Qxd4 7. Nxd4 Bd6 -8. Nc3 Ne7 9. O-O O-O 10. f4 Re8 11. Nb3 f6 12. f5 b6 13. Bf4 Bb7 14. Bxd6 cxd6 -15. Nd4 Rad8 16. Ne6 Rd7 17. Rad1 Nc8 18. Rf2 b5 19. Rfd2 Rde7 20. b4 Kf7 21. -a3 Ba8 22. Kf2 Ra7 23. g4 h6 24. Rd3 a5 25. h4 axb4 26. axb4 Rae7 27. Kf3 Rg8 -28. Kf4 g6 29. Rg3 g5+ 30. Kf3 Nb6 31. hxg5 hxg5 32. Rh3 Rd7 33. Kg3 Ke8 34. -Rdh1 Bb7 35. e5 dxe5 36. Ne4 Nd5 37. N6c5 Bc8 38. Nxd7 Bxd7 39. Rh7 Rf8 40. Ra1 -Kd8 41. Ra8+ Bc8 42. Nc5 1-0 - - -[Event "St Petersburg prel"] -[Site "St Petersburg"] -[Date "1914.??.??"] -[Round "?"] -[White "Nimzowitsch, Aron"] -[Black "Tarrasch, Siegbert"] -[Result "0-1"] -[ECO "D30"] -[PlyCount "64"] -[Annotator "ChessPenguin sample"] - -1. d4 d5 2. Nf3 c5 3. c4 e6 4. e3 Nf6 5. Bd3 Nc6 6. O-O Bd6 7. b3 O-O 8. Bb2 b6 -9. Nbd2 Bb7 10. Rc1 Qe7 11. cxd5 exd5 12. Nh4 g6 13. Nhf3 Rad8 14. dxc5 bxc5 -15. Bb5 Ne4 16. Bxc6 Bxc6 17. Qc2 Nxd2 18. Nxd2 d4 19. exd4 Bxh2+ 20. Kxh2 Qh4+ -21. Kg1 Bxg2 22. f3 Rfe8 23. Ne4 Qh1+ 24. Kf2 Bxf1 25. d5 f5 26. Qc3 Qg2+ 27. -Ke3 Rxe4+ 28. fxe4 f4+ 29. Kxf4 Rf8+ 30. Ke5 Qh2+ 31. Ke6 Re8+ 32. Kd7 Bb5# 0-1 - - -[Event "Manhattan CC International"] -[Site "New York"] -[Date "1918.??.??"] -[Round "?"] -[White "Capablanca, Jose Raul"] -[Black "Marshall, Frank James"] -[Result "1-0"] -[ECO "C89"] -[PlyCount "71"] -[Annotator "ChessPenguin sample"] - -{New York 1918. Marshall springs his gambit in the Ruy Lopez, 8...d5, kept -secret for years; Capablanca defends calmly and wins.} 1. e4 e5 2. Nf3 Nc6 3. -Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 O-O 8. c3 d5 9. exd5 Nxd5 10. -Nxe5 Nxe5 11. Rxe5 Nf6 12. Re1 Bd6 13. h3 Ng4 14. Qf3 Qh4 15. d4 Nxf2 16. Re2 -Bg4 17. hxg4 Bh2+ 18. Kf1 Bg3 19. Rxf2 Qh1+ 20. Ke2 Bxf2 21. Bd2 Bh4 22. Qh3 -Rae8+ 23. Kd3 Qf1+ 24. Kc2 Bf2 25. Qf3 Qg1 26. Bd5 c5 27. dxc5 Bxc5 28. b4 Bd6 -29. a4 a5 30. axb5 axb4 31. Ra6 bxc3 32. Nxc3 Bb4 33. b6 Bxc3 34. Bxc3 h6 35. -b7 Re3 36. Bxf7+ 1-0 - - -[Event "Berlin"] -[Site "Berlin"] -[Date "1918.??.??"] -[Round "?"] -[White "Rubinstein, Akiba"] -[Black "Vidmar, Milan"] -[Result "0-1"] -[ECO "A52"] -[PlyCount "48"] -[Annotator "ChessPenguin sample"] - -1. d4 Nf6 2. c4 e5 3. dxe5 Ng4 4. Bf4 Nc6 5. Nf3 Bb4+ 6. Nc3 Qe7 7. Qd5 Bxc3+ -8. bxc3 Qa3 9. Rc1 f6 10. exf6 Nxf6 11. Qd2 d6 12. Nd4 O-O 13. e3 Nxd4 14. cxd4 -Ne4 15. Qc2 Qa5+ 16. Ke2 Rxf4 17. exf4 Bf5 18. Qb2 Re8 19. Kf3 Nd2+ 20. Kg3 -Ne4+ 21. Kh4 Re6 22. Be2 Rh6+ 23. Bh5 Rxh5+ 24. Kxh5 Bg6+ 0-1 - - -[Event "New Orleans"] -[Site "New Orleans"] -[Date "1920.??.??"] -[Round "?"] -[White "Adams, Edwin Ziegler"] -[Black "Torre Repetto, Carlos"] -[Result "1-0"] -[ECO "C62"] -[PlyCount "45"] -[Annotator "ChessPenguin sample"] - -{New Orleans 1920, the famous "overloading" game: White's queen is offered -again and again (Qg4!, Qc4!, Qc7!) until Black's defence breaks. Its -authenticity is debated.} 1. e4 e5 2. Nf3 d6 3. d4 exd4 4. Qxd4 Nc6 5. Bb5 Bd7 -6. Bxc6 Bxc6 7. Nc3 Nf6 8. O-O Be7 9. Nd5 Bxd5 10. exd5 O-O 11. Bg5 c6 12. c4 -cxd5 13. cxd5 Re8 14. Rfe1 a5 15. Re2 Rc8 16. Rae1 Qd7 17. Bxf6 Bxf6 18. Qg4 -Qb5 19. Qc4 Qd7 20. Qc7 Qb5 21. a4 Qxa4 22. Re4 Qb5 23. Qxb7 1-0 - - -[Event "Hastings"] -[Site "Hastings"] -[Date "1922.??.??"] -[Round "?"] -[White "Bogoljubow, Efim"] -[Black "Alekhine, Alexander"] -[Result "0-1"] -[ECO "A90"] -[PlyCount "106"] -[Annotator "ChessPenguin sample"] - -1. d4 f5 2. c4 Nf6 3. g3 e6 4. Bg2 Bb4+ 5. Bd2 Bxd2+ 6. Nxd2 Nc6 7. Ngf3 O-O 8. -O-O d6 9. Qb3 Kh8 10. Qc3 e5 11. e3 a5 12. b3 Qe8 13. a3 Qh5 14. h4 Ng4 15. Ng5 -Bd7 16. f3 Nf6 17. f4 e4 18. Rfd1 h6 19. Nh3 d5 20. Nf1 Ne7 21. a4 Nc6 22. Rd2 -Nb4 23. Bh1 Qe8 24. Rg2 dxc4 25. bxc4 Bxa4 26. Nf2 Bd7 27. Nd2 b5 28. Nd1 Nd3 -29. Rxa5 b4 30. Rxa8 bxc3 31. Rxe8 c2 32. Rxf8+ Kh7 33. Nf2 c1=Q+ 34. Nf1 Ne1 -35. Rh2 Qxc4 36. Rb8 Bb5 37. Rxb5 Qxb5 38. g4 Nf3+ 39. Bxf3 exf3 40. gxf5 Qe2 -41. d5 Kg8 42. h5 Kh7 43. e4 Nxe4 44. Nxe4 Qxe4 45. d6 cxd6 46. f6 gxf6 47. Rd2 -Qe2 48. Rxe2 fxe2 49. Kf2 exf1=Q+ 50. Kxf1 Kg7 51. Kf2 Kf7 52. Ke3 Ke6 53. Ke4 -d5+ 0-1 - - -[Event "Copenhagen 6 Masters"] -[Site "Copenhagen"] -[Date "1923.03.10"] -[Round "7"] -[White "Saemisch, Friedrich"] -[Black "Nimzowitsch, Aron"] -[Result "0-1"] -[ECO "E06"] -[PlyCount "50"] -[Annotator "ChessPenguin sample"] - -{Copenhagen 1923, the "Immortal Zugzwang Game": White resigns with plenty of -material, because every move he can make loses.} 1. d4 Nf6 2. c4 e6 3. Nf3 b6 -4. g3 Bb7 5. Bg2 Be7 6. Nc3 O-O 7. O-O d5 8. Ne5 c6 9. cxd5 cxd5 10. Bf4 a6 11. -Rc1 b5 12. Qb3 Nc6 13. Nxc6 Bxc6 14. h3 Qd7 15. Kh2 Nh5 16. Bd2 f5 17. Qd1 b4 -18. Nb1 Bb5 19. Rg1 Bd6 20. e4 fxe4 21. Qxh5 Rxf2 22. Qg5 Raf8 23. Kh1 R8f5 24. -Qe3 Bd3 25. Rce1 h6 0-1 - - -[Event "New York International Masters-01"] -[Site "New York"] -[Date "1924.03.23"] -[Round "6"] -[White "Capablanca, Jose Raul"] -[Black "Tartakower, Saviely"] -[Result "1-0"] -[ECO "A85"] -[PlyCount "103"] -[Annotator "ChessPenguin sample"] - -{New York 1924. A celebrated rook endgame: Capablanca gives up pawns to bring -his king and rook to the most active squares.} 1. d4 e6 2. Nf3 f5 3. c4 Nf6 4. -Bg5 Be7 5. Nc3 O-O 6. e3 b6 7. Bd3 Bb7 8. O-O Qe8 9. Qe2 Ne4 10. Bxe7 Nxc3 11. -bxc3 Qxe7 12. a4 Bxf3 13. Qxf3 Nc6 14. Rfb1 Rae8 15. Qh3 Rf6 16. f4 Na5 17. Qf3 -d6 18. Re1 Qd7 19. e4 fxe4 20. Qxe4 g6 21. g3 Kf8 22. Kg2 Rf7 23. h4 d5 24. -cxd5 exd5 25. Qxe8+ Qxe8 26. Rxe8+ Kxe8 27. h5 Rf6 28. hxg6 hxg6 29. Rh1 Kf8 -30. Rh7 Rc6 31. g4 Nc4 32. g5 Ne3+ 33. Kf3 Nf5 34. Bxf5 gxf5 35. Kg3 Rxc3+ 36. -Kh4 Rf3 37. g6 Rxf4+ 38. Kg5 Re4 39. Kf6 Kg8 40. Rg7+ Kh8 41. Rxc7 Re8 42. Kxf5 -Re4 43. Kf6 Rf4+ 44. Ke5 Rg4 45. g7+ Kg8 46. Rxa7 Rg1 47. Kxd5 Rc1 48. Kd6 Rc2 -49. d5 Rc1 50. Rc7 Ra1 51. Kc6 Rxa4 52. d6 1-0 - - -[Event "New York"] -[Site "New York"] -[Date "1924.??.??"] -[Round "?"] -[White "Reti, Richard"] -[Black "Capablanca, Jose Raul"] -[Result "1-0"] -[ECO "A15"] -[PlyCount "61"] -[Annotator "ChessPenguin sample"] - -1. Nf3 Nf6 2. c4 g6 3. b4 Bg7 4. Bb2 O-O 5. g3 b6 6. Bg2 Bb7 7. O-O d6 8. d3 -Nbd7 9. Nbd2 e5 10. Qc2 Re8 11. Rfd1 a5 12. a3 h6 13. Nf1 c5 14. b5 Nf8 15. e3 -Qc7 16. d4 Be4 17. Qc3 exd4 18. exd4 N6d7 19. Qd2 cxd4 20. Bxd4 Qxc4 21. Bxg7 -Kxg7 22. Qb2+ Kg8 23. Rxd6 Qc5 24. Rad1 Ra7 25. Ne3 Qh5 26. Nd4 Bxg2 27. Kxg2 -Qe5 28. Nc4 Qc5 29. Nc6 Rc7 30. Ne3 Ne5 31. R1d5 1-0 - - -[Event "Baden-Baden"] -[Site "Baden-Baden"] -[Date "1925.??.??"] -[Round "?"] -[White "Reti, Richard"] -[Black "Alekhine, Alexander"] -[Result "0-1"] -[ECO "A00"] -[PlyCount "84"] -[Annotator "ChessPenguin sample"] - -1. g3 e5 2. Nf3 e4 3. Nd4 d5 4. d3 exd3 5. Qxd3 Nf6 6. Bg2 Bb4+ 7. Bd2 Bxd2+ 8. -Nxd2 O-O 9. c4 Na6 10. cxd5 Nb4 11. Qc4 Nbxd5 12. N2b3 c6 13. O-O Re8 14. Rfd1 -Bg4 15. Rd2 Qc8 16. Nc5 Bh3 17. Bf3 Bg4 18. Bg2 Bh3 19. Bf3 Bg4 20. Bh1 h5 21. -b4 a6 22. Rc1 h4 23. a4 hxg3 24. hxg3 Qc7 25. b5 axb5 26. axb5 Re3 27. Nf3 cxb5 -28. Qxb5 Nc3 29. Qxb7 Qxb7 30. Nxb7 Nxe2+ 31. Kh2 Ne4 32. Rc4 Nxf2 33. Bg2 Be6 -34. Rcc2 Ng4+ 35. Kh3 Ne5+ 36. Kh2 Rxf3 37. Rxe2 Ng4+ 38. Kh3 Ne3+ 39. Kh2 Nxc2 -40. Bxf3 Nd4 41. Rf2 Nxf3+ 42. Rxf3 Bd5 0-1 - - -[Event "Moscow"] -[Site "Moscow"] -[Date "1925.??.??"] -[Round "?"] -[White "Torre Repetto, Carlos"] -[Black "Lasker, Emanuel"] -[Result "1-0"] -[ECO "A46"] -[PlyCount "85"] -[Annotator "ChessPenguin sample"] - -1. d4 Nf6 2. Nf3 e6 3. Bg5 c5 4. e3 cxd4 5. exd4 Be7 6. Nbd2 d6 7. c3 Nbd7 8. -Bd3 b6 9. Nc4 Bb7 10. Qe2 Qc7 11. O-O O-O 12. Rfe1 Rfe8 13. Rad1 Nf8 14. Bc1 -Nd5 15. Ng5 b5 16. Na3 b4 17. cxb4 Nxb4 18. Qh5 Bxg5 19. Bxg5 Nxd3 20. Rxd3 Qa5 -21. b4 Qf5 22. Rg3 h6 23. Nc4 Qd5 24. Ne3 Qb5 25. Bf6 Qxh5 26. Rxg7+ Kh8 27. -Rxf7+ Kg8 28. Rg7+ Kh8 29. Rxb7+ Kg8 30. Rg7+ Kh8 31. Rg5+ Kh7 32. Rxh5 Kg6 33. -Rh3 Kxf6 34. Rxh6+ Kg5 35. Rh3 Reb8 36. Rg3+ Kf6 37. Rf3+ Kg6 38. a3 a5 39. -bxa5 Rxa5 40. Nc4 Rd5 41. Rf4 Nd7 42. Rxe6+ Kg5 43. g3 1-0 - - -[Event "World Championship 13th"] -[Site "Buenos Aires"] -[Date "1927.??.??"] -[Round "34"] -[White "Alekhine, Alexander"] -[Black "Capablanca, Jose Raul"] -[Result "1-0"] -[ECO "D51"] -[PlyCount "163"] -[Annotator "ChessPenguin sample"] - -1. d4 d5 2. c4 e6 3. Nc3 Nf6 4. Bg5 Nbd7 5. e3 c6 6. a3 Be7 7. Nf3 O-O 8. Bd3 -dxc4 9. Bxc4 Nd5 10. Bxe7 Qxe7 11. Ne4 N5f6 12. Ng3 c5 13. O-O Nb6 14. Ba2 cxd4 -15. Nxd4 g6 16. Rc1 Bd7 17. Qe2 Rac8 18. e4 e5 19. Nf3 Kg7 20. h3 h6 21. Qd2 -Be6 22. Bxe6 Qxe6 23. Qa5 Nc4 24. Qxa7 Nxb2 25. Rxc8 Rxc8 26. Qxb7 Nc4 27. Qb4 -Ra8 28. Ra1 Qc6 29. a4 Nxe4 30. Nxe5 Qd6 31. Qxc4 Qxe5 32. Re1 Nd6 33. Qc1 Qf6 -34. Ne4 Nxe4 35. Rxe4 Rb8 36. Re2 Ra8 37. Ra2 Ra5 38. Qc7 Qa6 39. Qc3+ Kh7 40. -Rd2 Qb6 41. Rd7 Qb1+ 42. Kh2 Qb8+ 43. g3 Rf5 44. Qd4 Qe8 45. Rd5 Rf3 46. h4 Qh8 -47. Qb6 Qa1 48. Kg2 Rf6 49. Qd4 Qxd4 50. Rxd4 Kg7 51. a5 Ra6 52. Rd5 Rf6 53. -Rd4 Ra6 54. Ra4 Kf6 55. Kf3 Ke5 56. Ke3 h5 57. Kd3 Kd5 58. Kc3 Kc5 59. Ra2 Kb5 -60. Kb3 Kc5 61. Kc3 Kb5 62. Kd4 Rd6+ 63. Ke5 Re6+ 64. Kf4 Ka6 65. Kg5 Re5+ 66. -Kh6 Rf5 67. f4 Rc5 68. Ra3 Rc7 69. Kg7 Rd7 70. f5 gxf5 71. Kh6 f4 72. gxf4 Rd5 -73. Kg7 Rf5 74. Ra4 Kb5 75. Re4 Ka6 76. Kh6 Rxa5 77. Re5 Ra1 78. Kxh5 Rg1 79. -Rg5 Rh1 80. Rf5 Kb6 81. Rxf7 Kc6 82. Re7 1-0 - - -[Event "Warsaw"] -[Site "Warsaw"] -[Date "1929.??.??"] -[Round "?"] -[White "Glucksberg"] -[Black "Najdorf, Miguel"] -[Result "0-1"] -[ECO "A85"] -[PlyCount "44"] -[Annotator "ChessPenguin sample"] - -1. d4 f5 2. c4 Nf6 3. Nc3 e6 4. Nf3 d5 5. e3 c6 6. Bd3 Bd6 7. O-O O-O 8. Ne2 -Nbd7 9. Ng5 Bxh2+ 10. Kh1 Ng4 11. f4 Qe8 12. g3 Qh5 13. Kg2 Bg1 14. Nxg1 Qh2+ -15. Kf3 e5 16. dxe5 Ndxe5+ 17. fxe5 Nxe5+ 18. Kf4 Ng6+ 19. Kf3 f4 20. exf4 Bg4+ -21. Kxg4 Ne5+ 22. fxe5 h5# 0-1 - - -[Event "San Remo"] -[Site "San Remo"] -[Date "1930.??.??"] -[Round "?"] -[White "Alekhine, Alexander"] -[Black "Nimzowitsch, Aron"] -[Result "1-0"] -[ECO "C17"] -[PlyCount "63"] -[Annotator "ChessPenguin sample"] - -1. e4 e6 2. d4 d5 3. Nc3 Bb4 4. e5 c5 5. Bd2 Ne7 6. Nb5 Bxd2+ 7. Qxd2 O-O 8. c3 -b6 9. f4 Ba6 10. Nf3 Qd7 11. a4 Nbc6 12. b4 cxb4 13. cxb4 Bb7 14. Nd6 f5 15. a5 -Nc8 16. Nxb7 Qxb7 17. a6 Qf7 18. Bb5 N8e7 19. O-O h6 20. Rfc1 Rfc8 21. Rc2 Qe8 -22. Rac1 Rab8 23. Qe3 Rc7 24. Rc3 Qd7 25. R1c2 Kf8 26. Qc1 Rbc8 27. Ba4 b5 28. -Bxb5 Ke8 29. Ba4 Kd8 30. h4 h5 31. Kh2 g6 32. g3 1-0 - - -[Event "World Championship 16th"] -[Site "NLD"] -[Date "1935.??.??"] -[Round "26"] -[White "Euwe, Max"] -[Black "Alekhine, Alexander"] -[Result "1-0"] -[ECO "E18"] -[PlyCount "93"] -[Annotator "ChessPenguin sample"] - -1. d4 e6 2. c4 f5 3. g3 Bb4+ 4. Bd2 Be7 5. Bg2 Nf6 6. Nc3 O-O 7. Nf3 Ne4 8. O-O -b6 9. Qc2 Bb7 10. Ne5 Nxc3 11. Bxc3 Bxg2 12. Kxg2 Qc8 13. d5 d6 14. Nd3 e5 15. -Kh1 c6 16. Qb3 Kh8 17. f4 e4 18. Nb4 c5 19. Nc2 Nd7 20. Ne3 Bf6 21. Nxf5 Bxc3 -22. Nxd6 Qb8 23. Nxe4 Bf6 24. Nd2 g5 25. e4 gxf4 26. gxf4 Bd4 27. e5 Qe8 28. e6 -Rg8 29. Nf3 Qg6 30. Rg1 Bxg1 31. Rxg1 Qf6 32. Ng5 Rg7 33. exd7 Rxd7 34. Qe3 Re7 -35. Ne6 Rf8 36. Qe5 Qxe5 37. fxe5 Rf5 38. Re1 h6 39. Nd8 Rf2 40. e6 Rd2 41. Nc6 -Re8 42. e7 b5 43. Nd8 Kg7 44. Nb7 Kf6 45. Re6+ Kg5 46. Nd6 Rxe7 47. Ne4+ 1-0 - - -[Event "AVRO"] -[Site "Netherlands"] -[Date "1938.11.22"] -[Round "11"] -[White "Botvinnik, Mikhail"] -[Black "Capablanca, Jose Raul"] -[Result "1-0"] -[ECO "E49"] -[PlyCount "81"] -[Annotator "ChessPenguin sample"] - -{AVRO 1938. Botvinnik's best-known combination begins with 30.Ba3!!, deflecting -the black queen.} 1. d4 Nf6 2. c4 e6 3. Nc3 Bb4 4. e3 d5 5. a3 Bxc3+ 6. bxc3 c5 -7. cxd5 exd5 8. Bd3 O-O 9. Ne2 b6 10. O-O Ba6 11. Bxa6 Nxa6 12. Bb2 Qd7 13. a4 -Rfe8 14. Qd3 c4 15. Qc2 Nb8 16. Rae1 Nc6 17. Ng3 Na5 18. f3 Nb3 19. e4 Qxa4 20. -e5 Nd7 21. Qf2 g6 22. f4 f5 23. exf6 Nxf6 24. f5 Rxe1 25. Rxe1 Re8 26. Re6 Rxe6 -27. fxe6 Kg7 28. Qf4 Qe8 29. Qe5 Qe7 30. Ba3 Qxa3 31. Nh5+ gxh5 32. Qg5+ Kf8 -33. Qxf6+ Kg8 34. e7 Qc1+ 35. Kf2 Qc2+ 36. Kg3 Qd3+ 37. Kh4 Qe4+ 38. Kxh5 Qe2+ -39. Kh4 Qe4+ 40. g4 Qe1+ 41. Kh5 1-0 - - -[Event "Candidates Tournament"] -[Site "Zuerich"] -[Date "1953.08.31"] -[Round "2"] -[White "Geller, Efim P"] -[Black "Euwe, Max"] -[Result "0-1"] -[ECO "E28"] -[PlyCount "52"] -[Annotator "ChessPenguin sample"] - -{Candidates tournament, Zurich 1953. Former world champion Euwe answers -Geller's kingside attack with a precise counter-attack.} 1. d4 Nf6 2. c4 e6 3. -Nc3 Bb4 4. e3 c5 5. a3 Bxc3+ 6. bxc3 b6 7. Bd3 Bb7 8. f3 Nc6 9. Ne2 O-O 10. O-O -Na5 11. e4 Ne8 12. Ng3 cxd4 13. cxd4 Rc8 14. f4 Nxc4 15. f5 f6 16. Rf4 b5 17. -Rh4 Qb6 18. e5 Nxe5 19. fxe6 Nxd3 20. Qxd3 Qxe6 21. Qxh7+ Kf7 22. Bh6 Rh8 23. -Qxh8 Rc2 24. Rc1 Rxg2+ 25. Kf1 Qb3 26. Ke1 Qf3 0-1 - - -[Event "Candidates Tournament"] -[Site "Zuerich"] -[Date "1953.09.23"] -[Round "14"] -[White "Averbakh, Yuri L"] -[Black "Kotov, Alexander"] -[Result "0-1"] -[ECO "A55"] -[PlyCount "102"] -[Annotator "ChessPenguin sample"] - -{Candidates tournament, Zurich 1953. Kotov's queen sacrifice 30...Qxh3+!! -drives the white king up the board to its death.} 1. d4 Nf6 2. c4 d6 3. Nf3 -Nbd7 4. Nc3 e5 5. e4 Be7 6. Be2 O-O 7. O-O c6 8. Qc2 Re8 9. Rd1 Bf8 10. Rb1 a5 -11. d5 Nc5 12. Be3 Qc7 13. h3 Bd7 14. Rbc1 g6 15. Nd2 Rab8 16. Nb3 Nxb3 17. -Qxb3 c5 18. Kh2 Kh8 19. Qc2 Ng8 20. Bg4 Nh6 21. Bxd7 Qxd7 22. Qd2 Ng8 23. g4 f5 -24. f3 Be7 25. Rg1 Rf8 26. Rcf1 Rf7 27. gxf5 gxf5 28. Rg2 f4 29. Bf2 Rf6 30. -Ne2 Qxh3+ 31. Kxh3 Rh6+ 32. Kg4 Nf6+ 33. Kf5 Nd7 34. Rg5 Rf8+ 35. Kg4 Nf6+ 36. -Kf5 Ng8+ 37. Kg4 Nf6+ 38. Kf5 Nxd5+ 39. Kg4 Nf6+ 40. Kf5 Ng8+ 41. Kg4 Nf6+ 42. -Kf5 Ng8+ 43. Kg4 Bxg5 44. Kxg5 Rf7 45. Bh4 Rg6+ 46. Kh5 Rfg7 47. Bg5 Rxg5+ 48. -Kh4 Nf6 49. Ng3 Rxg3 50. Qxd6 R3g6 51. Qb8+ Rg8 0-1 - - -[Event "World Championship 20th"] -[Site "Moscow"] -[Date "1954.??.??"] -[Round "14"] -[White "Botvinnik, Mikhail"] -[Black "Smyslov, Vassily V"] -[Result "0-1"] -[ECO "E68"] -[PlyCount "66"] -[Annotator "ChessPenguin sample"] - -1. d4 Nf6 2. c4 g6 3. g3 Bg7 4. Bg2 O-O 5. Nc3 d6 6. Nf3 Nbd7 7. O-O e5 8. e4 -c6 9. Be3 Ng4 10. Bg5 Qb6 11. h3 exd4 12. Na4 Qa6 13. hxg4 b5 14. Nxd4 bxa4 15. -Nxc6 Qxc6 16. e5 Qxc4 17. Bxa8 Nxe5 18. Rc1 Qb4 19. a3 Qxb2 20. Qxa4 Bb7 21. -Rb1 Nf3+ 22. Kh1 Bxa8 23. Rxb2 Nxg5+ 24. Kh2 Nf3+ 25. Kh3 Bxb2 26. Qxa7 Be4 27. -a4 Kg7 28. Rd1 Be5 29. Qe7 Rc8 30. a5 Rc2 31. Kg2 Nd4+ 32. Kf1 Bf3 33. Rb1 Nc6 -0-1 - - -[Event "New York Rosenwald-03"] -[Site "New York"] -[Date "1956.10.17"] -[Round "8"] -[White "Byrne, Donald"] -[Black "Fischer, Robert James"] -[Result "0-1"] -[ECO "D92"] -[PlyCount "82"] -[Annotator "ChessPenguin sample"] - -{New York 1956, "The Game of the Century": 13-year-old Bobby Fischer gives up -his queen with 17...Be6!! and his pieces mate the white king.} 1. Nf3 Nf6 2. c4 -g6 3. Nc3 Bg7 4. d4 O-O 5. Bf4 d5 6. Qb3 dxc4 7. Qxc4 c6 8. e4 Nbd7 9. Rd1 Nb6 -10. Qc5 Bg4 11. Bg5 Na4 12. Qa3 Nxc3 13. bxc3 Nxe4 14. Bxe7 Qb6 15. Bc4 Nxc3 -16. Bc5 Rfe8+ 17. Kf1 Be6 18. Bxb6 Bxc4+ 19. Kg1 Ne2+ 20. Kf1 Nxd4+ 21. Kg1 -Ne2+ 22. Kf1 Nc3+ 23. Kg1 axb6 24. Qb4 Ra4 25. Qxb6 Nxd1 26. h3 Rxa2 27. Kh2 -Nxf2 28. Re1 Rxe1 29. Qd8+ Bf8 30. Nxe1 Bd5 31. Nf3 Ne4 32. Qb8 b5 33. h4 h5 -34. Ne5 Kg7 35. Kg1 Bc5+ 36. Kf1 Ng3+ 37. Ke1 Bb4+ 38. Kd1 Bb3+ 39. Kc1 Ne2+ -40. Kb1 Nc3+ 41. Kc1 Rc2# 0-1 - - -[Event "RSFSR-ch18"] -[Site "Sochi"] -[Date "1958.??.??"] -[Round "?"] -[White "Polugaevsky, Lev"] -[Black "Nezhmetdinov, Rashid"] -[Result "0-1"] -[ECO "A53"] -[PlyCount "66"] -[Annotator "ChessPenguin sample"] - -{Sochi 1958. One of the most admired attacking games: Nezhmetdinov sacrifices -material again and again around White's king.} 1. d4 Nf6 2. c4 d6 3. Nc3 e5 4. -e4 exd4 5. Qxd4 Nc6 6. Qd2 g6 7. b3 Bg7 8. Bb2 O-O 9. Bd3 Ng4 10. Nge2 Qh4 11. -Ng3 Nge5 12. O-O f5 13. f3 Bh6 14. Qd1 f4 15. Nge2 g5 16. Nd5 g4 17. g3 fxg3 -18. hxg3 Qh3 19. f4 Be6 20. Bc2 Rf7 21. Kf2 Qh2+ 22. Ke3 Bxd5 23. cxd5 Nb4 24. -Rh1 Rxf4 25. Rxh2 Rf3+ 26. Kd4 Bg7 27. a4 c5+ 28. dxc6 bxc6 29. Bd3 Nexd3+ 30. -Kc4 d5+ 31. exd5 cxd5+ 32. Kb5 Rb8+ 33. Ka5 Nc6+ 0-1 - - -[Event "Candidates Tournament"] -[Site "Bled/Zagreb/Belgrade"] -[Date "1959.09.18"] -[Round "8"] -[White "Tal, Mihail"] -[Black "Smyslov, Vassily V"] -[Result "1-0"] -[ECO "B10"] -[PlyCount "51"] -[Annotator "ChessPenguin sample"] - -{Candidates tournament 1959, which Tal went on to win: the magician from Riga -at his most daring against a former world champion.} 1. e4 c6 2. d3 d5 3. Nd2 -e5 4. Ngf3 Nd7 5. d4 dxe4 6. Nxe4 exd4 7. Qxd4 Ngf6 8. Bg5 Be7 9. O-O-O O-O 10. -Nd6 Qa5 11. Bc4 b5 12. Bd2 Qa6 13. Nf5 Bd8 14. Qh4 bxc4 15. Qg5 Nh5 16. Nh6+ -Kh8 17. Qxh5 Qxa2 18. Bc3 Nf6 19. Qxf7 Qa1+ 20. Kd2 Rxf7 21. Nxf7+ Kg8 22. Rxa1 -Kxf7 23. Ne5+ Ke6 24. Nxc6 Ne4+ 25. Ke3 Bb6+ 26. Bd4 1-0 - - -[Event "Candidats Tournament"] -[Site "Bled/Zagreb/Belgrade"] -[Date "1959.??.??"] -[Round "16"] -[White "Fischer, Robert James"] -[Black "Petrosian, Tigran V"] -[Result "1/2-1/2"] -[ECO "B11"] -[PlyCount "96"] -[Annotator "ChessPenguin sample"] - -1. e4 c6 2. Nc3 d5 3. Nf3 Bg4 4. h3 Bxf3 5. Qxf3 Nf6 6. d3 e6 7. g3 Bb4 8. Bd2 -d4 9. Nb1 Bxd2+ 10. Nxd2 e5 11. Bg2 c5 12. O-O Nc6 13. Qe2 Qe7 14. f4 O-O-O 15. -a3 Ne8 16. b4 cxb4 17. Nc4 f6 18. fxe5 fxe5 19. axb4 Nc7 20. Na5 Nb5 21. Nxc6 -bxc6 22. Rf2 g6 23. h4 Kb7 24. h5 Qxb4 25. Rf7+ Kb6 26. Qf2 a5 27. c4 Nc3 28. -Rf1 a4 29. Qf6 Qc5 30. Rxh7 Rdf8 31. Qxg6 Rxf1+ 32. Bxf1 Rxh7 33. Qxh7 a3 34. -h6 a2 35. Qg8 a1=Q 36. h7 Qd6 37. h8=Q Qa7 38. g4 Kc5 39. Qf8 Qae7 40. Qa8 Kb4 -41. Qh2 Kb3 42. Qa1 Qa3 43. Qxa3+ Kxa3 44. Qh6 Qf7 45. Kg2 Kb3 46. Qd2 Qh7 47. -Kg3 Qxe4 48. Qf2 Qh1 1/2-1/2 - - -[Event "URS-ch27 Final"] -[Site "Leningrad"] -[Date "1960.02.20"] -[Round "16"] -[White "Spassky, Boris Vasilievich"] -[Black "Bronstein, David Ionovich"] -[Result "1-0"] -[ECO "C36"] -[PlyCount "45"] -[Annotator "ChessPenguin sample"] - -{USSR Championship 1960. A King's Gambit with a sacrificial attack; the final -position was used in the James Bond film "From Russia with Love".} 1. e4 e5 2. -f4 exf4 3. Nf3 d5 4. exd5 Bd6 5. Nc3 Ne7 6. d4 O-O 7. Bd3 Nd7 8. O-O h6 9. Ne4 -Nxd5 10. c4 Ne3 11. Bxe3 fxe3 12. c5 Be7 13. Bc2 Re8 14. Qd3 e2 15. Nd6 Nf8 16. -Nxf7 exf1=Q+ 17. Rxf1 Bf5 18. Qxf5 Qd7 19. Qf4 Bf6 20. N3e5 Qe7 21. Bb3 Bxe5 -22. Nxe5+ Kh7 23. Qe4+ 1-0 - - -[Event "World Championship 23th"] -[Site "Moscow"] -[Date "1960.??.??"] -[Round "1"] -[White "Tal, Mihail"] -[Black "Botvinnik, Mikhail"] -[Result "1-0"] -[ECO "C18"] -[PlyCount "63"] -[Annotator "ChessPenguin sample"] - -1. e4 e6 2. d4 d5 3. Nc3 Bb4 4. e5 c5 5. a3 Bxc3+ 6. bxc3 Qc7 7. Qg4 f5 8. Qg3 -Ne7 9. Qxg7 Rg8 10. Qxh7 cxd4 11. Kd1 Bd7 12. Qh5+ Ng6 13. Ne2 d3 14. cxd3 Ba4+ -15. Ke1 Qxe5 16. Bg5 Nc6 17. d4 Qc7 18. h4 e5 19. Rh3 Qf7 20. dxe5 Ncxe5 21. -Re3 Kd7 22. Rb1 b6 23. Nf4 Rae8 24. Rb4 Bc6 25. Qd1 Nxf4 26. Rxf4 Ng6 27. Rd4 -Rxe3+ 28. fxe3 Kc7 29. c4 dxc4 30. Bxc4 Qg7 31. Bxg8 Qxg8 32. h5 1-0 - - -[Event "World Championship 23th"] -[Site "Moscow"] -[Date "1960.??.??"] -[Round "6"] -[White "Botvinnik, Mikhail"] -[Black "Tal, Mihail"] -[Result "0-1"] -[ECO "E69"] -[PlyCount "92"] -[Annotator "ChessPenguin sample"] - -1. c4 Nf6 2. Nf3 g6 3. g3 Bg7 4. Bg2 O-O 5. d4 d6 6. Nc3 Nbd7 7. O-O e5 8. e4 -c6 9. h3 Qb6 10. d5 cxd5 11. cxd5 Nc5 12. Ne1 Bd7 13. Nd3 Nxd3 14. Qxd3 Rfc8 -15. Rb1 Nh5 16. Be3 Qb4 17. Qe2 Rc4 18. Rfc1 Rac8 19. Kh2 f5 20. exf5 Bxf5 21. -Ra1 Nf4 22. gxf4 exf4 23. Bd2 Qxb2 24. Rab1 f3 25. Rxb2 fxe2 26. Rb3 Rd4 27. -Be1 Be5+ 28. Kg1 Bf4 29. Nxe2 Rxc1 30. Nxd4 Rxe1+ 31. Bf1 Be4 32. Ne2 Be5 33. -f4 Bf6 34. Rxb7 Bxd5 35. Rc7 Bxa2 36. Rxa7 Bc4 37. Ra8+ Kf7 38. Ra7+ Ke6 39. -Ra3 d5 40. Kf2 Bh4+ 41. Kg2 Kd6 42. Ng3 Bxg3 43. Bxc4 dxc4 44. Kxg3 Kd5 45. Ra7 -c3 46. Rc7 Kd4 0-1 - - -[Event "Mar del Plata"] -[Site "Mar del Plata"] -[Date "1960.??.??"] -[Round "2"] -[White "Spassky, Boris Vasilievich"] -[Black "Fischer, Robert James"] -[Result "1-0"] -[ECO "C39"] -[PlyCount "57"] -[Annotator "ChessPenguin sample"] - -1. e4 e5 2. f4 exf4 3. Nf3 g5 4. h4 g4 5. Ne5 Nf6 6. d4 d6 7. Nd3 Nxe4 8. Bxf4 -Bg7 9. Nc3 Nxc3 10. bxc3 c5 11. Be2 cxd4 12. O-O Nc6 13. Bxg4 O-O 14. Bxc8 Rxc8 -15. Qg4 f5 16. Qg3 dxc3 17. Rae1 Kh8 18. Kh1 Rg8 19. Bxd6 Bf8 20. Be5+ Nxe5 21. -Qxe5+ Rg7 22. Rxf5 Qxh4+ 23. Kg1 Qg4 24. Rf2 Be7 25. Re4 Qg5 26. Qd4 Rf8 27. -Re5 Rd8 28. Qe4 Qh4 29. Rf4 1-0 - - -[Event "Bled"] -[Site "Bled"] -[Date "1961.??.??"] -[Round "6"] -[White "Petrosian, Tigran V"] -[Black "Pachman, Ludek"] -[Result "1-0"] -[ECO "A04"] -[PlyCount "41"] -[Annotator "ChessPenguin sample"] - -1. Nf3 c5 2. g3 Nc6 3. Bg2 g6 4. O-O Bg7 5. d3 e6 6. e4 Nge7 7. Re1 O-O 8. e5 -d6 9. exd6 Qxd6 10. Nbd2 Qc7 11. Nb3 Nd4 12. Bf4 Qb6 13. Ne5 Nxb3 14. Nc4 Qb5 -15. axb3 a5 16. Bd6 Bf6 17. Qf3 Kg7 18. Re4 Rd8 19. Qxf6+ Kxf6 20. Be5+ Kg5 21. -Bg7 1-0 - - -[Event "RSFSR Chigorin Cup"] -[Site "Rostov on Don"] -[Date "1962.??.??"] -[Round "?"] -[White "Nezhmetdinov, Rashid"] -[Black "Chernikov, Oleg L"] -[Result "1-0"] -[ECO "B35"] -[PlyCount "65"] -[Annotator "ChessPenguin sample"] - -{Rostov-on-Don 1962. Nezhmetdinov gives up his queen for two minor pieces with -12.Qxf6!! and attacks for twenty more moves.} 1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. -Nxd4 g6 5. Nc3 Bg7 6. Be3 Nf6 7. Bc4 O-O 8. Bb3 Ng4 9. Qxg4 Nxd4 10. Qh4 Qa5 -11. O-O Bf6 12. Qxf6 Ne2+ 13. Nxe2 exf6 14. Nc3 Re8 15. Nd5 Kg7 16. Bd4 Re6 17. -Rad1 d6 18. Rd3 Bd7 19. Rf3 Bb5 20. Bc3 Qd8 21. Nxf6 Be2 22. Nxh7+ Kg8 23. Rh3 -Re5 24. f4 Bxf1 25. Kxf1 Rc8 26. Bd4 b5 27. Ng5 Rc7 28. Bxf7+ Rxf7 29. Rh8+ -Kxh8 30. Nxf7+ Kh7 31. Nxd8 Rxe4 32. Nc6 Rxf4+ 33. Ke2 1-0 - - -[Event "WchT U26"] -[Site "Marianske Lazne"] -[Date "1962.??.??"] -[Round "?"] -[White "Gufeld, Eduard"] -[Black "Kavalek, Lubomir"] -[Result "0-1"] -[ECO "C64"] -[PlyCount "64"] -[Annotator "ChessPenguin sample"] - -1. e4 e5 2. Nf3 Nc6 3. Bb5 Bc5 4. c3 f5 5. d4 fxe4 6. Ng5 Bb6 7. d5 e3 8. Ne4 -Qh4 9. Qf3 Nf6 10. Nxf6+ gxf6 11. dxc6 exf2+ 12. Kd1 dxc6 13. Be2 Be6 14. Qh5+ -Qxh5 15. Bxh5+ Ke7 16. b3 Bd5 17. Ba3+ Ke6 18. Bg4+ f5 19. Bh3 Rhg8 20. Nd2 -Bxg2 21. Bxg2 Rxg2 22. Rf1 Rd8 23. Ke2 Rxd2+ 24. Kxd2 e4 25. Bf8 f4 26. b4 Rg5 -27. Bc5 Rxc5 28. bxc5 Bxc5 29. Rab1 f3 30. Rb4 Kf5 31. Rd4 Bxd4 32. cxd4 Kf4 -0-1 - - -[Event "USA-ch"] -[Site "New York"] -[Date "1963.12.18"] -[Round "3"] -[White "Byrne, Robert Eugene"] -[Black "Fischer, Robert James"] -[Result "0-1"] -[ECO "D71"] -[PlyCount "42"] -[Annotator "ChessPenguin sample"] - -{US Championship 1963/64, which Fischer won with 11 out of 11. Here his attack -is so deep that the commentators in the press room thought Black was lost; -Byrne resigned first.} 1. d4 Nf6 2. c4 g6 3. g3 c6 4. Bg2 d5 5. cxd5 cxd5 6. -Nc3 Bg7 7. e3 O-O 8. Nge2 Nc6 9. O-O b6 10. b3 Ba6 11. Ba3 Re8 12. Qd2 e5 13. -dxe5 Nxe5 14. Rfd1 Nd3 15. Qc2 Nxf2 16. Kxf2 Ng4+ 17. Kg1 Nxe3 18. Qd2 Nxg2 19. -Kxg2 d4 20. Nxd4 Bb7+ 21. Kf1 Qd7 0-1 - - -[Event "USA-ch"] -[Site "New York"] -[Date "1963.??.??"] -[Round "10"] -[White "Fischer, Robert James"] -[Black "Benko, Pal C"] -[Result "1-0"] -[ECO "B09"] -[PlyCount "41"] -[Annotator "ChessPenguin sample"] - -1. e4 g6 2. d4 Bg7 3. Nc3 d6 4. f4 Nf6 5. Nf3 O-O 6. Bd3 Bg4 7. h3 Bxf3 8. Qxf3 -Nc6 9. Be3 e5 10. dxe5 dxe5 11. f5 gxf5 12. Qxf5 Nd4 13. Qf2 Ne8 14. O-O Nd6 -15. Qg3 Kh8 16. Qg4 c6 17. Qh5 Qe8 18. Bxd4 exd4 19. Rf6 Kg8 20. e5 h6 21. Ne2 -1-0 - - -[Event "Candidats sf1"] -[Site "Bled"] -[Date "1965.??.??"] -[Round "10"] -[White "Tal, Mihail"] -[Black "Larsen, Bent"] -[Result "1-0"] -[ECO "B82"] -[PlyCount "73"] -[Annotator "ChessPenguin sample"] - -1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. Nxd4 e6 5. Nc3 d6 6. Be3 Nf6 7. f4 Be7 8. Qf3 -O-O 9. O-O-O Qc7 10. Ndb5 Qb8 11. g4 a6 12. Nd4 Nxd4 13. Bxd4 b5 14. g5 Nd7 15. -Bd3 b4 16. Nd5 exd5 17. exd5 f5 18. Rde1 Rf7 19. h4 Bb7 20. Bxf5 Rxf5 21. Rxe7 -Ne5 22. Qe4 Qf8 23. fxe5 Rf4 24. Qe3 Rf3 25. Qe2 Qxe7 26. Qxf3 dxe5 27. Re1 Rd8 -28. Rxe5 Qd6 29. Qf4 Rf8 30. Qe4 b3 31. axb3 Rf1+ 32. Kd2 Qb4+ 33. c3 Qd6 34. -Bc5 Qxc5 35. Re8+ Rf8 36. Qe6+ Kh8 37. Qf7 1-0 - - -[Event "World-ch25 Petrosian-Spassky +4-3=17"] -[Site "Moscow"] -[Date "1966.05.02"] -[Round "10"] -[White "Petrosian, Tigran V"] -[Black "Spassky, Boris Vasilievich"] -[Result "1-0"] -[ECO "E66"] -[PlyCount "59"] -[Annotator "ChessPenguin sample"] - -{World Championship 1966, game 10. Petrosian, known for defence, finishes with -the queen sacrifice 30.Qh8+!!} 1. Nf3 Nf6 2. g3 g6 3. c4 Bg7 4. Bg2 O-O 5. O-O -Nc6 6. Nc3 d6 7. d4 a6 8. d5 Na5 9. Nd2 c5 10. Qc2 e5 11. b3 Ng4 12. e4 f5 13. -exf5 gxf5 14. Nd1 b5 15. f3 e4 16. Bb2 exf3 17. Bxf3 Bxb2 18. Qxb2 Ne5 19. Be2 -f4 20. gxf4 Bh3 21. Ne3 Bxf1 22. Rxf1 Ng6 23. Bg4 Nxf4 24. Rxf4 Rxf4 25. Be6+ -Rf7 26. Ne4 Qh4 27. Nxd6 Qg5+ 28. Kh1 Ra7 29. Bxf7+ Rxf7 30. Qh8+ 1-0 - - -[Event "Sousse Interzonal+"] -[Site "Sousse"] -[Date "1967.??.??"] -[Round "3"] -[White "Fischer, Robert James"] -[Black "Myagmarsuren, Lhamsuren"] -[Result "1-0"] -[ECO "A08"] -[PlyCount "61"] -[Annotator "ChessPenguin sample"] - -1. e4 e6 2. d3 d5 3. Nd2 Nf6 4. g3 c5 5. Bg2 Nc6 6. Ngf3 Be7 7. O-O O-O 8. e5 -Nd7 9. Re1 b5 10. Nf1 b4 11. h4 a5 12. Bf4 a4 13. a3 bxa3 14. bxa3 Na5 15. Ne3 -Ba6 16. Bh3 d4 17. Nf1 Nb6 18. Ng5 Nd5 19. Bd2 Bxg5 20. Bxg5 Qd7 21. Qh5 Rfc8 -22. Nd2 Nc3 23. Bf6 Qe8 24. Ne4 g6 25. Qg5 Nxe4 26. Rxe4 c4 27. h5 cxd3 28. Rh4 -Ra7 29. Bg2 dxc2 30. Qh6 Qf8 31. Qxh7+ 1-0 - - -[Event "Monaco Grand Prix-02 GM"] -[Site "Monte Carlo"] -[Date "1968.04.09"] -[Round "7"] -[White "Botvinnik, Mikhail"] -[Black "Portisch, Lajos"] -[Result "1-0"] -[ECO "A29"] -[PlyCount "51"] -[Annotator "ChessPenguin sample"] - -{Monaco 1968. One of Botvinnik's most celebrated attacks: a series of -sacrifices opens the black king.} 1. c4 e5 2. Nc3 Nf6 3. g3 d5 4. cxd5 Nxd5 5. -Bg2 Be6 6. Nf3 Nc6 7. O-O Nb6 8. d3 Be7 9. a3 a5 10. Be3 O-O 11. Na4 Nxa4 12. -Qxa4 Bd5 13. Rfc1 Re8 14. Rc2 Bf8 15. Rac1 Nb8 16. Rxc7 Bc6 17. R1xc6 bxc6 18. -Rxf7 h6 19. Rb7 Qc8 20. Qc4+ Kh8 21. Nh4 Qxb7 22. Ng6+ Kh7 23. Be4 Bd6 24. -Nxe5+ g6 25. Bxg6+ Kg7 26. Bxh6+ 1-0 - - -[Event "World Championship 27th"] -[Site "Moscow"] -[Date "1969.??.??"] -[Round "19"] -[White "Spassky, Boris Vasilievich"] -[Black "Petrosian, Tigran V"] -[Result "1-0"] -[ECO "B94"] -[PlyCount "47"] -[Annotator "ChessPenguin sample"] - -1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 a6 6. Bg5 Nbd7 7. Bc4 Qa5 8. -Qd2 h6 9. Bxf6 Nxf6 10. O-O-O e6 11. Rhe1 Be7 12. f4 O-O 13. Bb3 Re8 14. Kb1 -Bf8 15. g4 Nxg4 16. Qg2 Nf6 17. Rg1 Bd7 18. f5 Kh8 19. Rdf1 Qd8 20. fxe6 fxe6 -21. e5 dxe5 22. Ne4 Nh5 23. Qg6 exd4 24. Ng5 1-0 - - -[Event "Match/Team URS-World 20,5-19,5"] -[Site "Belgrade"] -[Date "1970.03.29"] -[Round "2.1"] -[White "Larsen, Bent"] -[Black "Spassky, Boris Vasilievich"] -[Result "0-1"] -[WhiteElo "2650"] -[BlackElo "2670"] -[ECO "A01"] -[PlyCount "34"] -[Annotator "ChessPenguin sample"] - -{USSR v Rest of the World, Belgrade 1970. Spassky crushes Larsen in 17 moves; -14...Rh1!! is the key blow.} 1. b3 e5 2. Bb2 Nc6 3. c4 Nf6 4. Nf3 e4 5. Nd4 Bc5 -6. Nxc6 dxc6 7. e3 Bf5 8. Qc2 Qe7 9. Be2 O-O-O 10. f4 Ng4 11. g3 h5 12. h3 h4 -13. hxg4 hxg3 14. Rg1 Rh1 15. Rxh1 g2 16. Rf1 Qh4+ 17. Kd1 gxf1=Q+ 0-1 - - -[Event "Candidats qf3"] -[Site "Vancouver"] -[Date "1971.??.??"] -[Round "4"] -[White "Fischer, Robert James"] -[Black "Taimanov, Mark E"] -[Result "1-0"] -[ECO "B47"] -[PlyCount "141"] -[Annotator "ChessPenguin sample"] - -1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. Nxd4 Qc7 5. Nc3 e6 6. g3 a6 7. Bg2 Nf6 8. O-O -Nxd4 9. Qxd4 Bc5 10. Bf4 d6 11. Qd2 h6 12. Rad1 e5 13. Be3 Bg4 14. Bxc5 dxc5 -15. f3 Be6 16. f4 Rd8 17. Nd5 Bxd5 18. exd5 e4 19. Rfe1 Rxd5 20. Rxe4+ Kd8 21. -Qe2 Rxd1+ 22. Qxd1+ Qd7 23. Qxd7+ Kxd7 24. Re5 b6 25. Bf1 a5 26. Bc4 Rf8 27. -Kg2 Kd6 28. Kf3 Nd7 29. Re3 Nb8 30. Rd3+ Kc7 31. c3 Nc6 32. Re3 Kd6 33. a4 Ne7 -34. h3 Nc6 35. h4 h5 36. Rd3+ Kc7 37. Rd5 f5 38. Rd2 Rf6 39. Re2 Kd7 40. Re3 g6 -41. Bb5 Rd6 42. Ke2 Kd8 43. Rd3 Kc7 44. Rxd6 Kxd6 45. Kd3 Ne7 46. Be8 Kd5 47. -Bf7+ Kd6 48. Kc4 Kc6 49. Be8+ Kb7 50. Kb5 Nc8 51. Bc6+ Kc7 52. Bd5 Ne7 53. Bf7 -Kb7 54. Bb3 Ka7 55. Bd1 Kb7 56. Bf3+ Kc7 57. Ka6 Nc8 58. Bd5 Ne7 59. Bc4 Nc6 -60. Bf7 Ne7 61. Be8 Kd8 62. Bxg6 Nxg6 63. Kxb6 Kd7 64. Kxc5 Ne7 65. b4 axb4 66. -cxb4 Nc8 67. a5 Nd6 68. b5 Ne4+ 69. Kb6 Kc8 70. Kc6 Kb8 71. b6 1-0 - - -[Event "World-ch27 Fischer-Spassky +7-3=11"] -[Site "Reykjavik"] -[Date "1972.07.23"] -[Round "6"] -[White "Fischer, Robert James"] -[Black "Spassky, Boris Vasilievich"] -[Result "1-0"] -[WhiteElo "2785"] -[BlackElo "2660"] -[ECO "D59"] -[PlyCount "81"] -[Annotator "ChessPenguin sample"] - -{World Championship 1972, game 6. Fischer surprises with 1.c4 and plays a model -Queen's Gambit; Spassky reportedly joined the audience's applause.} 1. c4 e6 2. -Nf3 d5 3. d4 Nf6 4. Nc3 Be7 5. Bg5 O-O 6. e3 h6 7. Bh4 b6 8. cxd5 Nxd5 9. Bxe7 -Qxe7 10. Nxd5 exd5 11. Rc1 Be6 12. Qa4 c5 13. Qa3 Rc8 14. Bb5 a6 15. dxc5 bxc5 -16. O-O Ra7 17. Be2 Nd7 18. Nd4 Qf8 19. Nxe6 fxe6 20. e4 d4 21. f4 Qe7 22. e5 -Rb8 23. Bc4 Kh8 24. Qh3 Nf8 25. b3 a5 26. f5 exf5 27. Rxf5 Nh7 28. Rcf1 Qd8 29. -Qg3 Re7 30. h4 Rbb7 31. e6 Rbc7 32. Qe5 Qe8 33. a4 Qd8 34. R1f2 Qe8 35. R2f3 -Qd8 36. Bd3 Qe8 37. Qe4 Nf6 38. Rxf6 gxf6 39. Rxf6 Kg8 40. Bc4 Kh8 41. Qf4 1-0 - - -[Event "World Championship 28th"] -[Site "Reykjavik"] -[Date "1972.??.??"] -[Round "13"] -[White "Spassky, Boris Vasilievich"] -[Black "Fischer, Robert James"] -[Result "0-1"] -[ECO "B04"] -[PlyCount "148"] -[Annotator "ChessPenguin sample"] - -1. e4 Nf6 2. e5 Nd5 3. d4 d6 4. Nf3 g6 5. Bc4 Nb6 6. Bb3 Bg7 7. Nbd2 O-O 8. h3 -a5 9. a4 dxe5 10. dxe5 Na6 11. O-O Nc5 12. Qe2 Qe8 13. Ne4 Nbxa4 14. Bxa4 Nxa4 -15. Re1 Nb6 16. Bd2 a4 17. Bg5 h6 18. Bh4 Bf5 19. g4 Be6 20. Nd4 Bc4 21. Qd2 -Qd7 22. Rad1 Rfe8 23. f4 Bd5 24. Nc5 Qc8 25. Qc3 e6 26. Kh2 Nd7 27. Nd3 c5 28. -Nb5 Qc6 29. Nd6 Qxd6 30. exd6 Bxc3 31. bxc3 f6 32. g5 hxg5 33. fxg5 f5 34. Bg3 -Kf7 35. Ne5+ Nxe5 36. Bxe5 b5 37. Rf1 Rh8 38. Bf6 a3 39. Rf4 a2 40. c4 Bxc4 41. -d7 Bd5 42. Kg3 Ra3+ 43. c3 Rha8 44. Rh4 e5 45. Rh7+ Ke6 46. Re7+ Kd6 47. Rxe5 -Rxc3+ 48. Kf2 Rc2+ 49. Ke1 Kxd7 50. Rexd5+ Kc6 51. Rd6+ Kb7 52. Rd7+ Ka6 53. -R7d2 Rxd2 54. Kxd2 b4 55. h4 Kb5 56. h5 c4 57. Ra1 gxh5 58. g6 h4 59. g7 h3 60. -Be7 Rg8 61. Bf8 h2 62. Kc2 Kc6 63. Rd1 b3+ 64. Kc3 h1=Q 65. Rxh1 Kd5 66. Kb2 f4 -67. Rd1+ Ke4 68. Rc1 Kd3 69. Rd1+ Ke2 70. Rc1 f3 71. Bc5 Rxg7 72. Rxc4 Rd7 73. -Re4+ Kf1 74. Bd4 f2 0-1 - - -[Event "Petropolis Interzonal"] -[Site "Petropolis"] -[Date "1973.??.??"] -[Round "11"] -[White "Bronstein, David Ionovich"] -[Black "Ljubojevic, Ljubomir"] -[Result "1-0"] -[ECO "B03"] -[PlyCount "81"] -[Annotator "ChessPenguin sample"] - -1. e4 Nf6 2. e5 Nd5 3. d4 d6 4. c4 Nb6 5. f4 dxe5 6. fxe5 c5 7. d5 e6 8. Nc3 -exd5 9. cxd5 c4 10. Nf3 Bg4 11. Qd4 Bxf3 12. gxf3 Bb4 13. Bxc4 O-O 14. Rg1 g6 -15. Bg5 Qc7 16. Bb3 Bc5 17. Qf4 Bxg1 18. d6 Qc8 19. Ke2 Bc5 20. Ne4 N8d7 21. -Rc1 Qc6 22. Rxc5 Nxc5 23. Nf6+ Kh8 24. Qh4 Qb5+ 25. Ke3 h5 26. Nxh5 Qxb3+ 27. -axb3 Nd5+ 28. Kd4 Ne6+ 29. Kxd5 Nxg5 30. Nf6+ Kg7 31. Qxg5 Rfd8 32. e6 fxe6+ -33. Kxe6 Rf8 34. d7 a5 35. Ng4 Ra6+ 36. Ke5 Rf5+ 37. Qxf5 gxf5 38. d8=Q fxg4 -39. Qd7+ Kh6 40. Qxb7 Rg6 41. f4 1-0 - - -[Event "Olympiad-21 Final A"] -[Site "Nice"] -[Date "1974.06.17"] -[Round "3"] -[White "Karpov, Anatoly"] -[Black "Unzicker, Wolfgang"] -[Result "1-0"] -[ECO "C98"] -[PlyCount "87"] -[Annotator "ChessPenguin sample"] - -{Nice Olympiad 1974. A model of positional play: Karpov slowly squeezes Black -until there is nothing left to do.} 1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. -O-O Be7 6. Re1 b5 7. Bb3 d6 8. c3 O-O 9. h3 Na5 10. Bc2 c5 11. d4 Qc7 12. Nbd2 -Nc6 13. d5 Nd8 14. a4 Rb8 15. axb5 axb5 16. b4 Nb7 17. Nf1 Bd7 18. Be3 Ra8 19. -Qd2 Rfc8 20. Bd3 g6 21. Ng3 Bf8 22. Ra2 c4 23. Bb1 Qd8 24. Ba7 Ne8 25. Bc2 Nc7 -26. Rea1 Qe7 27. Bb1 Be8 28. Ne2 Nd8 29. Nh2 Bg7 30. f4 f6 31. f5 g5 32. Bc2 -Bf7 33. Ng3 Nb7 34. Bd1 h6 35. Bh5 Qe8 36. Qd1 Nd8 37. Ra3 Kf8 38. R1a2 Kg8 39. -Ng4 Kf8 40. Ne3 Kg8 41. Bxf7+ Nxf7 42. Qh5 Nd8 43. Qg6 Kf8 44. Nh5 1-0 - - -[Event "Candidats sf1"] -[Site "Leningrad"] -[Date "1974.??.??"] -[Round "9"] -[White "Karpov, Anatoly"] -[Black "Spassky, Boris Vasilievich"] -[Result "1-0"] -[ECO "B83"] -[PlyCount "69"] -[Annotator "ChessPenguin sample"] - -1. e4 c5 2. Nf3 e6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 d6 6. Be2 Be7 7. O-O O-O 8. f4 -Nc6 9. Be3 Bd7 10. Nb3 a5 11. a4 Nb4 12. Bf3 Bc6 13. Nd4 g6 14. Rf2 e5 15. Nxc6 -bxc6 16. fxe5 dxe5 17. Qf1 Qc8 18. h3 Nd7 19. Bg4 h5 20. Bxd7 Qxd7 21. Qc4 Bh4 -22. Rd2 Qe7 23. Rf1 Rfd8 24. Nb1 Qb7 25. Kh2 Kg7 26. c3 Na6 27. Re2 Rf8 28. Nd2 -Bd8 29. Nf3 f6 30. Rd2 Be7 31. Qe6 Rad8 32. Rxd8 Bxd8 33. Rd1 Nb8 34. Bc5 Rh8 -35. Rxd8 1-0 - - -[Event "EU-chT"] -[Site "Skara"] -[Date "1980.??.??"] -[Round "1"] -[White "Karpov, Anatoly"] -[Black "Miles, Anthony John"] -[Result "0-1"] -[ECO "B00"] -[PlyCount "92"] -[Annotator "ChessPenguin sample"] - -1. e4 a6 2. d4 b5 3. Nf3 Bb7 4. Bd3 Nf6 5. Qe2 e6 6. a4 c5 7. dxc5 Bxc5 8. Nbd2 -b4 9. e5 Nd5 10. Ne4 Be7 11. O-O Nc6 12. Bd2 Qc7 13. c4 bxc3 14. Nxc3 Nxc3 15. -Bxc3 Nb4 16. Bxb4 Bxb4 17. Rac1 Qb6 18. Be4 O-O 19. Ng5 h6 20. Bh7+ Kh8 21. Bb1 -Be7 22. Ne4 Rac8 23. Qd3 Rxc1 24. Rxc1 Qxb2 25. Re1 Qxe5 26. Qxd7 Bb4 27. Re3 -Qd5 28. Qxd5 Bxd5 29. Nc3 Rc8 30. Ne2 g5 31. h4 Kg7 32. hxg5 hxg5 33. Bd3 a5 -34. Rg3 Kf6 35. Rg4 Bd6 36. Kf1 Be5 37. Ke1 Rh8 38. f4 gxf4 39. Nxf4 Bc6 40. -Ne2 Rh1+ 41. Kd2 Rh2 42. g3 Bf3 43. Rg8 Rg2 44. Ke1 Bxe2 45. Bxe2 Rxg3 46. Ra8 -Bc7 0-1 - - -[Event "Niksic"] -[Site "Niksic"] -[Date "1983.??.??"] -[Round "4"] -[White "Kasparov, Garry"] -[Black "Portisch, Lajos"] -[Result "1-0"] -[ECO "E12"] -[PlyCount "69"] -[Annotator "ChessPenguin sample"] - -1. d4 Nf6 2. c4 e6 3. Nf3 b6 4. Nc3 Bb7 5. a3 d5 6. cxd5 Nxd5 7. e3 Nxc3 8. -bxc3 Be7 9. Bb5+ c6 10. Bd3 c5 11. O-O Nc6 12. Bb2 Rc8 13. Qe2 O-O 14. Rad1 Qc7 -15. c4 cxd4 16. exd4 Na5 17. d5 exd5 18. cxd5 Bxd5 19. Bxh7+ Kxh7 20. Rxd5 Kg8 -21. Bxg7 Kxg7 22. Ne5 Rfd8 23. Qg4+ Kf8 24. Qf5 f6 25. Nd7+ Rxd7 26. Rxd7 Qc5 -27. Qh7 Rc7 28. Qh8+ Kf7 29. Rd3 Nc4 30. Rfd1 Ne5 31. Qh7+ Ke6 32. Qg8+ Kf5 33. -g4+ Kf4 34. Rd4+ Kf3 35. Qb3+ 1-0 - - -[Event "World-ch31-KK2 Kasparov-Karpov +5-3=16"] -[Site "Moscow"] -[Date "1985.10.15"] -[Round "16"] -[White "Karpov, Anatoly"] -[Black "Kasparov, Garry"] -[Result "0-1"] -[WhiteElo "2720"] -[BlackElo "2700"] -[ECO "B44"] -[PlyCount "80"] -[Annotator "ChessPenguin sample"] - -{World Championship 1985, game 16. Kasparov's knight on d3 paralyses White's -whole position; he won the title later in the match.} 1. e4 c5 2. Nf3 e6 3. d4 -cxd4 4. Nxd4 Nc6 5. Nb5 d6 6. c4 Nf6 7. N1c3 a6 8. Na3 d5 9. cxd5 exd5 10. exd5 -Nb4 11. Be2 Bc5 12. O-O O-O 13. Bf3 Bf5 14. Bg5 Re8 15. Qd2 b5 16. Rad1 Nd3 17. -Nab1 h6 18. Bh4 b4 19. Na4 Bd6 20. Bg3 Rc8 21. b3 g5 22. Bxd6 Qxd6 23. g3 Nd7 -24. Bg2 Qf6 25. a3 a5 26. axb4 axb4 27. Qa2 Bg6 28. d6 g4 29. Qd2 Kg7 30. f3 -Qxd6 31. fxg4 Qd4+ 32. Kh1 Nf6 33. Rf4 Ne4 34. Qxd3 Nf2+ 35. Rxf2 Bxd3 36. Rfd2 -Qe3 37. Rxd3 Rc1 38. Nb2 Qf2 39. Nd2 Rxd1+ 40. Nxd1 Re1+ 0-1 - - -[Event "World Championship 32th-KK2"] -[Site "Moscow"] -[Date "1985.??.??"] -[Round "24"] -[White "Karpov, Anatoly"] -[Black "Kasparov, Garry"] -[Result "0-1"] -[ECO "B85"] -[PlyCount "84"] -[Annotator "ChessPenguin sample"] - -1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 a6 6. Be2 e6 7. O-O Be7 8. f4 -O-O 9. Kh1 Qc7 10. a4 Nc6 11. Be3 Re8 12. Bf3 Rb8 13. Qd2 Bd7 14. Nb3 b6 15. g4 -Bc8 16. g5 Nd7 17. Qf2 Bf8 18. Bg2 Bb7 19. Rad1 g6 20. Bc1 Rbc8 21. Rd3 Nb4 22. -Rh3 Bg7 23. Be3 Re7 24. Kg1 Rce8 25. Rd1 f5 26. gxf6 Nxf6 27. Rg3 Rf7 28. Bxb6 -Qb8 29. Be3 Nh5 30. Rg4 Nf6 31. Rh4 g5 32. fxg5 Ng4 33. Qd2 Nxe3 34. Qxe3 Nxc2 -35. Qb6 Ba8 36. Rxd6 Rb7 37. Qxa6 Rxb3 38. Rxe6 Rxb2 39. Qc4 Kh8 40. e5 Qa7+ -41. Kh1 Bxg2+ 42. Kxg2 Nd4+ 0-1 - - -[Event "World Championship 33th-KK3"] -[Site "London/Leningrad"] -[Date "1986.??.??"] -[Round "16"] -[White "Kasparov, Garry"] -[Black "Karpov, Anatoly"] -[Result "1-0"] -[ECO "C92"] -[PlyCount "81"] -[Annotator "ChessPenguin sample"] - -1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 8. c3 -O-O 9. h3 Bb7 10. d4 Re8 11. Nbd2 Bf8 12. a4 h6 13. Bc2 exd4 14. cxd4 Nb4 15. -Bb1 c5 16. d5 Nd7 17. Ra3 c4 18. Nd4 Qf6 19. N2f3 Nc5 20. axb5 axb5 21. Nxb5 -Rxa3 22. Nxa3 Ba6 23. Re3 Rb8 24. e5 dxe5 25. Nxe5 Nbd3 26. Ng4 Qb6 27. Rg3 g6 -28. Bxh6 Qxb2 29. Qf3 Nd7 30. Bxf8 Kxf8 31. Kh2 Rb3 32. Bxd3 cxd3 33. Qf4 Qxa3 -34. Nh6 Qe7 35. Rxg6 Qe5 36. Rg8+ Ke7 37. d6+ Ke6 38. Re8+ Kd5 39. Rxe5+ Nxe5 -40. d7 Rb8 41. Nxf7 1-0 - - -[Event "World Championship 34th-KK4"] -[Site "Sevilla"] -[Date "1987.??.??"] -[Round "24"] -[White "Kasparov, Garry"] -[Black "Karpov, Anatoly"] -[Result "1-0"] -[ECO "A14"] -[PlyCount "127"] -[Annotator "ChessPenguin sample"] - -1. c4 e6 2. Nf3 Nf6 3. g3 d5 4. b3 Be7 5. Bg2 O-O 6. O-O b6 7. Bb2 Bb7 8. e3 -Nbd7 9. Nc3 Ne4 10. Ne2 a5 11. d3 Bf6 12. Qc2 Bxb2 13. Qxb2 Nd6 14. cxd5 Bxd5 -15. d4 c5 16. Rfd1 Rc8 17. Nf4 Bxf3 18. Bxf3 Qe7 19. Rac1 Rfd8 20. dxc5 Nxc5 -21. b4 axb4 22. Qxb4 Qa7 23. a3 Nf5 24. Rb1 Rxd1+ 25. Rxd1 Qc7 26. Nd3 h6 27. -Rc1 Ne7 28. Qb5 Nf5 29. a4 Nd6 30. Qb1 Qa7 31. Ne5 Nxa4 32. Rxc8+ Nxc8 33. Qd1 -Ne7 34. Qd8+ Kh7 35. Nxf7 Ng6 36. Qe8 Qe7 37. Qxa4 Qxf7 38. Be4 Kg8 39. Qb5 Nf8 -40. Qxb6 Qf6 41. Qb5 Qe7 42. Kg2 g6 43. Qa5 Qg7 44. Qc5 Qf7 45. h4 h5 46. Qc6 -Qe7 47. Bd3 Qf7 48. Qd6 Kg7 49. e4 Kg8 50. Bc4 Kg7 51. Qe5+ Kg8 52. Qd6 Kg7 53. -Bb5 Kg8 54. Bc6 Qa7 55. Qb4 Qc7 56. Qb7 Qd8 57. e5 Qa5 58. Be8 Qc5 59. Qf7+ Kh8 -60. Ba4 Qd5+ 61. Kh2 Qc5 62. Bb3 Qc8 63. Bd1 Qc5 64. Kg2 1-0 - - -[Event "World Championship 35th-KK5"] -[Site "Lyon/New York"] -[Date "1990.??.??"] -[Round "20"] -[White "Kasparov, Garry"] -[Black "Karpov, Anatoly"] -[Result "1-0"] -[ECO "C92"] -[PlyCount "81"] -[Annotator "ChessPenguin sample"] - -1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 8. c3 -O-O 9. h3 Bb7 10. d4 Re8 11. Nbd2 Bf8 12. a4 h6 13. Bc2 exd4 14. cxd4 Nb4 15. -Bb1 c5 16. d5 Nd7 17. Ra3 f5 18. Rae3 Nf6 19. Nh2 Kh8 20. b3 bxa4 21. bxa4 c4 -22. Bb2 fxe4 23. Nxe4 Nfxd5 24. Rg3 Re6 25. Ng4 Qe8 26. Nxh6 c3 27. Nf5 cxb2 -28. Qg4 Bc8 29. Qh4+ Rh6 30. Nxh6 gxh6 31. Kh2 Qe5 32. Ng5 Qf6 33. Re8 Bf5 34. -Qxh6+ Qxh6 35. Nf7+ Kh7 36. Bxf5+ Qg6 37. Bxg6+ Kg7 38. Rxa8 Be7 39. Rb8 a5 40. -Be4+ Kxf7 41. Bxd5+ 1-0 - - -[Event "Tilburg"] -[Site "Tilburg"] -[Date "1991.10.??"] -[Round "4"] -[White "Short, Nigel D"] -[Black "Timman, Jan H"] -[Result "1-0"] -[WhiteElo "2660"] -[BlackElo "2630"] -[ECO "B04"] -[PlyCount "67"] -[Annotator "ChessPenguin sample"] - -{Tilburg 1991. With queens still on the board, Short marches his king -g1-h2-g3-f4-g5 to support the mating attack, and Black resigns.} 1. e4 Nf6 2. -e5 Nd5 3. d4 d6 4. Nf3 g6 5. Bc4 Nb6 6. Bb3 Bg7 7. Qe2 Nc6 8. O-O O-O 9. h3 a5 -10. a4 dxe5 11. dxe5 Nd4 12. Nxd4 Qxd4 13. Re1 e6 14. Nd2 Nd5 15. Nf3 Qc5 16. -Qe4 Qb4 17. Bc4 Nb6 18. b3 Nxc4 19. bxc4 Re8 20. Rd1 Qc5 21. Qh4 b6 22. Be3 Qc6 -23. Bh6 Bh8 24. Rd8 Bb7 25. Rad1 Bg7 26. R8d7 Rf8 27. Bxg7 Kxg7 28. R1d4 Rae8 -29. Qf6+ Kg8 30. h4 h5 31. Kh2 Rc8 32. Kg3 Rce8 33. Kf4 Bc8 34. Kg5 1-0 - - -[Event "Candidats qf3 rapid60"] -[Site "Brussels"] -[Date "1991.??.??"] -[Round "9"] -[White "Ivanchuk, Vasyl"] -[Black "Yusupov, Artur"] -[Result "0-1"] -[ECO "E67"] -[PlyCount "78"] -[Annotator "ChessPenguin sample"] - -1. c4 e5 2. g3 d6 3. Bg2 g6 4. d4 Nd7 5. Nc3 Bg7 6. Nf3 Ngf6 7. O-O O-O 8. Qc2 -Re8 9. Rd1 c6 10. b3 Qe7 11. Ba3 e4 12. Ng5 e3 13. f4 Nf8 14. b4 Bf5 15. Qb3 h6 -16. Nf3 Ng4 17. b5 g5 18. bxc6 bxc6 19. Ne5 gxf4 20. Nxc6 Qg5 21. Bxd6 Ng6 22. -Nd5 Qh5 23. h4 Nxh4 24. gxh4 Qxh4 25. Nde7+ Kh8 26. Nxf5 Qh2+ 27. Kf1 Re6 28. -Qb7 Rg6 29. Qxa8+ Kh7 30. Qg8+ Kxg8 31. Nce7+ Kh7 32. Nxg6 fxg6 33. Nxg7 Nf2 -34. Bxf4 Qxf4 35. Ne6 Qh2 36. Rdb1 Nh3 37. Rb7+ Kg8 38. Rb8+ Qxb8 39. Bxh3 Qg3 -0-1 - - -[Event "Buenos Aires Sicilian"] -[Site "Buenos Aires"] -[Date "1994.??.??"] -[Round "8"] -[White "Shirov, Alexei"] -[Black "Polgar, Judit"] -[Result "0-1"] -[ECO "B54"] -[PlyCount "58"] -[Annotator "ChessPenguin sample"] - -1. e4 c5 2. Nf3 e6 3. d4 cxd4 4. Nxd4 Nc6 5. Nc3 d6 6. g4 a6 7. Be3 Nge7 8. Nb3 -b5 9. f4 Bb7 10. Qf3 g5 11. fxg5 Ne5 12. Qg2 b4 13. Ne2 h5 14. gxh5 Nf5 15. Bf2 -Qxg5 16. Na5 Ne3 17. Qg3 Qxg3 18. Nxg3 Nxc2+ 19. Kd1 Nxa1 20. Nxb7 b3 21. axb3 -Nxb3 22. Kc2 Nc5 23. Nxc5 dxc5 24. Be1 Nf3 25. Bc3 Nd4+ 26. Kd3 Bd6 27. Bg2 Be5 -28. Kc4 Ke7 29. Ra1 Nc6 0-1 - - -[Event "Hoogovens op"] -[Site "Wijk aan Zee"] -[Date "1995.??.??"] -[Round "1"] -[White "Cifuentes Parada, Roberto"] -[Black "Zvjaginsev, Vadim"] -[Result "0-1"] -[ECO "D45"] -[PlyCount "70"] -[Annotator "ChessPenguin sample"] - -1. d4 e6 2. Nf3 d5 3. c4 Nf6 4. Nc3 c6 5. e3 Nbd7 6. Qc2 b6 7. Be2 Bb7 8. O-O -Be7 9. Rd1 O-O 10. e4 dxe4 11. Nxe4 Qc7 12. Nc3 c5 13. d5 exd5 14. cxd5 a6 15. -Nh4 g6 16. Bh6 Rfe8 17. Qd2 Bd6 18. g3 b5 19. Bf3 b4 20. Ne2 Ne4 21. Qc2 Ndf6 -22. Ng2 Qd7 23. Ne3 Rad8 24. Bg2 Nxf2 25. Kxf2 Rxe3 26. Bxe3 Ng4+ 27. Kf3 Nxh2+ -28. Kf2 Ng4+ 29. Kf3 Qe6 30. Bf4 Re8 31. Qc4 Qe3+ 32. Bxe3 Rxe3+ 33. Kxg4 Bc8+ -34. Kg5 h6+ 35. Kxh6 Re5 0-1 - - -[Event "Philadelphia m"] -[Site "Philadelphia"] -[Date "1996.??.??"] -[Round "1"] -[White "Deep Blue (computer)"] -[Black "Kasparov, Garry"] -[Result "1-0"] -[ECO "B22"] -[PlyCount "73"] -[Annotator "ChessPenguin sample"] - -1. e4 c5 2. c3 d5 3. exd5 Qxd5 4. d4 Nf6 5. Nf3 Bg4 6. Be2 e6 7. h3 Bh5 8. O-O -Nc6 9. Be3 cxd4 10. cxd4 Bb4 11. a3 Ba5 12. Nc3 Qd6 13. Nb5 Qe7 14. Ne5 Bxe2 -15. Qxe2 O-O 16. Rac1 Rac8 17. Bg5 Bb6 18. Bxf6 gxf6 19. Nc4 Rfd8 20. Nxb6 axb6 -21. Rfd1 f5 22. Qe3 Qf6 23. d5 Rxd5 24. Rxd5 exd5 25. b3 Kh8 26. Qxb6 Rg8 27. -Qc5 d4 28. Nd6 f4 29. Nxb7 Ne5 30. Qd5 f3 31. g3 Nd3 32. Rc7 Re8 33. Nd6 Re1+ -34. Kh2 Nxf2 35. Nxf7+ Kg7 36. Ng5+ Kh6 37. Rxh7+ 1-0 - - -[Event "New York Man-Machine"] -[Site "New York"] -[Date "1997.05.11"] -[Round "6"] -[White "Deep Blue (computer)"] -[Black "Kasparov, Garry"] -[Result "1-0"] -[BlackElo "2785"] -[ECO "B17"] -[PlyCount "37"] -[Annotator "ChessPenguin sample"] - -{New York 1997, game 6 of the rematch: the first time a computer beat the -reigning world champion in a match.} 1. e4 c6 2. d4 d5 3. Nc3 dxe4 4. Nxe4 Nd7 -5. Ng5 Ngf6 6. Bd3 e6 7. N1f3 h6 8. Nxe6 Qe7 9. O-O fxe6 10. Bg6+ Kd8 11. Bf4 -b5 12. a4 Bb7 13. Re1 Nd5 14. Bg3 Kc8 15. axb5 cxb5 16. Qd3 Bc6 17. Bf5 exf5 -18. Rxe7 Bxe7 19. c4 1-0 - - -[Event "Linares"] -[Site "Linares"] -[Date "1998.03.04"] -[Round "10"] -[White "Topalov, Veselin"] -[Black "Shirov, Alexei"] -[Result "0-1"] -[ECO "D85"] -[PlyCount "106"] -[Annotator "ChessPenguin sample"] - -1. d4 Nf6 2. c4 g6 3. Nc3 d5 4. cxd5 Nxd5 5. e4 Nxc3 6. bxc3 Bg7 7. Bb5+ c6 8. -Ba4 O-O 9. Ne2 Nd7 10. O-O e5 11. f3 Qe7 12. Be3 Rd8 13. Qc2 Nb6 14. Bb3 Be6 -15. Rad1 Nc4 16. Bc1 b5 17. f4 exd4 18. Nxd4 Bg4 19. Rde1 Qc5 20. Kh1 a5 21. h3 -Bd7 22. a4 bxa4 23. Ba2 Be8 24. e5 Nb6 25. f5 Nd5 26. Bd2 Nb4 27. Qxa4 Nxa2 28. -Qxa2 Bxe5 29. fxg6 hxg6 30. Bg5 Rd5 31. Re3 Qd6 32. Qe2 Bd7 33. c4 Bxd4 34. -cxd5 Bxe3 35. Qxe3 Re8 36. Qc3 Qxd5 37. Bh6 Re5 38. Rf3 Qc5 39. Qa1 Bf5 40. Re3 -f6 41. Rxe5 Qxe5 42. Qa2+ Qd5 43. Qxd5+ cxd5 44. Bd2 a4 45. Bc3 Kf7 46. h4 Ke6 -47. Kg1 Bh3 48. gxh3 Kf5 49. Kf2 Ke4 50. Bxf6 d4 51. Be7 Kd3 52. Bc5 Kc4 53. -Be7 Kb3 0-1 - - -[Event "Hoogovens"] -[Site "Wijk aan Zee"] -[Date "1999.01.20"] -[Round "4"] -[White "Kasparov, Garry"] -[Black "Topalov, Veselin"] -[Result "1-0"] -[WhiteElo "2812"] -[BlackElo "2700"] -[ECO "B07"] -[PlyCount "87"] -[Annotator "ChessPenguin sample"] - -{Wijk aan Zee 1999, "Kasparov's Immortal": 24.Rxd4!! starts a king hunt across -the whole board.} 1. e4 d6 2. d4 Nf6 3. Nc3 g6 4. Be3 Bg7 5. Qd2 c6 6. f3 b5 7. -Nge2 Nbd7 8. Bh6 Bxh6 9. Qxh6 Bb7 10. a3 e5 11. O-O-O Qe7 12. Kb1 a6 13. Nc1 -O-O-O 14. Nb3 exd4 15. Rxd4 c5 16. Rd1 Nb6 17. g3 Kb8 18. Na5 Ba8 19. Bh3 d5 -20. Qf4+ Ka7 21. Rhe1 d4 22. Nd5 Nbxd5 23. exd5 Qd6 24. Rxd4 cxd4 25. Re7+ Kb6 -26. Qxd4+ Kxa5 27. b4+ Ka4 28. Qc3 Qxd5 29. Ra7 Bb7 30. Rxb7 Qc4 31. Qxf6 Kxa3 -32. Qxa6+ Kxb4 33. c3+ Kxc3 34. Qa1+ Kd2 35. Qb2+ Kd1 36. Bf1 Rd2 37. Rd7 Rxd7 -38. Bxc4 bxc4 39. Qxh8 Rd3 40. Qa8 c3 41. Qa4+ Ke1 42. f4 f5 43. Kc1 Rd2 44. -Qa7 1-0 - - -[Event "Kasparov vs The World"] -[Site "Internet MSN"] -[Date "1999.06.21"] -[Round "1"] -[White "Kasparov, Garry"] -[Black "The World"] -[Result "1-0"] -[ECO "B52"] -[PlyCount "123"] -[Annotator "ChessPenguin sample"] - -1. e4 c5 2. Nf3 d6 3. Bb5+ Bd7 4. Bxd7+ Qxd7 5. c4 Nc6 6. Nc3 Nf6 7. O-O g6 8. -d4 cxd4 9. Nxd4 Bg7 10. Nde2 Qe6 11. Nd5 Qxe4 12. Nc7+ Kd7 13. Nxa8 Qxc4 14. -Nb6+ axb6 15. Nc3 Ra8 16. a4 Ne4 17. Nxe4 Qxe4 18. Qb3 f5 19. Bg5 Qb4 20. Qf7 -Be5 21. h3 Rxa4 22. Rxa4 Qxa4 23. Qxh7 Bxb2 24. Qxg6 Qe4 25. Qf7 Bd4 26. Qb3 f4 -27. Qf7 Be5 28. h4 b5 29. h5 Qc4 30. Qf5+ Qe6 31. Qxe6+ Kxe6 32. g3 fxg3 33. -fxg3 b4 34. Bf4 Bd4+ 35. Kh1 b3 36. g4 Kd5 37. g5 e6 38. h6 Ne7 39. Rd1 e5 40. -Be3 Kc4 41. Bxd4 exd4 42. Kg2 b2 43. Kf3 Kc3 44. h7 Ng6 45. Ke4 Kc2 46. Rh1 d3 -47. Kf5 b1=Q 48. Rxb1 Kxb1 49. Kxg6 d2 50. h8=Q d1=Q 51. Qh7 b5 52. Kf6+ Kb2 -53. Qh2+ Ka1 54. Qf4 b4 55. Qxb4 Qf3+ 56. Kg7 d5 57. Qd4+ Kb1 58. g6 Qe4 59. -Qg1+ Kb2 60. Qf2+ Kc1 61. Kf6 d4 62. g7 1-0 - - -[Event "World-ch Kramnik-Kasparov +2-0=13"] -[Site "London"] -[Date "2000.10.10"] -[Round "2"] -[White "Kramnik, Vladimir"] -[Black "Kasparov, Garry"] -[Result "1-0"] -[WhiteElo "2770"] -[BlackElo "2849"] -[ECO "D85"] -[PlyCount "79"] -[Annotator "ChessPenguin sample"] - -{World Championship, London 2000, game 2: Kramnik's first win in the match in -which he took the title from Kasparov.} 1. d4 Nf6 2. c4 g6 3. Nc3 d5 4. cxd5 -Nxd5 5. e4 Nxc3 6. bxc3 Bg7 7. Nf3 c5 8. Be3 Qa5 9. Qd2 Bg4 10. Rb1 a6 11. Rxb7 -Bxf3 12. gxf3 Nc6 13. Bc4 O-O 14. O-O cxd4 15. cxd4 Bxd4 16. Bd5 Bc3 17. Qc1 -Nd4 18. Bxd4 Bxd4 19. Rxe7 Ra7 20. Rxa7 Bxa7 21. f4 Qd8 22. Qc3 Bb8 23. Qf3 Qh4 -24. e5 g5 25. Re1 Qxf4 26. Qxf4 gxf4 27. e6 fxe6 28. Rxe6 Kg7 29. Rxa6 Rf5 30. -Be4 Re5 31. f3 Re7 32. a4 Ra7 33. Rb6 Be5 34. Rb4 Rd7 35. Kg2 Rd2+ 36. Kh3 h5 -37. Rb5 Kf6 38. a5 Ra2 39. Rb6+ Ke7 40. Bd5 1-0 - - -[Event "RUS vs. ROW"] -[Site "Moscow RUS"] -[Date "2002.09.09"] -[Round "5"] -[White "Polgar, Judit"] -[Black "Kasparov, Garry"] -[Result "1-0"] -[ECO "C67"] -[PlyCount "84"] -[Annotator "ChessPenguin sample"] - -1. e4 e5 2. Nf3 Nc6 3. Bb5 Nf6 4. O-O Nxe4 5. d4 Nd6 6. Bxc6 dxc6 7. dxe5 Nf5 -8. Qxd8+ Kxd8 9. Nc3 h6 10. Rd1+ Ke8 11. h3 Be7 12. Ne2 Nh4 13. Nxh4 Bxh4 14. -Be3 Bf5 15. Nd4 Bh7 16. g4 Be7 17. Kg2 h5 18. Nf5 Bf8 19. Kf3 Bg6 20. Rd2 hxg4+ -21. hxg4 Rh3+ 22. Kg2 Rh7 23. Kg3 f6 24. Bf4 Bxf5 25. gxf5 fxe5 26. Re1 Bd6 27. -Bxe5 Kd7 28. c4 c5 29. Bxd6 cxd6 30. Re6 Rah8 31. Rexd6+ Kc8 32. R2d5 Rh3+ 33. -Kg2 Rh2+ 34. Kf3 R2h3+ 35. Ke4 b6 36. Rc6+ Kb8 37. Rd7 Rh2 38. Ke3 Rf8 39. Rcc7 -Rxf5 40. Rb7+ Kc8 41. Rdc7+ Kd8 42. Rxg7 Kc8 1-0 - - -[Event "Corus-C"] -[Site "Wijk aan Zee"] -[Date "2004.01.24"] -[Round "12"] -[White "Carlsen, Magnus"] -[Black "Ernst, Sipke"] -[Result "1-0"] -[WhiteElo "2484"] -[BlackElo "2474"] -[ECO "B19"] -[PlyCount "57"] -[Annotator "ChessPenguin sample"] - -{Wijk aan Zee 2004. Thirteen-year-old Magnus Carlsen wins with a series of -sacrifices in 29 moves.} 1. e4 c6 2. d4 d5 3. Nc3 dxe4 4. Nxe4 Bf5 5. Ng3 Bg6 -6. h4 h6 7. Nf3 Nd7 8. h5 Bh7 9. Bd3 Bxd3 10. Qxd3 e6 11. Bf4 Ngf6 12. O-O-O -Be7 13. Ne4 Qa5 14. Kb1 O-O 15. Nxf6+ Nxf6 16. Ne5 Rad8 17. Qe2 c5 18. Ng6 fxg6 -19. Qxe6+ Kh8 20. hxg6 Ng8 21. Bxh6 gxh6 22. Rxh6+ Nxh6 23. Qxe7 Nf7 24. gxf7 -Kg7 25. Rd3 Rd6 26. Rg3+ Rg6 27. Qe5+ Kxf7 28. Qf5+ Rf6 29. Qd7# 1-0 - - -[Event "WCh"] -[Site "Brissago SUI"] -[Date "2004.10.18"] -[Round "14"] -[White "Kramnik, Vladimir"] -[Black "Leko, Peter"] -[Result "1-0"] -[ECO "B12"] -[PlyCount "81"] -[Annotator "ChessPenguin sample"] - -1. e4 c6 2. d4 d5 3. e5 Bf5 4. h4 h6 5. g4 Bd7 6. Nd2 c5 7. dxc5 e6 8. Nb3 Bxc5 -9. Nxc5 Qa5+ 10. c3 Qxc5 11. Nf3 Ne7 12. Bd3 Nbc6 13. Be3 Qa5 14. Qd2 Ng6 15. -Bd4 Nxd4 16. cxd4 Qxd2+ 17. Kxd2 Nf4 18. Rac1 h5 19. Rhg1 Bc6 20. gxh5 Nxh5 21. -b4 a6 22. a4 Kd8 23. Ng5 Be8 24. b5 Nf4 25. b6 Nxd3 26. Kxd3 Rc8 27. Rxc8+ Kxc8 -28. Rc1+ Bc6 29. Nxf7 Rxh4 30. Nd6+ Kd8 31. Rg1 Rh3+ 32. Ke2 Ra3 33. Rxg7 Rxa4 -34. f4 Ra2+ 35. Kf3 Ra3+ 36. Kg4 Rd3 37. f5 Rxd4+ 38. Kg5 exf5 39. Kf6 Rg4 40. -Rc7 Rh4 41. Nf7+ 1-0 - - -[Event "Corus A"] -[Site "Wijk aan Zee NED"] -[Date "2006.01.14"] -[Round "1"] -[White "Karjakin, Sergey"] -[Black "Anand, Viswanathan"] -[Result "0-1"] -[ECO "B90"] -[PlyCount "74"] -[Annotator "ChessPenguin sample"] - -1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 a6 6. Be3 e5 7. Nb3 Be6 8. f3 -Be7 9. Qd2 O-O 10. O-O-O Nbd7 11. g4 b5 12. g5 b4 13. Ne2 Ne8 14. f4 a5 15. f5 -a4 16. Nbd4 exd4 17. Nxd4 b3 18. Kb1 bxc2+ 19. Nxc2 Bb3 20. axb3 axb3 21. Na3 -Ne5 22. h4 Ra5 23. Qc3 Qa8 24. Bg2 Nc7 25. Qxc7 Rc8 26. Qxe7 Nc4 27. g6 hxg6 -28. fxg6 Nxa3+ 29. bxa3 Rxa3 30. gxf7+ Kh7 31. f8=N+ Rxf8 32. Qxf8 Ra1+ 33. Kb2 -Ra2+ 34. Kc3 Qa5+ 35. Kd3 Qb5+ 36. Kd4 Ra4+ 37. Kc3 Qc4+ 0-1 - - -[Event "WCh Playoffs"] -[Site "Elista RUS"] -[Date "2006.10.13"] -[Round "4"] -[White "Kramnik, Vladimir"] -[Black "Topalov, Veselin"] -[Result "1-0"] -[ECO "D47"] -[PlyCount "89"] -[Annotator "ChessPenguin sample"] - -1. d4 d5 2. c4 c6 3. Nf3 Nf6 4. Nc3 e6 5. e3 Nbd7 6. Bd3 dxc4 7. Bxc4 b5 8. Be2 -Bb7 9. O-O Be7 10. e4 b4 11. e5 bxc3 12. exf6 Bxf6 13. bxc3 c5 14. dxc5 Nxc5 -15. Bb5+ Kf8 16. Qxd8+ Rxd8 17. Ba3 Rc8 18. Nd4 Be7 19. Rfd1 a6 20. Bf1 Na4 21. -Rab1 Be4 22. Rb3 Bxa3 23. Rxa3 Nc5 24. Nb3 Ke7 25. Rd4 Bg6 26. c4 Rc6 27. Nxc5 -Rxc5 28. Rxa6 Rb8 29. Rd1 Rb2 30. Ra7+ Kf6 31. Ra1 Rf5 32. f3 Re5 33. Ra3 Rc2 -34. Rb3 Ra5 35. a4 Ke7 36. Rb5 Ra7 37. a5 Kd6 38. a6 Kc7 39. c5 Rc3 40. Raa5 -Rc1 41. Rb3 Kc6 42. Rb6+ Kc7 43. Kf2 Rc2+ 44. Ke3 Rxc5 45. Rb7+ 1-0 - - -[Event "WCh"] -[Site "Bonn GER"] -[Date "2008.10.17"] -[Round "3"] -[White "Kramnik, Vladimir"] -[Black "Anand, Viswanathan"] -[Result "0-1"] -[ECO "D49"] -[PlyCount "82"] -[Annotator "ChessPenguin sample"] - -1. d4 d5 2. c4 c6 3. Nf3 Nf6 4. Nc3 e6 5. e3 Nbd7 6. Bd3 dxc4 7. Bxc4 b5 8. Bd3 -a6 9. e4 c5 10. e5 cxd4 11. Nxb5 axb5 12. exf6 gxf6 13. O-O Qb6 14. Qe2 Bb7 15. -Bxb5 Bd6 16. Rd1 Rg8 17. g3 Rg4 18. Bf4 Bxf4 19. Nxd4 h5 20. Nxe6 fxe6 21. Rxd7 -Kf8 22. Qd3 Rg7 23. Rxg7 Kxg7 24. gxf4 Rd8 25. Qe2 Kh6 26. Kf1 Rg8 27. a4 Bg2+ -28. Ke1 Bh3 29. Ra3 Rg1+ 30. Kd2 Qd4+ 31. Kc2 Bg4 32. f3 Bf5+ 33. Bd3 Bh3 34. -a5 Rg2 35. a6 Rxe2+ 36. Bxe2 Bf5+ 37. Kb3 Qe3+ 38. Ka2 Qxe2 39. a7 Qc4+ 40. Ka1 -Qf1+ 41. Ka2 Bb1+ 0-1 - - -[Event "WCh"] -[Site "Bonn GER"] -[Date "2008.10.21"] -[Round "6"] -[White "Anand, Viswanathan"] -[Black "Kramnik, Vladimir"] -[Result "1-0"] -[ECO "E34"] -[PlyCount "93"] -[Annotator "ChessPenguin sample"] - -1. d4 Nf6 2. c4 e6 3. Nc3 Bb4 4. Qc2 d5 5. cxd5 Qxd5 6. Nf3 Qf5 7. Qb3 Nc6 8. -Bd2 O-O 9. h3 b6 10. g4 Qa5 11. Rc1 Bb7 12. a3 Bxc3 13. Bxc3 Qd5 14. Qxd5 Nxd5 -15. Bd2 Nf6 16. Rg1 Rac8 17. Bg2 Ne7 18. Bb4 c5 19. dxc5 Rfd8 20. Ne5 Bxg2 21. -Rxg2 bxc5 22. Rxc5 Ne4 23. Rxc8 Rxc8 24. Nd3 Nd5 25. Bd2 Rc2 26. Bc1 f5 27. Kd1 -Rc8 28. f3 Nd6 29. Ke1 a5 30. e3 e5 31. gxf5 e4 32. fxe4 Nxe4 33. Bd2 a4 34. -Nf2 Nd6 35. Rg4 Nc4 36. e4 Nf6 37. Rg3 Nxb2 38. e5 Nd5 39. f6 Kf7 40. Ne4 Nc4 -41. fxg7 Kg8 42. Rd3 Ndb6 43. Bh6 Nxe5 44. Nf6+ Kf7 45. Rc3 Rxc3 46. g8=Q+ Kxf6 -47. Bg7+ 1-0 - - -[Event "Tata Steel-A 75th"] -[Site "Wijk aan Zee"] -[Date "2013.01.15"] -[Round "4"] -[White "Aronian, Levon"] -[Black "Anand, Viswanathan"] -[Result "0-1"] -[WhiteElo "2802"] -[BlackElo "2772"] -[ECO "D46"] -[PlyCount "46"] -[Annotator "ChessPenguin sample"] - -{Wijk aan Zee 2013. Anand, with Black, launches a sacrificial attack and wins -in 23 moves.} 1. d4 d5 2. c4 c6 3. Nf3 Nf6 4. Nc3 e6 5. e3 Nbd7 6. Bd3 dxc4 7. -Bxc4 b5 8. Bd3 Bd6 9. O-O O-O 10. Qc2 Bb7 11. a3 Rc8 12. Ng5 c5 13. Nxh7 Ng4 -14. f4 cxd4 15. exd4 Bc5 16. Be2 Nde5 17. Bxg4 Bxd4+ 18. Kh1 Nxg4 19. Nxf8 f5 -20. Ng6 Qf6 21. h3 Qxg6 22. Qe2 Qh5 23. Qd3 Be3 0-1 - - -[Event "WCh 2013"] -[Site "Chennai IND"] -[Date "2013.11.15"] -[Round "5"] -[White "Carlsen, Magnus"] -[Black "Anand, Viswanathan"] -[Result "1-0"] -[ECO "D31"] -[PlyCount "115"] -[Annotator "ChessPenguin sample"] - -1. c4 e6 2. d4 d5 3. Nc3 c6 4. e4 dxe4 5. Nxe4 Bb4+ 6. Nc3 c5 7. a3 Ba5 8. Nf3 -Nf6 9. Be3 Nc6 10. Qd3 cxd4 11. Nxd4 Ng4 12. O-O-O Nxe3 13. fxe3 Bc7 14. Nxc6 -bxc6 15. Qxd8+ Bxd8 16. Be2 Ke7 17. Bf3 Bd7 18. Ne4 Bb6 19. c5 f5 20. cxb6 fxe4 -21. b7 Rab8 22. Bxe4 Rxb7 23. Rhf1 Rb5 24. Rf4 g5 25. Rf3 h5 26. Rdf1 Be8 27. -Bc2 Rc5 28. Rf6 h4 29. e4 a5 30. Kd2 Rb5 31. b3 Bh5 32. Kc3 Rc5+ 33. Kb2 Rd8 -34. R1f2 Rd4 35. Rh6 Bd1 36. Bb1 Rb5 37. Kc3 c5 38. Rb2 e5 39. Rg6 a4 40. Rxg5 -Rxb3+ 41. Rxb3 Bxb3 42. Rxe5+ Kd6 43. Rh5 Rd1 44. e5+ Kd5 45. Bh7 Rc1+ 46. Kb2 -Rg1 47. Bg8+ Kc6 48. Rh6+ Kd7 49. Bxb3 axb3 50. Kxb3 Rxg2 51. Rxh4 Ke6 52. a4 -Kxe5 53. a5 Kd6 54. Rh7 Kd5 55. a6 c4+ 56. Kc3 Ra2 57. a7 Kc5 58. h4 1-0 - - -[Event "WCh 2013"] -[Site "Chennai IND"] -[Date "2013.11.21"] -[Round "9"] -[White "Anand, Viswanathan"] -[Black "Carlsen, Magnus"] -[Result "0-1"] -[ECO "E25"] -[PlyCount "56"] -[Annotator "ChessPenguin sample"] - -1. d4 Nf6 2. c4 e6 3. Nc3 Bb4 4. f3 d5 5. a3 Bxc3+ 6. bxc3 c5 7. cxd5 exd5 8. -e3 c4 9. Ne2 Nc6 10. g4 O-O 11. Bg2 Na5 12. O-O Nb3 13. Ra2 b5 14. Ng3 a5 15. -g5 Ne8 16. e4 Nxc1 17. Qxc1 Ra6 18. e5 Nc7 19. f4 b4 20. axb4 axb4 21. Rxa6 -Nxa6 22. f5 b3 23. Qf4 Nc7 24. f6 g6 25. Qh4 Ne8 26. Qh6 b2 27. Rf4 b1=Q+ 28. -Nf1 Qe1 0-1 - - -[Event "6th Hainan Danzhou GM"] -[Site "Danzhou CHN"] -[Date "2015.07.03"] -[Round "2.4"] -[White "Wei, Yi"] -[Black "Bruzon Batista, Lazaro"] -[Result "1-0"] -[ECO "B40"] -[PlyCount "71"] -[Annotator "ChessPenguin sample"] - -1. e4 c5 2. Nf3 e6 3. Nc3 a6 4. Be2 Nc6 5. d4 cxd4 6. Nxd4 Qc7 7. O-O Nf6 8. -Be3 Be7 9. f4 d6 10. Kh1 O-O 11. Qe1 Nxd4 12. Bxd4 b5 13. Qg3 Bb7 14. a3 Rad8 -15. Rae1 Rd7 16. Bd3 Qd8 17. Qh3 g6 18. f5 e5 19. Be3 Re8 20. fxg6 hxg6 21. Nd5 -Nxd5 22. Rxf7 Kxf7 23. Qh7+ Ke6 24. exd5+ Kxd5 25. Be4+ Kxe4 26. Qf7 Bf6 27. -Bd2+ Kd4 28. Be3+ Ke4 29. Qb3 Kf5 30. Rf1+ Kg4 31. Qd3 Bxg2+ 32. Kxg2 Qa8+ 33. -Kg1 Bg5 34. Qe2+ Kh4 35. Bf2+ Kh3 36. Be1 1-0 - - -[Event "World-ch Carlsen-Karjakin Tiebreak"] -[Site "New York"] -[Date "2016.11.30"] -[Round "4"] -[White "Carlsen, Magnus"] -[Black "Karjakin, Sergey"] -[Result "1-0"] -[WhiteElo "2853"] -[BlackElo "2772"] -[ECO "B55"] -[PlyCount "99"] -[Annotator "ChessPenguin sample"] - -{World Championship 2016, the fourth rapid tie-break game. Carlsen keeps his -title with the queen sacrifice 50.Qh6+!!} 1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 -Nf6 5. f3 e5 6. Nb3 Be7 7. c4 a5 8. Be3 a4 9. Nc1 O-O 10. Nc3 Qa5 11. Qd2 Na6 -12. Be2 Nc5 13. O-O Bd7 14. Rb1 Rfc8 15. b4 axb3 16. axb3 Qd8 17. Nd3 Ne6 18. -Nb4 Bc6 19. Rfd1 h5 20. Bf1 h4 21. Qf2 Nd7 22. g3 Ra3 23. Bh3 Rca8 24. Nc2 R3a6 -25. Nb4 Ra5 26. Nc2 b6 27. Rd2 Qc7 28. Rbd1 Bf8 29. gxh4 Nf4 30. Bxf4 exf4 31. -Bxd7 Qxd7 32. Nb4 Ra3 33. Nxc6 Qxc6 34. Nb5 Rxb3 35. Nd4 Qxc4 36. Nxb3 Qxb3 37. -Qe2 Be7 38. Kg2 Qe6 39. h5 Ra3 40. Rd3 Ra2 41. R3d2 Ra3 42. Rd3 Ra7 43. Rd5 Rc7 -44. Qd2 Qf6 45. Rf5 Qh4 46. Rc1 Ra7 47. Qxf4 Ra2+ 48. Kh1 Qf2 49. Rc8+ Kh7 50. -Qh6+ 1-0 - - -[Event "TCh-CHN 2017"] -[Site "China CHN"] -[Date "2017.11.04"] -[Round "18.4"] -[White "Bai, Jinshi"] -[Black "Ding, Liren"] -[Result "0-1"] -[ECO "E21"] -[PlyCount "64"] -[Annotator "ChessPenguin sample"] - -1. d4 Nf6 2. c4 e6 3. Nc3 Bb4 4. Nf3 O-O 5. Bg5 c5 6. e3 cxd4 7. Qxd4 Nc6 8. -Qd3 h6 9. Bh4 d5 10. Rd1 g5 11. Bg3 Ne4 12. Nd2 Nc5 13. Qc2 d4 14. Nf3 e5 15. -Nxe5 dxc3 16. Rxd8 cxb2+ 17. Ke2 Rxd8 18. Qxb2 Na4 19. Qc2 Nc3+ 20. Kf3 Rd4 21. -h3 h5 22. Bh2 g4+ 23. Kg3 Rd2 24. Qb3 Ne4+ 25. Kh4 Be7+ 26. Kxh5 Kg7 27. Bf4 -Bf5 28. Bh6+ Kh7 29. Qxb7 Rxf2 30. Bg5 Rh8 31. Nxf7 Bg6+ 32. Kxg4 Ne5+ 0-1 - - -[Event "WCh 2021"] -[Site "Dubai UAE"] -[Date "2021.12.03"] -[Round "6"] -[White "Carlsen, Magnus"] -[Black "Nepomniachtchi, Ian"] -[Result "1-0"] -[ECO "D02"] -[PlyCount "271"] -[Annotator "ChessPenguin sample"] - -1. d4 Nf6 2. Nf3 d5 3. g3 e6 4. Bg2 Be7 5. O-O O-O 6. b3 c5 7. dxc5 Bxc5 8. c4 -dxc4 9. Qc2 Qe7 10. Nbd2 Nc6 11. Nxc4 b5 12. Nce5 Nb4 13. Qb2 Bb7 14. a3 Nc6 -15. Nd3 Bb6 16. Bg5 Rfd8 17. Bxf6 gxf6 18. Rac1 Nd4 19. Nxd4 Bxd4 20. Qa2 Bxg2 -21. Kxg2 Qb7+ 22. Kg1 Qe4 23. Qc2 a5 24. Rfd1 Kg7 25. Rd2 Rac8 26. Qxc8 Rxc8 -27. Rxc8 Qd5 28. b4 a4 29. e3 Be5 30. h4 h5 31. Kh2 Bb2 32. Rc5 Qd6 33. Rd1 -Bxa3 34. Rxb5 Qd7 35. Rc5 e5 36. Rc2 Qd5 37. Rdd2 Qb3 38. Ra2 e4 39. Nc5 Qxb4 -40. Nxe4 Qb3 41. Rac2 Bf8 42. Nc5 Qb5 43. Nd3 a3 44. Nf4 Qa5 45. Ra2 Bb4 46. -Rd3 Kh6 47. Rd1 Qa4 48. Rda1 Bd6 49. Kg1 Qb3 50. Ne2 Qd3 51. Nd4 Kh7 52. Kh2 -Qe4 53. Rxa3 Qxh4+ 54. Kg1 Qe4 55. Ra4 Be5 56. Ne2 Qc2 57. R1a2 Qb3 58. Kg2 -Qd5+ 59. f3 Qd1 60. f4 Bc7 61. Kf2 Bb6 62. Ra1 Qb3 63. Re4 Kg7 64. Re8 f5 65. -Raa8 Qb4 66. Rac8 Ba5 67. Rc1 Bb6 68. Re5 Qb3 69. Re8 Qd5 70. Rcc8 Qh1 71. Rc1 -Qd5 72. Rb1 Ba7 73. Re7 Bc5 74. Re5 Qd3 75. Rb7 Qc2 76. Rb5 Ba7 77. Ra5 Bb6 78. -Rab5 Ba7 79. Rxf5 Qd3 80. Rxf7+ Kxf7 81. Rb7+ Kg6 82. Rxa7 Qd5 83. Ra6+ Kh7 84. -Ra1 Kg6 85. Nd4 Qb7 86. Ra2 Qh1 87. Ra6+ Kf7 88. Nf3 Qb1 89. Rd6 Kg7 90. Rd5 -Qa2+ 91. Rd2 Qb1 92. Re2 Qb6 93. Rc2 Qb1 94. Nd4 Qh1 95. Rc7+ Kf6 96. Rc6+ Kf7 -97. Nf3 Qb1 98. Ng5+ Kg7 99. Ne6+ Kf7 100. Nd4 Qh1 101. Rc7+ Kf6 102. Nf3 Qb1 -103. Rd7 Qb2+ 104. Rd2 Qb1 105. Ng1 Qb4 106. Rd1 Qb3 107. Rd6+ Kg7 108. Rd4 -Qb2+ 109. Ne2 Qb1 110. e4 Qh1 111. Rd7+ Kg8 112. Rd4 Qh2+ 113. Ke3 h4 114. gxh4 -Qh3+ 115. Kd2 Qxh4 116. Rd3 Kf8 117. Rf3 Qd8+ 118. Ke3 Qa5 119. Kf2 Qa7+ 120. -Re3 Qd7 121. Ng3 Qd2+ 122. Kf3 Qd1+ 123. Re2 Qb3+ 124. Kg2 Qb7 125. Rd2 Qb3 -126. Rd5 Ke7 127. Re5+ Kf7 128. Rf5+ Ke8 129. e5 Qa2+ 130. Kh3 Qe6 131. Kh4 -Qh6+ 132. Nh5 Qh7 133. e6 Qg6 134. Rf7 Kd8 135. f5 Qg1 136. Ng7 1-0 - - -[Event "WCh Rapid TB 2023"] -[Site "Astana KAZ"] -[Date "2023.04.30"] -[Round "4.1"] -[White "Nepomniachtchi, Ian"] -[Black "Ding, Liren"] -[Result "0-1"] -[ECO "C84"] -[PlyCount "136"] -[Annotator "ChessPenguin sample"] - -1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. d3 b5 7. Bb3 d6 8. a4 -Bd7 9. h3 O-O 10. Be3 Na5 11. Ba2 bxa4 12. Nc3 Rb8 13. Bb1 Qe8 14. b3 c5 15. -Nxa4 Nc6 16. Nc3 a5 17. Nd2 Be6 18. Nc4 d5 19. exd5 Nxd5 20. Bd2 Nxc3 21. Bxc3 -Bxc4 22. bxc4 Bd8 23. Bd2 Bc7 24. c3 f5 25. Re1 Rd8 26. Ra2 Qg6 27. Qe2 Qd6 28. -g3 Rde8 29. Qf3 e4 30. dxe4 Ne5 31. Qg2 Nd3 32. Bxd3 Qxd3 33. exf5 Rxe1+ 34. -Bxe1 Qxc4 35. Ra1 Rxf5 36. Bd2 h6 37. Qc6 Rf7 38. Re1 Kh7 39. Be3 Be5 40. Qe8 -Bxc3 41. Rc1 Rf6 42. Qd7 Qe2 43. Qd5 Bb4 44. Qe4+ Kg8 45. Qd5+ Kh7 46. Qe4+ Rg6 -47. Qf5 c4 48. h4 Qd3 49. Qf3 Rf6 50. Qg4 c3 51. Rd1 Qg6 52. Qc8 Rc6 53. Qa8 -Rd6 54. Rxd6 Qxd6 55. Qe4+ Qg6 56. Qc4 Qb1+ 57. Kh2 a4 58. Bd4 a3 59. Qc7 Qg6 -60. Qc4 c2 61. Be3 Bd6 62. Kg2 h5 63. Kf1 Be5 64. g4 hxg4 65. h5 Qf5 66. Qd5 g3 -67. f4 a2 68. Qxa2 Bxf4 0-1 - - -[Event "WCh 2024"] -[Site "Singapore SIN"] -[Date "2024.12.12"] -[Round "14.1"] -[White "Ding, Liren"] -[Black "Gukesh, Dommaraju"] -[Result "0-1"] -[ECO "A08"] -[PlyCount "116"] -[Annotator "ChessPenguin sample"] - -1. Nf3 d5 2. g3 c5 3. Bg2 Nc6 4. d4 e6 5. O-O cxd4 6. Nxd4 Nge7 7. c4 Nxd4 8. -Qxd4 Nc6 9. Qd1 d4 10. e3 Bc5 11. exd4 Bxd4 12. Nc3 O-O 13. Nb5 Bb6 14. b3 a6 -15. Nc3 Bd4 16. Bb2 e5 17. Qd2 Be6 18. Nd5 b5 19. cxb5 axb5 20. Nf4 exf4 21. -Bxc6 Bxb2 22. Qxb2 Rb8 23. Rfd1 Qb6 24. Bf3 fxg3 25. hxg3 b4 26. a4 bxa3 27. -Rxa3 g6 28. Qd4 Qb5 29. b4 Qxb4 30. Qxb4 Rxb4 31. Ra8 Rxa8 32. Bxa8 g5 33. Bd5 -Bf5 34. Rc1 Kg7 35. Rc7 Bg6 36. Rc4 Rb1+ 37. Kg2 Re1 38. Rb4 h5 39. Ra4 Re5 40. -Bf3 Kh6 41. Kg1 Re6 42. Rc4 g4 43. Bd5 Rd6 44. Bb7 Kg5 45. f3 f5 46. fxg4 hxg4 -47. Rb4 Bf7 48. Kf2 Rd2+ 49. Kg1 Kf6 50. Rb6+ Kg5 51. Rb4 Be6 52. Ra4 Rb2 53. -Ba8 Kf6 54. Rf4 Ke5 55. Rf2 Rxf2 56. Kxf2 Bd5 57. Bxd5 Kxd5 58. Ke3 Ke5 0-1 diff --git a/iosApp/ChessPenguin/Resources/en.lproj/Localizable.strings b/iosApp/ChessPenguin/Resources/en.lproj/Localizable.strings deleted file mode 100644 index 8735b10..0000000 --- a/iosApp/ChessPenguin/Resources/en.lproj/Localizable.strings +++ /dev/null @@ -1,35 +0,0 @@ -"app_name" = "ChessPenguin"; -"files" = "Files"; -"classic_games" = "Classic games"; -"reading" = "Reading…"; -"retry" = "Try again"; -"open_failed" = "Could not open the database"; -"game_failed" = "Could not read the game"; -"sample_missing" = "The bundled Classic games database is missing."; -"invalid_game" = "This game is no longer in the database."; -"invalid_position" = "The position cannot be shown."; -"empty_database" = "There are no games in this database."; -"game_of" = "%1$ld of %2$ld"; -"previous_game" = "Previous game"; -"next_game" = "Next game"; -"flip" = "Flip board"; -"move_back" = "Move back"; -"move_forward" = "Move forward"; -"to_start" = "To the start"; -"to_end" = "To the end of the line"; -"next_moves" = "Next:"; -"white" = "White"; -"black" = "Black"; -"white_won" = "White won"; -"black_won" = "Black won"; -"draw" = "Draw"; -"board_start" = "Board, starting position"; -"board_after" = "Board, position after %@"; -"move_back_hint" = "Previous move. Hold for the first position"; -"move_forward_hint" = "Next move. Hold for the end of the line"; -"checkmate" = "Checkmate"; -"stalemate" = "Stalemate"; -"current_move" = "Current move"; -"unfinished" = "Unfinished"; -"last_opened" = "Last opened"; -"game_number" = "Game %1$ld"; diff --git a/iosApp/ChessPenguin/Resources/en.lproj/Localizable.stringsdict b/iosApp/ChessPenguin/Resources/en.lproj/Localizable.stringsdict deleted file mode 100644 index e627a8c..0000000 --- a/iosApp/ChessPenguin/Resources/en.lproj/Localizable.stringsdict +++ /dev/null @@ -1,17 +0,0 @@ - - - - - games_count - - NSStringLocalizedFormatKey%#@games@ - games - - NSStringFormatSpecTypeKeyNSStringPluralRuleType - NSStringFormatValueTypeKeyd - one%d game - other%d games - - - - diff --git a/iosApp/ChessPenguin/Resources/ru.lproj/Localizable.strings b/iosApp/ChessPenguin/Resources/ru.lproj/Localizable.strings deleted file mode 100644 index d63f103..0000000 --- a/iosApp/ChessPenguin/Resources/ru.lproj/Localizable.strings +++ /dev/null @@ -1,35 +0,0 @@ -"app_name" = "ChessPenguin"; -"files" = "Файлы"; -"classic_games" = "Классические партии"; -"reading" = "Читаю…"; -"retry" = "Попробовать снова"; -"open_failed" = "Не удалось открыть базу"; -"game_failed" = "Не удалось прочитать партию"; -"sample_missing" = "Встроенная база «Классические партии» не найдена."; -"invalid_game" = "Этой партии больше нет в базе."; -"invalid_position" = "Позицию невозможно показать."; -"empty_database" = "В этой базе нет партий."; -"game_of" = "%1$ld из %2$ld"; -"previous_game" = "Предыдущая партия"; -"next_game" = "Следующая партия"; -"flip" = "Перевернуть доску"; -"move_back" = "Ход назад"; -"move_forward" = "Ход вперёд"; -"to_start" = "В начало"; -"to_end" = "В конец линии"; -"next_moves" = "Дальше:"; -"white" = "Белые"; -"black" = "Чёрные"; -"white_won" = "Победили белые"; -"black_won" = "Победили чёрные"; -"draw" = "Ничья"; -"board_start" = "Доска, начальная позиция"; -"board_after" = "Доска, позиция после %@"; -"move_back_hint" = "Предыдущий ход. Удерживайте для перехода в начало"; -"move_forward_hint" = "Следующий ход. Удерживайте для перехода в конец линии"; -"checkmate" = "Мат"; -"stalemate" = "Пат"; -"current_move" = "Текущий ход"; -"unfinished" = "Партия не завершена"; -"last_opened" = "Открыта последней"; -"game_number" = "Партия %1$ld"; diff --git a/iosApp/ChessPenguin/Resources/ru.lproj/Localizable.stringsdict b/iosApp/ChessPenguin/Resources/ru.lproj/Localizable.stringsdict deleted file mode 100644 index 6e20790..0000000 --- a/iosApp/ChessPenguin/Resources/ru.lproj/Localizable.stringsdict +++ /dev/null @@ -1,19 +0,0 @@ - - - - - games_count - - NSStringLocalizedFormatKey%#@games@ - games - - NSStringFormatSpecTypeKeyNSStringPluralRuleType - NSStringFormatValueTypeKeyd - one%d партия - few%d партии - many%d партий - other%d партии - - - - diff --git a/iosApp/ChessPenguin/SharedViews.swift b/iosApp/ChessPenguin/SharedViews.swift deleted file mode 100644 index 5b66981..0000000 --- a/iosApp/ChessPenguin/SharedViews.swift +++ /dev/null @@ -1,113 +0,0 @@ -import SwiftUI - -func known(_ value: String) -> String? { - let trimmed = value.trimmingCharacters(in: .whitespacesAndNewlines) - return trimmed.isEmpty || trimmed == "?" ? nil : trimmed -} - -func knownElo(_ value: String) -> String? { - guard let text = known(value), let rating = Int(text), rating > 0 else { return nil } - return text -} - -func pgnYear(_ date: String) -> String? { - let year = String(date.prefix(4)) - return year.count == 4 && Int(year) != nil ? year : nil -} - -func joinedKnown(_ values: [String?]) -> String { - values.compactMap { $0.flatMap(known) }.joined(separator: " · ") -} - -func sideResult(_ result: String, white: Bool) -> String? { - switch result { - case "1-0": return white ? "1" : "0" - case "0-1": return white ? "0" : "1" - case "1/2-1/2": return "½" - default: return nil - } -} - -func gameResultAccessibility(_ result: String) -> String { - switch result { - case "1-0": return "1-0, \(String(localized: "white_won"))" - case "0-1": return "0-1, \(String(localized: "black_won"))" - case "1/2-1/2": return "½-½, \(String(localized: "draw"))" - default: return "\(result.isEmpty ? "*" : result), \(String(localized: "unfinished"))" - } -} - -func gameRowAccessibility(row: GameRow, number: Int, lastOpened: Bool) -> String { - var parts = [String(format: String(localized: "game_number"), number)] - for (side, name, rating) in [(L10n.white, row.white, row.whiteElo), (L10n.black, row.black, row.blackElo)] { - var player = "\(side): \(known(name) ?? "?")" - if let elo = knownElo(rating) { player += ", Elo \(elo)" } - parts.append(player) - } - parts.append(gameResultAccessibility(row.result)) - let context = joinedKnown([row.event, pgnYear(row.date), row.eco]) - if !context.isEmpty { parts.append(context) } - if lastOpened { parts.append(String(localized: "last_opened")) } - return parts.joined(separator: ". ") -} - -extension GameData { - func tag(_ name: String) -> String? { - tags.first { $0.name == name }?.value - } -} - -struct SideDisc: View { - let white: Bool - var size: CGFloat = 10 - - var body: some View { - Circle() - .fill(white ? Color.white : Color(rgb: 0x0E0F10)) - .overlay(Circle().stroke(Theme.onSurfaceVariant, lineWidth: 1)) - .frame(width: size, height: size) - .accessibilityHidden(true) - } -} - -struct ResultTile: View { - let result: String? - - var body: some View { - Group { - if let result { - Text(result) - .font(.subheadline.monospacedDigit()) - .fontWeight(result == "1" ? .bold : .regular) - .foregroundStyle(result == "0" ? Theme.onSurfaceVariant : Theme.onSurface) - .frame(minWidth: 24, minHeight: 20) - .background(result == "0" ? Color.clear : (result == "½" ? Theme.containerHigh : Theme.primaryContainer)) - .clipShape(RoundedRectangle(cornerRadius: 6)) - } else { - Color.clear.frame(width: 24, height: 20) - } - } - } -} - -struct ErrorMessage: View { - let title: String - let detail: String - var retry: (() -> Void)? - - var body: some View { - VStack(spacing: 12) { - Text(title).font(.title3).multilineTextAlignment(.center) - if !detail.isEmpty { - Text(detail) - .foregroundStyle(Theme.onSurfaceVariant) - .multilineTextAlignment(.center) - } - if let retry { - Button(L10n.retry, action: retry) - } - } - .padding(32) - .frame(maxWidth: .infinity) - } -} diff --git a/iosApp/ChessPenguin/Theme.swift b/iosApp/ChessPenguin/Theme.swift deleted file mode 100644 index fd5cd44..0000000 --- a/iosApp/ChessPenguin/Theme.swift +++ /dev/null @@ -1,81 +0,0 @@ -import Foundation -import SwiftUI - -extension Color { - init(rgb: UInt32) { - self.init( - red: Double((rgb >> 16) & 0xFF) / 255, - green: Double((rgb >> 8) & 0xFF) / 255, - blue: Double(rgb & 0xFF) / 255 - ) - } -} - -enum Theme { - static let background = Color(rgb: 0x161718) - static let containerLow = Color(rgb: 0x1F2022) - static let container = Color(rgb: 0x232427) - static let containerHigh = Color(rgb: 0x2A2C2F) - static let onSurface = Color(rgb: 0xE8E8E8) - static let onSurfaceVariant = Color(rgb: 0xA3A7AD) - static let outline = Color(rgb: 0x4A4D52) - static let outlineVariant = Color(rgb: 0x2E3033) - static let primary = Color(rgb: 0x62AEE6) - static let primaryContainer = Color(rgb: 0x1A4566) - static let error = Color(rgb: 0xF28B82) - static let pgnBadge = Color(rgb: 0x384660) - static let pgnBadgeText = Color(rgb: 0x89B4FA) - static let currentMove = Color(rgb: 0x005C80) - static let comment = Color(rgb: 0x9EC4E0) - static let boardLight = Color(rgb: 0xFFFFDD) - static let boardDark = Color(rgb: 0x86A666) - static let lastMove = Color(rgb: 0x9BC700).opacity(0.41) -} - -enum L10n { - static let appName = String(localized: "app_name") - static let files = String(localized: "files") - static let classics = String(localized: "classic_games") - static let reading = String(localized: "reading") - static let retry = String(localized: "retry") - static let openFailed = String(localized: "open_failed") - static let gameFailed = String(localized: "game_failed") - static let emptyDatabase = String(localized: "empty_database") - static let previousGame = String(localized: "previous_game") - static let nextGame = String(localized: "next_game") - static let flip = String(localized: "flip") - static let moveBack = String(localized: "move_back") - static let moveForward = String(localized: "move_forward") - static let toStart = String(localized: "to_start") - static let toEnd = String(localized: "to_end") - static let nextMoves = String(localized: "next_moves") - static let white = String(localized: "white") - static let black = String(localized: "black") - static let boardStart = String(localized: "board_start") - static let checkmate = String(localized: "checkmate") - static let stalemate = String(localized: "stalemate") - static let currentMove = String(localized: "current_move") - static let moveBackHint = String(localized: "move_back_hint") - static let moveForwardHint = String(localized: "move_forward_hint") - - static func games(_ count: Int) -> String { - String.localizedStringWithFormat(NSLocalizedString("games_count", comment: "Number of games"), count) - } - - static func gameOf(_ current: Int, _ total: Int) -> String { - String(format: String(localized: "game_of"), current, total) - } - - static func boardAfter(_ move: String) -> String { - String(format: String(localized: "board_after"), move) - } - - static func resultLine(_ result: String) -> String { - switch result { - case "1-0": return "1-0 · \(String(localized: "white_won"))" - case "0-1": return "0-1 · \(String(localized: "black_won"))" - case "1/2-1/2": return "½-½ · \(String(localized: "draw"))" - default: return "" - } - } -} diff --git a/iosApp/ChessPenguinTests/BoardModelTests.swift b/iosApp/ChessPenguinTests/BoardModelTests.swift deleted file mode 100644 index ce61872..0000000 --- a/iosApp/ChessPenguinTests/BoardModelTests.swift +++ /dev/null @@ -1,52 +0,0 @@ -import XCTest -@testable import ChessPenguin - -final class BoardModelTests: XCTestCase { - func testFlipUsesSameSquareTransformAsBoard() { - XCTAssertEqual(visualSquareIndex(0, flipped: false), 0) - XCTAssertEqual(visualSquareIndex(0, flipped: true), 63) - XCTAssertEqual(visualSquareIndex(63, flipped: true), 0) - XCTAssertEqual(visualSquareIndex(36, flipped: true), 27) - XCTAssertNil(visualSquareIndex(-1, flipped: false)) - XCTAssertNil(visualSquareIndex(64, flipped: true)) - XCTAssertEqual(squareIndex("a8"), 0) - XCTAssertEqual(squareIndex("h1"), 63) - XCTAssertNil(squareIndex("i9")) - } - - func testStartingPositionHasAllPiecesAndRejectsMalformedFEN() { - let position = BoardPosition(fen: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1") - XCTAssertEqual(position?.squares.count, 64) - XCTAssertEqual(position?.squares.compactMap { $0 }.count, 32) - XCTAssertNil(BoardPosition(fen: "8/8/8 w - - 0 1")) - XCTAssertNil(BoardPosition(fen: "9/8/8/8/8/8/8/8 w - - 0 1")) - } - - func testCommentArrowsAndSquareMarksReachBoardModel() throws { - let game = try loadGame("1. e4 {[%cal Ge2e4,Rd7d5] [%csl Yd5] Center} e5 *") - let model = BoardAnnotationModel(node: game.nodes[1]) - XCTAssertEqual(model.arrows.count, 2) - XCTAssertEqual(model.arrows[0].from, squareIndex("e2")) - XCTAssertEqual(model.arrows[0].to, squareIndex("e4")) - XCTAssertEqual(model.arrows[0].color, .green) - XCTAssertEqual(model.arrows[1].color, .red) - XCTAssertEqual(model.circles.count, 1) - XCTAssertEqual(model.circles[0].square, squareIndex("d5")) - XCTAssertEqual(model.circles[0].color, .yellow) - XCTAssertNil(model.badge) - } - - func testCurrentNAGBadgeAndCheckmateReachBoardModel() throws { - let badgeGame = try loadGame("1. e4 $1 e5 *") - let first = BoardAnnotationModel(node: badgeGame.nodes[1]) - XCTAssertEqual(first.badge?.text, "!") - XCTAssertEqual(first.badge?.square, squareIndex("e4")) - XCTAssertEqual(first.badge?.rgb, 0x81B64C) - - let mateGame = try loadGame("1. f3 e5 2. g4 Qh4# 0-1") - let lastNode = try XCTUnwrap(mateGame.nodes.last { !$0.end.isEmpty }) - let last = BoardAnnotationModel(node: lastNode) - XCTAssertEqual(last.ending, .checkmate) - XCTAssertEqual(BoardEnding(rawValue: "stalemate"), .stalemate) - } -} diff --git a/iosApp/ChessPenguinTests/GameLoadStateTests.swift b/iosApp/ChessPenguinTests/GameLoadStateTests.swift deleted file mode 100644 index efe769b..0000000 --- a/iosApp/ChessPenguinTests/GameLoadStateTests.swift +++ /dev/null @@ -1,114 +0,0 @@ -import Foundation -import XCTest -@testable import ChessPenguin - -private actor PageLoaderProbe { - private(set) var calls = 0 - - func load(database: Database, start: UInt32, count: UInt32) async -> [GameRow] { - calls += 1 - try? await Task.sleep(nanoseconds: 100_000_000) - return database.rows(start: start, count: count) - } -} - -final class GameLoadStateTests: XCTestCase { - func testLateRetryCannotReplaceGameFromNewPlace() { - var state = GameLoadState() - - // Retry A is pending. Place B opens and finishes first. - state.begin() - XCTAssertTrue(state.succeed(requestedPlace: 1, currentPlace: 1, game: "GAME_B")) - - // Late success and failure from retry A are both ignored. - XCTAssertFalse(state.succeed(requestedPlace: 0, currentPlace: 1, game: "GAME_A")) - XCTAssertFalse(state.fail(requestedPlace: 0, currentPlace: 1, message: "late A")) - XCTAssertEqual(state.loadedPlace, 1) - XCTAssertEqual(state.game, "GAME_B") - XCTAssertNil(state.failure) - } - - func testCurrentRequestStillApplies() { - var state = GameLoadState() - XCTAssertTrue(state.succeed(requestedPlace: 0, currentPlace: 0, game: "GAME_A")) - XCTAssertEqual(state.loadedPlace, 0) - XCTAssertEqual(state.game, "GAME_A") - - state.begin() - XCTAssertNil(state.failure) - XCTAssertTrue(state.fail(requestedPlace: 0, currentPlace: 0, message: "read error")) - XCTAssertNil(state.game) - XCTAssertEqual(state.failure, "read error") - } - - func testPagesContainAtMostOneHundredRows() { - XCTAssertEqual(nextGameRowPage(loaded: 0, total: 250), GameRowPage(start: 0, count: 100)) - XCTAssertEqual(nextGameRowPage(loaded: 100, total: 250), GameRowPage(start: 100, count: 100)) - XCTAssertEqual(nextGameRowPage(loaded: 200, total: 250), GameRowPage(start: 200, count: 50)) - XCTAssertNil(nextGameRowPage(loaded: 250, total: 250)) - XCTAssertNil(nextGameRowPage(loaded: 0, total: 0)) - XCTAssertEqual(nextGameRowPage(loaded: 0, total: 100), GameRowPage(start: 0, count: 100)) - } - - func testNextAcrossPageBoundariesRequestsPageThenUsesLoadedRow() { - // Human transition 100 → 101: place 99 needs the second page for place 100. - XCTAssertEqual( - nextGameRequest(fromPlace: 99, totalGames: 250, loadedRows: 100), - NextGameRequest(fromPlace: 99, toPlace: 100, needsNextPage: true) - ) - XCTAssertEqual( - nextGameRequest(fromPlace: 100, totalGames: 250, loadedRows: 200), - NextGameRequest(fromPlace: 100, toPlace: 101, needsNextPage: false) - ) - - // Human transition 200 → 201 follows the same rule at the third page. - XCTAssertEqual( - nextGameRequest(fromPlace: 199, totalGames: 250, loadedRows: 200), - NextGameRequest(fromPlace: 199, toPlace: 200, needsNextPage: true) - ) - XCTAssertEqual( - nextGameRequest(fromPlace: 200, totalGames: 250, loadedRows: 250), - NextGameRequest(fromPlace: 200, toPlace: 201, needsNextPage: false) - ) - XCTAssertNil(nextGameRequest(fromPlace: 249, totalGames: 250, loadedRows: 250)) - } - - @MainActor - func testConcurrentFooterAndNextShareInFlightPageLoad() async throws { - let pgn = (0..<250).map { - "[Event \"Game \($0)\"]\n[White \"White\"]\n[Black \"Black\"]\n\n1. e4 *\n\n" - }.joined() - let database = try openBytes(name: "250.pgn", bytes: Data(pgn.utf8)) - let probe = PageLoaderProbe() - let model = AppModel( - database: database, - rows: database.rows(start: 0, count: 100), - totalGames: 250 - ) { database, start, count in - await probe.load(database: database, start: start, count: count) - } - - // Footer starts the delayed page load. Next must await the same task, not return early. - async let footer = model.loadNextPage() - async let next = model.loadNextPage() - await next - XCTAssertEqual(model.rows.count, 200, "Next returned before the shared page was appended") - await footer - - let calls = await probe.calls - XCTAssertEqual(calls, 1) - XCTAssertEqual(model.rows.count, 200) - XCTAssertFalse(model.isLoadingPage) - - // The guard used by show(100) now passes for both awaiting callers. - let request = try XCTUnwrap(nextGameRequest( - fromPlace: 99, - totalGames: model.totalGames, - loadedRows: model.rows.count - )) - XCTAssertEqual(request.toPlace, 100) - XCTAssertFalse(request.needsNextPage) - XCTAssertTrue(model.rows.indices.contains(request.toPlace)) - XCTAssertEqual(model.rows[request.toPlace].index, 100) - } -} diff --git a/iosApp/ChessPenguinTests/KeyboardAccessibilityTests.swift b/iosApp/ChessPenguinTests/KeyboardAccessibilityTests.swift deleted file mode 100644 index 3a60ef1..0000000 --- a/iosApp/ChessPenguinTests/KeyboardAccessibilityTests.swift +++ /dev/null @@ -1,39 +0,0 @@ -import XCTest -@testable import ChessPenguin - -final class KeyboardAccessibilityTests: XCTestCase { - func testEveryHardwareKeyHasRealGameCommand() { - let mapping: [(GameKeyboardKey, GameCommand)] = [ - (.leftArrow, .previousMove), - (.rightArrow, .nextMove), - (.shiftLeftArrow, .startOfLine), - (.shiftRightArrow, .endOfLine), - (.f, .flip), - (.escape, .back), - ] - for (key, expected) in mapping { - XCTAssertEqual(gameCommand(for: key), expected) - } - } - - func testWholeRowAccessibilityIncludesResultAndFullNames() { - let row = makeGameRow(result: "1-0") - let label = gameRowAccessibility(row: row, number: 7, lastOpened: true) - XCTAssertTrue(label.contains(row.white)) - XCTAssertTrue(label.contains(row.black)) - XCTAssertTrue(label.contains("1-0")) - XCTAssertTrue(label.contains(row.event)) - XCTAssertTrue(label.contains("1858")) - XCTAssertTrue(label.contains(row.eco)) - XCTAssertFalse(gameResultAccessibility(row.result).isEmpty) - XCTAssertFalse(label.isEmpty) - } - - func testEveryResultHasMeaningfulAccessibilityText() { - for result in ["1-0", "0-1", "1/2-1/2", "*"] { - let spoken = gameResultAccessibility(result) - XCTAssertFalse(spoken.isEmpty) - if result != "1/2-1/2" { XCTAssertTrue(spoken.contains(result)) } - } - } -} diff --git a/iosApp/ChessPenguinTests/NotationModelTests.swift b/iosApp/ChessPenguinTests/NotationModelTests.swift deleted file mode 100644 index 20cbe56..0000000 --- a/iosApp/ChessPenguinTests/NotationModelTests.swift +++ /dev/null @@ -1,71 +0,0 @@ -import XCTest -@testable import ChessPenguin - -final class NotationModelTests: XCTestCase { - func testOperaContainsMainLineAndEveryVariationNode() throws { - let game = try loadGame(operaPGN) - let model = NotationModel(game: game) - let expected = Set(game.nodes.dropFirst().map { Int($0.id) }) - - XCTAssertEqual(Set(model.moveIDs), expected) - XCTAssertEqual(model.moveIDs.count, expected.count, "a reachable node is rendered exactly once") - - let qxb7 = try XCTUnwrap(game.nodes.first { $0.san == "Qxb7" && $0.moveNumber == 8 }) - let nc3 = try XCTUnwrap(game.nodes.first { $0.san == "Nc3" }) - XCTAssertNotNil(model.entryByNode[Int(qxb7.id)]) - XCTAssertNotNil(model.entryByNode[Int(nc3.id)]) - - let labels = model.entries.flatMap { entry -> [String] in - guard case .variation(let variation) = entry else { return [] } - return variation.tokens.compactMap { - if case .move(let move) = $0 { return move.label } - return nil - } - } - XCTAssertTrue(labels.contains("8.Qxb7")) - XCTAssertTrue(labels.contains("Qb4+")) - XCTAssertTrue(labels.contains("9.Qxb4")) - XCTAssertTrue(labels.contains("Bxb4+")) - } - - func testNestedRAVRemainsClickableWithParentheses() throws { - let game = try loadGame("1. e4 (1. d4 d5 (1... c5)) 1... e5 *") - let model = NotationModel(game: game) - let expected = Set(game.nodes.dropFirst().map { Int($0.id) }) - - XCTAssertEqual(Set(model.moveIDs), expected) - XCTAssertEqual(model.moveIDs.count, expected.count) - for id in expected { - XCTAssertNotNil(model.entryByNode[id], "node \(id) has no clickable notation entry") - } - - let tokens = model.entries.flatMap { entry -> [NotationToken] in - guard case .variation(let variation) = entry else { return [] } - return variation.tokens - } - let punctuation = tokens.compactMap { - if case .punctuation(_, let text) = $0 { return text } - return nil - } - XCTAssertEqual(punctuation.filter { $0 == "(" }.count, 1) - XCTAssertEqual(punctuation.filter { $0 == ")" }.count, 1) - } - - func testVisitedSetStopsMalformedCyclesWithoutDroppingFirstNode() throws { - var game = try loadGame("1. e4 e5 *") - game.nodes[1].children = [1] - let model = NotationModel(game: game) - XCTAssertEqual(model.moveIDs, [1]) - XCTAssertEqual(model.moveIDs.count, Set(model.moveIDs).count) - } - - func testResultIsSeparateEntry() throws { - let model = NotationModel(game: try loadGame("1. e4 e5 1-0")) - let last = try XCTUnwrap(model.entries.last) - guard case .result(let result) = last else { - return XCTFail("missing result entry") - } - XCTAssertTrue(result.text.contains("1-0")) - XCTAssertEqual(result.indent, 0) - } -} diff --git a/iosApp/ChessPenguinTests/TestSupport.swift b/iosApp/ChessPenguinTests/TestSupport.swift deleted file mode 100644 index 83651bc..0000000 --- a/iosApp/ChessPenguinTests/TestSupport.swift +++ /dev/null @@ -1,47 +0,0 @@ -import Foundation -@testable import ChessPenguin - -func loadGame(_ pgn: String, index: UInt32 = 0) throws -> GameData { - let database = try openBytes(name: "fixture.pgn", bytes: Data(pgn.utf8)) - return try database.game(index: index) -} - -func makeGameRow(result: String = "1-0") -> GameRow { - GameRow( - index: 6, - white: "Morphy, Paul", - black: "Duke Karl / Count Isouard", - result: result, - date: "1858.??.??", - event: "Paris Opera", - eco: "C41", - whiteElo: "", - blackElo: "" - ) -} - -let operaPGN = #""" -[Event "Paris Opera"] -[Site "Paris FRA"] -[Date "1858.??.??"] -[Round "?"] -[White "Morphy, Paul"] -[Black "Duke Karl / Count Isouard"] -[Result "1-0"] -[ECO "C41"] -[PlyCount "33"] - -{The "Opera Game": a model of rapid development and open lines.} 1. e4 e5 2. Nf3 -d6 3. d4 Bg4 $6 {Pinning the knight, but Black will have to give up the bishop -pair.} 4. dxe5 Bxf3 (4... dxe5 5. Qxd8+ Kxd8 6. Nxe5 {wins a pawn.}) 5. Qxf3 -dxe5 6. Bc4 {Threatening Qxf7#.} Nf6 7. Qb3 $1 {A double attack on f7 and b7.} -Qe7 8. Nc3 {Morphy prefers development to material.} (8. Qxb7 Qb4+ 9. Qxb4 Bxb4+ -{only trades queens.}) 8... c6 9. Bg5 b5 $2 {Black wants to chase the bishop, but opens lines towards his own king.} -(9... Nbd7 {is the healthy move:} 10. O-O-O {keeps the pressure on d7.} (10. Qxb7 $6 Qb4+ -11. Qxb4 Bxb4 {[%csl Gb4] and Black is fine.}) 10... h6 11. Bh4 $14) 10. Nxb5 $1 -{[%cal Gb5d6,Gc4f7] The knight sacrifice opens the c-file and the a4-e8 diagonal.} cxb5 11. -Bxb5+ Nbd7 12. O-O-O {[%csl Rd7][%cal Gd1d7,Gb5d7] All of White's pieces aim at d7.} Rd8 -13. Rxd7 $1 Rxd7 14. Rd1 Qe6 15. Bxd7+ Nxd7 16. Qb8+ $3 {[%cal Gb3b8,Gd1d8] The famous -queen sacrifice.} Nxb8 17. Rd8# {[%csl Re8] A model of rapid development.} -1-0 -"""# diff --git a/iosApp/Generated/.gitattributes b/iosApp/Generated/.gitattributes deleted file mode 100644 index d2b20fe..0000000 --- a/iosApp/Generated/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -# Preserve UniFFI output byte-for-byte: its templates emit trailing spaces. -*.swift whitespace=-trailing-space -*.h whitespace=-trailing-space diff --git a/iosApp/Generated/MobileAPI/MobileAPI.swift b/iosApp/Generated/MobileAPI/MobileAPI.swift deleted file mode 100644 index ff469af..0000000 --- a/iosApp/Generated/MobileAPI/MobileAPI.swift +++ /dev/null @@ -1,8614 +0,0 @@ -// This file was autogenerated by some hot garbage in the `uniffi` crate. -// Trust me, you don't want to mess with it! - -// swiftlint:disable all -import Foundation - -// Depending on the consumer's build setup, the low-level FFI code -// might be in a separate module, or it might be compiled inline into -// this module. This is a bit of light hackery to work with both. -#if canImport(MobileAPIFFI) -import MobileAPIFFI -#endif - -fileprivate extension RustBuffer { - // Allocate a new buffer, copying the contents of a `UInt8` array. - init(bytes: [UInt8]) { - let rbuf = bytes.withUnsafeBufferPointer { ptr in - RustBuffer.from(ptr) - } - self.init(capacity: rbuf.capacity, len: rbuf.len, data: rbuf.data) - } - - static func empty() -> RustBuffer { - RustBuffer(capacity: 0, len:0, data: nil) - } - - static func from(_ ptr: UnsafeBufferPointer) -> RustBuffer { - try! rustCall { ffi_mobile_api_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) } - } - - // Frees the buffer in place. - // The buffer must not be used after this is called. - func deallocate() { - try! rustCall { ffi_mobile_api_rustbuffer_free(self, $0) } - } -} - -fileprivate extension ForeignBytes { - init(bufferPointer: UnsafeBufferPointer) { - self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress) - } - - init(rawBufferPointer: UnsafeRawBufferPointer) { - self.init( - len: Int32(rawBufferPointer.count), - data: rawBufferPointer.baseAddress?.assumingMemoryBound(to: UInt8.self) - ) - } -} - -// Converter for `&[u8]` / `[ByRef] bytes` arguments. -// -// Conforms to `FfiConverter` so the compiler enforces the full converter -// method set. Only the scope-bound `lower(_:_body:)` overload is sound — -// zero-copy byte buffers only flow foreign -> Rust, and only in argument -// position. The four protocol-witness methods (`lift`, `lower`, `read`, -// `write`) `fatalError` at runtime if anyone reaches them. -// -// The scope-bound `lower` takes a closure because the `ForeignBytes` -// pointer is only guaranteed valid for the duration of -// `Data.withUnsafeBytes`. Callers must run the full FFI call inside -// the closure body. -fileprivate enum FfiConverterByRefBytes: FfiConverter { - typealias SwiftType = Data - typealias FfiType = ForeignBytes - - static func lower(_ value: Data, _ body: (ForeignBytes) throws -> R) rethrows -> R { - return try value.withUnsafeBytes { rawBuf in - try body(ForeignBytes(rawBufferPointer: rawBuf)) - } - } - - static func lower(_ value: Data) -> ForeignBytes { - fatalError("ByRef bytes cannot use the plain lower: returning ForeignBytes escapes the Data.withUnsafeBytes scope. Use the scope-bound lower(_:_body:) overload instead.") - } - - static func lift(_ value: ForeignBytes) throws -> Data { - fatalError("ByRef bytes cannot be lifted: zero-copy &[u8] only flows foreign->Rust") - } - - static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Data { - fatalError("ByRef bytes cannot be read from a buffer: zero-copy &[u8] is only supported in argument position, not nested in records/options/etc.") - } - - static func write(_ value: Data, into buf: inout [UInt8]) { - fatalError("ByRef bytes cannot be written to a buffer: zero-copy &[u8] is only supported in argument position, not nested in records/options/etc.") - } -} - -// For every type used in the interface, we provide helper methods for conveniently -// lifting and lowering that type from C-compatible data, and for reading and writing -// values of that type in a buffer. - -// Helper classes/extensions that don't change. -// Someday, this will be in a library of its own. - -fileprivate extension Data { - init(rustBuffer: RustBuffer) { - self.init( - bytesNoCopy: rustBuffer.data!, - count: Int(rustBuffer.len), - deallocator: .none - ) - } -} - -// Define reader functionality. Normally this would be defined in a class or -// struct, but we use standalone functions instead in order to make external -// types work. -// -// With external types, one swift source file needs to be able to call the read -// method on another source file's FfiConverter, but then what visibility -// should Reader have? -// - If Reader is fileprivate, then this means the read() must also -// be fileprivate, which doesn't work with external types. -// - If Reader is internal/public, we'll get compile errors since both source -// files will try define the same type. -// -// Instead, the read() method and these helper functions input a tuple of data - -fileprivate func createReader(data: Data) -> (data: Data, offset: Data.Index) { - (data: data, offset: 0) -} - -// Reads an integer at the current offset, in big-endian order, and advances -// the offset on success. Throws if reading the integer would move the -// offset past the end of the buffer. -fileprivate func readInt(_ reader: inout (data: Data, offset: Data.Index)) throws -> T { - let range = reader.offset...size - guard reader.data.count >= range.upperBound else { - throw UniffiInternalError.bufferOverflow - } - if T.self == UInt8.self { - let value = reader.data[reader.offset] - reader.offset += 1 - return value as! T - } - var value: T = 0 - let _ = withUnsafeMutableBytes(of: &value, { reader.data.copyBytes(to: $0, from: range)}) - reader.offset = range.upperBound - return value.bigEndian -} - -// Reads an arbitrary number of bytes, to be used to read -// raw bytes, this is useful when lifting strings -fileprivate func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> Array { - let range = reader.offset..<(reader.offset+count) - guard reader.data.count >= range.upperBound else { - throw UniffiInternalError.bufferOverflow - } - var value = [UInt8](repeating: 0, count: count) - value.withUnsafeMutableBufferPointer({ buffer in - reader.data.copyBytes(to: buffer, from: range) - }) - reader.offset = range.upperBound - return value -} - -// Reads a float at the current offset. -fileprivate func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float { - return Float(bitPattern: try readInt(&reader)) -} - -// Reads a float at the current offset. -fileprivate func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double { - return Double(bitPattern: try readInt(&reader)) -} - -// Indicates if the offset has reached the end of the buffer. -fileprivate func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool { - return reader.offset < reader.data.count -} - -// Define writer functionality. Normally this would be defined in a class or -// struct, but we use standalone functions instead in order to make external -// types work. See the above discussion on Readers for details. - -fileprivate func createWriter() -> [UInt8] { - return [] -} - -fileprivate func writeBytes(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 { - writer.append(contentsOf: byteArr) -} - -// Writes an integer in big-endian order. -// -// Warning: make sure what you are trying to write -// is in the correct type! -fileprivate func writeInt(_ writer: inout [UInt8], _ value: T) { - var value = value.bigEndian - withUnsafeBytes(of: &value) { writer.append(contentsOf: $0) } -} - -fileprivate func writeFloat(_ writer: inout [UInt8], _ value: Float) { - writeInt(&writer, value.bitPattern) -} - -fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) { - writeInt(&writer, value.bitPattern) -} - -// Protocol for types that transfer other types across the FFI. This is -// analogous to the Rust trait of the same name. -fileprivate protocol FfiConverter { - associatedtype FfiType - associatedtype SwiftType - - static func lift(_ value: FfiType) throws -> SwiftType - static func lower(_ value: SwiftType) -> FfiType - static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType - static func write(_ value: SwiftType, into buf: inout [UInt8]) -} - -// Types conforming to `Primitive` pass themselves directly over the FFI. -fileprivate protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType { } - -extension FfiConverterPrimitive { -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public static func lift(_ value: FfiType) throws -> SwiftType { - return value - } - -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public static func lower(_ value: SwiftType) -> FfiType { - return value - } -} - -// Types conforming to `FfiConverterRustBuffer` lift and lower into a `RustBuffer`. -// Used for complex types where it's hard to write a custom lift/lower. -fileprivate protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {} - -extension FfiConverterRustBuffer { -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public static func lift(_ buf: RustBuffer) throws -> SwiftType { - var reader = createReader(data: Data(rustBuffer: buf)) - let value = try read(from: &reader) - if hasRemaining(reader) { - throw UniffiInternalError.incompleteData - } - buf.deallocate() - return value - } - -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public static func lower(_ value: SwiftType) -> RustBuffer { - var writer = createWriter() - write(value, into: &writer) - return RustBuffer(bytes: writer) - } -} -// An error type for FFI errors. These errors occur at the UniFFI level, not -// the library level. -fileprivate enum UniffiInternalError: LocalizedError { - case bufferOverflow - case incompleteData - case unexpectedOptionalTag - case unexpectedEnumCase - case unexpectedNullPointer - case unexpectedRustCallStatusCode - case unexpectedRustCallError - case unexpectedStaleHandle - case rustPanic(_ message: String) - - public var errorDescription: String? { - switch self { - case .bufferOverflow: return "Reading the requested value would read past the end of the buffer" - case .incompleteData: return "The buffer still has data after lifting its containing value" - case .unexpectedOptionalTag: return "Unexpected optional tag; should be 0 or 1" - case .unexpectedEnumCase: return "Raw enum value doesn't match any cases" - case .unexpectedNullPointer: return "Raw pointer value was null" - case .unexpectedRustCallStatusCode: return "Unexpected RustCallStatus code" - case .unexpectedRustCallError: return "CALL_ERROR but no errorClass specified" - case .unexpectedStaleHandle: return "The object in the handle map has been dropped already" - case let .rustPanic(message): return message - } - } -} - -fileprivate extension NSLock { - func withLock(f: () throws -> T) rethrows -> T { - self.lock() - defer { self.unlock() } - return try f() - } -} - -fileprivate let CALL_SUCCESS: Int8 = 0 -fileprivate let CALL_ERROR: Int8 = 1 -fileprivate let CALL_UNEXPECTED_ERROR: Int8 = 2 -fileprivate let CALL_CANCELLED: Int8 = 3 - -fileprivate extension RustCallStatus { - init() { - self.init( - code: CALL_SUCCESS, - errorBuf: RustBuffer.init( - capacity: 0, - len: 0, - data: nil - ) - ) - } -} - -private func rustCall(_ callback: (UnsafeMutablePointer) -> T) throws -> T { - let neverThrow: ((RustBuffer) throws -> Never)? = nil - return try makeRustCall(callback, errorHandler: neverThrow) -} - -private func rustCallWithError( - _ errorHandler: @escaping (RustBuffer) throws -> E, - _ callback: (UnsafeMutablePointer) -> T) throws -> T { - try makeRustCall(callback, errorHandler: errorHandler) -} - -private func makeRustCall( - _ callback: (UnsafeMutablePointer) -> T, - errorHandler: ((RustBuffer) throws -> E)? -) throws -> T { - uniffiEnsureMobileApiInitialized() - var callStatus = RustCallStatus.init() - let returnedVal = callback(&callStatus) - try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler) - return returnedVal -} - -private func uniffiCheckCallStatus( - callStatus: RustCallStatus, - errorHandler: ((RustBuffer) throws -> E)? -) throws { - switch callStatus.code { - case CALL_SUCCESS: - return - - case CALL_ERROR: - if let errorHandler = errorHandler { - throw try errorHandler(callStatus.errorBuf) - } else { - callStatus.errorBuf.deallocate() - throw UniffiInternalError.unexpectedRustCallError - } - - case CALL_UNEXPECTED_ERROR: - // When the rust code sees a panic, it tries to construct a RustBuffer - // with the message. But if that code panics, then it just sends back - // an empty buffer. - if callStatus.errorBuf.len > 0 { - throw UniffiInternalError.rustPanic(try FfiConverterString.lift(callStatus.errorBuf)) - } else { - callStatus.errorBuf.deallocate() - throw UniffiInternalError.rustPanic("Rust panic") - } - - case CALL_CANCELLED: - fatalError("Cancellation not supported yet") - - default: - throw UniffiInternalError.unexpectedRustCallStatusCode - } -} - -private func uniffiTraitInterfaceCall( - callStatus: UnsafeMutablePointer, - makeCall: () throws -> T, - writeReturn: (T) -> () -) { - do { - try writeReturn(makeCall()) - } catch let error { - callStatus.pointee.code = CALL_UNEXPECTED_ERROR - callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error)) - } -} - -private func uniffiTraitInterfaceCallWithError( - callStatus: UnsafeMutablePointer, - makeCall: () throws -> T, - writeReturn: (T) -> (), - lowerError: (E) -> RustBuffer -) { - do { - try writeReturn(makeCall()) - } catch let error as E { - callStatus.pointee.code = CALL_ERROR - callStatus.pointee.errorBuf = lowerError(error) - } catch { - callStatus.pointee.code = CALL_UNEXPECTED_ERROR - callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error)) - } -} -// Initial value and increment amount for handles. -// These ensure that SWIFT handles always have the lowest bit set -fileprivate let UNIFFI_HANDLEMAP_INITIAL: UInt64 = 1 -fileprivate let UNIFFI_HANDLEMAP_DELTA: UInt64 = 2 - -fileprivate final class UniffiHandleMap: @unchecked Sendable { - // All mutation happens with this lock held, which is why we implement @unchecked Sendable. - private let lock = NSLock() - private var map: [UInt64: T] = [:] - private var currentHandle: UInt64 = UNIFFI_HANDLEMAP_INITIAL - - func insert(obj: T) -> UInt64 { - lock.withLock { - return doInsert(obj) - } - } - - // Low-level insert function, this assumes `lock` is held. - private func doInsert(_ obj: T) -> UInt64 { - let handle = currentHandle - currentHandle += UNIFFI_HANDLEMAP_DELTA - map[handle] = obj - return handle - } - - func get(handle: UInt64) throws -> T { - try lock.withLock { - guard let obj = map[handle] else { - throw UniffiInternalError.unexpectedStaleHandle - } - return obj - } - } - - func clone(handle: UInt64) throws -> UInt64 { - try lock.withLock { - guard let obj = map[handle] else { - throw UniffiInternalError.unexpectedStaleHandle - } - return doInsert(obj) - } - } - - @discardableResult - func remove(handle: UInt64) throws -> T { - try lock.withLock { - guard let obj = map.removeValue(forKey: handle) else { - throw UniffiInternalError.unexpectedStaleHandle - } - return obj - } - } - - var count: Int { - get { - map.count - } - } -} - - -// Public interface members begin here. - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterUInt32: FfiConverterPrimitive { - typealias FfiType = UInt32 - typealias SwiftType = UInt32 - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt32 { - return try lift(readInt(&buf)) - } - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterInt32: FfiConverterPrimitive { - typealias FfiType = Int32 - typealias SwiftType = Int32 - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Int32 { - return try lift(readInt(&buf)) - } - - public static func write(_ value: Int32, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterUInt64: FfiConverterPrimitive { - typealias FfiType = UInt64 - typealias SwiftType = UInt64 - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt64 { - return try lift(readInt(&buf)) - } - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterInt64: FfiConverterPrimitive { - typealias FfiType = Int64 - typealias SwiftType = Int64 - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Int64 { - return try lift(readInt(&buf)) - } - - public static func write(_ value: Int64, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterFloat: FfiConverterPrimitive { - typealias FfiType = Float - typealias SwiftType = Float - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Float { - return try lift(readFloat(&buf)) - } - - public static func write(_ value: Float, into buf: inout [UInt8]) { - writeFloat(&buf, lower(value)) - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterDouble: FfiConverterPrimitive { - typealias FfiType = Double - typealias SwiftType = Double - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Double { - return try lift(readDouble(&buf)) - } - - public static func write(_ value: Double, into buf: inout [UInt8]) { - writeDouble(&buf, lower(value)) - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterBool : FfiConverter { - typealias FfiType = Int8 - typealias SwiftType = Bool - - public static func lift(_ value: Int8) throws -> Bool { - return value != 0 - } - - public static func lower(_ value: Bool) -> Int8 { - return value ? 1 : 0 - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Bool { - return try lift(readInt(&buf)) - } - - public static func write(_ value: Bool, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterString: FfiConverter { - typealias SwiftType = String - typealias FfiType = RustBuffer - - public static func lift(_ value: RustBuffer) throws -> String { - defer { - value.deallocate() - } - if value.data == nil { - return String() - } - let bytes = UnsafeBufferPointer(start: value.data!, count: Int(value.len)) - // Use Swift's native UTF-8 decoder; `String(bytes:encoding:.utf8)` goes - // through Foundation's NSString and silently strips a leading U+FEFF BOM. - // Invalid UTF-8 substitutes U+FFFD instead of trapping (unreachable - // given Rust's `String` invariant). - return String(decoding: bytes, as: UTF8.self) - } - - public static func lower(_ value: String) -> RustBuffer { - return value.utf8CString.withUnsafeBufferPointer { ptr in - // The swift string gives us int8_t, we want uint8_t. - ptr.withMemoryRebound(to: UInt8.self) { ptr in - // The swift string gives us a trailing null byte, we don't want it. - let buf = UnsafeBufferPointer(rebasing: ptr.prefix(upTo: ptr.count - 1)) - return RustBuffer.from(buf) - } - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> String { - let len: Int32 = try readInt(&buf) - // See `lift` above for why we avoid Foundation's NSString-backed decoder here. - return String(decoding: try readBytes(&buf, count: Int(len)), as: UTF8.self) - } - - public static func write(_ value: String, into buf: inout [UInt8]) { - let len = Int32(value.utf8.count) - writeInt(&buf, len) - writeBytes(&buf, value.utf8) - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterData: FfiConverterRustBuffer { - typealias SwiftType = Data - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Data { - let len: Int32 = try readInt(&buf) - return Data(try readBytes(&buf, count: Int(len))) - } - - public static func write(_ value: Data, into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - writeBytes(&buf, value) - } -} - - - - -/** - * A running engine. - */ -public protocol AnalyzerProtocol: AnyObject, Sendable { - - /** - * Analyses the position reached from `start_fen` by `moves` (UCI), with `lines` - * lines, until [`Analyzer::stop`] or the next call. Returns the search's number: - * only snapshots with it belong to this position. - */ - func analyze(startFen: String, moves: [String], lines: UInt32) throws -> UInt64 - - /** - * Waits up to `timeout_ms` for the engine; returns the analysis of the current - * search when it has changed, `None` otherwise. Fails once the engine has stopped. - */ - func poll(timeoutMs: UInt32) throws -> Analysis? - - /** - * Quits the engine (and kills it if it does not leave in time). - */ - func quit() - - /** - * Stops the search (its last lines stay valid for its position). - */ - func stop() - -} -/** - * A running engine. - */ -open class Analyzer: AnalyzerProtocol, @unchecked Sendable { - fileprivate let handle: UInt64 - - /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public struct NoHandle { - public init() {} - } - - // TODO: We'd like this to be `private` but for Swifty reasons, - // we can't implement `FfiConverter` without making this `required` and we can't - // make it `required` without making it `public`. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - required public init(unsafeFromHandle handle: UInt64) { - self.handle = handle - } - - // This constructor can be used to instantiate a fake object. - // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. - // - // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public init(noHandle: NoHandle) { - self.handle = 0 - } - -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public func uniffiCloneHandle() -> UInt64 { - return try! rustCall { uniffi_mobile_api_fn_clone_analyzer(self.handle, $0) } - } - // No primary constructor declared for this class. - - deinit { - if handle == 0 { - // Mock objects have handle=0 don't try to free them - return - } - - try! rustCall { uniffi_mobile_api_fn_free_analyzer(handle, $0) } - } - - - /** - * Starts the engine at `path` with its network `eval_file`. Blocks for the - * handshake (seconds at most): call it off the main thread. - */ -public static func start(path: String, evalFile: String, threads: UInt32, hashMb: UInt32)throws -> Analyzer { - return try FfiConverterTypeAnalyzer_lift(try rustCallWithError(FfiConverterTypeEngineFailure_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_constructor_analyzer_start( - FfiConverterString.lower(path), - FfiConverterString.lower(evalFile), - FfiConverterUInt32.lower(threads), - FfiConverterUInt32.lower(hashMb),uniffiCallStatus - ) -}) -} - - - - /** - * Analyses the position reached from `start_fen` by `moves` (UCI), with `lines` - * lines, until [`Analyzer::stop`] or the next call. Returns the search's number: - * only snapshots with it belong to this position. - */ -open func analyze(startFen: String, moves: [String], lines: UInt32)throws -> UInt64 { - return try FfiConverterUInt64.lift(try rustCallWithError(FfiConverterTypeEngineFailure_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_method_analyzer_analyze( - self.uniffiCloneHandle(), - FfiConverterString.lower(startFen), - FfiConverterSequenceString.lower(moves), - FfiConverterUInt32.lower(lines),uniffiCallStatus - ) -}) -} - - /** - * Waits up to `timeout_ms` for the engine; returns the analysis of the current - * search when it has changed, `None` otherwise. Fails once the engine has stopped. - */ -open func poll(timeoutMs: UInt32)throws -> Analysis? { - return try FfiConverterOptionTypeAnalysis.lift(try rustCallWithError(FfiConverterTypeEngineFailure_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_method_analyzer_poll( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(timeoutMs),uniffiCallStatus - ) -}) -} - - /** - * Quits the engine (and kills it if it does not leave in time). - */ -open func quit() {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_analyzer_quit( - self.uniffiCloneHandle(),uniffiCallStatus - ) -} -} - - /** - * Stops the search (its last lines stay valid for its position). - */ -open func stop() {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_analyzer_stop( - self.uniffiCloneHandle(),uniffiCallStatus - ) -} -} - - - -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeAnalyzer: FfiConverter { - typealias FfiType = UInt64 - typealias SwiftType = Analyzer - - public static func lift(_ handle: UInt64) throws -> Analyzer { - return Analyzer(unsafeFromHandle: handle) - } - - public static func lower(_ value: Analyzer) -> UInt64 { - return value.uniffiCloneHandle() - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Analyzer { - let handle: UInt64 = try readInt(&buf) - return try lift(handle) - } - - public static func write(_ value: Analyzer, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeAnalyzer_lift(_ handle: UInt64) throws -> Analyzer { - return try FfiConverterTypeAnalyzer.lift(handle) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeAnalyzer_lower(_ value: Analyzer) -> UInt64 { - return FfiConverterTypeAnalyzer.lower(value) -} - - - - - - -/** - * An open database. - */ -public protocol DatabaseProtocol: AnyObject, Sendable { - - /** - * The numbers of the games whose players, event, site, date or opening code (ECO) - * contain every word of `text` (case does not matter); all games for an empty text. - */ - func find(text: String) -> [UInt32] - - /** - * What the database was read from ("PGN", "ChessBase", "zip", …). - */ - func format() -> String - - /** - * The game `index`, ready to show. - */ - func game(index: UInt32) throws -> GameData - - func isEmpty() -> Bool - - /** - * The number of games. - */ - func len() -> UInt32 - - /** - * These games (from [`Database::find`]) from the most recent to the oldest, by the - * time they were played (`UTCDate` and `UTCTime` when there, else `Date`); games of - * the same time keep the newer place in the file first. For downloaded databases, - * where both sites' games are appended oldest first. - */ - func newestFirst(indices: [UInt32]) -> [UInt32] - - /** - * Remarks about the conversion, one line each. - */ - func notes() -> [String] - - /** - * The game `index` as PGN text, as it is in the file (to copy or share). - */ - func pgn(index: UInt32) -> String? - - /** - * The analysis of the game `index` (its report), with earlier results from the - * cache folder `cache_dir` ("" for none) or from `[%eval]` comments of the game. - */ - func review(index: UInt32, cacheDir: String) throws -> GameReview - - /** - * Up to `count` lines of the game list from `start` on. - */ - func rows(start: UInt32, count: UInt32) -> [GameRow] - - /** - * The rows of these games (from [`Database::find`]), in this order. - */ - func rowsOf(indices: [UInt32]) -> [GameRow] - - /** - * The game `index`, to change (moves, variations, its data) and save. - */ - func session(index: UInt32) throws -> GameSession - - /** - * Starts preparation for an exact player and colour at `query_fen` (empty means - * the usual initial position). Only the first main-line occurrence in each game - * counts; transpositions count and variations in the database do not. The thread - * is bounded to one active request per database: a new request cancels the old one. - */ - func preparePosition(playerId: UInt32, white: Bool, queryFen: String) throws -> PrepSearch - - /** - * Exact-name suggestions, `count` at most 200. An empty query lists all named - * players alphabetically; a non-empty one keeps the catalogue's prefix/games order. - */ - func suggestPlayers(query: String, start: UInt32, count: UInt32) -> PlayerSuggestions - -} -/** - * An open database. - */ -open class Database: DatabaseProtocol, @unchecked Sendable { - fileprivate let handle: UInt64 - - /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public struct NoHandle { - public init() {} - } - - // TODO: We'd like this to be `private` but for Swifty reasons, - // we can't implement `FfiConverter` without making this `required` and we can't - // make it `required` without making it `public`. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - required public init(unsafeFromHandle handle: UInt64) { - self.handle = handle - } - - // This constructor can be used to instantiate a fake object. - // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. - // - // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public init(noHandle: NoHandle) { - self.handle = 0 - } - -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public func uniffiCloneHandle() -> UInt64 { - return try! rustCall { uniffi_mobile_api_fn_clone_database(self.handle, $0) } - } - // No primary constructor declared for this class. - - deinit { - if handle == 0 { - // Mock objects have handle=0 don't try to free them - return - } - - try! rustCall { uniffi_mobile_api_fn_free_database(handle, $0) } - } - - - - - /** - * The numbers of the games whose players, event, site, date or opening code (ECO) - * contain every word of `text` (case does not matter); all games for an empty text. - */ -open func find(text: String) -> [UInt32] { - return try! FfiConverterSequenceUInt32.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_find( - self.uniffiCloneHandle(), - FfiConverterString.lower(text),uniffiCallStatus - ) -}) -} - - /** - * What the database was read from ("PGN", "ChessBase", "zip", …). - */ -open func format() -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_format( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * The game `index`, ready to show. - */ -open func game(index: UInt32)throws -> GameData { - return try FfiConverterTypeGameData_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_game( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(index),uniffiCallStatus - ) -}) -} - -open func isEmpty() -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_is_empty( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * The number of games. - */ -open func len() -> UInt32 { - return try! FfiConverterUInt32.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_len( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * These games (from [`Database::find`]) from the most recent to the oldest, by the - * time they were played (`UTCDate` and `UTCTime` when there, else `Date`); games of - * the same time keep the newer place in the file first. For downloaded databases, - * where both sites' games are appended oldest first. - */ -open func newestFirst(indices: [UInt32]) -> [UInt32] { - return try! FfiConverterSequenceUInt32.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_newest_first( - self.uniffiCloneHandle(), - FfiConverterSequenceUInt32.lower(indices),uniffiCallStatus - ) -}) -} - - /** - * Remarks about the conversion, one line each. - */ -open func notes() -> [String] { - return try! FfiConverterSequenceString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_notes( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * The game `index` as PGN text, as it is in the file (to copy or share). - */ -open func pgn(index: UInt32) -> String? { - return try! FfiConverterOptionString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_pgn( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(index),uniffiCallStatus - ) -}) -} - - /** - * The analysis of the game `index` (its report), with earlier results from the - * cache folder `cache_dir` ("" for none) or from `[%eval]` comments of the game. - */ -open func review(index: UInt32, cacheDir: String)throws -> GameReview { - return try FfiConverterTypeGameReview_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_review( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(index), - FfiConverterString.lower(cacheDir),uniffiCallStatus - ) -}) -} - - /** - * Up to `count` lines of the game list from `start` on. - */ -open func rows(start: UInt32, count: UInt32) -> [GameRow] { - return try! FfiConverterSequenceTypeGameRow.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_rows( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(start), - FfiConverterUInt32.lower(count),uniffiCallStatus - ) -}) -} - - /** - * The rows of these games (from [`Database::find`]), in this order. - */ -open func rowsOf(indices: [UInt32]) -> [GameRow] { - return try! FfiConverterSequenceTypeGameRow.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_rows_of( - self.uniffiCloneHandle(), - FfiConverterSequenceUInt32.lower(indices),uniffiCallStatus - ) -}) -} - - /** - * The game `index`, to change (moves, variations, its data) and save. - */ -open func session(index: UInt32)throws -> GameSession { - return try FfiConverterTypeGameSession_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_session( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(index),uniffiCallStatus - ) -}) -} - - /** - * Starts preparation for an exact player and colour at `query_fen` (empty means - * the usual initial position). Only the first main-line occurrence in each game - * counts; transpositions count and variations in the database do not. The thread - * is bounded to one active request per database: a new request cancels the old one. - */ -open func preparePosition(playerId: UInt32, white: Bool, queryFen: String)throws -> PrepSearch { - return try FfiConverterTypePrepSearch_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_prepare_position( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(playerId), - FfiConverterBool.lower(white), - FfiConverterString.lower(queryFen),uniffiCallStatus - ) -}) -} - - /** - * Exact-name suggestions, `count` at most 200. An empty query lists all named - * players alphabetically; a non-empty one keeps the catalogue's prefix/games order. - */ -open func suggestPlayers(query: String, start: UInt32, count: UInt32) -> PlayerSuggestions { - return try! FfiConverterTypePlayerSuggestions_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_database_suggest_players( - self.uniffiCloneHandle(), - FfiConverterString.lower(query), - FfiConverterUInt32.lower(start), - FfiConverterUInt32.lower(count),uniffiCallStatus - ) -}) -} - - - -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeDatabase: FfiConverter { - typealias FfiType = UInt64 - typealias SwiftType = Database - - public static func lift(_ handle: UInt64) throws -> Database { - return Database(unsafeFromHandle: handle) - } - - public static func lower(_ value: Database) -> UInt64 { - return value.uniffiCloneHandle() - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Database { - let handle: UInt64 = try readInt(&buf) - return try lift(handle) - } - - public static func write(_ value: Database, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeDatabase_lift(_ handle: UInt64) throws -> Database { - return try FfiConverterTypeDatabase.lift(handle) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeDatabase_lower(_ value: Database) -> UInt64 { - return FfiConverterTypeDatabase.lower(value) -} - - - - - - -/** - * The analysis of one game. - */ -public protocol GameReviewProtocol: AnyObject, Sendable { - - /** - * Stops the engine; what it has evaluated is kept (and cached). - */ - func cancel() - - /** - * Starts the engine at `path` (with its network `eval_file`, if not empty) on the - * positions without an evaluation, or on all of them when `full` (or when the - * analysis is stale). The search is the fixed one of every game analysis, the same - * as on the desktop. Returns false when there is nothing to analyse. Returns at - * once: the engine starts on its own thread. - */ - func start(path: String, evalFile: String, full: Bool) -> Bool - - /** - * The state now, with what the engine has said since the last call. - */ - func state() -> ReviewState - -} -/** - * The analysis of one game. - */ -open class GameReview: GameReviewProtocol, @unchecked Sendable { - fileprivate let handle: UInt64 - - /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public struct NoHandle { - public init() {} - } - - // TODO: We'd like this to be `private` but for Swifty reasons, - // we can't implement `FfiConverter` without making this `required` and we can't - // make it `required` without making it `public`. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - required public init(unsafeFromHandle handle: UInt64) { - self.handle = handle - } - - // This constructor can be used to instantiate a fake object. - // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. - // - // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public init(noHandle: NoHandle) { - self.handle = 0 - } - -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public func uniffiCloneHandle() -> UInt64 { - return try! rustCall { uniffi_mobile_api_fn_clone_gamereview(self.handle, $0) } - } - // No primary constructor declared for this class. - - deinit { - if handle == 0 { - // Mock objects have handle=0 don't try to free them - return - } - - try! rustCall { uniffi_mobile_api_fn_free_gamereview(handle, $0) } - } - - - - - /** - * Stops the engine; what it has evaluated is kept (and cached). - */ -open func cancel() {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamereview_cancel( - self.uniffiCloneHandle(),uniffiCallStatus - ) -} -} - - /** - * Starts the engine at `path` (with its network `eval_file`, if not empty) on the - * positions without an evaluation, or on all of them when `full` (or when the - * analysis is stale). The search is the fixed one of every game analysis, the same - * as on the desktop. Returns false when there is nothing to analyse. Returns at - * once: the engine starts on its own thread. - */ -open func start(path: String, evalFile: String, full: Bool) -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamereview_start( - self.uniffiCloneHandle(), - FfiConverterString.lower(path), - FfiConverterString.lower(evalFile), - FfiConverterBool.lower(full),uniffiCallStatus - ) -}) -} - - /** - * The state now, with what the engine has said since the last call. - */ -open func state() -> ReviewState { - return try! FfiConverterTypeReviewState_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamereview_state( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - - -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeGameReview: FfiConverter { - typealias FfiType = UInt64 - typealias SwiftType = GameReview - - public static func lift(_ handle: UInt64) throws -> GameReview { - return GameReview(unsafeFromHandle: handle) - } - - public static func lower(_ value: GameReview) -> UInt64 { - return value.uniffiCloneHandle() - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GameReview { - let handle: UInt64 = try readInt(&buf) - return try lift(handle) - } - - public static func write(_ value: GameReview, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeGameReview_lift(_ handle: UInt64) throws -> GameReview { - return try FfiConverterTypeGameReview.lift(handle) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeGameReview_lower(_ value: GameReview) -> UInt64 { - return FfiConverterTypeGameReview.lower(value) -} - - - - - - -/** - * A game that can be changed. - */ -public protocol GameSessionProtocol: AnyObject, Sendable { - - /** - * How the game stands at the move at place `at` (its line from the start counts - * for repetitions); none while it goes on. - */ - func ending(at: UInt32) -> GameEnding? - - /** - * Adds `text` to the comments after the move at place `at` (its symbols kept). - */ - func addComment(at: UInt32, text: String) throws -> Edited - - /** - * Adds a line of moves (an engine's) from place `at`, as `play` does each move. - */ - func addLine(at: UInt32, uci: [String]) throws -> Edited - - func canRedo() -> Bool - - func canUndo() -> Bool - - /** - * The whole game, ready to show. - */ - func data() -> GameData - - /** - * Removes the move at place `at` with all that follows it; shows its parent. - */ - func deleteFrom(at: UInt32) throws -> Edited - - /** - * Changed since it was opened or last saved. - */ - func isModified() -> Bool - - /** - * The legal moves in the position at place `at`, in UCI ("e2e4", "e7e8q"); none - * after a null move's position cannot go on, at checkmate or stalemate. - */ - func legalMoves(at: UInt32) -> [String] - - /** - * Makes the line of the move at place `at` the main one at its branch. - */ - func makeMain(at: UInt32) throws -> Edited - - func markSaved() - - /** - * The game as PGN, for saving or sharing. - */ - func pgn() -> String - - /** - * Plays `uci` from the node at place `at`: the existing continuation when there is - * one (nothing changes), else a new move — the main line where the line ends, a - * variation elsewhere. One undo step. - */ - func play(at: UInt32, uci: String) throws -> Edited - - /** - * A new game of the moves from the start to the move at place `at` (to play on from - * there, android-play.md §31.6): the same start position, no tags but those of the - * position. Refused on a null move on the way (a position the board cannot reach). - */ - func playFrom(at: UInt32) throws -> GameSession - - func redo() -> Edited? - - /** - * The analysis of the game as it is now (its report), with earlier results from - * the cache folder `cache_dir` ("" for none). - */ - func review(cacheDir: String) -> GameReview - - /** - * Sets the game's tags (an empty value removes the tag; one of the Seven Tag Roster - * becomes "?") and its result ("1-0", "0-1", "1/2-1/2", "*"). - */ - func setData(tags: [Tag], result: String) - - /** - * Takes the last change back; `None` when there is none. - */ - func undo() -> Edited? - - /** - * A training of the line from the start to the move at place `at` (none: no move - * there, or a null move on the way). - */ - func trainer(at: UInt32) -> Trainer? - - /** - * How many times the line up to the move at place `at` was trained. - */ - func trainingRuns(at: UInt32) -> UInt32? - -} -/** - * A game that can be changed. - */ -open class GameSession: GameSessionProtocol, @unchecked Sendable { - fileprivate let handle: UInt64 - - /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public struct NoHandle { - public init() {} - } - - // TODO: We'd like this to be `private` but for Swifty reasons, - // we can't implement `FfiConverter` without making this `required` and we can't - // make it `required` without making it `public`. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - required public init(unsafeFromHandle handle: UInt64) { - self.handle = handle - } - - // This constructor can be used to instantiate a fake object. - // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. - // - // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public init(noHandle: NoHandle) { - self.handle = 0 - } - -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public func uniffiCloneHandle() -> UInt64 { - return try! rustCall { uniffi_mobile_api_fn_clone_gamesession(self.handle, $0) } - } - // No primary constructor declared for this class. - - deinit { - if handle == 0 { - // Mock objects have handle=0 don't try to free them - return - } - - try! rustCall { uniffi_mobile_api_fn_free_gamesession(handle, $0) } - } - - - /** - * The first game of a PGN text. - */ -public static func fromPgn(pgn: String)throws -> GameSession { - return try FfiConverterTypeGameSession_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_constructor_gamesession_from_pgn( - FfiConverterString.lower(pgn),uniffiCallStatus - ) -}) -} - - /** - * A new game from the start position, dated today (`date`: "2026.10.26"). - */ -public static func newGame(date: String) -> GameSession { - return try! FfiConverterTypeGameSession_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_constructor_gamesession_new_game( - FfiConverterString.lower(date),uniffiCallStatus - ) -}) -} - - - - /** - * How the game stands at the move at place `at` (its line from the start counts - * for repetitions); none while it goes on. - */ -open func ending(at: UInt32) -> GameEnding? { - return try! FfiConverterOptionTypeGameEnding.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_ending( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(at),uniffiCallStatus - ) -}) -} - - /** - * Adds `text` to the comments after the move at place `at` (its symbols kept). - */ -open func addComment(at: UInt32, text: String)throws -> Edited { - return try FfiConverterTypeEdited_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_add_comment( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(at), - FfiConverterString.lower(text),uniffiCallStatus - ) -}) -} - - /** - * Adds a line of moves (an engine's) from place `at`, as `play` does each move. - */ -open func addLine(at: UInt32, uci: [String])throws -> Edited { - return try FfiConverterTypeEdited_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_add_line( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(at), - FfiConverterSequenceString.lower(uci),uniffiCallStatus - ) -}) -} - -open func canRedo() -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_can_redo( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - -open func canUndo() -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_can_undo( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * The whole game, ready to show. - */ -open func data() -> GameData { - return try! FfiConverterTypeGameData_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_data( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * Removes the move at place `at` with all that follows it; shows its parent. - */ -open func deleteFrom(at: UInt32)throws -> Edited { - return try FfiConverterTypeEdited_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_delete_from( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(at),uniffiCallStatus - ) -}) -} - - /** - * Changed since it was opened or last saved. - */ -open func isModified() -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_is_modified( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * The legal moves in the position at place `at`, in UCI ("e2e4", "e7e8q"); none - * after a null move's position cannot go on, at checkmate or stalemate. - */ -open func legalMoves(at: UInt32) -> [String] { - return try! FfiConverterSequenceString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_legal_moves( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(at),uniffiCallStatus - ) -}) -} - - /** - * Makes the line of the move at place `at` the main one at its branch. - */ -open func makeMain(at: UInt32)throws -> Edited { - return try FfiConverterTypeEdited_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_make_main( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(at),uniffiCallStatus - ) -}) -} - -open func markSaved() {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_mark_saved( - self.uniffiCloneHandle(),uniffiCallStatus - ) -} -} - - /** - * The game as PGN, for saving or sharing. - */ -open func pgn() -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_pgn( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * Plays `uci` from the node at place `at`: the existing continuation when there is - * one (nothing changes), else a new move — the main line where the line ends, a - * variation elsewhere. One undo step. - */ -open func play(at: UInt32, uci: String)throws -> Edited { - return try FfiConverterTypeEdited_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_play( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(at), - FfiConverterString.lower(uci),uniffiCallStatus - ) -}) -} - - /** - * A new game of the moves from the start to the move at place `at` (to play on from - * there, android-play.md §31.6): the same start position, no tags but those of the - * position. Refused on a null move on the way (a position the board cannot reach). - */ -open func playFrom(at: UInt32)throws -> GameSession { - return try FfiConverterTypeGameSession_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_play_from( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(at),uniffiCallStatus - ) -}) -} - -open func redo() -> Edited? { - return try! FfiConverterOptionTypeEdited.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_redo( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * The analysis of the game as it is now (its report), with earlier results from - * the cache folder `cache_dir` ("" for none). - */ -open func review(cacheDir: String) -> GameReview { - return try! FfiConverterTypeGameReview_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_review( - self.uniffiCloneHandle(), - FfiConverterString.lower(cacheDir),uniffiCallStatus - ) -}) -} - - /** - * Sets the game's tags (an empty value removes the tag; one of the Seven Tag Roster - * becomes "?") and its result ("1-0", "0-1", "1/2-1/2", "*"). - */ -open func setData(tags: [Tag], result: String) {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_set_data( - self.uniffiCloneHandle(), - FfiConverterSequenceTypeTag.lower(tags), - FfiConverterString.lower(result),uniffiCallStatus - ) -} -} - - /** - * Takes the last change back; `None` when there is none. - */ -open func undo() -> Edited? { - return try! FfiConverterOptionTypeEdited.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_undo( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * A training of the line from the start to the move at place `at` (none: no move - * there, or a null move on the way). - */ -open func trainer(at: UInt32) -> Trainer? { - return try! FfiConverterOptionTypeTrainer.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_trainer( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(at),uniffiCallStatus - ) -}) -} - - /** - * How many times the line up to the move at place `at` was trained. - */ -open func trainingRuns(at: UInt32) -> UInt32? { - return try! FfiConverterOptionUInt32.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_gamesession_training_runs( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(at),uniffiCallStatus - ) -}) -} - - - -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeGameSession: FfiConverter { - typealias FfiType = UInt64 - typealias SwiftType = GameSession - - public static func lift(_ handle: UInt64) throws -> GameSession { - return GameSession(unsafeFromHandle: handle) - } - - public static func lower(_ value: GameSession) -> UInt64 { - return value.uniffiCloneHandle() - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GameSession { - let handle: UInt64 = try readInt(&buf) - return try lift(handle) - } - - public static func write(_ value: GameSession, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeGameSession_lift(_ handle: UInt64) throws -> GameSession { - return try FfiConverterTypeGameSession.lift(handle) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeGameSession_lower(_ value: GameSession) -> UInt64 { - return FfiConverterTypeGameSession.lower(value) -} - - - - - - -/** - * Maia, loaded once for a game. - */ -public protocol MaiaPlayerProtocol: AnyObject, Sendable { - - /** - * Maia's move (UCI) in the position at place `at` of the game, playing at - * `strength` against a player rated `opponent` (her own strength when unknown). - * `random` is in [0, 1). None when the game is over there. - */ - func choose(game: GameSession, at: UInt32, strength: UInt32, opponent: UInt32?, random: Float) -> String? - -} -/** - * Maia, loaded once for a game. - */ -open class MaiaPlayer: MaiaPlayerProtocol, @unchecked Sendable { - fileprivate let handle: UInt64 - - /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public struct NoHandle { - public init() {} - } - - // TODO: We'd like this to be `private` but for Swifty reasons, - // we can't implement `FfiConverter` without making this `required` and we can't - // make it `required` without making it `public`. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - required public init(unsafeFromHandle handle: UInt64) { - self.handle = handle - } - - // This constructor can be used to instantiate a fake object. - // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. - // - // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public init(noHandle: NoHandle) { - self.handle = 0 - } - -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public func uniffiCloneHandle() -> UInt64 { - return try! rustCall { uniffi_mobile_api_fn_clone_maiaplayer(self.handle, $0) } - } - // No primary constructor declared for this class. - - deinit { - if handle == 0 { - // Mock objects have handle=0 don't try to free them - return - } - - try! rustCall { uniffi_mobile_api_fn_free_maiaplayer(handle, $0) } - } - - - /** - * Reads the weights (`maia3-5m.pt`). - */ -public static func load(path: String)throws -> MaiaPlayer { - return try FfiConverterTypeMaiaPlayer_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_constructor_maiaplayer_load( - FfiConverterString.lower(path),uniffiCallStatus - ) -}) -} - - - - /** - * Maia's move (UCI) in the position at place `at` of the game, playing at - * `strength` against a player rated `opponent` (her own strength when unknown). - * `random` is in [0, 1). None when the game is over there. - */ -open func choose(game: GameSession, at: UInt32, strength: UInt32, opponent: UInt32?, random: Float) -> String? { - return try! FfiConverterOptionString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_maiaplayer_choose( - self.uniffiCloneHandle(), - FfiConverterTypeGameSession_lower(game), - FfiConverterUInt32.lower(at), - FfiConverterUInt32.lower(strength), - FfiConverterOptionUInt32.lower(opponent), - FfiConverterFloat.lower(random),uniffiCallStatus - ) -}) -} - - - -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeMaiaPlayer: FfiConverter { - typealias FfiType = UInt64 - typealias SwiftType = MaiaPlayer - - public static func lift(_ handle: UInt64) throws -> MaiaPlayer { - return MaiaPlayer(unsafeFromHandle: handle) - } - - public static func lower(_ value: MaiaPlayer) -> UInt64 { - return value.uniffiCloneHandle() - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MaiaPlayer { - let handle: UInt64 = try readInt(&buf) - return try lift(handle) - } - - public static func write(_ value: MaiaPlayer, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeMaiaPlayer_lift(_ handle: UInt64) throws -> MaiaPlayer { - return try FfiConverterTypeMaiaPlayer.lift(handle) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeMaiaPlayer_lower(_ value: MaiaPlayer) -> UInt64 { - return FfiConverterTypeMaiaPlayer.lower(value) -} - - - - - - -/** - * A download of accounts into one database. - */ -public protocol OnlineDownloadProtocol: AnyObject, Sendable { - - /** - * Stops it soon; what was fetched is kept. - */ - func cancel() - - func state() -> DownloadState - -} -/** - * A download of accounts into one database. - */ -open class OnlineDownload: OnlineDownloadProtocol, @unchecked Sendable { - fileprivate let handle: UInt64 - - /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public struct NoHandle { - public init() {} - } - - // TODO: We'd like this to be `private` but for Swifty reasons, - // we can't implement `FfiConverter` without making this `required` and we can't - // make it `required` without making it `public`. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - required public init(unsafeFromHandle handle: UInt64) { - self.handle = handle - } - - // This constructor can be used to instantiate a fake object. - // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. - // - // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public init(noHandle: NoHandle) { - self.handle = 0 - } - -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public func uniffiCloneHandle() -> UInt64 { - return try! rustCall { uniffi_mobile_api_fn_clone_onlinedownload(self.handle, $0) } - } - // No primary constructor declared for this class. - - deinit { - if handle == 0 { - // Mock objects have handle=0 don't try to free them - return - } - - try! rustCall { uniffi_mobile_api_fn_free_onlinedownload(handle, $0) } - } - - - /** - * Starts fetching the games of `accounts` new since the last time into the database - * at `path` (created when it is not there). Returns at once. - */ -public static func start(accounts: [OnlineAccount], path: String) -> OnlineDownload { - return try! FfiConverterTypeOnlineDownload_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_constructor_onlinedownload_start( - FfiConverterSequenceTypeOnlineAccount.lower(accounts), - FfiConverterString.lower(path),uniffiCallStatus - ) -}) -} - - - - /** - * Stops it soon; what was fetched is kept. - */ -open func cancel() {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_onlinedownload_cancel( - self.uniffiCloneHandle(),uniffiCallStatus - ) -} -} - -open func state() -> DownloadState { - return try! FfiConverterTypeDownloadState_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_onlinedownload_state( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - - -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeOnlineDownload: FfiConverter { - typealias FfiType = UInt64 - typealias SwiftType = OnlineDownload - - public static func lift(_ handle: UInt64) throws -> OnlineDownload { - return OnlineDownload(unsafeFromHandle: handle) - } - - public static func lower(_ value: OnlineDownload) -> UInt64 { - return value.uniffiCloneHandle() - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OnlineDownload { - let handle: UInt64 = try readInt(&buf) - return try lift(handle) - } - - public static func write(_ value: OnlineDownload, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeOnlineDownload_lift(_ handle: UInt64) throws -> OnlineDownload { - return try FfiConverterTypeOnlineDownload.lift(handle) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeOnlineDownload_lower(_ value: OnlineDownload) -> UInt64 { - return FfiConverterTypeOnlineDownload.lower(value) -} - - - - - - -/** - * One running or finished position search. Dropping it requests cancellation. - */ -public protocol PrepSearchProtocol: AnyObject, Sendable { - - /** - * Stops soon; an old worker cannot publish its result afterwards. - */ - func cancel() - - func state() -> PrepState - -} -/** - * One running or finished position search. Dropping it requests cancellation. - */ -open class PrepSearch: PrepSearchProtocol, @unchecked Sendable { - fileprivate let handle: UInt64 - - /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public struct NoHandle { - public init() {} - } - - // TODO: We'd like this to be `private` but for Swifty reasons, - // we can't implement `FfiConverter` without making this `required` and we can't - // make it `required` without making it `public`. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - required public init(unsafeFromHandle handle: UInt64) { - self.handle = handle - } - - // This constructor can be used to instantiate a fake object. - // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. - // - // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public init(noHandle: NoHandle) { - self.handle = 0 - } - -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public func uniffiCloneHandle() -> UInt64 { - return try! rustCall { uniffi_mobile_api_fn_clone_prepsearch(self.handle, $0) } - } - // No primary constructor declared for this class. - - deinit { - if handle == 0 { - // Mock objects have handle=0 don't try to free them - return - } - - try! rustCall { uniffi_mobile_api_fn_free_prepsearch(handle, $0) } - } - - - - - /** - * Stops soon; an old worker cannot publish its result afterwards. - */ -open func cancel() {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_prepsearch_cancel( - self.uniffiCloneHandle(),uniffiCallStatus - ) -} -} - -open func state() -> PrepState { - return try! FfiConverterTypePrepState_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_prepsearch_state( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - - -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypePrepSearch: FfiConverter { - typealias FfiType = UInt64 - typealias SwiftType = PrepSearch - - public static func lift(_ handle: UInt64) throws -> PrepSearch { - return PrepSearch(unsafeFromHandle: handle) - } - - public static func lower(_ value: PrepSearch) -> UInt64 { - return value.uniffiCloneHandle() - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepSearch { - let handle: UInt64 = try readInt(&buf) - return try lift(handle) - } - - public static func write(_ value: PrepSearch, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePrepSearch_lift(_ handle: UInt64) throws -> PrepSearch { - return try FfiConverterTypePrepSearch.lift(handle) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePrepSearch_lower(_ value: PrepSearch) -> UInt64 { - return FfiConverterTypePrepSearch.lower(value) -} - - - - - - -/** - * Stockfish judging the positions where Maia is to move (unseen by the user), for her - * resignation; one for the whole game. - */ -public protocol ResignJudgeProtocol: AnyObject, Sendable { - - /** - * Judges the position at place `at` of the game (Maia to move there). - */ - func ask(game: GameSession, at: UInt32) - - /** - * Drops the request in flight (its position is gone). - */ - func forget() - - /** - * Moves were taken back: the scores of Maia's turns gone are forgotten. - */ - func forgetScores() - - /** - * Whether the position asked last is hopeless for Maia, once the answer came. - */ - func hopeless() -> Bool? - - /** - * A draw may be offered now (not right after a refusal). - */ - func mayOfferDraw() -> Bool - - /** - * The user offers a draw: whether Maia accepts (the shared rule, `play::accepts_draw`). - */ - func offerDraw() -> Bool - -} -/** - * Stockfish judging the positions where Maia is to move (unseen by the user), for her - * resignation; one for the whole game. - */ -open class ResignJudge: ResignJudgeProtocol, @unchecked Sendable { - fileprivate let handle: UInt64 - - /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public struct NoHandle { - public init() {} - } - - // TODO: We'd like this to be `private` but for Swifty reasons, - // we can't implement `FfiConverter` without making this `required` and we can't - // make it `required` without making it `public`. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - required public init(unsafeFromHandle handle: UInt64) { - self.handle = handle - } - - // This constructor can be used to instantiate a fake object. - // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. - // - // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public init(noHandle: NoHandle) { - self.handle = 0 - } - -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public func uniffiCloneHandle() -> UInt64 { - return try! rustCall { uniffi_mobile_api_fn_clone_resignjudge(self.handle, $0) } - } - // No primary constructor declared for this class. - - deinit { - if handle == 0 { - // Mock objects have handle=0 don't try to free them - return - } - - try! rustCall { uniffi_mobile_api_fn_free_resignjudge(handle, $0) } - } - - - /** - * The engine at `path` with its network `eval_file`. - */ -public static func start(path: String, evalFile: String) -> ResignJudge { - return try! FfiConverterTypeResignJudge_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_constructor_resignjudge_start( - FfiConverterString.lower(path), - FfiConverterString.lower(evalFile),uniffiCallStatus - ) -}) -} - - - - /** - * Judges the position at place `at` of the game (Maia to move there). - */ -open func ask(game: GameSession, at: UInt32) {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_resignjudge_ask( - self.uniffiCloneHandle(), - FfiConverterTypeGameSession_lower(game), - FfiConverterUInt32.lower(at),uniffiCallStatus - ) -} -} - - /** - * Drops the request in flight (its position is gone). - */ -open func forget() {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_resignjudge_forget( - self.uniffiCloneHandle(),uniffiCallStatus - ) -} -} - - /** - * Moves were taken back: the scores of Maia's turns gone are forgotten. - */ -open func forgetScores() {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_resignjudge_forget_scores( - self.uniffiCloneHandle(),uniffiCallStatus - ) -} -} - - /** - * Whether the position asked last is hopeless for Maia, once the answer came. - */ -open func hopeless() -> Bool? { - return try! FfiConverterOptionBool.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_resignjudge_hopeless( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * A draw may be offered now (not right after a refusal). - */ -open func mayOfferDraw() -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_resignjudge_may_offer_draw( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * The user offers a draw: whether Maia accepts (the shared rule, `play::accepts_draw`). - */ -open func offerDraw() -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_resignjudge_offer_draw( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - - -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeResignJudge: FfiConverter { - typealias FfiType = UInt64 - typealias SwiftType = ResignJudge - - public static func lift(_ handle: UInt64) throws -> ResignJudge { - return ResignJudge(unsafeFromHandle: handle) - } - - public static func lower(_ value: ResignJudge) -> UInt64 { - return value.uniffiCloneHandle() - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ResignJudge { - let handle: UInt64 = try readInt(&buf) - return try lift(handle) - } - - public static func write(_ value: ResignJudge, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeResignJudge_lift(_ handle: UInt64) throws -> ResignJudge { - return try FfiConverterTypeResignJudge.lift(handle) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeResignJudge_lower(_ value: ResignJudge) -> UInt64 { - return FfiConverterTypeResignJudge.lower(value) -} - - - - - - -/** - * Rodent IV playing one game (a UCI child process, the shared crate's player). - */ -public protocol RodentPlayerProtocol: AnyObject, Sendable { - - /** - * Rodent's move (UCI) in the position at place `at` of the game, given after - * `pause_ms` (it thinks meanwhile). Blocks: called off the main thread. None when - * the game is over there, a newer request or `forget` passed it over, or Rodent - * failed. - */ - func choose(game: GameSession, at: UInt32, pauseMs: UInt64) -> String? - - /** - * Why Rodent does not play, if it does not. - */ - func failure() -> RodentFailure? - - /** - * Drops the request in flight (its position is gone): its `choose` returns none. - */ - func forget() - -} -/** - * Rodent IV playing one game (a UCI child process, the shared crate's player). - */ -open class RodentPlayer: RodentPlayerProtocol, @unchecked Sendable { - fileprivate let handle: UInt64 - - /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public struct NoHandle { - public init() {} - } - - // TODO: We'd like this to be `private` but for Swifty reasons, - // we can't implement `FfiConverter` without making this `required` and we can't - // make it `required` without making it `public`. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - required public init(unsafeFromHandle handle: UInt64) { - self.handle = handle - } - - // This constructor can be used to instantiate a fake object. - // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. - // - // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public init(noHandle: NoHandle) { - self.handle = 0 - } - -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public func uniffiCloneHandle() -> UInt64 { - return try! rustCall { uniffi_mobile_api_fn_clone_rodentplayer(self.handle, $0) } - } - // No primary constructor declared for this class. - - deinit { - if handle == 0 { - // Mock objects have handle=0 don't try to free them - return - } - - try! rustCall { uniffi_mobile_api_fn_free_rodentplayer(handle, $0) } - } - - - /** - * The engine at `exe` with its personalities and books in `home`, playing - * `style_id` at `strength` (its UCI_Elo), with its opening book when `use_book`. - * It starts in the background: a failure is told by [`RodentPlayer::failure`]. - */ -public static func start(exe: String, home: String, styleId: String, strength: UInt32, useBook: Bool) -> RodentPlayer { - return try! FfiConverterTypeRodentPlayer_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_constructor_rodentplayer_start( - FfiConverterString.lower(exe), - FfiConverterString.lower(home), - FfiConverterString.lower(styleId), - FfiConverterUInt32.lower(strength), - FfiConverterBool.lower(useBook),uniffiCallStatus - ) -}) -} - - - - /** - * Rodent's move (UCI) in the position at place `at` of the game, given after - * `pause_ms` (it thinks meanwhile). Blocks: called off the main thread. None when - * the game is over there, a newer request or `forget` passed it over, or Rodent - * failed. - */ -open func choose(game: GameSession, at: UInt32, pauseMs: UInt64) -> String? { - return try! FfiConverterOptionString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_rodentplayer_choose( - self.uniffiCloneHandle(), - FfiConverterTypeGameSession_lower(game), - FfiConverterUInt32.lower(at), - FfiConverterUInt64.lower(pauseMs),uniffiCallStatus - ) -}) -} - - /** - * Why Rodent does not play, if it does not. - */ -open func failure() -> RodentFailure? { - return try! FfiConverterOptionTypeRodentFailure.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_rodentplayer_failure( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * Drops the request in flight (its position is gone): its `choose` returns none. - */ -open func forget() {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_rodentplayer_forget( - self.uniffiCloneHandle(),uniffiCallStatus - ) -} -} - - - -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeRodentPlayer: FfiConverter { - typealias FfiType = UInt64 - typealias SwiftType = RodentPlayer - - public static func lift(_ handle: UInt64) throws -> RodentPlayer { - return RodentPlayer(unsafeFromHandle: handle) - } - - public static func lower(_ value: RodentPlayer) -> UInt64 { - return value.uniffiCloneHandle() - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RodentPlayer { - let handle: UInt64 = try readInt(&buf) - return try lift(handle) - } - - public static func write(_ value: RodentPlayer, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeRodentPlayer_lift(_ handle: UInt64) throws -> RodentPlayer { - return try FfiConverterTypeRodentPlayer.lift(handle) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeRodentPlayer_lower(_ value: RodentPlayer) -> UInt64 { - return FfiConverterTypeRodentPlayer.lower(value) -} - - - - - - -/** - * A training of one line. - */ -public protocol TrainerProtocol: AnyObject, Sendable { - - /** - * The same line again from the start. - */ - func again() - - /** - * «Wijk aan Zee 2024», when the game says so. - */ - func event() -> String? - - /** - * The position after a wrong `uci` made after `ply` half-moves (shown a moment). - */ - func fenAfter(ply: UInt32, uci: String) -> String? - - /** - * «Carlsen — Caruana», when the game names its players. - */ - func game() -> String? - - /** - * Judges `uci` made after `ply` half-moves. - */ - func judge(ply: UInt32, uci: String) -> TrainVerdict - - /** - * The legal moves after `ply` half-moves (UCI). - */ - func legalMoves(ply: UInt32) -> [String] - - /** - * The line's move on half-move `ply` in UCI: its piece where a pawn promotes (the - * phone promotes to a queen otherwise, android-play.md §29.4). - */ - func promotionAt(ply: UInt32) -> String? - - /** - * Shows the move of half-move `ply` (the run is then «with a hint»). - */ - func show(ply: UInt32) - - /** - * The run after `ply` half-moves. - */ - func state(ply: UInt32) -> TrainState - - /** - * The line's last move («12…Rd8», SAN in Latin letters). - */ - func upTo() -> String - -} -/** - * A training of one line. - */ -open class Trainer: TrainerProtocol, @unchecked Sendable { - fileprivate let handle: UInt64 - - /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public struct NoHandle { - public init() {} - } - - // TODO: We'd like this to be `private` but for Swifty reasons, - // we can't implement `FfiConverter` without making this `required` and we can't - // make it `required` without making it `public`. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - required public init(unsafeFromHandle handle: UInt64) { - self.handle = handle - } - - // This constructor can be used to instantiate a fake object. - // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. - // - // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash. -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public init(noHandle: NoHandle) { - self.handle = 0 - } - -#if swift(>=5.8) - @_documentation(visibility: private) -#endif - public func uniffiCloneHandle() -> UInt64 { - return try! rustCall { uniffi_mobile_api_fn_clone_trainer(self.handle, $0) } - } - // No primary constructor declared for this class. - - deinit { - if handle == 0 { - // Mock objects have handle=0 don't try to free them - return - } - - try! rustCall { uniffi_mobile_api_fn_free_trainer(handle, $0) } - } - - - - - /** - * The same line again from the start. - */ -open func again() {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_trainer_again( - self.uniffiCloneHandle(),uniffiCallStatus - ) -} -} - - /** - * «Wijk aan Zee 2024», when the game says so. - */ -open func event() -> String? { - return try! FfiConverterOptionString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_trainer_event( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * The position after a wrong `uci` made after `ply` half-moves (shown a moment). - */ -open func fenAfter(ply: UInt32, uci: String) -> String? { - return try! FfiConverterOptionString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_trainer_fen_after( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(ply), - FfiConverterString.lower(uci),uniffiCallStatus - ) -}) -} - - /** - * «Carlsen — Caruana», when the game names its players. - */ -open func game() -> String? { - return try! FfiConverterOptionString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_trainer_game( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - /** - * Judges `uci` made after `ply` half-moves. - */ -open func judge(ply: UInt32, uci: String) -> TrainVerdict { - return try! FfiConverterTypeTrainVerdict_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_trainer_judge( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(ply), - FfiConverterString.lower(uci),uniffiCallStatus - ) -}) -} - - /** - * The legal moves after `ply` half-moves (UCI). - */ -open func legalMoves(ply: UInt32) -> [String] { - return try! FfiConverterSequenceString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_trainer_legal_moves( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(ply),uniffiCallStatus - ) -}) -} - - /** - * The line's move on half-move `ply` in UCI: its piece where a pawn promotes (the - * phone promotes to a queen otherwise, android-play.md §29.4). - */ -open func promotionAt(ply: UInt32) -> String? { - return try! FfiConverterOptionString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_trainer_promotion_at( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(ply),uniffiCallStatus - ) -}) -} - - /** - * Shows the move of half-move `ply` (the run is then «with a hint»). - */ -open func show(ply: UInt32) {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_trainer_show( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(ply),uniffiCallStatus - ) -} -} - - /** - * The run after `ply` half-moves. - */ -open func state(ply: UInt32) -> TrainState { - return try! FfiConverterTypeTrainState_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_trainer_state( - self.uniffiCloneHandle(), - FfiConverterUInt32.lower(ply),uniffiCallStatus - ) -}) -} - - /** - * The line's last move («12…Rd8», SAN in Latin letters). - */ -open func upTo() -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_method_trainer_up_to( - self.uniffiCloneHandle(),uniffiCallStatus - ) -}) -} - - - -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeTrainer: FfiConverter { - typealias FfiType = UInt64 - typealias SwiftType = Trainer - - public static func lift(_ handle: UInt64) throws -> Trainer { - return Trainer(unsafeFromHandle: handle) - } - - public static func lower(_ value: Trainer) -> UInt64 { - return value.uniffiCloneHandle() - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Trainer { - let handle: UInt64 = try readInt(&buf) - return try lift(handle) - } - - public static func write(_ value: Trainer, into buf: inout [UInt8]) { - writeInt(&buf, lower(value)) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeTrainer_lift(_ handle: UInt64) throws -> Trainer { - return try FfiConverterTypeTrainer.lift(handle) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeTrainer_lower(_ value: Trainer) -> UInt64 { - return FfiConverterTypeTrainer.lower(value) -} - - - - -/** - * What the engine says about the position of `search`. - */ -public struct Analysis: Equatable, Hashable { - public var search: UInt64 - public var depth: UInt32 - public var nodesPerSecond: UInt64 - /** - * Ordered by `multipv`. - */ - public var lines: [EngineLine] - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(search: UInt64, depth: UInt32, nodesPerSecond: UInt64, - /** - * Ordered by `multipv`. - */lines: [EngineLine]) { - self.search = search - self.depth = depth - self.nodesPerSecond = nodesPerSecond - self.lines = lines - } - - - - -} - -#if compiler(>=6) -extension Analysis: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeAnalysis: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Analysis { - return - try Analysis( - search: FfiConverterUInt64.read(from: &buf), - depth: FfiConverterUInt32.read(from: &buf), - nodesPerSecond: FfiConverterUInt64.read(from: &buf), - lines: FfiConverterSequenceTypeEngineLine.read(from: &buf) - ) - } - - public static func write(_ value: Analysis, into buf: inout [UInt8]) { - FfiConverterUInt64.write(value.search, into: &buf) - FfiConverterUInt32.write(value.depth, into: &buf) - FfiConverterUInt64.write(value.nodesPerSecond, into: &buf) - FfiConverterSequenceTypeEngineLine.write(value.lines, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeAnalysis_lift(_ buf: RustBuffer) throws -> Analysis { - return try FfiConverterTypeAnalysis.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeAnalysis_lower(_ value: Analysis) -> RustBuffer { - return FfiConverterTypeAnalysis.lower(value) -} - - -/** - * An APK of a release. - */ -public struct ApkFile: Equatable, Hashable { - public var name: String - public var url: String - public var size: UInt64 - /** - * From the release's `SHA256SUMS.txt`, lowercase hex. - */ - public var sha256: String - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(name: String, url: String, size: UInt64, - /** - * From the release's `SHA256SUMS.txt`, lowercase hex. - */sha256: String) { - self.name = name - self.url = url - self.size = size - self.sha256 = sha256 - } - - - - -} - -#if compiler(>=6) -extension ApkFile: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeApkFile: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ApkFile { - return - try ApkFile( - name: FfiConverterString.read(from: &buf), - url: FfiConverterString.read(from: &buf), - size: FfiConverterUInt64.read(from: &buf), - sha256: FfiConverterString.read(from: &buf) - ) - } - - public static func write(_ value: ApkFile, into buf: inout [UInt8]) { - FfiConverterString.write(value.name, into: &buf) - FfiConverterString.write(value.url, into: &buf) - FfiConverterUInt64.write(value.size, into: &buf) - FfiConverterString.write(value.sha256, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeApkFile_lift(_ buf: RustBuffer) throws -> ApkFile { - return try FfiConverterTypeApkFile.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeApkFile_lower(_ value: ApkFile) -> RustBuffer { - return FfiConverterTypeApkFile.lower(value) -} - - -/** - * A release newer than this app. - */ -public struct AppRelease: Equatable, Hashable { - public var version: String - /** - * Its page: what is new in it. - */ - public var page: String - /** - * The build without the engine's network (the network already in the app stays). - */ - public var light: ApkFile? - /** - * The build with the network inside. - */ - public var full: ApkFile? - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(version: String, - /** - * Its page: what is new in it. - */page: String, - /** - * The build without the engine's network (the network already in the app stays). - */light: ApkFile?, - /** - * The build with the network inside. - */full: ApkFile?) { - self.version = version - self.page = page - self.light = light - self.full = full - } - - - - -} - -#if compiler(>=6) -extension AppRelease: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeAppRelease: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppRelease { - return - try AppRelease( - version: FfiConverterString.read(from: &buf), - page: FfiConverterString.read(from: &buf), - light: FfiConverterOptionTypeApkFile.read(from: &buf), - full: FfiConverterOptionTypeApkFile.read(from: &buf) - ) - } - - public static func write(_ value: AppRelease, into buf: inout [UInt8]) { - FfiConverterString.write(value.version, into: &buf) - FfiConverterString.write(value.page, into: &buf) - FfiConverterOptionTypeApkFile.write(value.light, into: &buf) - FfiConverterOptionTypeApkFile.write(value.full, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeAppRelease_lift(_ buf: RustBuffer) throws -> AppRelease { - return try FfiConverterTypeAppRelease.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeAppRelease_lower(_ value: AppRelease) -> RustBuffer { - return FfiConverterTypeAppRelease.lower(value) -} - - -/** - * How a download stands. - */ -public struct DownloadState: Equatable, Hashable { - public var running: Bool - /** - * The account being fetched (an index into the download's accounts). - */ - public var account: UInt32 - /** - * Games of that account so far. - */ - public var accountGames: UInt64 - /** - * Games added by this download so far. - */ - public var added: UInt64 - /** - * Chess.com: months done of all. - */ - public var monthsDone: UInt32 - public var monthsTotal: UInt32 - /** - * When it has ended: the games added and in the database now; stopped by the user. - */ - public var total: UInt64? - public var cancelled: Bool - public var failure: OnlineFailure? - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(running: Bool, - /** - * The account being fetched (an index into the download's accounts). - */account: UInt32, - /** - * Games of that account so far. - */accountGames: UInt64, - /** - * Games added by this download so far. - */added: UInt64, - /** - * Chess.com: months done of all. - */monthsDone: UInt32, monthsTotal: UInt32, - /** - * When it has ended: the games added and in the database now; stopped by the user. - */total: UInt64?, cancelled: Bool, failure: OnlineFailure?) { - self.running = running - self.account = account - self.accountGames = accountGames - self.added = added - self.monthsDone = monthsDone - self.monthsTotal = monthsTotal - self.total = total - self.cancelled = cancelled - self.failure = failure - } - - - - -} - -#if compiler(>=6) -extension DownloadState: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeDownloadState: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DownloadState { - return - try DownloadState( - running: FfiConverterBool.read(from: &buf), - account: FfiConverterUInt32.read(from: &buf), - accountGames: FfiConverterUInt64.read(from: &buf), - added: FfiConverterUInt64.read(from: &buf), - monthsDone: FfiConverterUInt32.read(from: &buf), - monthsTotal: FfiConverterUInt32.read(from: &buf), - total: FfiConverterOptionUInt64.read(from: &buf), - cancelled: FfiConverterBool.read(from: &buf), - failure: FfiConverterOptionTypeOnlineFailure.read(from: &buf) - ) - } - - public static func write(_ value: DownloadState, into buf: inout [UInt8]) { - FfiConverterBool.write(value.running, into: &buf) - FfiConverterUInt32.write(value.account, into: &buf) - FfiConverterUInt64.write(value.accountGames, into: &buf) - FfiConverterUInt64.write(value.added, into: &buf) - FfiConverterUInt32.write(value.monthsDone, into: &buf) - FfiConverterUInt32.write(value.monthsTotal, into: &buf) - FfiConverterOptionUInt64.write(value.total, into: &buf) - FfiConverterBool.write(value.cancelled, into: &buf) - FfiConverterOptionTypeOnlineFailure.write(value.failure, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeDownloadState_lift(_ buf: RustBuffer) throws -> DownloadState { - return try FfiConverterTypeDownloadState.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeDownloadState_lower(_ value: DownloadState) -> RustBuffer { - return FfiConverterTypeDownloadState.lower(value) -} - - -/** - * A game after a change: all of it again (the ids are places in `data.nodes`, which a - * change may move) and the node to show. - */ -public struct Edited: Equatable, Hashable { - public var data: GameData - public var cursor: UInt32 - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(data: GameData, cursor: UInt32) { - self.data = data - self.cursor = cursor - } - - - - -} - -#if compiler(>=6) -extension Edited: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeEdited: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Edited { - return - try Edited( - data: FfiConverterTypeGameData.read(from: &buf), - cursor: FfiConverterUInt32.read(from: &buf) - ) - } - - public static func write(_ value: Edited, into buf: inout [UInt8]) { - FfiConverterTypeGameData.write(value.data, into: &buf) - FfiConverterUInt32.write(value.cursor, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeEdited_lift(_ buf: RustBuffer) throws -> Edited { - return try FfiConverterTypeEdited.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeEdited_lower(_ value: Edited) -> RustBuffer { - return FfiConverterTypeEdited.lower(value) -} - - -/** - * One line of the analysis, from White's point of view. - */ -public struct EngineLine: Equatable, Hashable { - /** - * 1 for the best line. - */ - public var multipv: UInt32 - /** - * "+0.45", "−1.20", "0.00", "#3" (White mates), "#−2" (Black mates). - */ - public var eval: String - /** - * Centipawns for White, when the score is not a mate. - */ - public var cp: Int32? - /** - * Moves to mate: positive when White mates, negative when Black mates. - */ - public var mate: Int32? - /** - * The line in SAN with move numbers: "14.Nd5 Bxd5 15.exd5". - */ - public var text: String - /** - * The squares of its first move, for an arrow on the board. - */ - public var fromSquare: String? - public var toSquare: String? - /** - * The line move by move, to show it on the board without touching the game. - */ - public var steps: [LineStep] - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init( - /** - * 1 for the best line. - */multipv: UInt32, - /** - * "+0.45", "−1.20", "0.00", "#3" (White mates), "#−2" (Black mates). - */eval: String, - /** - * Centipawns for White, when the score is not a mate. - */cp: Int32?, - /** - * Moves to mate: positive when White mates, negative when Black mates. - */mate: Int32?, - /** - * The line in SAN with move numbers: "14.Nd5 Bxd5 15.exd5". - */text: String, - /** - * The squares of its first move, for an arrow on the board. - */fromSquare: String?, toSquare: String?, - /** - * The line move by move, to show it on the board without touching the game. - */steps: [LineStep]) { - self.multipv = multipv - self.eval = eval - self.cp = cp - self.mate = mate - self.text = text - self.fromSquare = fromSquare - self.toSquare = toSquare - self.steps = steps - } - - - - -} - -#if compiler(>=6) -extension EngineLine: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeEngineLine: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EngineLine { - return - try EngineLine( - multipv: FfiConverterUInt32.read(from: &buf), - eval: FfiConverterString.read(from: &buf), - cp: FfiConverterOptionInt32.read(from: &buf), - mate: FfiConverterOptionInt32.read(from: &buf), - text: FfiConverterString.read(from: &buf), - fromSquare: FfiConverterOptionString.read(from: &buf), - toSquare: FfiConverterOptionString.read(from: &buf), - steps: FfiConverterSequenceTypeLineStep.read(from: &buf) - ) - } - - public static func write(_ value: EngineLine, into buf: inout [UInt8]) { - FfiConverterUInt32.write(value.multipv, into: &buf) - FfiConverterString.write(value.eval, into: &buf) - FfiConverterOptionInt32.write(value.cp, into: &buf) - FfiConverterOptionInt32.write(value.mate, into: &buf) - FfiConverterString.write(value.text, into: &buf) - FfiConverterOptionString.write(value.fromSquare, into: &buf) - FfiConverterOptionString.write(value.toSquare, into: &buf) - FfiConverterSequenceTypeLineStep.write(value.steps, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeEngineLine_lift(_ buf: RustBuffer) throws -> EngineLine { - return try FfiConverterTypeEngineLine.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeEngineLine_lower(_ value: EngineLine) -> RustBuffer { - return FfiConverterTypeEngineLine.lower(value) -} - - -/** - * A file of a ChessBase database folder: its name and descriptor (taken over). - */ -public struct FolderFile: Equatable, Hashable { - public var name: String - public var fd: Int32 - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(name: String, fd: Int32) { - self.name = name - self.fd = fd - } - - - - -} - -#if compiler(>=6) -extension FolderFile: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeFolderFile: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FolderFile { - return - try FolderFile( - name: FfiConverterString.read(from: &buf), - fd: FfiConverterInt32.read(from: &buf) - ) - } - - public static func write(_ value: FolderFile, into buf: inout [UInt8]) { - FfiConverterString.write(value.name, into: &buf) - FfiConverterInt32.write(value.fd, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeFolderFile_lift(_ buf: RustBuffer) throws -> FolderFile { - return try FfiConverterTypeFolderFile.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeFolderFile_lower(_ value: FolderFile) -> RustBuffer { - return FfiConverterTypeFolderFile.lower(value) -} - - -/** - * A game ready to show. - */ -public struct GameData: Equatable, Hashable { - public var tags: [Tag] - public var result: String - /** - * Every node: `nodes[0]` is the root; a node's id is its place in this list. - */ - public var nodes: [MoveNode] - /** - * Problems found reading the game, one line each. - */ - public var notes: [String] - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(tags: [Tag], result: String, - /** - * Every node: `nodes[0]` is the root; a node's id is its place in this list. - */nodes: [MoveNode], - /** - * Problems found reading the game, one line each. - */notes: [String]) { - self.tags = tags - self.result = result - self.nodes = nodes - self.notes = notes - } - - - - -} - -#if compiler(>=6) -extension GameData: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeGameData: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GameData { - return - try GameData( - tags: FfiConverterSequenceTypeTag.read(from: &buf), - result: FfiConverterString.read(from: &buf), - nodes: FfiConverterSequenceTypeMoveNode.read(from: &buf), - notes: FfiConverterSequenceString.read(from: &buf) - ) - } - - public static func write(_ value: GameData, into buf: inout [UInt8]) { - FfiConverterSequenceTypeTag.write(value.tags, into: &buf) - FfiConverterString.write(value.result, into: &buf) - FfiConverterSequenceTypeMoveNode.write(value.nodes, into: &buf) - FfiConverterSequenceString.write(value.notes, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeGameData_lift(_ buf: RustBuffer) throws -> GameData { - return try FfiConverterTypeGameData.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeGameData_lower(_ value: GameData) -> RustBuffer { - return FfiConverterTypeGameData.lower(value) -} - - -/** - * One line of the game list. - */ -public struct GameRow: Equatable, Hashable { - /** - * The game's number in the database (0-based), for [`Database::game`]. - */ - public var index: UInt32 - public var white: String - public var black: String - /** - * "1-0", "0-1", "1/2-1/2" or "*". - */ - public var result: String - /** - * As in PGN: "1858.??.??". - */ - public var date: String - public var event: String - public var eco: String - public var whiteElo: String - public var blackElo: String - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init( - /** - * The game's number in the database (0-based), for [`Database::game`]. - */index: UInt32, white: String, black: String, - /** - * "1-0", "0-1", "1/2-1/2" or "*". - */result: String, - /** - * As in PGN: "1858.??.??". - */date: String, event: String, eco: String, whiteElo: String, blackElo: String) { - self.index = index - self.white = white - self.black = black - self.result = result - self.date = date - self.event = event - self.eco = eco - self.whiteElo = whiteElo - self.blackElo = blackElo - } - - - - -} - -#if compiler(>=6) -extension GameRow: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeGameRow: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GameRow { - return - try GameRow( - index: FfiConverterUInt32.read(from: &buf), - white: FfiConverterString.read(from: &buf), - black: FfiConverterString.read(from: &buf), - result: FfiConverterString.read(from: &buf), - date: FfiConverterString.read(from: &buf), - event: FfiConverterString.read(from: &buf), - eco: FfiConverterString.read(from: &buf), - whiteElo: FfiConverterString.read(from: &buf), - blackElo: FfiConverterString.read(from: &buf) - ) - } - - public static func write(_ value: GameRow, into buf: inout [UInt8]) { - FfiConverterUInt32.write(value.index, into: &buf) - FfiConverterString.write(value.white, into: &buf) - FfiConverterString.write(value.black, into: &buf) - FfiConverterString.write(value.result, into: &buf) - FfiConverterString.write(value.date, into: &buf) - FfiConverterString.write(value.event, into: &buf) - FfiConverterString.write(value.eco, into: &buf) - FfiConverterString.write(value.whiteElo, into: &buf) - FfiConverterString.write(value.blackElo, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeGameRow_lift(_ buf: RustBuffer) throws -> GameRow { - return try FfiConverterTypeGameRow.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeGameRow_lower(_ value: GameRow) -> RustBuffer { - return FfiConverterTypeGameRow.lower(value) -} - - -/** - * A move of an engine line and the position after it. - */ -public struct LineStep: Equatable, Hashable { - /** - * "14.Nd5", "14…Bxd5". - */ - public var label: String - public var fen: String - public var fromSquare: String - public var toSquare: String - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init( - /** - * "14.Nd5", "14…Bxd5". - */label: String, fen: String, fromSquare: String, toSquare: String) { - self.label = label - self.fen = fen - self.fromSquare = fromSquare - self.toSquare = toSquare - } - - - - -} - -#if compiler(>=6) -extension LineStep: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeLineStep: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LineStep { - return - try LineStep( - label: FfiConverterString.read(from: &buf), - fen: FfiConverterString.read(from: &buf), - fromSquare: FfiConverterString.read(from: &buf), - toSquare: FfiConverterString.read(from: &buf) - ) - } - - public static func write(_ value: LineStep, into buf: inout [UInt8]) { - FfiConverterString.write(value.label, into: &buf) - FfiConverterString.write(value.fen, into: &buf) - FfiConverterString.write(value.fromSquare, into: &buf) - FfiConverterString.write(value.toSquare, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeLineStep_lift(_ buf: RustBuffer) throws -> LineStep { - return try FfiConverterTypeLineStep.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeLineStep_lower(_ value: LineStep) -> RustBuffer { - return FfiConverterTypeLineStep.lower(value) -} - - -/** - * An arrow (`to` set) or a marked square of a comment, in a comment color: - * 'R', 'G', 'B', 'Y' or another letter. - */ -public struct Mark: Equatable, Hashable { - public var color: String - public var from: String - public var to: String? - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(color: String, from: String, to: String?) { - self.color = color - self.from = from - self.to = to - } - - - - -} - -#if compiler(>=6) -extension Mark: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeMark: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Mark { - return - try Mark( - color: FfiConverterString.read(from: &buf), - from: FfiConverterString.read(from: &buf), - to: FfiConverterOptionString.read(from: &buf) - ) - } - - public static func write(_ value: Mark, into buf: inout [UInt8]) { - FfiConverterString.write(value.color, into: &buf) - FfiConverterString.write(value.from, into: &buf) - FfiConverterOptionString.write(value.to, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeMark_lift(_ buf: RustBuffer) throws -> Mark { - return try FfiConverterTypeMark.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeMark_lower(_ value: Mark) -> RustBuffer { - return FfiConverterTypeMark.lower(value) -} - - -/** - * A position in the game: the root (the start position) or the one after a move. - */ -public struct MoveNode: Equatable, Hashable { - /** - * The node's id (the root is 0); `children` and `parent` refer to these. - */ - public var id: UInt32 - public var parent: UInt32? - /** - * The moves from here: the main line first, then the variations. - */ - public var children: [UInt32] - /** - * SAN of the move that led here ("" for the root), always Latin letters. - */ - public var san: String - /** - * The move's number and side: 12 and true for "12.Nf3", 12 and false for "12…Nf6". - */ - public var moveNumber: UInt32 - public var white: Bool - /** - * Numeric annotation glyphs ($1 = "!") and their symbols ("!", "+-", …). - */ - public var nags: Data - public var nagSymbols: String - /** - * Comments as shown: board commands left out, lines reflowed. - */ - public var commentBefore: String - public var commentAfter: String - /** - * The position here, and the squares of the move that led to it (for highlighting). - */ - public var fen: String - public var fromSquare: String? - public var toSquare: String? - /** - * A null move ("--") of a study. - */ - public var nullMove: Bool - /** - * The move in UCI notation, for the engine's history; empty for the root and a - * null move (after which the engine gets the position as a FEN). - */ - public var uci: String - /** - * Arrows (`[%cal]`) and marked squares (`[%csl]`) of the comments after the move. - */ - public var marks: [Mark] - /** - * "checkmate" or "stalemate" when the game cannot go on from here; "" otherwise. - */ - public var end: String - /** - * On the main line of the game (not inside a variation). - */ - public var mainLine: Bool - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init( - /** - * The node's id (the root is 0); `children` and `parent` refer to these. - */id: UInt32, parent: UInt32?, - /** - * The moves from here: the main line first, then the variations. - */children: [UInt32], - /** - * SAN of the move that led here ("" for the root), always Latin letters. - */san: String, - /** - * The move's number and side: 12 and true for "12.Nf3", 12 and false for "12…Nf6". - */moveNumber: UInt32, white: Bool, - /** - * Numeric annotation glyphs ($1 = "!") and their symbols ("!", "+-", …). - */nags: Data, nagSymbols: String, - /** - * Comments as shown: board commands left out, lines reflowed. - */commentBefore: String, commentAfter: String, - /** - * The position here, and the squares of the move that led to it (for highlighting). - */fen: String, fromSquare: String?, toSquare: String?, - /** - * A null move ("--") of a study. - */nullMove: Bool, - /** - * The move in UCI notation, for the engine's history; empty for the root and a - * null move (after which the engine gets the position as a FEN). - */uci: String, - /** - * Arrows (`[%cal]`) and marked squares (`[%csl]`) of the comments after the move. - */marks: [Mark], - /** - * "checkmate" or "stalemate" when the game cannot go on from here; "" otherwise. - */end: String, - /** - * On the main line of the game (not inside a variation). - */mainLine: Bool) { - self.id = id - self.parent = parent - self.children = children - self.san = san - self.moveNumber = moveNumber - self.white = white - self.nags = nags - self.nagSymbols = nagSymbols - self.commentBefore = commentBefore - self.commentAfter = commentAfter - self.fen = fen - self.fromSquare = fromSquare - self.toSquare = toSquare - self.nullMove = nullMove - self.uci = uci - self.marks = marks - self.end = end - self.mainLine = mainLine - } - - - - -} - -#if compiler(>=6) -extension MoveNode: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeMoveNode: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MoveNode { - return - try MoveNode( - id: FfiConverterUInt32.read(from: &buf), - parent: FfiConverterOptionUInt32.read(from: &buf), - children: FfiConverterSequenceUInt32.read(from: &buf), - san: FfiConverterString.read(from: &buf), - moveNumber: FfiConverterUInt32.read(from: &buf), - white: FfiConverterBool.read(from: &buf), - nags: FfiConverterData.read(from: &buf), - nagSymbols: FfiConverterString.read(from: &buf), - commentBefore: FfiConverterString.read(from: &buf), - commentAfter: FfiConverterString.read(from: &buf), - fen: FfiConverterString.read(from: &buf), - fromSquare: FfiConverterOptionString.read(from: &buf), - toSquare: FfiConverterOptionString.read(from: &buf), - nullMove: FfiConverterBool.read(from: &buf), - uci: FfiConverterString.read(from: &buf), - marks: FfiConverterSequenceTypeMark.read(from: &buf), - end: FfiConverterString.read(from: &buf), - mainLine: FfiConverterBool.read(from: &buf) - ) - } - - public static func write(_ value: MoveNode, into buf: inout [UInt8]) { - FfiConverterUInt32.write(value.id, into: &buf) - FfiConverterOptionUInt32.write(value.parent, into: &buf) - FfiConverterSequenceUInt32.write(value.children, into: &buf) - FfiConverterString.write(value.san, into: &buf) - FfiConverterUInt32.write(value.moveNumber, into: &buf) - FfiConverterBool.write(value.white, into: &buf) - FfiConverterData.write(value.nags, into: &buf) - FfiConverterString.write(value.nagSymbols, into: &buf) - FfiConverterString.write(value.commentBefore, into: &buf) - FfiConverterString.write(value.commentAfter, into: &buf) - FfiConverterString.write(value.fen, into: &buf) - FfiConverterOptionString.write(value.fromSquare, into: &buf) - FfiConverterOptionString.write(value.toSquare, into: &buf) - FfiConverterBool.write(value.nullMove, into: &buf) - FfiConverterString.write(value.uci, into: &buf) - FfiConverterSequenceTypeMark.write(value.marks, into: &buf) - FfiConverterString.write(value.end, into: &buf) - FfiConverterBool.write(value.mainLine, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeMoveNode_lift(_ buf: RustBuffer) throws -> MoveNode { - return try FfiConverterTypeMoveNode.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeMoveNode_lower(_ value: MoveNode) -> RustBuffer { - return FfiConverterTypeMoveNode.lower(value) -} - - -/** - * An account on a site. - */ -public struct OnlineAccount: Equatable, Hashable { - public var site: Site - /** - * As the site spells it. - */ - public var username: String - /** - * Lichess: the games of the account (of all kinds, so at most this many). - */ - public var games: UInt64? - /** - * Chess.com: the months with games. - */ - public var months: UInt32? - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(site: Site, - /** - * As the site spells it. - */username: String, - /** - * Lichess: the games of the account (of all kinds, so at most this many). - */games: UInt64?, - /** - * Chess.com: the months with games. - */months: UInt32?) { - self.site = site - self.username = username - self.games = games - self.months = months - } - - - - -} - -#if compiler(>=6) -extension OnlineAccount: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeOnlineAccount: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OnlineAccount { - return - try OnlineAccount( - site: FfiConverterTypeSite.read(from: &buf), - username: FfiConverterString.read(from: &buf), - games: FfiConverterOptionUInt64.read(from: &buf), - months: FfiConverterOptionUInt32.read(from: &buf) - ) - } - - public static func write(_ value: OnlineAccount, into buf: inout [UInt8]) { - FfiConverterTypeSite.write(value.site, into: &buf) - FfiConverterString.write(value.username, into: &buf) - FfiConverterOptionUInt64.write(value.games, into: &buf) - FfiConverterOptionUInt32.write(value.months, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeOnlineAccount_lift(_ buf: RustBuffer) throws -> OnlineAccount { - return try FfiConverterTypeOnlineAccount.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeOnlineAccount_lower(_ value: OnlineAccount) -> RustBuffer { - return FfiConverterTypeOnlineAccount.lower(value) -} - - -/** - * What a downloaded database holds. - */ -public struct OnlineDatabase: Equatable, Hashable { - public var accounts: [OnlineAccount] - /** - * Games written into it. - */ - public var games: UInt64 - /** - * When the last download finished (Unix seconds); none while it never finished. - */ - public var updated: Int64? - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(accounts: [OnlineAccount], - /** - * Games written into it. - */games: UInt64, - /** - * When the last download finished (Unix seconds); none while it never finished. - */updated: Int64?) { - self.accounts = accounts - self.games = games - self.updated = updated - } - - - - -} - -#if compiler(>=6) -extension OnlineDatabase: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeOnlineDatabase: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OnlineDatabase { - return - try OnlineDatabase( - accounts: FfiConverterSequenceTypeOnlineAccount.read(from: &buf), - games: FfiConverterUInt64.read(from: &buf), - updated: FfiConverterOptionInt64.read(from: &buf) - ) - } - - public static func write(_ value: OnlineDatabase, into buf: inout [UInt8]) { - FfiConverterSequenceTypeOnlineAccount.write(value.accounts, into: &buf) - FfiConverterUInt64.write(value.games, into: &buf) - FfiConverterOptionInt64.write(value.updated, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeOnlineDatabase_lift(_ buf: RustBuffer) throws -> OnlineDatabase { - return try FfiConverterTypeOnlineDatabase.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeOnlineDatabase_lower(_ value: OnlineDatabase) -> RustBuffer { - return FfiConverterTypeOnlineDatabase.lower(value) -} - - -/** - * A problem, the site it came from (when known), and the technical text. - */ -public struct OnlineFailure: Equatable, Hashable { - public var problem: OnlineProblem - public var site: Site? - public var detail: String - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(problem: OnlineProblem, site: Site?, detail: String) { - self.problem = problem - self.site = site - self.detail = detail - } - - - - -} - -#if compiler(>=6) -extension OnlineFailure: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeOnlineFailure: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OnlineFailure { - return - try OnlineFailure( - problem: FfiConverterTypeOnlineProblem.read(from: &buf), - site: FfiConverterOptionTypeSite.read(from: &buf), - detail: FfiConverterString.read(from: &buf) - ) - } - - public static func write(_ value: OnlineFailure, into buf: inout [UInt8]) { - FfiConverterTypeOnlineProblem.write(value.problem, into: &buf) - FfiConverterOptionTypeSite.write(value.site, into: &buf) - FfiConverterString.write(value.detail, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeOnlineFailure_lift(_ buf: RustBuffer) throws -> OnlineFailure { - return try FfiConverterTypeOnlineFailure.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeOnlineFailure_lower(_ value: OnlineFailure) -> RustBuffer { - return FfiConverterTypeOnlineFailure.lower(value) -} - - -/** - * Accounts and the database file they are downloaded into. - */ -public struct OnlineTarget: Equatable, Hashable { - public var accounts: [OnlineAccount] - public var path: String - /** - * The file is there already (its new games are fetched). - */ - public var exists: Bool - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(accounts: [OnlineAccount], path: String, - /** - * The file is there already (its new games are fetched). - */exists: Bool) { - self.accounts = accounts - self.path = path - self.exists = exists - } - - - - -} - -#if compiler(>=6) -extension OnlineTarget: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeOnlineTarget: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OnlineTarget { - return - try OnlineTarget( - accounts: FfiConverterSequenceTypeOnlineAccount.read(from: &buf), - path: FfiConverterString.read(from: &buf), - exists: FfiConverterBool.read(from: &buf) - ) - } - - public static func write(_ value: OnlineTarget, into buf: inout [UInt8]) { - FfiConverterSequenceTypeOnlineAccount.write(value.accounts, into: &buf) - FfiConverterString.write(value.path, into: &buf) - FfiConverterBool.write(value.exists, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeOnlineTarget_lift(_ buf: RustBuffer) throws -> OnlineTarget { - return try FfiConverterTypeOnlineTarget.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeOnlineTarget_lower(_ value: OnlineTarget) -> RustBuffer { - return FfiConverterTypeOnlineTarget.lower(value) -} - - -/** - * One exact player name from the database catalogue. - */ -public struct PlayerSuggestion: Equatable, Hashable { - /** - * Stable within this open database; used by [`Database::prepare_position`]. - */ - public var id: UInt32 - public var name: String - /** - * Distinct games. A game with this name on both sides counts once here. - */ - public var games: UInt32 - public var whiteGames: UInt32 - public var blackGames: UInt32 - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init( - /** - * Stable within this open database; used by [`Database::prepare_position`]. - */id: UInt32, name: String, - /** - * Distinct games. A game with this name on both sides counts once here. - */games: UInt32, whiteGames: UInt32, blackGames: UInt32) { - self.id = id - self.name = name - self.games = games - self.whiteGames = whiteGames - self.blackGames = blackGames - } - - - - -} - -#if compiler(>=6) -extension PlayerSuggestion: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypePlayerSuggestion: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PlayerSuggestion { - return - try PlayerSuggestion( - id: FfiConverterUInt32.read(from: &buf), - name: FfiConverterString.read(from: &buf), - games: FfiConverterUInt32.read(from: &buf), - whiteGames: FfiConverterUInt32.read(from: &buf), - blackGames: FfiConverterUInt32.read(from: &buf) - ) - } - - public static func write(_ value: PlayerSuggestion, into buf: inout [UInt8]) { - FfiConverterUInt32.write(value.id, into: &buf) - FfiConverterString.write(value.name, into: &buf) - FfiConverterUInt32.write(value.games, into: &buf) - FfiConverterUInt32.write(value.whiteGames, into: &buf) - FfiConverterUInt32.write(value.blackGames, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePlayerSuggestion_lift(_ buf: RustBuffer) throws -> PlayerSuggestion { - return try FfiConverterTypePlayerSuggestion.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePlayerSuggestion_lower(_ value: PlayerSuggestion) -> RustBuffer { - return FfiConverterTypePlayerSuggestion.lower(value) -} - - -/** - * A page of [`PlayerSuggestion`] and the total number of matching names. - */ -public struct PlayerSuggestions: Equatable, Hashable { - public var players: [PlayerSuggestion] - public var total: UInt32 - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(players: [PlayerSuggestion], total: UInt32) { - self.players = players - self.total = total - } - - - - -} - -#if compiler(>=6) -extension PlayerSuggestions: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypePlayerSuggestions: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PlayerSuggestions { - return - try PlayerSuggestions( - players: FfiConverterSequenceTypePlayerSuggestion.read(from: &buf), - total: FfiConverterUInt32.read(from: &buf) - ) - } - - public static func write(_ value: PlayerSuggestions, into buf: inout [UInt8]) { - FfiConverterSequenceTypePlayerSuggestion.write(value.players, into: &buf) - FfiConverterUInt32.write(value.total, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePlayerSuggestions_lift(_ buf: RustBuffer) throws -> PlayerSuggestions { - return try FfiConverterTypePlayerSuggestions.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePlayerSuggestions_lower(_ value: PlayerSuggestions) -> RustBuffer { - return FfiConverterTypePlayerSuggestions.lower(value) -} - - -/** - * A move played next, with the selected player's results (not the mover's). - */ -public struct PrepContinuation: Equatable, Hashable { - public var uci: String - public var san: String - public var count: UInt32 - public var wins: UInt32 - public var draws: UInt32 - public var losses: UInt32 - /** - * Games with `Result "*"` (or another unknown result); not a loss. - */ - public var unknown: UInt32 - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(uci: String, san: String, count: UInt32, wins: UInt32, draws: UInt32, losses: UInt32, - /** - * Games with `Result "*"` (or another unknown result); not a loss. - */unknown: UInt32) { - self.uci = uci - self.san = san - self.count = count - self.wins = wins - self.draws = draws - self.losses = losses - self.unknown = unknown - } - - - - -} - -#if compiler(>=6) -extension PrepContinuation: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypePrepContinuation: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepContinuation { - return - try PrepContinuation( - uci: FfiConverterString.read(from: &buf), - san: FfiConverterString.read(from: &buf), - count: FfiConverterUInt32.read(from: &buf), - wins: FfiConverterUInt32.read(from: &buf), - draws: FfiConverterUInt32.read(from: &buf), - losses: FfiConverterUInt32.read(from: &buf), - unknown: FfiConverterUInt32.read(from: &buf) - ) - } - - public static func write(_ value: PrepContinuation, into buf: inout [UInt8]) { - FfiConverterString.write(value.uci, into: &buf) - FfiConverterString.write(value.san, into: &buf) - FfiConverterUInt32.write(value.count, into: &buf) - FfiConverterUInt32.write(value.wins, into: &buf) - FfiConverterUInt32.write(value.draws, into: &buf) - FfiConverterUInt32.write(value.losses, into: &buf) - FfiConverterUInt32.write(value.unknown, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePrepContinuation_lift(_ buf: RustBuffer) throws -> PrepContinuation { - return try FfiConverterTypePrepContinuation.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePrepContinuation_lower(_ value: PrepContinuation) -> RustBuffer { - return FfiConverterTypePrepContinuation.lower(value) -} - - -/** - * One matching game. `ply` opens its first main-line occurrence of the position. - */ -public struct PrepMatch: Equatable, Hashable { - public var index: UInt32 - public var ply: UInt32 - public var row: GameRow - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(index: UInt32, ply: UInt32, row: GameRow) { - self.index = index - self.ply = ply - self.row = row - } - - - - -} - -#if compiler(>=6) -extension PrepMatch: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypePrepMatch: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepMatch { - return - try PrepMatch( - index: FfiConverterUInt32.read(from: &buf), - ply: FfiConverterUInt32.read(from: &buf), - row: FfiConverterTypeGameRow.read(from: &buf) - ) - } - - public static func write(_ value: PrepMatch, into buf: inout [UInt8]) { - FfiConverterUInt32.write(value.index, into: &buf) - FfiConverterUInt32.write(value.ply, into: &buf) - FfiConverterTypeGameRow.write(value.row, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePrepMatch_lift(_ buf: RustBuffer) throws -> PrepMatch { - return try FfiConverterTypePrepMatch.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePrepMatch_lower(_ value: PrepMatch) -> RustBuffer { - return FfiConverterTypePrepMatch.lower(value) -} - - -/** - * Continuations and results at one position. - */ -public struct PrepResult: Equatable, Hashable { - /** - * Matching games, each counted once at its first main-line occurrence. - */ - public var games: UInt32 - public var wins: UInt32 - public var draws: UInt32 - public var losses: UInt32 - public var unknown: UInt32 - /** - * Whether the selected player (rather than their opponents) moves here. - */ - public var playerToMove: Bool - /** - * By count descending, then SAN ascending. - */ - public var continuations: [PrepContinuation] - public var ended: UInt32 - /** - * A teaching null move or a continuation that is not a normal legal move. - */ - public var noNormalContinuation: UInt32 - /** - * At most 100 rows in record order; `matches_total` is the unpaginated count. - */ - public var matches: [PrepMatch] - public var matchesTotal: UInt32 - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init( - /** - * Matching games, each counted once at its first main-line occurrence. - */games: UInt32, wins: UInt32, draws: UInt32, losses: UInt32, unknown: UInt32, - /** - * Whether the selected player (rather than their opponents) moves here. - */playerToMove: Bool, - /** - * By count descending, then SAN ascending. - */continuations: [PrepContinuation], ended: UInt32, - /** - * A teaching null move or a continuation that is not a normal legal move. - */noNormalContinuation: UInt32, - /** - * At most 100 rows in record order; `matches_total` is the unpaginated count. - */matches: [PrepMatch], matchesTotal: UInt32) { - self.games = games - self.wins = wins - self.draws = draws - self.losses = losses - self.unknown = unknown - self.playerToMove = playerToMove - self.continuations = continuations - self.ended = ended - self.noNormalContinuation = noNormalContinuation - self.matches = matches - self.matchesTotal = matchesTotal - } - - - - -} - -#if compiler(>=6) -extension PrepResult: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypePrepResult: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepResult { - return - try PrepResult( - games: FfiConverterUInt32.read(from: &buf), - wins: FfiConverterUInt32.read(from: &buf), - draws: FfiConverterUInt32.read(from: &buf), - losses: FfiConverterUInt32.read(from: &buf), - unknown: FfiConverterUInt32.read(from: &buf), - playerToMove: FfiConverterBool.read(from: &buf), - continuations: FfiConverterSequenceTypePrepContinuation.read(from: &buf), - ended: FfiConverterUInt32.read(from: &buf), - noNormalContinuation: FfiConverterUInt32.read(from: &buf), - matches: FfiConverterSequenceTypePrepMatch.read(from: &buf), - matchesTotal: FfiConverterUInt32.read(from: &buf) - ) - } - - public static func write(_ value: PrepResult, into buf: inout [UInt8]) { - FfiConverterUInt32.write(value.games, into: &buf) - FfiConverterUInt32.write(value.wins, into: &buf) - FfiConverterUInt32.write(value.draws, into: &buf) - FfiConverterUInt32.write(value.losses, into: &buf) - FfiConverterUInt32.write(value.unknown, into: &buf) - FfiConverterBool.write(value.playerToMove, into: &buf) - FfiConverterSequenceTypePrepContinuation.write(value.continuations, into: &buf) - FfiConverterUInt32.write(value.ended, into: &buf) - FfiConverterUInt32.write(value.noNormalContinuation, into: &buf) - FfiConverterSequenceTypePrepMatch.write(value.matches, into: &buf) - FfiConverterUInt32.write(value.matchesTotal, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePrepResult_lift(_ buf: RustBuffer) throws -> PrepResult { - return try FfiConverterTypePrepResult.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePrepResult_lower(_ value: PrepResult) -> RustBuffer { - return FfiConverterTypePrepResult.lower(value) -} - - -/** - * A snapshot of a preparation worker. - */ -public struct PrepState: Equatable, Hashable { - public var phase: PrepPhase - /** - * Progress inside the current phase (`total == 0` means not applicable). - */ - public var done: UInt32 - public var total: UInt32 - public var running: Bool - public var result: PrepResult? - /** - * Empty except for `Failed` and `NoMemory`. - */ - public var failure: String - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(phase: PrepPhase, - /** - * Progress inside the current phase (`total == 0` means not applicable). - */done: UInt32, total: UInt32, running: Bool, result: PrepResult?, - /** - * Empty except for `Failed` and `NoMemory`. - */failure: String) { - self.phase = phase - self.done = done - self.total = total - self.running = running - self.result = result - self.failure = failure - } - - - - -} - -#if compiler(>=6) -extension PrepState: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypePrepState: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepState { - return - try PrepState( - phase: FfiConverterTypePrepPhase.read(from: &buf), - done: FfiConverterUInt32.read(from: &buf), - total: FfiConverterUInt32.read(from: &buf), - running: FfiConverterBool.read(from: &buf), - result: FfiConverterOptionTypePrepResult.read(from: &buf), - failure: FfiConverterString.read(from: &buf) - ) - } - - public static func write(_ value: PrepState, into buf: inout [UInt8]) { - FfiConverterTypePrepPhase.write(value.phase, into: &buf) - FfiConverterUInt32.write(value.done, into: &buf) - FfiConverterUInt32.write(value.total, into: &buf) - FfiConverterBool.write(value.running, into: &buf) - FfiConverterOptionTypePrepResult.write(value.result, into: &buf) - FfiConverterString.write(value.failure, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePrepState_lift(_ buf: RustBuffer) throws -> PrepState { - return try FfiConverterTypePrepState.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePrepState_lower(_ value: PrepState) -> RustBuffer { - return FfiConverterTypePrepState.lower(value) -} - - -/** - * A marked move of the main line: an inaccuracy, mistake or blunder, or a great or - * brilliant move (these have no better line and no reply). - */ -public struct ReviewMove: Equatable, Hashable { - /** - * The node of the move. - */ - public var node: UInt32 - public var judgement: MoveJudgement - /** - * White made the move. - */ - public var white: Bool - /** - * The engine's line from the position before the move (its first move was - * better), to show on the board; `None` when the evaluation came from the PGN. - */ - public var best: EngineLine? - /** - * The better move with its number, Latin letters: "23…Nf6" ("" when unknown). - */ - public var bestLabel: String - /** - * How the opponent punishes the move: the engine's reply, for an arrow. - */ - public var replyFrom: String? - public var replyTo: String? - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init( - /** - * The node of the move. - */node: UInt32, judgement: MoveJudgement, - /** - * White made the move. - */white: Bool, - /** - * The engine's line from the position before the move (its first move was - * better), to show on the board; `None` when the evaluation came from the PGN. - */best: EngineLine?, - /** - * The better move with its number, Latin letters: "23…Nf6" ("" when unknown). - */bestLabel: String, - /** - * How the opponent punishes the move: the engine's reply, for an arrow. - */replyFrom: String?, replyTo: String?) { - self.node = node - self.judgement = judgement - self.white = white - self.best = best - self.bestLabel = bestLabel - self.replyFrom = replyFrom - self.replyTo = replyTo - } - - - - -} - -#if compiler(>=6) -extension ReviewMove: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeReviewMove: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ReviewMove { - return - try ReviewMove( - node: FfiConverterUInt32.read(from: &buf), - judgement: FfiConverterTypeMoveJudgement.read(from: &buf), - white: FfiConverterBool.read(from: &buf), - best: FfiConverterOptionTypeEngineLine.read(from: &buf), - bestLabel: FfiConverterString.read(from: &buf), - replyFrom: FfiConverterOptionString.read(from: &buf), - replyTo: FfiConverterOptionString.read(from: &buf) - ) - } - - public static func write(_ value: ReviewMove, into buf: inout [UInt8]) { - FfiConverterUInt32.write(value.node, into: &buf) - FfiConverterTypeMoveJudgement.write(value.judgement, into: &buf) - FfiConverterBool.write(value.white, into: &buf) - FfiConverterOptionTypeEngineLine.write(value.best, into: &buf) - FfiConverterString.write(value.bestLabel, into: &buf) - FfiConverterOptionString.write(value.replyFrom, into: &buf) - FfiConverterOptionString.write(value.replyTo, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeReviewMove_lift(_ buf: RustBuffer) throws -> ReviewMove { - return try FfiConverterTypeReviewMove.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeReviewMove_lower(_ value: ReviewMove) -> RustBuffer { - return FfiConverterTypeReviewMove.lower(value) -} - - -/** - * A position of the main line: the start, then the one after each move. - */ -public struct ReviewPoint: Equatable, Hashable { - /** - * The node (of [`crate::GameData`]) of this position. - */ - public var node: UInt32 - /** - * White's chance of winning, 0..100, when the position is evaluated. - */ - public var whiteWin: Float? - /** - * "+0.35", "−1.20", "#3", "#−2", "1-0" ("" while not evaluated). - */ - public var eval: String - /** - * The judgement of the move that led here. - */ - public var judgement: MoveJudgement? - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init( - /** - * The node (of [`crate::GameData`]) of this position. - */node: UInt32, - /** - * White's chance of winning, 0..100, when the position is evaluated. - */whiteWin: Float?, - /** - * "+0.35", "−1.20", "#3", "#−2", "1-0" ("" while not evaluated). - */eval: String, - /** - * The judgement of the move that led here. - */judgement: MoveJudgement?) { - self.node = node - self.whiteWin = whiteWin - self.eval = eval - self.judgement = judgement - } - - - - -} - -#if compiler(>=6) -extension ReviewPoint: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeReviewPoint: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ReviewPoint { - return - try ReviewPoint( - node: FfiConverterUInt32.read(from: &buf), - whiteWin: FfiConverterOptionFloat.read(from: &buf), - eval: FfiConverterString.read(from: &buf), - judgement: FfiConverterOptionTypeMoveJudgement.read(from: &buf) - ) - } - - public static func write(_ value: ReviewPoint, into buf: inout [UInt8]) { - FfiConverterUInt32.write(value.node, into: &buf) - FfiConverterOptionFloat.write(value.whiteWin, into: &buf) - FfiConverterString.write(value.eval, into: &buf) - FfiConverterOptionTypeMoveJudgement.write(value.judgement, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeReviewPoint_lift(_ buf: RustBuffer) throws -> ReviewPoint { - return try FfiConverterTypeReviewPoint.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeReviewPoint_lower(_ value: ReviewPoint) -> RustBuffer { - return FfiConverterTypeReviewPoint.lower(value) -} - - -/** - * Everything about the analysis of the game at this moment. - */ -public struct ReviewState: Equatable, Hashable { - /** - * The engine job is running. - */ - public var running: Bool - /** - * Positions evaluated by this run, of `total`. - */ - public var done: UInt32 - public var total: UInt32 - /** - * Why the last run stopped early (the engine crashed, did not start). - */ - public var failure: String? - /** - * Some evaluations exist (from the engine, the cache or the PGN). - */ - public var hasData: Bool - /** - * The engine's name; "PGN" when the evaluations come from `[%eval]` comments. - */ - public var engine: String - /** - * Nodes per position; 0 for evaluations from the PGN. - */ - public var nodes: UInt64 - /** - * The evaluations come from another engine search than today's fixed one (an - * analysis made before it): shown, but "update" makes them all again. - */ - public var stale: Bool - /** - * Positions of the main line without an evaluation. - */ - public var missing: UInt32 - /** - * Evaluated positions still waiting for the second search of !! and ! (an analysis - * from before them): "fill in" does it. - */ - public var secondsMissing: UInt32 - /** - * Positions a full analysis looks at (for the time estimate). - */ - public var positions: UInt32 - /** - * Engine searches a full analysis is expected to make (for the time estimate: a - * second search for moves that could be brilliant or great). - */ - public var searches: UInt32 - /** - * The speed of one engine process in the last run (0 when unknown). - */ - public var npsPerProcess: UInt64 - /** - * The start position and the position after every main-line move. - */ - public var points: [ReviewPoint] - /** - * Where the middlegame and the endgame begin, as indices of `points`. - */ - public var middlegame: UInt32? - public var endgame: UInt32? - public var white: SideReview - public var black: SideReview - /** - * The marked moves, in the order of the game. - */ - public var moves: [ReviewMove] - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init( - /** - * The engine job is running. - */running: Bool, - /** - * Positions evaluated by this run, of `total`. - */done: UInt32, total: UInt32, - /** - * Why the last run stopped early (the engine crashed, did not start). - */failure: String?, - /** - * Some evaluations exist (from the engine, the cache or the PGN). - */hasData: Bool, - /** - * The engine's name; "PGN" when the evaluations come from `[%eval]` comments. - */engine: String, - /** - * Nodes per position; 0 for evaluations from the PGN. - */nodes: UInt64, - /** - * The evaluations come from another engine search than today's fixed one (an - * analysis made before it): shown, but "update" makes them all again. - */stale: Bool, - /** - * Positions of the main line without an evaluation. - */missing: UInt32, - /** - * Evaluated positions still waiting for the second search of !! and ! (an analysis - * from before them): "fill in" does it. - */secondsMissing: UInt32, - /** - * Positions a full analysis looks at (for the time estimate). - */positions: UInt32, - /** - * Engine searches a full analysis is expected to make (for the time estimate: a - * second search for moves that could be brilliant or great). - */searches: UInt32, - /** - * The speed of one engine process in the last run (0 when unknown). - */npsPerProcess: UInt64, - /** - * The start position and the position after every main-line move. - */points: [ReviewPoint], - /** - * Where the middlegame and the endgame begin, as indices of `points`. - */middlegame: UInt32?, endgame: UInt32?, white: SideReview, black: SideReview, - /** - * The marked moves, in the order of the game. - */moves: [ReviewMove]) { - self.running = running - self.done = done - self.total = total - self.failure = failure - self.hasData = hasData - self.engine = engine - self.nodes = nodes - self.stale = stale - self.missing = missing - self.secondsMissing = secondsMissing - self.positions = positions - self.searches = searches - self.npsPerProcess = npsPerProcess - self.points = points - self.middlegame = middlegame - self.endgame = endgame - self.white = white - self.black = black - self.moves = moves - } - - - - -} - -#if compiler(>=6) -extension ReviewState: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeReviewState: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ReviewState { - return - try ReviewState( - running: FfiConverterBool.read(from: &buf), - done: FfiConverterUInt32.read(from: &buf), - total: FfiConverterUInt32.read(from: &buf), - failure: FfiConverterOptionString.read(from: &buf), - hasData: FfiConverterBool.read(from: &buf), - engine: FfiConverterString.read(from: &buf), - nodes: FfiConverterUInt64.read(from: &buf), - stale: FfiConverterBool.read(from: &buf), - missing: FfiConverterUInt32.read(from: &buf), - secondsMissing: FfiConverterUInt32.read(from: &buf), - positions: FfiConverterUInt32.read(from: &buf), - searches: FfiConverterUInt32.read(from: &buf), - npsPerProcess: FfiConverterUInt64.read(from: &buf), - points: FfiConverterSequenceTypeReviewPoint.read(from: &buf), - middlegame: FfiConverterOptionUInt32.read(from: &buf), - endgame: FfiConverterOptionUInt32.read(from: &buf), - white: FfiConverterTypeSideReview.read(from: &buf), - black: FfiConverterTypeSideReview.read(from: &buf), - moves: FfiConverterSequenceTypeReviewMove.read(from: &buf) - ) - } - - public static func write(_ value: ReviewState, into buf: inout [UInt8]) { - FfiConverterBool.write(value.running, into: &buf) - FfiConverterUInt32.write(value.done, into: &buf) - FfiConverterUInt32.write(value.total, into: &buf) - FfiConverterOptionString.write(value.failure, into: &buf) - FfiConverterBool.write(value.hasData, into: &buf) - FfiConverterString.write(value.engine, into: &buf) - FfiConverterUInt64.write(value.nodes, into: &buf) - FfiConverterBool.write(value.stale, into: &buf) - FfiConverterUInt32.write(value.missing, into: &buf) - FfiConverterUInt32.write(value.secondsMissing, into: &buf) - FfiConverterUInt32.write(value.positions, into: &buf) - FfiConverterUInt32.write(value.searches, into: &buf) - FfiConverterUInt64.write(value.npsPerProcess, into: &buf) - FfiConverterSequenceTypeReviewPoint.write(value.points, into: &buf) - FfiConverterOptionUInt32.write(value.middlegame, into: &buf) - FfiConverterOptionUInt32.write(value.endgame, into: &buf) - FfiConverterTypeSideReview.write(value.white, into: &buf) - FfiConverterTypeSideReview.write(value.black, into: &buf) - FfiConverterSequenceTypeReviewMove.write(value.moves, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeReviewState_lift(_ buf: RustBuffer) throws -> ReviewState { - return try FfiConverterTypeReviewState.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeReviewState_lower(_ value: ReviewState) -> RustBuffer { - return FfiConverterTypeReviewState.lower(value) -} - - -/** - * A file of the book pack: where it comes from, where it goes (under the engine's - * home), its size and SHA-256. - */ -public struct RodentBook: Equatable, Hashable { - public var url: String - public var local: String - public var size: UInt64 - public var sha256: String - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(url: String, local: String, size: UInt64, sha256: String) { - self.url = url - self.local = local - self.size = size - self.sha256 = sha256 - } - - - - -} - -#if compiler(>=6) -extension RodentBook: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeRodentBook: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RodentBook { - return - try RodentBook( - url: FfiConverterString.read(from: &buf), - local: FfiConverterString.read(from: &buf), - size: FfiConverterUInt64.read(from: &buf), - sha256: FfiConverterString.read(from: &buf) - ) - } - - public static func write(_ value: RodentBook, into buf: inout [UInt8]) { - FfiConverterString.write(value.url, into: &buf) - FfiConverterString.write(value.local, into: &buf) - FfiConverterUInt64.write(value.size, into: &buf) - FfiConverterString.write(value.sha256, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeRodentBook_lift(_ buf: RustBuffer) throws -> RodentBook { - return try FfiConverterTypeRodentBook.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeRodentBook_lower(_ value: RodentBook) -> RustBuffer { - return FfiConverterTypeRodentBook.lower(value) -} - - -/** - * A character of Rodent IV: its id, its English name (for PGN), its title and what it - * does (English: the app shows its own translations), a great player or not. - */ -public struct RodentStyle: Equatable, Hashable { - public var id: String - public var name: String - public var title: String - public var about: String - public var player: Bool - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(id: String, name: String, title: String, about: String, player: Bool) { - self.id = id - self.name = name - self.title = title - self.about = about - self.player = player - } - - - - -} - -#if compiler(>=6) -extension RodentStyle: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeRodentStyle: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RodentStyle { - return - try RodentStyle( - id: FfiConverterString.read(from: &buf), - name: FfiConverterString.read(from: &buf), - title: FfiConverterString.read(from: &buf), - about: FfiConverterString.read(from: &buf), - player: FfiConverterBool.read(from: &buf) - ) - } - - public static func write(_ value: RodentStyle, into buf: inout [UInt8]) { - FfiConverterString.write(value.id, into: &buf) - FfiConverterString.write(value.name, into: &buf) - FfiConverterString.write(value.title, into: &buf) - FfiConverterString.write(value.about, into: &buf) - FfiConverterBool.write(value.player, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeRodentStyle_lift(_ buf: RustBuffer) throws -> RodentStyle { - return try FfiConverterTypeRodentStyle.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeRodentStyle_lower(_ value: RodentStyle) -> RustBuffer { - return FfiConverterTypeRodentStyle.lower(value) -} - - -/** - * One player's numbers. - */ -public struct SideReview: Equatable, Hashable { - public var inaccuracies: UInt32 - public var mistakes: UInt32 - public var blunders: UInt32 - public var great: UInt32 - public var brilliant: UInt32 - /** - * Average centipawn loss. - */ - public var acpl: UInt32? - /** - * Accuracy 0..100 (only when every position is evaluated). - */ - public var accuracy: Double? - public var opening: Double? - public var middlegame: Double? - public var endgame: Double? - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(inaccuracies: UInt32, mistakes: UInt32, blunders: UInt32, great: UInt32, brilliant: UInt32, - /** - * Average centipawn loss. - */acpl: UInt32?, - /** - * Accuracy 0..100 (only when every position is evaluated). - */accuracy: Double?, opening: Double?, middlegame: Double?, endgame: Double?) { - self.inaccuracies = inaccuracies - self.mistakes = mistakes - self.blunders = blunders - self.great = great - self.brilliant = brilliant - self.acpl = acpl - self.accuracy = accuracy - self.opening = opening - self.middlegame = middlegame - self.endgame = endgame - } - - - - -} - -#if compiler(>=6) -extension SideReview: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeSideReview: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SideReview { - return - try SideReview( - inaccuracies: FfiConverterUInt32.read(from: &buf), - mistakes: FfiConverterUInt32.read(from: &buf), - blunders: FfiConverterUInt32.read(from: &buf), - great: FfiConverterUInt32.read(from: &buf), - brilliant: FfiConverterUInt32.read(from: &buf), - acpl: FfiConverterOptionUInt32.read(from: &buf), - accuracy: FfiConverterOptionDouble.read(from: &buf), - opening: FfiConverterOptionDouble.read(from: &buf), - middlegame: FfiConverterOptionDouble.read(from: &buf), - endgame: FfiConverterOptionDouble.read(from: &buf) - ) - } - - public static func write(_ value: SideReview, into buf: inout [UInt8]) { - FfiConverterUInt32.write(value.inaccuracies, into: &buf) - FfiConverterUInt32.write(value.mistakes, into: &buf) - FfiConverterUInt32.write(value.blunders, into: &buf) - FfiConverterUInt32.write(value.great, into: &buf) - FfiConverterUInt32.write(value.brilliant, into: &buf) - FfiConverterOptionUInt32.write(value.acpl, into: &buf) - FfiConverterOptionDouble.write(value.accuracy, into: &buf) - FfiConverterOptionDouble.write(value.opening, into: &buf) - FfiConverterOptionDouble.write(value.middlegame, into: &buf) - FfiConverterOptionDouble.write(value.endgame, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeSideReview_lift(_ buf: RustBuffer) throws -> SideReview { - return try FfiConverterTypeSideReview.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeSideReview_lower(_ value: SideReview) -> RustBuffer { - return FfiConverterTypeSideReview.lower(value) -} - - -/** - * A PGN tag. - */ -public struct Tag: Equatable, Hashable { - public var name: String - public var value: String - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(name: String, value: String) { - self.name = name - self.value = value - } - - - - -} - -#if compiler(>=6) -extension Tag: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeTag: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Tag { - return - try Tag( - name: FfiConverterString.read(from: &buf), - value: FfiConverterString.read(from: &buf) - ) - } - - public static func write(_ value: Tag, into buf: inout [UInt8]) { - FfiConverterString.write(value.name, into: &buf) - FfiConverterString.write(value.value, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeTag_lift(_ buf: RustBuffer) throws -> Tag { - return try FfiConverterTypeTag.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeTag_lower(_ value: Tag) -> RustBuffer { - return FfiConverterTypeTag.lower(value) -} - - -/** - * The state of the run after `ply` half-moves. - */ -public struct TrainState: Equatable, Hashable { - /** - * The position now, and the move that led here (none at the start). - */ - public var fen: String - public var fromSquare: String? - public var toSquare: String? - /** - * The moves played so far, in SAN (Latin letters). - */ - public var played: [String] - /** - * Half-moves in the line. - */ - public var length: UInt32 - public var mistakesHere: UInt32 - public var mistakes: UInt32 - /** - * The user may ask to see this move; it is shown now (from, to). - */ - public var mayShow: Bool - public var hint: [String]? - public var hinted: Bool - public var done: Bool - public var before: TrainStats - public var after: TrainStats? - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init( - /** - * The position now, and the move that led here (none at the start). - */fen: String, fromSquare: String?, toSquare: String?, - /** - * The moves played so far, in SAN (Latin letters). - */played: [String], - /** - * Half-moves in the line. - */length: UInt32, mistakesHere: UInt32, mistakes: UInt32, - /** - * The user may ask to see this move; it is shown now (from, to). - */mayShow: Bool, hint: [String]?, hinted: Bool, done: Bool, before: TrainStats, after: TrainStats?) { - self.fen = fen - self.fromSquare = fromSquare - self.toSquare = toSquare - self.played = played - self.length = length - self.mistakesHere = mistakesHere - self.mistakes = mistakes - self.mayShow = mayShow - self.hint = hint - self.hinted = hinted - self.done = done - self.before = before - self.after = after - } - - - - -} - -#if compiler(>=6) -extension TrainState: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeTrainState: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TrainState { - return - try TrainState( - fen: FfiConverterString.read(from: &buf), - fromSquare: FfiConverterOptionString.read(from: &buf), - toSquare: FfiConverterOptionString.read(from: &buf), - played: FfiConverterSequenceString.read(from: &buf), - length: FfiConverterUInt32.read(from: &buf), - mistakesHere: FfiConverterUInt32.read(from: &buf), - mistakes: FfiConverterUInt32.read(from: &buf), - mayShow: FfiConverterBool.read(from: &buf), - hint: FfiConverterOptionSequenceString.read(from: &buf), - hinted: FfiConverterBool.read(from: &buf), - done: FfiConverterBool.read(from: &buf), - before: FfiConverterTypeTrainStats.read(from: &buf), - after: FfiConverterOptionTypeTrainStats.read(from: &buf) - ) - } - - public static func write(_ value: TrainState, into buf: inout [UInt8]) { - FfiConverterString.write(value.fen, into: &buf) - FfiConverterOptionString.write(value.fromSquare, into: &buf) - FfiConverterOptionString.write(value.toSquare, into: &buf) - FfiConverterSequenceString.write(value.played, into: &buf) - FfiConverterUInt32.write(value.length, into: &buf) - FfiConverterUInt32.write(value.mistakesHere, into: &buf) - FfiConverterUInt32.write(value.mistakes, into: &buf) - FfiConverterBool.write(value.mayShow, into: &buf) - FfiConverterOptionSequenceString.write(value.hint, into: &buf) - FfiConverterBool.write(value.hinted, into: &buf) - FfiConverterBool.write(value.done, into: &buf) - FfiConverterTypeTrainStats.write(value.before, into: &buf) - FfiConverterOptionTypeTrainStats.write(value.after, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeTrainState_lift(_ buf: RustBuffer) throws -> TrainState { - return try FfiConverterTypeTrainState.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeTrainState_lower(_ value: TrainState) -> RustBuffer { - return FfiConverterTypeTrainState.lower(value) -} - - -/** - * The runs of a line so far. - */ -public struct TrainStats: Equatable, Hashable { - public var runs: UInt32 - public var last: UInt32? - public var best: UInt32? - public var cleanStreak: UInt32 - /** - * The last runs, oldest first: their mistakes and whether the move was shown. - */ - public var recentMistakes: [UInt32] - public var recentHinted: [Bool] - - // Default memberwise initializers are never public by default, so we - // declare one manually. - public init(runs: UInt32, last: UInt32?, best: UInt32?, cleanStreak: UInt32, - /** - * The last runs, oldest first: their mistakes and whether the move was shown. - */recentMistakes: [UInt32], recentHinted: [Bool]) { - self.runs = runs - self.last = last - self.best = best - self.cleanStreak = cleanStreak - self.recentMistakes = recentMistakes - self.recentHinted = recentHinted - } - - - - -} - -#if compiler(>=6) -extension TrainStats: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeTrainStats: FfiConverterRustBuffer { - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TrainStats { - return - try TrainStats( - runs: FfiConverterUInt32.read(from: &buf), - last: FfiConverterOptionUInt32.read(from: &buf), - best: FfiConverterOptionUInt32.read(from: &buf), - cleanStreak: FfiConverterUInt32.read(from: &buf), - recentMistakes: FfiConverterSequenceUInt32.read(from: &buf), - recentHinted: FfiConverterSequenceBool.read(from: &buf) - ) - } - - public static func write(_ value: TrainStats, into buf: inout [UInt8]) { - FfiConverterUInt32.write(value.runs, into: &buf) - FfiConverterOptionUInt32.write(value.last, into: &buf) - FfiConverterOptionUInt32.write(value.best, into: &buf) - FfiConverterUInt32.write(value.cleanStreak, into: &buf) - FfiConverterSequenceUInt32.write(value.recentMistakes, into: &buf) - FfiConverterSequenceBool.write(value.recentHinted, into: &buf) - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeTrainStats_lift(_ buf: RustBuffer) throws -> TrainStats { - return try FfiConverterTypeTrainStats.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeTrainStats_lower(_ value: TrainStats) -> RustBuffer { - return FfiConverterTypeTrainStats.lower(value) -} - - -/** - * What looking a nickname up on a site gave. - */ - -public enum AccountLookup: Equatable, Hashable { - - case found(account: OnlineAccount - ) - case notFound - case failed(failure: OnlineFailure - ) - - - - - -} - -#if compiler(>=6) -extension AccountLookup: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeAccountLookup: FfiConverterRustBuffer { - typealias SwiftType = AccountLookup - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AccountLookup { - let variant: Int32 = try readInt(&buf) - switch variant { - - case 1: return .found(account: try FfiConverterTypeOnlineAccount.read(from: &buf) - ) - - case 2: return .notFound - - case 3: return .failed(failure: try FfiConverterTypeOnlineFailure.read(from: &buf) - ) - - default: throw UniffiInternalError.unexpectedEnumCase - } - } - - public static func write(_ value: AccountLookup, into buf: inout [UInt8]) { - switch value { - - - case let .found(account): - writeInt(&buf, Int32(1)) - FfiConverterTypeOnlineAccount.write(account, into: &buf) - - - case .notFound: - writeInt(&buf, Int32(2)) - - - case let .failed(failure): - writeInt(&buf, Int32(3)) - FfiConverterTypeOnlineFailure.write(failure, into: &buf) - - } - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeAccountLookup_lift(_ buf: RustBuffer) throws -> AccountLookup { - return try FfiConverterTypeAccountLookup.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeAccountLookup_lower(_ value: AccountLookup) -> RustBuffer { - return FfiConverterTypeAccountLookup.lower(value) -} - - - -/** - * What went wrong opening or reading a database, in words for the user (the Kotlin - * side shows them as they are, or picks its own text by kind). - */ -public -enum ApiError: Swift.Error, Equatable, Hashable, Foundation.LocalizedError { - - - - /** - * The file could not be read. - */ - case Io(detail: String - ) - /** - * A known format that cannot be read (password, ChessBase 2CBH). - */ - case Unsupported(detail: String - ) - /** - * The file is damaged or not a database. - */ - case Corrupt(detail: String - ) - /** - * An archive without a database inside. - */ - case Empty - /** - * No game with this number. - */ - case NoGame(index: UInt32 - ) - /** - * No move at this place of the game's list. - */ - case NoNode(place: UInt32 - ) - /** - * A change of the game that cannot be made (an illegal move, …). - */ - case Edit(detail: String - ) - - - - - - - public var errorDescription: String? { - String(reflecting: self) - } - -} - -#if compiler(>=6) -extension ApiError: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeApiError: FfiConverterRustBuffer { - typealias SwiftType = ApiError - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ApiError { - let variant: Int32 = try readInt(&buf) - switch variant { - - - - - case 1: return .Io( - detail: try FfiConverterString.read(from: &buf) - ) - case 2: return .Unsupported( - detail: try FfiConverterString.read(from: &buf) - ) - case 3: return .Corrupt( - detail: try FfiConverterString.read(from: &buf) - ) - case 4: return .Empty - case 5: return .NoGame( - index: try FfiConverterUInt32.read(from: &buf) - ) - case 6: return .NoNode( - place: try FfiConverterUInt32.read(from: &buf) - ) - case 7: return .Edit( - detail: try FfiConverterString.read(from: &buf) - ) - - default: throw UniffiInternalError.unexpectedEnumCase - } - } - - public static func write(_ value: ApiError, into buf: inout [UInt8]) { - switch value { - - - - - - case let .Io(detail): - writeInt(&buf, Int32(1)) - FfiConverterString.write(detail, into: &buf) - - - case let .Unsupported(detail): - writeInt(&buf, Int32(2)) - FfiConverterString.write(detail, into: &buf) - - - case let .Corrupt(detail): - writeInt(&buf, Int32(3)) - FfiConverterString.write(detail, into: &buf) - - - case .Empty: - writeInt(&buf, Int32(4)) - - - case let .NoGame(index): - writeInt(&buf, Int32(5)) - FfiConverterUInt32.write(index, into: &buf) - - - case let .NoNode(place): - writeInt(&buf, Int32(6)) - FfiConverterUInt32.write(place, into: &buf) - - - case let .Edit(detail): - writeInt(&buf, Int32(7)) - FfiConverterString.write(detail, into: &buf) - - } - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeApiError_lift(_ buf: RustBuffer) throws -> ApiError { - return try FfiConverterTypeApiError.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeApiError_lower(_ value: ApiError) -> RustBuffer { - return FfiConverterTypeApiError.lower(value) -} - - -/** - * Why the engine cannot serve. - */ -public -enum EngineFailure: Swift.Error, Equatable, Hashable, Foundation.LocalizedError { - - - - /** - * The engine did not start or did not answer the handshake. - */ - case Start(detail: String - ) - /** - * The position cannot be sent (a bad FEN or move). - */ - case Input(detail: String - ) - /** - * The engine has stopped (it crashed, hung and was killed, or was quit). - */ - case Stopped(detail: String - ) - - - - - - - public var errorDescription: String? { - String(reflecting: self) - } - -} - -#if compiler(>=6) -extension EngineFailure: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeEngineFailure: FfiConverterRustBuffer { - typealias SwiftType = EngineFailure - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EngineFailure { - let variant: Int32 = try readInt(&buf) - switch variant { - - - - - case 1: return .Start( - detail: try FfiConverterString.read(from: &buf) - ) - case 2: return .Input( - detail: try FfiConverterString.read(from: &buf) - ) - case 3: return .Stopped( - detail: try FfiConverterString.read(from: &buf) - ) - - default: throw UniffiInternalError.unexpectedEnumCase - } - } - - public static func write(_ value: EngineFailure, into buf: inout [UInt8]) { - switch value { - - - - - - case let .Start(detail): - writeInt(&buf, Int32(1)) - FfiConverterString.write(detail, into: &buf) - - - case let .Input(detail): - writeInt(&buf, Int32(2)) - FfiConverterString.write(detail, into: &buf) - - - case let .Stopped(detail): - writeInt(&buf, Int32(3)) - FfiConverterString.write(detail, into: &buf) - - } - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeEngineFailure_lift(_ buf: RustBuffer) throws -> EngineFailure { - return try FfiConverterTypeEngineFailure.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeEngineFailure_lower(_ value: EngineFailure) -> RustBuffer { - return FfiConverterTypeEngineFailure.lower(value) -} - - -/** - * How a game stands at a position: over or not. - */ - -public enum GameEnding: Equatable, Hashable { - - /** - * The side named won by mate. - */ - case checkmate(whiteWon: Bool - ) - case stalemate - case insufficientMaterial - case threefold - case fiftyMoves - - - - - -} - -#if compiler(>=6) -extension GameEnding: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeGameEnding: FfiConverterRustBuffer { - typealias SwiftType = GameEnding - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GameEnding { - let variant: Int32 = try readInt(&buf) - switch variant { - - case 1: return .checkmate(whiteWon: try FfiConverterBool.read(from: &buf) - ) - - case 2: return .stalemate - - case 3: return .insufficientMaterial - - case 4: return .threefold - - case 5: return .fiftyMoves - - default: throw UniffiInternalError.unexpectedEnumCase - } - } - - public static func write(_ value: GameEnding, into buf: inout [UInt8]) { - switch value { - - - case let .checkmate(whiteWon): - writeInt(&buf, Int32(1)) - FfiConverterBool.write(whiteWon, into: &buf) - - - case .stalemate: - writeInt(&buf, Int32(2)) - - - case .insufficientMaterial: - writeInt(&buf, Int32(3)) - - - case .threefold: - writeInt(&buf, Int32(4)) - - - case .fiftyMoves: - writeInt(&buf, Int32(5)) - - } - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeGameEnding_lift(_ buf: RustBuffer) throws -> GameEnding { - return try FfiConverterTypeGameEnding.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeGameEnding_lower(_ value: GameEnding) -> RustBuffer { - return FfiConverterTypeGameEnding.lower(value) -} - - - -/** - * How bad a move was, or that it was of note. - */ - -public enum MoveJudgement: Equatable, Hashable { - - case inaccuracy - case mistake - case blunder - /** - * The only good move, or one that turned the game (!). - */ - case great - /** - * A sound sacrifice of a piece (!!). - */ - case brilliant - - - - - -} - -#if compiler(>=6) -extension MoveJudgement: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeMoveJudgement: FfiConverterRustBuffer { - typealias SwiftType = MoveJudgement - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MoveJudgement { - let variant: Int32 = try readInt(&buf) - switch variant { - - case 1: return .inaccuracy - - case 2: return .mistake - - case 3: return .blunder - - case 4: return .great - - case 5: return .brilliant - - default: throw UniffiInternalError.unexpectedEnumCase - } - } - - public static func write(_ value: MoveJudgement, into buf: inout [UInt8]) { - switch value { - - - case .inaccuracy: - writeInt(&buf, Int32(1)) - - - case .mistake: - writeInt(&buf, Int32(2)) - - - case .blunder: - writeInt(&buf, Int32(3)) - - - case .great: - writeInt(&buf, Int32(4)) - - - case .brilliant: - writeInt(&buf, Int32(5)) - - } - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeMoveJudgement_lift(_ buf: RustBuffer) throws -> MoveJudgement { - return try FfiConverterTypeMoveJudgement.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeMoveJudgement_lower(_ value: MoveJudgement) -> RustBuffer { - return FfiConverterTypeMoveJudgement.lower(value) -} - - - -/** - * What went wrong talking to a site. - */ - -public enum OnlineProblem: Equatable, Hashable { - - /** - * No answer (offline, a timeout). - */ - case network - /** - * The site asks for a pause: too many requests. - */ - case rateLimited - /** - * An answer this version does not understand (the site changed). - */ - case unexpected - /** - * The database could not be written (the phone is full). - */ - case disk - /** - * The database is being downloaded already. - */ - case busy - - - - - -} - -#if compiler(>=6) -extension OnlineProblem: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeOnlineProblem: FfiConverterRustBuffer { - typealias SwiftType = OnlineProblem - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OnlineProblem { - let variant: Int32 = try readInt(&buf) - switch variant { - - case 1: return .network - - case 2: return .rateLimited - - case 3: return .unexpected - - case 4: return .disk - - case 5: return .busy - - default: throw UniffiInternalError.unexpectedEnumCase - } - } - - public static func write(_ value: OnlineProblem, into buf: inout [UInt8]) { - switch value { - - - case .network: - writeInt(&buf, Int32(1)) - - - case .rateLimited: - writeInt(&buf, Int32(2)) - - - case .unexpected: - writeInt(&buf, Int32(3)) - - - case .disk: - writeInt(&buf, Int32(4)) - - - case .busy: - writeInt(&buf, Int32(5)) - - } - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeOnlineProblem_lift(_ buf: RustBuffer) throws -> OnlineProblem { - return try FfiConverterTypeOnlineProblem.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeOnlineProblem_lower(_ value: OnlineProblem) -> RustBuffer { - return FfiConverterTypeOnlineProblem.lower(value) -} - - - -/** - * The phase of a [`PrepSearch`]. Terminal phases are `Ready`, `Cancelled`, - * `NoMemory` and `Failed`. - */ - -public enum PrepPhase: Equatable, Hashable { - - case games - case index - case search - case ready - case cancelled - case noMemory - case failed - - - - - -} - -#if compiler(>=6) -extension PrepPhase: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypePrepPhase: FfiConverterRustBuffer { - typealias SwiftType = PrepPhase - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PrepPhase { - let variant: Int32 = try readInt(&buf) - switch variant { - - case 1: return .games - - case 2: return .index - - case 3: return .search - - case 4: return .ready - - case 5: return .cancelled - - case 6: return .noMemory - - case 7: return .failed - - default: throw UniffiInternalError.unexpectedEnumCase - } - } - - public static func write(_ value: PrepPhase, into buf: inout [UInt8]) { - switch value { - - - case .games: - writeInt(&buf, Int32(1)) - - - case .index: - writeInt(&buf, Int32(2)) - - - case .search: - writeInt(&buf, Int32(3)) - - - case .ready: - writeInt(&buf, Int32(4)) - - - case .cancelled: - writeInt(&buf, Int32(5)) - - - case .noMemory: - writeInt(&buf, Int32(6)) - - - case .failed: - writeInt(&buf, Int32(7)) - - } - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePrepPhase_lift(_ buf: RustBuffer) throws -> PrepPhase { - return try FfiConverterTypePrepPhase.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypePrepPhase_lower(_ value: PrepPhase) -> RustBuffer { - return FfiConverterTypePrepPhase.lower(value) -} - - - - -public enum ReleaseCheck: Equatable, Hashable { - - /** - * This app is the latest release (or newer: a build from the sources), or the newer - * release has nothing for Android (a desktop-only one). - */ - case upToDate(latest: String - ) - case newer(release: AppRelease - ) - /** - * A newer release whose light APK cannot be checked: no `SHA256SUMS.txt`, or no sum - * for the file in it. - */ - case unverifiable(release: AppRelease - ) - /** - * No answer: `detail` for the log. - */ - case failed(detail: String - ) - - - - - -} - -#if compiler(>=6) -extension ReleaseCheck: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeReleaseCheck: FfiConverterRustBuffer { - typealias SwiftType = ReleaseCheck - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ReleaseCheck { - let variant: Int32 = try readInt(&buf) - switch variant { - - case 1: return .upToDate(latest: try FfiConverterString.read(from: &buf) - ) - - case 2: return .newer(release: try FfiConverterTypeAppRelease.read(from: &buf) - ) - - case 3: return .unverifiable(release: try FfiConverterTypeAppRelease.read(from: &buf) - ) - - case 4: return .failed(detail: try FfiConverterString.read(from: &buf) - ) - - default: throw UniffiInternalError.unexpectedEnumCase - } - } - - public static func write(_ value: ReleaseCheck, into buf: inout [UInt8]) { - switch value { - - - case let .upToDate(latest): - writeInt(&buf, Int32(1)) - FfiConverterString.write(latest, into: &buf) - - - case let .newer(release): - writeInt(&buf, Int32(2)) - FfiConverterTypeAppRelease.write(release, into: &buf) - - - case let .unverifiable(release): - writeInt(&buf, Int32(3)) - FfiConverterTypeAppRelease.write(release, into: &buf) - - - case let .failed(detail): - writeInt(&buf, Int32(4)) - FfiConverterString.write(detail, into: &buf) - - } - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeReleaseCheck_lift(_ buf: RustBuffer) throws -> ReleaseCheck { - return try FfiConverterTypeReleaseCheck.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeReleaseCheck_lower(_ value: ReleaseCheck) -> RustBuffer { - return FfiConverterTypeReleaseCheck.lower(value) -} - - - -/** - * Who plays against the user. - */ - -public enum Rival: Equatable, Hashable { - - case maia - /** - * Rodent IV in a style of its list (`iv_tal`…). - */ - case rodent(styleId: String - ) - - - - - -} - -#if compiler(>=6) -extension Rival: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeRival: FfiConverterRustBuffer { - typealias SwiftType = Rival - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Rival { - let variant: Int32 = try readInt(&buf) - switch variant { - - case 1: return .maia - - case 2: return .rodent(styleId: try FfiConverterString.read(from: &buf) - ) - - default: throw UniffiInternalError.unexpectedEnumCase - } - } - - public static func write(_ value: Rival, into buf: inout [UInt8]) { - switch value { - - - case .maia: - writeInt(&buf, Int32(1)) - - - case let .rodent(styleId): - writeInt(&buf, Int32(2)) - FfiConverterString.write(styleId, into: &buf) - - } - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeRival_lift(_ buf: RustBuffer) throws -> Rival { - return try FfiConverterTypeRival.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeRival_lower(_ value: Rival) -> RustBuffer { - return FfiConverterTypeRival.lower(value) -} - - - -/** - * Why Rodent does not play: it did not start (the engine's words), or it stopped - * during the game (android-rodent.md §6.6). - */ - -public enum RodentFailure: Equatable, Hashable { - - case didNotStart(detail: String - ) - case stopped - - - - - -} - -#if compiler(>=6) -extension RodentFailure: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeRodentFailure: FfiConverterRustBuffer { - typealias SwiftType = RodentFailure - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RodentFailure { - let variant: Int32 = try readInt(&buf) - switch variant { - - case 1: return .didNotStart(detail: try FfiConverterString.read(from: &buf) - ) - - case 2: return .stopped - - default: throw UniffiInternalError.unexpectedEnumCase - } - } - - public static func write(_ value: RodentFailure, into buf: inout [UInt8]) { - switch value { - - - case let .didNotStart(detail): - writeInt(&buf, Int32(1)) - FfiConverterString.write(detail, into: &buf) - - - case .stopped: - writeInt(&buf, Int32(2)) - - } - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeRodentFailure_lift(_ buf: RustBuffer) throws -> RodentFailure { - return try FfiConverterTypeRodentFailure.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeRodentFailure_lower(_ value: RodentFailure) -> RustBuffer { - return FfiConverterTypeRodentFailure.lower(value) -} - - - -/** - * A site. - */ - -public enum Site: Equatable, Hashable { - - case lichess - case chessCom - - - - - -} - -#if compiler(>=6) -extension Site: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeSite: FfiConverterRustBuffer { - typealias SwiftType = Site - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Site { - let variant: Int32 = try readInt(&buf) - switch variant { - - case 1: return .lichess - - case 2: return .chessCom - - default: throw UniffiInternalError.unexpectedEnumCase - } - } - - public static func write(_ value: Site, into buf: inout [UInt8]) { - switch value { - - - case .lichess: - writeInt(&buf, Int32(1)) - - - case .chessCom: - writeInt(&buf, Int32(2)) - - } - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeSite_lift(_ buf: RustBuffer) throws -> Site { - return try FfiConverterTypeSite.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeSite_lower(_ value: Site) -> RustBuffer { - return FfiConverterTypeSite.lower(value) -} - - - -/** - * What a move made was. - */ - -public enum TrainVerdict: Equatable, Hashable { - - case right - case finished - case wrong - case done - - - - - -} - -#if compiler(>=6) -extension TrainVerdict: Sendable {} -#endif - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public struct FfiConverterTypeTrainVerdict: FfiConverterRustBuffer { - typealias SwiftType = TrainVerdict - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TrainVerdict { - let variant: Int32 = try readInt(&buf) - switch variant { - - case 1: return .right - - case 2: return .finished - - case 3: return .wrong - - case 4: return .done - - default: throw UniffiInternalError.unexpectedEnumCase - } - } - - public static func write(_ value: TrainVerdict, into buf: inout [UInt8]) { - switch value { - - - case .right: - writeInt(&buf, Int32(1)) - - - case .finished: - writeInt(&buf, Int32(2)) - - - case .wrong: - writeInt(&buf, Int32(3)) - - - case .done: - writeInt(&buf, Int32(4)) - - } - } -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeTrainVerdict_lift(_ buf: RustBuffer) throws -> TrainVerdict { - return try FfiConverterTypeTrainVerdict.lift(buf) -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -public func FfiConverterTypeTrainVerdict_lower(_ value: TrainVerdict) -> RustBuffer { - return FfiConverterTypeTrainVerdict.lower(value) -} - - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionUInt32: FfiConverterRustBuffer { - typealias SwiftType = UInt32? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterUInt32.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterUInt32.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionInt32: FfiConverterRustBuffer { - typealias SwiftType = Int32? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterInt32.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterInt32.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionUInt64: FfiConverterRustBuffer { - typealias SwiftType = UInt64? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterUInt64.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterUInt64.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionInt64: FfiConverterRustBuffer { - typealias SwiftType = Int64? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterInt64.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterInt64.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionFloat: FfiConverterRustBuffer { - typealias SwiftType = Float? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterFloat.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterFloat.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionDouble: FfiConverterRustBuffer { - typealias SwiftType = Double? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterDouble.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterDouble.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionBool: FfiConverterRustBuffer { - typealias SwiftType = Bool? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterBool.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterBool.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer { - typealias SwiftType = String? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterString.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterString.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionTypeTrainer: FfiConverterRustBuffer { - typealias SwiftType = Trainer? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterTypeTrainer.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterTypeTrainer.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionTypeAnalysis: FfiConverterRustBuffer { - typealias SwiftType = Analysis? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterTypeAnalysis.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterTypeAnalysis.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionTypeApkFile: FfiConverterRustBuffer { - typealias SwiftType = ApkFile? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterTypeApkFile.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterTypeApkFile.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionTypeEdited: FfiConverterRustBuffer { - typealias SwiftType = Edited? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterTypeEdited.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterTypeEdited.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionTypeEngineLine: FfiConverterRustBuffer { - typealias SwiftType = EngineLine? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterTypeEngineLine.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterTypeEngineLine.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionTypeOnlineDatabase: FfiConverterRustBuffer { - typealias SwiftType = OnlineDatabase? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterTypeOnlineDatabase.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterTypeOnlineDatabase.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionTypeOnlineFailure: FfiConverterRustBuffer { - typealias SwiftType = OnlineFailure? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterTypeOnlineFailure.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterTypeOnlineFailure.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionTypePrepResult: FfiConverterRustBuffer { - typealias SwiftType = PrepResult? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterTypePrepResult.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterTypePrepResult.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionTypeTrainStats: FfiConverterRustBuffer { - typealias SwiftType = TrainStats? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterTypeTrainStats.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterTypeTrainStats.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionTypeGameEnding: FfiConverterRustBuffer { - typealias SwiftType = GameEnding? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterTypeGameEnding.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterTypeGameEnding.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionTypeMoveJudgement: FfiConverterRustBuffer { - typealias SwiftType = MoveJudgement? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterTypeMoveJudgement.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterTypeMoveJudgement.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionTypeRodentFailure: FfiConverterRustBuffer { - typealias SwiftType = RodentFailure? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterTypeRodentFailure.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterTypeRodentFailure.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionTypeSite: FfiConverterRustBuffer { - typealias SwiftType = Site? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterTypeSite.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterTypeSite.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterOptionSequenceString: FfiConverterRustBuffer { - typealias SwiftType = [String]? - - public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value = value else { - writeInt(&buf, Int8(0)) - return - } - writeInt(&buf, Int8(1)) - FfiConverterSequenceString.write(value, into: &buf) - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { - switch try readInt(&buf) as Int8 { - case 0: return nil - case 1: return try FfiConverterSequenceString.read(from: &buf) - default: throw UniffiInternalError.unexpectedOptionalTag - } - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceUInt32: FfiConverterRustBuffer { - typealias SwiftType = [UInt32] - - public static func write(_ value: [UInt32], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterUInt32.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [UInt32] { - let len: Int32 = try readInt(&buf) - var seq = [UInt32]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterUInt32.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceBool: FfiConverterRustBuffer { - typealias SwiftType = [Bool] - - public static func write(_ value: [Bool], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterBool.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [Bool] { - let len: Int32 = try readInt(&buf) - var seq = [Bool]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterBool.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceString: FfiConverterRustBuffer { - typealias SwiftType = [String] - - public static func write(_ value: [String], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterString.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String] { - let len: Int32 = try readInt(&buf) - var seq = [String]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterString.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypeEngineLine: FfiConverterRustBuffer { - typealias SwiftType = [EngineLine] - - public static func write(_ value: [EngineLine], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypeEngineLine.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [EngineLine] { - let len: Int32 = try readInt(&buf) - var seq = [EngineLine]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypeEngineLine.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypeFolderFile: FfiConverterRustBuffer { - typealias SwiftType = [FolderFile] - - public static func write(_ value: [FolderFile], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypeFolderFile.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [FolderFile] { - let len: Int32 = try readInt(&buf) - var seq = [FolderFile]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypeFolderFile.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypeGameRow: FfiConverterRustBuffer { - typealias SwiftType = [GameRow] - - public static func write(_ value: [GameRow], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypeGameRow.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [GameRow] { - let len: Int32 = try readInt(&buf) - var seq = [GameRow]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypeGameRow.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypeLineStep: FfiConverterRustBuffer { - typealias SwiftType = [LineStep] - - public static func write(_ value: [LineStep], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypeLineStep.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [LineStep] { - let len: Int32 = try readInt(&buf) - var seq = [LineStep]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypeLineStep.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypeMark: FfiConverterRustBuffer { - typealias SwiftType = [Mark] - - public static func write(_ value: [Mark], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypeMark.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [Mark] { - let len: Int32 = try readInt(&buf) - var seq = [Mark]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypeMark.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypeMoveNode: FfiConverterRustBuffer { - typealias SwiftType = [MoveNode] - - public static func write(_ value: [MoveNode], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypeMoveNode.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [MoveNode] { - let len: Int32 = try readInt(&buf) - var seq = [MoveNode]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypeMoveNode.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypeOnlineAccount: FfiConverterRustBuffer { - typealias SwiftType = [OnlineAccount] - - public static func write(_ value: [OnlineAccount], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypeOnlineAccount.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [OnlineAccount] { - let len: Int32 = try readInt(&buf) - var seq = [OnlineAccount]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypeOnlineAccount.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypeOnlineTarget: FfiConverterRustBuffer { - typealias SwiftType = [OnlineTarget] - - public static func write(_ value: [OnlineTarget], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypeOnlineTarget.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [OnlineTarget] { - let len: Int32 = try readInt(&buf) - var seq = [OnlineTarget]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypeOnlineTarget.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypePlayerSuggestion: FfiConverterRustBuffer { - typealias SwiftType = [PlayerSuggestion] - - public static func write(_ value: [PlayerSuggestion], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypePlayerSuggestion.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [PlayerSuggestion] { - let len: Int32 = try readInt(&buf) - var seq = [PlayerSuggestion]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypePlayerSuggestion.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypePrepContinuation: FfiConverterRustBuffer { - typealias SwiftType = [PrepContinuation] - - public static func write(_ value: [PrepContinuation], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypePrepContinuation.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [PrepContinuation] { - let len: Int32 = try readInt(&buf) - var seq = [PrepContinuation]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypePrepContinuation.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypePrepMatch: FfiConverterRustBuffer { - typealias SwiftType = [PrepMatch] - - public static func write(_ value: [PrepMatch], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypePrepMatch.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [PrepMatch] { - let len: Int32 = try readInt(&buf) - var seq = [PrepMatch]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypePrepMatch.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypeReviewMove: FfiConverterRustBuffer { - typealias SwiftType = [ReviewMove] - - public static func write(_ value: [ReviewMove], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypeReviewMove.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [ReviewMove] { - let len: Int32 = try readInt(&buf) - var seq = [ReviewMove]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypeReviewMove.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypeReviewPoint: FfiConverterRustBuffer { - typealias SwiftType = [ReviewPoint] - - public static func write(_ value: [ReviewPoint], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypeReviewPoint.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [ReviewPoint] { - let len: Int32 = try readInt(&buf) - var seq = [ReviewPoint]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypeReviewPoint.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypeRodentBook: FfiConverterRustBuffer { - typealias SwiftType = [RodentBook] - - public static func write(_ value: [RodentBook], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypeRodentBook.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RodentBook] { - let len: Int32 = try readInt(&buf) - var seq = [RodentBook]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypeRodentBook.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypeRodentStyle: FfiConverterRustBuffer { - typealias SwiftType = [RodentStyle] - - public static func write(_ value: [RodentStyle], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypeRodentStyle.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RodentStyle] { - let len: Int32 = try readInt(&buf) - var seq = [RodentStyle]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypeRodentStyle.read(from: &buf)) - } - return seq - } -} - -#if swift(>=5.8) -@_documentation(visibility: private) -#endif -fileprivate struct FfiConverterSequenceTypeTag: FfiConverterRustBuffer { - typealias SwiftType = [Tag] - - public static func write(_ value: [Tag], into buf: inout [UInt8]) { - let len = Int32(value.count) - writeInt(&buf, len) - for item in value { - FfiConverterTypeTag.write(item, into: &buf) - } - } - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [Tag] { - let len: Int32 = try readInt(&buf) - var seq = [Tag]() - seq.reserveCapacity(Int(len)) - for _ in 0 ..< len { - seq.append(try FfiConverterTypeTag.read(from: &buf)) - } - return seq - } -} -/** - * Opens a database file given as its content. - */ -public func openBytes(name: String, bytes: Data)throws -> Database { - return try FfiConverterTypeDatabase_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_func_open_bytes( - FfiConverterString.lower(name), - FfiConverterData.lower(bytes),uniffiCallStatus - ) -}) -} -/** - * Opens the ChessBase database `cbh_name` from the files of its folder (the `.cbh` - * and the files beside it with the same name; others are closed unread). - */ -public func openChessbase(cbhName: String, files: [FolderFile])throws -> Database { - return try FfiConverterTypeDatabase_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_func_open_chessbase( - FfiConverterString.lower(cbhName), - FfiConverterSequenceTypeFolderFile.lower(files),uniffiCallStatus - ) -}) -} -/** - * Opens a database file (PGN, `.zip`, `.7z`, `.cbv`) from a file descriptor; the - * descriptor is taken over and closed (on Android: `ParcelFileDescriptor.detachFd()`). - * `name` is the file's name, for its extension. - */ -public func openFile(name: String, fd: Int32)throws -> Database { - return try FfiConverterTypeDatabase_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_func_open_file( - FfiConverterString.lower(name), - FfiConverterInt32.lower(fd),uniffiCallStatus - ) -}) -} -/** - * Opens a database by its path (tests, tools; the app uses descriptors). - */ -public func openPath(path: String)throws -> Database { - return try FfiConverterTypeDatabase_lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_func_open_path( - FfiConverterString.lower(path),uniffiCallStatus - ) -}) -} -/** - * Deletes a downloaded database and the files beside it (its state). - */ -public func deleteOnlineDatabase(path: String) {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_delete_online_database( - FfiConverterString.lower(path),uniffiCallStatus - ) -} -} -/** - * Looks the nickname up on the site (blocks: it asks the site). - */ -public func findAccount(site: Site, nick: String) -> AccountLookup { - return try! FfiConverterTypeAccountLookup_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_find_account( - FfiConverterTypeSite_lower(site), - FfiConverterString.lower(nick),uniffiCallStatus - ) -}) -} -/** - * The state of the database at `path`, when it is a downloaded one. - */ -public func onlineDatabase(path: String) -> OnlineDatabase? { - return try! FfiConverterOptionTypeOnlineDatabase.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_online_database( - FfiConverterString.lower(path),uniffiCallStatus - ) -}) -} -/** - * Where the found accounts go in `dir`: all into one database (`together`) or each into - * its own; a database already holding them is kept. - */ -public func onlineTargets(dir: String, accounts: [OnlineAccount], together: Bool) -> [OnlineTarget] { - return try! FfiConverterSequenceTypeOnlineTarget.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_online_targets( - FfiConverterString.lower(dir), - FfiConverterSequenceTypeOnlineAccount.lower(accounts), - FfiConverterBool.lower(together),uniffiCallStatus - ) -}) -} -/** - * A nickname both sites could have: 2–30 letters, digits, `_` or `-`. - */ -public func validNickname(nick: String) -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_valid_nickname( - FfiConverterString.lower(nick),uniffiCallStatus - ) -}) -} -/** - * The tags of a game against the computer on the phone (no clocks): `event` in the - * app's language; the user plays White when `user_white`. - */ -public func computerGameTags(event: String, userWhite: Bool, userName: String, rival: Rival, strength: UInt32) -> [Tag] { - return try! FfiConverterSequenceTypeTag.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_computer_game_tags( - FfiConverterString.lower(event), - FfiConverterBool.lower(userWhite), - FfiConverterString.lower(userName), - FfiConverterTypeRival_lower(rival), - FfiConverterUInt32.lower(strength),uniffiCallStatus - ) -}) -} -/** - * Maia's turns in a row with her position hopeless before she offers to resign. - */ -public func hopelessTurns() -> UInt32 { - return try! FfiConverterUInt32.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_hopeless_turns(uniffiCallStatus - ) -}) -} -/** - * The strengths Maia plays on her own scale, as on the desktop: (weakest, strongest). - */ -public func maiaRange() -> [UInt32] { - return try! FfiConverterSequenceUInt32.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_maia_range(uniffiCallStatus - ) -}) -} -/** - * How long the computer "thinks" before its move `ply` of an untimed game - * (milliseconds): as a person would, quicker with one legal move. - */ -public func movePauseMs(ply: UInt32, onlyMove: Bool) -> UInt64 { - return try! FfiConverterUInt64.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_move_pause_ms( - FfiConverterUInt32.lower(ply), - FfiConverterBool.lower(onlyMove),uniffiCallStatus - ) -}) -} -/** - * The opponent as the app shows it, without the style: «Maia 1500», «Rodent IV 1800». - */ -public func rivalLabel(rival: Rival, strength: UInt32) -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_rival_label( - FfiConverterTypeRival_lower(rival), - FfiConverterUInt32.lower(strength),uniffiCallStatus - ) -}) -} -/** - * The opponent as the game's record names it: «Maia 1500», «Rodent IV 1800 (Tal)». - */ -public func rivalName(rival: Rival, strength: UInt32) -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_rival_name( - FfiConverterTypeRival_lower(rival), - FfiConverterUInt32.lower(strength),uniffiCallStatus - ) -}) -} -/** - * The opening books Rodent IV's characters open, downloaded as one pack - * (android-rodent.md §5). - */ -public func rodentBookPack() -> [RodentBook] { - return try! FfiConverterSequenceTypeRodentBook.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_rodent_book_pack(uniffiCallStatus - ) -}) -} -/** - * The strengths Rodent IV plays (its UCI_Elo): (weakest, strongest). - */ -public func rodentRange() -> [UInt32] { - return try! FfiConverterSequenceUInt32.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_rodent_range(uniffiCallStatus - ) -}) -} -/** - * Rodent IV's characters (the desktop's list; Rodent V is not on the phone). - */ -public func rodentStyles() -> [RodentStyle] { - return try! FfiConverterSequenceTypeRodentStyle.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_rodent_styles(uniffiCallStatus - ) -}) -} -/** - * The version of Rodent IV's files (the authors' commit): the personalities copied out - * of the APK are copied again when it changes. - */ -public func rodentVersion() -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_rodent_version(uniffiCallStatus - ) -}) -} -/** - * Seconds `searches` engine searches of the game analysis take at `nps_per_process` - * nodes per second of one engine process (measured before, or a guess), in this - * phone's engine processes. - */ -public func reviewEstimateSecs(searches: UInt32, npsPerProcess: UInt64) -> UInt32 { - return try! FfiConverterUInt32.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_review_estimate_secs( - FfiConverterUInt32.lower(searches), - FfiConverterUInt64.lower(npsPerProcess),uniffiCallStatus - ) -}) -} -/** - * Makes a new empty own database at `path` (refused when the file exists). - */ -public func ownCreate(path: String)throws {try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_func_own_create( - FfiConverterString.lower(path),uniffiCallStatus - ) -} -} -/** - * Removes game `index` from the own database at `path`. - */ -public func ownRemove(path: String, index: UInt32)throws {try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_func_own_remove( - FfiConverterString.lower(path), - FfiConverterUInt32.lower(index),uniffiCallStatus - ) -} -} -/** - * Saves the game `pgn` into the own database at `path`: as game `index` (replacing - * it), or added at the end when `index` is `None`. Returns the game's number. - */ -public func ownSave(path: String, index: UInt32?, pgn: String)throws -> UInt32 { - return try FfiConverterUInt32.lift(try rustCallWithError(FfiConverterTypeApiError_lift) { - uniffiCallStatus in - uniffi_mobile_api_fn_func_own_save( - FfiConverterString.lower(path), - FfiConverterOptionUInt32.lower(index), - FfiConverterString.lower(pgn),uniffiCallStatus - ) -}) -} -/** - * Where the runs are kept (`training.json` in the app's files). - */ -public func trainerSetFile(path: String) {try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_trainer_set_file( - FfiConverterString.lower(path),uniffiCallStatus - ) -} -} -/** - * Asks `api` (a test server) for the latest release; a newer one comes with its APKs. - */ -public func checkRelease(api: String) -> ReleaseCheck { - return try! FfiConverterTypeReleaseCheck_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_check_release( - FfiConverterString.lower(api),uniffiCallStatus - ) -}) -} -/** - * Asks the site for the latest release, counting this installation for the day (its - * random `install` id and `platform`: "android" or "android-noengine"); without the - * site, GitHub. A newer release comes with its APKs. - */ -public func checkReleaseCounted(install: String, platform: String) -> ReleaseCheck { - return try! FfiConverterTypeReleaseCheck_lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_check_release_counted( - FfiConverterString.lower(install), - FfiConverterString.lower(platform),uniffiCallStatus - ) -}) -} -/** - * GitHub's answer for the latest release (a debug build may ask a test server). - */ -public func releaseApi() -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffiCallStatus in - uniffi_mobile_api_fn_func_release_api(uniffiCallStatus - ) -}) -} - -private enum InitializationResult { - case ok - case contractVersionMismatch - case apiChecksumMismatch -} -// Use a global variable to perform the versioning checks. Swift ensures that -// the code inside is only computed once. -private let initializationResult: InitializationResult = { - // Get the bindings contract version from our ComponentInterface - let bindings_contract_version = 30 - // Get the scaffolding contract version by calling the into the dylib - let scaffolding_contract_version = ffi_mobile_api_uniffi_contract_version() - if bindings_contract_version != scaffolding_contract_version { - return InitializationResult.contractVersionMismatch - } - if (uniffi_mobile_api_checksum_func_open_bytes() != 45696) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_open_chessbase() != 34293) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_open_file() != 41660) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_open_path() != 3159) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_delete_online_database() != 10827) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_find_account() != 34245) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_online_database() != 14641) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_online_targets() != 17914) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_valid_nickname() != 20440) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_computer_game_tags() != 13978) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_hopeless_turns() != 4716) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_maia_range() != 8445) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_move_pause_ms() != 46916) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_rival_label() != 1851) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_rival_name() != 50702) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_rodent_book_pack() != 6165) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_rodent_range() != 30309) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_rodent_styles() != 6717) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_rodent_version() != 17337) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_review_estimate_secs() != 59010) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_own_create() != 43565) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_own_remove() != 39994) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_own_save() != 29490) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_trainer_set_file() != 24709) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_check_release() != 17738) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_check_release_counted() != 54959) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_func_release_api() != 51397) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_find() != 41701) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_format() != 62190) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_game() != 13948) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_is_empty() != 3355) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_len() != 39534) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_newest_first() != 25840) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_notes() != 8568) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_pgn() != 14) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_review() != 20396) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_rows() != 55855) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_rows_of() != 22834) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_session() != 13281) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_prepare_position() != 11767) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_database_suggest_players() != 46681) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_analyzer_analyze() != 34144) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_analyzer_poll() != 45771) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_analyzer_quit() != 45344) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_analyzer_stop() != 50787) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_onlinedownload_cancel() != 32278) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_onlinedownload_state() != 46119) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_maiaplayer_choose() != 14997) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_resignjudge_ask() != 1694) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_resignjudge_forget() != 52931) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_resignjudge_forget_scores() != 9173) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_resignjudge_hopeless() != 5608) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_resignjudge_may_offer_draw() != 60609) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_resignjudge_offer_draw() != 17768) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_rodentplayer_choose() != 22740) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_rodentplayer_failure() != 64959) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_rodentplayer_forget() != 65358) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_prepsearch_cancel() != 5927) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_prepsearch_state() != 37530) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamereview_cancel() != 25049) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamereview_start() != 54716) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamereview_state() != 48523) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_ending() != 17995) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_add_comment() != 41399) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_add_line() != 61827) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_can_redo() != 7738) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_can_undo() != 32279) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_data() != 35662) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_delete_from() != 34708) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_is_modified() != 910) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_legal_moves() != 48605) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_make_main() != 45389) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_mark_saved() != 12000) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_pgn() != 56097) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_play() != 3894) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_play_from() != 7019) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_redo() != 42738) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_review() != 55508) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_set_data() != 43756) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_undo() != 49960) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_trainer() != 14323) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_gamesession_training_runs() != 31571) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_trainer_again() != 43209) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_trainer_event() != 16815) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_trainer_fen_after() != 21411) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_trainer_game() != 8370) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_trainer_judge() != 41333) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_trainer_legal_moves() != 28204) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_trainer_promotion_at() != 23166) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_trainer_show() != 12978) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_trainer_state() != 11667) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_method_trainer_up_to() != 28864) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_constructor_analyzer_start() != 48571) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_constructor_onlinedownload_start() != 6799) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_constructor_maiaplayer_load() != 29545) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_constructor_resignjudge_start() != 7151) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_constructor_rodentplayer_start() != 41669) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_constructor_gamesession_from_pgn() != 23248) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_mobile_api_checksum_constructor_gamesession_new_game() != 14475) { - return InitializationResult.apiChecksumMismatch - } - - return InitializationResult.ok -}() - -// Make the ensure init function public so that other modules which have external type references to -// our types can call it. -public func uniffiEnsureMobileApiInitialized() { - switch initializationResult { - case .ok: - break - case .contractVersionMismatch: - fatalError("UniFFI contract version mismatch: try cleaning and rebuilding your project") - case .apiChecksumMismatch: - fatalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } -} - -// swiftlint:enable all \ No newline at end of file diff --git a/iosApp/Generated/MobileAPI/MobileAPIFFI.h b/iosApp/Generated/MobileAPI/MobileAPIFFI.h deleted file mode 100644 index fff367b..0000000 --- a/iosApp/Generated/MobileAPI/MobileAPIFFI.h +++ /dev/null @@ -1,1708 +0,0 @@ -// This file was autogenerated by some hot garbage in the `uniffi` crate. -// Trust me, you don't want to mess with it! - -#pragma once - -#include -#include -#include - -// The following structs are used to implement the lowest level -// of the FFI, and thus useful to multiple uniffied crates. -// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H. -#ifdef UNIFFI_SHARED_H - // We also try to prevent mixing versions of shared uniffi header structs. - // If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4 - #ifndef UNIFFI_SHARED_HEADER_V4 - #error Combining helper code from multiple versions of uniffi is not supported - #endif // ndef UNIFFI_SHARED_HEADER_V4 -#else -#define UNIFFI_SHARED_H -#define UNIFFI_SHARED_HEADER_V4 -// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️ -// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️ - -typedef struct RustBuffer -{ - uint64_t capacity; - uint64_t len; - uint8_t *_Nullable data; -} RustBuffer; - -typedef struct ForeignBytes -{ - int32_t len; - const uint8_t *_Nullable data; -} ForeignBytes; - -// Error definitions -typedef struct RustCallStatus { - int8_t code; - RustBuffer errorBuf; -} RustCallStatus; - -// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️ -// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️ -#endif // def UNIFFI_SHARED_H -#ifndef UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK -#define UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK -typedef void (*UniffiRustFutureContinuationCallback)(uint64_t, int8_t - ); - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_DROPPED_CALLBACK -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_DROPPED_CALLBACK -typedef void (*UniffiForeignFutureDroppedCallback)(uint64_t - ); - -#endif -#ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE -#define UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE -typedef void (*UniffiCallbackInterfaceFree)(uint64_t - ); - -#endif -#ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_CLONE -#define UNIFFI_FFIDEF_CALLBACK_INTERFACE_CLONE -typedef uint64_t (*UniffiCallbackInterfaceClone)(uint64_t - ); - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_DROPPED_CALLBACK_STRUCT -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_DROPPED_CALLBACK_STRUCT -typedef struct UniffiForeignFutureDroppedCallbackStruct { - uint64_t handle; - UniffiForeignFutureDroppedCallback _Nonnull free; -} UniffiForeignFutureDroppedCallbackStruct; - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_U8 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_U8 -typedef struct UniffiForeignFutureResultU8 { - uint8_t returnValue; - RustCallStatus callStatus; -} UniffiForeignFutureResultU8; - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 -typedef void (*UniffiForeignFutureCompleteU8)(uint64_t, UniffiForeignFutureResultU8 - ); - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_I8 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_I8 -typedef struct UniffiForeignFutureResultI8 { - int8_t returnValue; - RustCallStatus callStatus; -} UniffiForeignFutureResultI8; - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 -typedef void (*UniffiForeignFutureCompleteI8)(uint64_t, UniffiForeignFutureResultI8 - ); - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_U16 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_U16 -typedef struct UniffiForeignFutureResultU16 { - uint16_t returnValue; - RustCallStatus callStatus; -} UniffiForeignFutureResultU16; - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 -typedef void (*UniffiForeignFutureCompleteU16)(uint64_t, UniffiForeignFutureResultU16 - ); - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_I16 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_I16 -typedef struct UniffiForeignFutureResultI16 { - int16_t returnValue; - RustCallStatus callStatus; -} UniffiForeignFutureResultI16; - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 -typedef void (*UniffiForeignFutureCompleteI16)(uint64_t, UniffiForeignFutureResultI16 - ); - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_U32 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_U32 -typedef struct UniffiForeignFutureResultU32 { - uint32_t returnValue; - RustCallStatus callStatus; -} UniffiForeignFutureResultU32; - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 -typedef void (*UniffiForeignFutureCompleteU32)(uint64_t, UniffiForeignFutureResultU32 - ); - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_I32 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_I32 -typedef struct UniffiForeignFutureResultI32 { - int32_t returnValue; - RustCallStatus callStatus; -} UniffiForeignFutureResultI32; - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 -typedef void (*UniffiForeignFutureCompleteI32)(uint64_t, UniffiForeignFutureResultI32 - ); - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_U64 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_U64 -typedef struct UniffiForeignFutureResultU64 { - uint64_t returnValue; - RustCallStatus callStatus; -} UniffiForeignFutureResultU64; - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 -typedef void (*UniffiForeignFutureCompleteU64)(uint64_t, UniffiForeignFutureResultU64 - ); - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_I64 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_I64 -typedef struct UniffiForeignFutureResultI64 { - int64_t returnValue; - RustCallStatus callStatus; -} UniffiForeignFutureResultI64; - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 -typedef void (*UniffiForeignFutureCompleteI64)(uint64_t, UniffiForeignFutureResultI64 - ); - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_F32 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_F32 -typedef struct UniffiForeignFutureResultF32 { - float returnValue; - RustCallStatus callStatus; -} UniffiForeignFutureResultF32; - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 -typedef void (*UniffiForeignFutureCompleteF32)(uint64_t, UniffiForeignFutureResultF32 - ); - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_F64 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_F64 -typedef struct UniffiForeignFutureResultF64 { - double returnValue; - RustCallStatus callStatus; -} UniffiForeignFutureResultF64; - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 -typedef void (*UniffiForeignFutureCompleteF64)(uint64_t, UniffiForeignFutureResultF64 - ); - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_RUST_BUFFER -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_RUST_BUFFER -typedef struct UniffiForeignFutureResultRustBuffer { - RustBuffer returnValue; - RustCallStatus callStatus; -} UniffiForeignFutureResultRustBuffer; - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER -typedef void (*UniffiForeignFutureCompleteRustBuffer)(uint64_t, UniffiForeignFutureResultRustBuffer - ); - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_VOID -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_RESULT_VOID -typedef struct UniffiForeignFutureResultVoid { - RustCallStatus callStatus; -} UniffiForeignFutureResultVoid; - -#endif -#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID -#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID -typedef void (*UniffiForeignFutureCompleteVoid)(uint64_t, UniffiForeignFutureResultVoid - ); - -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_DATABASE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_DATABASE -uint64_t uniffi_mobile_api_fn_clone_database(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_DATABASE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_DATABASE -void uniffi_mobile_api_fn_free_database(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_FIND -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_FIND -RustBuffer uniffi_mobile_api_fn_method_database_find(uint64_t ptr, RustBuffer text, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_FORMAT -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_FORMAT -RustBuffer uniffi_mobile_api_fn_method_database_format(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_GAME -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_GAME -RustBuffer uniffi_mobile_api_fn_method_database_game(uint64_t ptr, uint32_t index, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_IS_EMPTY -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_IS_EMPTY -int8_t uniffi_mobile_api_fn_method_database_is_empty(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_LEN -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_LEN -uint32_t uniffi_mobile_api_fn_method_database_len(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_NEWEST_FIRST -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_NEWEST_FIRST -RustBuffer uniffi_mobile_api_fn_method_database_newest_first(uint64_t ptr, RustBuffer indices, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_NOTES -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_NOTES -RustBuffer uniffi_mobile_api_fn_method_database_notes(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_PGN -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_PGN -RustBuffer uniffi_mobile_api_fn_method_database_pgn(uint64_t ptr, uint32_t index, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_REVIEW -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_REVIEW -uint64_t uniffi_mobile_api_fn_method_database_review(uint64_t ptr, uint32_t index, RustBuffer cache_dir, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_ROWS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_ROWS -RustBuffer uniffi_mobile_api_fn_method_database_rows(uint64_t ptr, uint32_t start, uint32_t count, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_ROWS_OF -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_ROWS_OF -RustBuffer uniffi_mobile_api_fn_method_database_rows_of(uint64_t ptr, RustBuffer indices, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_SESSION -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_SESSION -uint64_t uniffi_mobile_api_fn_method_database_session(uint64_t ptr, uint32_t index, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_PREPARE_POSITION -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_PREPARE_POSITION -uint64_t uniffi_mobile_api_fn_method_database_prepare_position(uint64_t ptr, uint32_t player_id, int8_t white, RustBuffer query_fen, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_SUGGEST_PLAYERS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_DATABASE_SUGGEST_PLAYERS -RustBuffer uniffi_mobile_api_fn_method_database_suggest_players(uint64_t ptr, RustBuffer query, uint32_t start, uint32_t count, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_ANALYZER -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_ANALYZER -uint64_t uniffi_mobile_api_fn_clone_analyzer(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_ANALYZER -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_ANALYZER -void uniffi_mobile_api_fn_free_analyzer(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_ANALYZER_START -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_ANALYZER_START -uint64_t uniffi_mobile_api_fn_constructor_analyzer_start(RustBuffer path, RustBuffer eval_file, uint32_t threads, uint32_t hash_mb, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_ANALYZER_ANALYZE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_ANALYZER_ANALYZE -uint64_t uniffi_mobile_api_fn_method_analyzer_analyze(uint64_t ptr, RustBuffer start_fen, RustBuffer moves, uint32_t lines, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_ANALYZER_POLL -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_ANALYZER_POLL -RustBuffer uniffi_mobile_api_fn_method_analyzer_poll(uint64_t ptr, uint32_t timeout_ms, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_ANALYZER_QUIT -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_ANALYZER_QUIT -void uniffi_mobile_api_fn_method_analyzer_quit(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_ANALYZER_STOP -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_ANALYZER_STOP -void uniffi_mobile_api_fn_method_analyzer_stop(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_ONLINEDOWNLOAD -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_ONLINEDOWNLOAD -uint64_t uniffi_mobile_api_fn_clone_onlinedownload(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_ONLINEDOWNLOAD -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_ONLINEDOWNLOAD -void uniffi_mobile_api_fn_free_onlinedownload(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_ONLINEDOWNLOAD_START -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_ONLINEDOWNLOAD_START -uint64_t uniffi_mobile_api_fn_constructor_onlinedownload_start(RustBuffer accounts, RustBuffer path, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_ONLINEDOWNLOAD_CANCEL -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_ONLINEDOWNLOAD_CANCEL -void uniffi_mobile_api_fn_method_onlinedownload_cancel(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_ONLINEDOWNLOAD_STATE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_ONLINEDOWNLOAD_STATE -RustBuffer uniffi_mobile_api_fn_method_onlinedownload_state(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_MAIAPLAYER -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_MAIAPLAYER -uint64_t uniffi_mobile_api_fn_clone_maiaplayer(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_MAIAPLAYER -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_MAIAPLAYER -void uniffi_mobile_api_fn_free_maiaplayer(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_MAIAPLAYER_LOAD -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_MAIAPLAYER_LOAD -uint64_t uniffi_mobile_api_fn_constructor_maiaplayer_load(RustBuffer path, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_MAIAPLAYER_CHOOSE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_MAIAPLAYER_CHOOSE -RustBuffer uniffi_mobile_api_fn_method_maiaplayer_choose(uint64_t ptr, uint64_t game, uint32_t at, uint32_t strength, RustBuffer opponent, float random, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_RESIGNJUDGE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_RESIGNJUDGE -uint64_t uniffi_mobile_api_fn_clone_resignjudge(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_RESIGNJUDGE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_RESIGNJUDGE -void uniffi_mobile_api_fn_free_resignjudge(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_RESIGNJUDGE_START -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_RESIGNJUDGE_START -uint64_t uniffi_mobile_api_fn_constructor_resignjudge_start(RustBuffer path, RustBuffer eval_file, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RESIGNJUDGE_ASK -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RESIGNJUDGE_ASK -void uniffi_mobile_api_fn_method_resignjudge_ask(uint64_t ptr, uint64_t game, uint32_t at, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RESIGNJUDGE_FORGET -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RESIGNJUDGE_FORGET -void uniffi_mobile_api_fn_method_resignjudge_forget(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RESIGNJUDGE_FORGET_SCORES -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RESIGNJUDGE_FORGET_SCORES -void uniffi_mobile_api_fn_method_resignjudge_forget_scores(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RESIGNJUDGE_HOPELESS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RESIGNJUDGE_HOPELESS -RustBuffer uniffi_mobile_api_fn_method_resignjudge_hopeless(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RESIGNJUDGE_MAY_OFFER_DRAW -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RESIGNJUDGE_MAY_OFFER_DRAW -int8_t uniffi_mobile_api_fn_method_resignjudge_may_offer_draw(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RESIGNJUDGE_OFFER_DRAW -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RESIGNJUDGE_OFFER_DRAW -int8_t uniffi_mobile_api_fn_method_resignjudge_offer_draw(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_RODENTPLAYER -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_RODENTPLAYER -uint64_t uniffi_mobile_api_fn_clone_rodentplayer(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_RODENTPLAYER -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_RODENTPLAYER -void uniffi_mobile_api_fn_free_rodentplayer(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_RODENTPLAYER_START -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_RODENTPLAYER_START -uint64_t uniffi_mobile_api_fn_constructor_rodentplayer_start(RustBuffer exe, RustBuffer home, RustBuffer style_id, uint32_t strength, int8_t use_book, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RODENTPLAYER_CHOOSE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RODENTPLAYER_CHOOSE -RustBuffer uniffi_mobile_api_fn_method_rodentplayer_choose(uint64_t ptr, uint64_t game, uint32_t at, uint64_t pause_ms, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RODENTPLAYER_FAILURE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RODENTPLAYER_FAILURE -RustBuffer uniffi_mobile_api_fn_method_rodentplayer_failure(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RODENTPLAYER_FORGET -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_RODENTPLAYER_FORGET -void uniffi_mobile_api_fn_method_rodentplayer_forget(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_PREPSEARCH -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_PREPSEARCH -uint64_t uniffi_mobile_api_fn_clone_prepsearch(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_PREPSEARCH -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_PREPSEARCH -void uniffi_mobile_api_fn_free_prepsearch(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_PREPSEARCH_CANCEL -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_PREPSEARCH_CANCEL -void uniffi_mobile_api_fn_method_prepsearch_cancel(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_PREPSEARCH_STATE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_PREPSEARCH_STATE -RustBuffer uniffi_mobile_api_fn_method_prepsearch_state(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_GAMEREVIEW -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_GAMEREVIEW -uint64_t uniffi_mobile_api_fn_clone_gamereview(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_GAMEREVIEW -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_GAMEREVIEW -void uniffi_mobile_api_fn_free_gamereview(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMEREVIEW_CANCEL -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMEREVIEW_CANCEL -void uniffi_mobile_api_fn_method_gamereview_cancel(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMEREVIEW_START -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMEREVIEW_START -int8_t uniffi_mobile_api_fn_method_gamereview_start(uint64_t ptr, RustBuffer path, RustBuffer eval_file, int8_t full, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMEREVIEW_STATE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMEREVIEW_STATE -RustBuffer uniffi_mobile_api_fn_method_gamereview_state(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_GAMESESSION -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_GAMESESSION -uint64_t uniffi_mobile_api_fn_clone_gamesession(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_GAMESESSION -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_GAMESESSION -void uniffi_mobile_api_fn_free_gamesession(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_GAMESESSION_FROM_PGN -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_GAMESESSION_FROM_PGN -uint64_t uniffi_mobile_api_fn_constructor_gamesession_from_pgn(RustBuffer pgn, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_GAMESESSION_NEW_GAME -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CONSTRUCTOR_GAMESESSION_NEW_GAME -uint64_t uniffi_mobile_api_fn_constructor_gamesession_new_game(RustBuffer date, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_ENDING -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_ENDING -RustBuffer uniffi_mobile_api_fn_method_gamesession_ending(uint64_t ptr, uint32_t at, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_ADD_COMMENT -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_ADD_COMMENT -RustBuffer uniffi_mobile_api_fn_method_gamesession_add_comment(uint64_t ptr, uint32_t at, RustBuffer text, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_ADD_LINE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_ADD_LINE -RustBuffer uniffi_mobile_api_fn_method_gamesession_add_line(uint64_t ptr, uint32_t at, RustBuffer uci, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_CAN_REDO -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_CAN_REDO -int8_t uniffi_mobile_api_fn_method_gamesession_can_redo(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_CAN_UNDO -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_CAN_UNDO -int8_t uniffi_mobile_api_fn_method_gamesession_can_undo(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_DATA -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_DATA -RustBuffer uniffi_mobile_api_fn_method_gamesession_data(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_DELETE_FROM -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_DELETE_FROM -RustBuffer uniffi_mobile_api_fn_method_gamesession_delete_from(uint64_t ptr, uint32_t at, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_IS_MODIFIED -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_IS_MODIFIED -int8_t uniffi_mobile_api_fn_method_gamesession_is_modified(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_LEGAL_MOVES -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_LEGAL_MOVES -RustBuffer uniffi_mobile_api_fn_method_gamesession_legal_moves(uint64_t ptr, uint32_t at, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_MAKE_MAIN -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_MAKE_MAIN -RustBuffer uniffi_mobile_api_fn_method_gamesession_make_main(uint64_t ptr, uint32_t at, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_MARK_SAVED -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_MARK_SAVED -void uniffi_mobile_api_fn_method_gamesession_mark_saved(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_PGN -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_PGN -RustBuffer uniffi_mobile_api_fn_method_gamesession_pgn(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_PLAY -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_PLAY -RustBuffer uniffi_mobile_api_fn_method_gamesession_play(uint64_t ptr, uint32_t at, RustBuffer uci, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_PLAY_FROM -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_PLAY_FROM -uint64_t uniffi_mobile_api_fn_method_gamesession_play_from(uint64_t ptr, uint32_t at, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_REDO -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_REDO -RustBuffer uniffi_mobile_api_fn_method_gamesession_redo(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_REVIEW -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_REVIEW -uint64_t uniffi_mobile_api_fn_method_gamesession_review(uint64_t ptr, RustBuffer cache_dir, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_SET_DATA -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_SET_DATA -void uniffi_mobile_api_fn_method_gamesession_set_data(uint64_t ptr, RustBuffer tags, RustBuffer result, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_UNDO -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_UNDO -RustBuffer uniffi_mobile_api_fn_method_gamesession_undo(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_TRAINER -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_TRAINER -RustBuffer uniffi_mobile_api_fn_method_gamesession_trainer(uint64_t ptr, uint32_t at, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_TRAINING_RUNS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_GAMESESSION_TRAINING_RUNS -RustBuffer uniffi_mobile_api_fn_method_gamesession_training_runs(uint64_t ptr, uint32_t at, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_TRAINER -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_CLONE_TRAINER -uint64_t uniffi_mobile_api_fn_clone_trainer(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_TRAINER -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FREE_TRAINER -void uniffi_mobile_api_fn_free_trainer(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_AGAIN -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_AGAIN -void uniffi_mobile_api_fn_method_trainer_again(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_EVENT -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_EVENT -RustBuffer uniffi_mobile_api_fn_method_trainer_event(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_FEN_AFTER -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_FEN_AFTER -RustBuffer uniffi_mobile_api_fn_method_trainer_fen_after(uint64_t ptr, uint32_t ply, RustBuffer uci, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_GAME -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_GAME -RustBuffer uniffi_mobile_api_fn_method_trainer_game(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_JUDGE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_JUDGE -RustBuffer uniffi_mobile_api_fn_method_trainer_judge(uint64_t ptr, uint32_t ply, RustBuffer uci, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_LEGAL_MOVES -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_LEGAL_MOVES -RustBuffer uniffi_mobile_api_fn_method_trainer_legal_moves(uint64_t ptr, uint32_t ply, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_PROMOTION_AT -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_PROMOTION_AT -RustBuffer uniffi_mobile_api_fn_method_trainer_promotion_at(uint64_t ptr, uint32_t ply, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_SHOW -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_SHOW -void uniffi_mobile_api_fn_method_trainer_show(uint64_t ptr, uint32_t ply, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_STATE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_STATE -RustBuffer uniffi_mobile_api_fn_method_trainer_state(uint64_t ptr, uint32_t ply, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_UP_TO -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_METHOD_TRAINER_UP_TO -RustBuffer uniffi_mobile_api_fn_method_trainer_up_to(uint64_t ptr, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OPEN_BYTES -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OPEN_BYTES -uint64_t uniffi_mobile_api_fn_func_open_bytes(RustBuffer name, RustBuffer bytes, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OPEN_CHESSBASE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OPEN_CHESSBASE -uint64_t uniffi_mobile_api_fn_func_open_chessbase(RustBuffer cbh_name, RustBuffer files, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OPEN_FILE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OPEN_FILE -uint64_t uniffi_mobile_api_fn_func_open_file(RustBuffer name, int32_t fd, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OPEN_PATH -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OPEN_PATH -uint64_t uniffi_mobile_api_fn_func_open_path(RustBuffer path, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_DELETE_ONLINE_DATABASE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_DELETE_ONLINE_DATABASE -void uniffi_mobile_api_fn_func_delete_online_database(RustBuffer path, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_FIND_ACCOUNT -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_FIND_ACCOUNT -RustBuffer uniffi_mobile_api_fn_func_find_account(RustBuffer site, RustBuffer nick, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_ONLINE_DATABASE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_ONLINE_DATABASE -RustBuffer uniffi_mobile_api_fn_func_online_database(RustBuffer path, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_ONLINE_TARGETS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_ONLINE_TARGETS -RustBuffer uniffi_mobile_api_fn_func_online_targets(RustBuffer dir, RustBuffer accounts, int8_t together, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_VALID_NICKNAME -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_VALID_NICKNAME -int8_t uniffi_mobile_api_fn_func_valid_nickname(RustBuffer nick, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_COMPUTER_GAME_TAGS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_COMPUTER_GAME_TAGS -RustBuffer uniffi_mobile_api_fn_func_computer_game_tags(RustBuffer event, int8_t user_white, RustBuffer user_name, RustBuffer rival, uint32_t strength, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_HOPELESS_TURNS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_HOPELESS_TURNS -uint32_t uniffi_mobile_api_fn_func_hopeless_turns(RustCallStatus *_Nonnull out_status - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_MAIA_RANGE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_MAIA_RANGE -RustBuffer uniffi_mobile_api_fn_func_maia_range(RustCallStatus *_Nonnull out_status - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_MOVE_PAUSE_MS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_MOVE_PAUSE_MS -uint64_t uniffi_mobile_api_fn_func_move_pause_ms(uint32_t ply, int8_t only_move, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RIVAL_LABEL -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RIVAL_LABEL -RustBuffer uniffi_mobile_api_fn_func_rival_label(RustBuffer rival, uint32_t strength, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RIVAL_NAME -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RIVAL_NAME -RustBuffer uniffi_mobile_api_fn_func_rival_name(RustBuffer rival, uint32_t strength, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RODENT_BOOK_PACK -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RODENT_BOOK_PACK -RustBuffer uniffi_mobile_api_fn_func_rodent_book_pack(RustCallStatus *_Nonnull out_status - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RODENT_RANGE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RODENT_RANGE -RustBuffer uniffi_mobile_api_fn_func_rodent_range(RustCallStatus *_Nonnull out_status - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RODENT_STYLES -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RODENT_STYLES -RustBuffer uniffi_mobile_api_fn_func_rodent_styles(RustCallStatus *_Nonnull out_status - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RODENT_VERSION -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RODENT_VERSION -RustBuffer uniffi_mobile_api_fn_func_rodent_version(RustCallStatus *_Nonnull out_status - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_REVIEW_ESTIMATE_SECS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_REVIEW_ESTIMATE_SECS -uint32_t uniffi_mobile_api_fn_func_review_estimate_secs(uint32_t searches, uint64_t nps_per_process, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OWN_CREATE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OWN_CREATE -void uniffi_mobile_api_fn_func_own_create(RustBuffer path, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OWN_REMOVE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OWN_REMOVE -void uniffi_mobile_api_fn_func_own_remove(RustBuffer path, uint32_t index, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OWN_SAVE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_OWN_SAVE -uint32_t uniffi_mobile_api_fn_func_own_save(RustBuffer path, RustBuffer index, RustBuffer pgn, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_TRAINER_SET_FILE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_TRAINER_SET_FILE -void uniffi_mobile_api_fn_func_trainer_set_file(RustBuffer path, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_CHECK_RELEASE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_CHECK_RELEASE -RustBuffer uniffi_mobile_api_fn_func_check_release(RustBuffer api, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_CHECK_RELEASE_COUNTED -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_CHECK_RELEASE_COUNTED -RustBuffer uniffi_mobile_api_fn_func_check_release_counted(RustBuffer install, RustBuffer platform, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RELEASE_API -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_FN_FUNC_RELEASE_API -RustBuffer uniffi_mobile_api_fn_func_release_api(RustCallStatus *_Nonnull out_status - -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUSTBUFFER_ALLOC -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUSTBUFFER_ALLOC -RustBuffer ffi_mobile_api_rustbuffer_alloc(uint64_t size, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUSTBUFFER_FROM_BYTES -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUSTBUFFER_FROM_BYTES -RustBuffer ffi_mobile_api_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUSTBUFFER_FREE -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUSTBUFFER_FREE -void ffi_mobile_api_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUSTBUFFER_RESERVE -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUSTBUFFER_RESERVE -RustBuffer ffi_mobile_api_rustbuffer_reserve(RustBuffer buf, uint64_t additional, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_U8 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_U8 -void ffi_mobile_api_rust_future_poll_u8(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_U8 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_U8 -void ffi_mobile_api_rust_future_cancel_u8(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_U8 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_U8 -void ffi_mobile_api_rust_future_free_u8(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_U8 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_U8 -uint8_t ffi_mobile_api_rust_future_complete_u8(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_I8 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_I8 -void ffi_mobile_api_rust_future_poll_i8(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_I8 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_I8 -void ffi_mobile_api_rust_future_cancel_i8(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_I8 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_I8 -void ffi_mobile_api_rust_future_free_i8(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_I8 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_I8 -int8_t ffi_mobile_api_rust_future_complete_i8(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_U16 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_U16 -void ffi_mobile_api_rust_future_poll_u16(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_U16 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_U16 -void ffi_mobile_api_rust_future_cancel_u16(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_U16 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_U16 -void ffi_mobile_api_rust_future_free_u16(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_U16 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_U16 -uint16_t ffi_mobile_api_rust_future_complete_u16(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_I16 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_I16 -void ffi_mobile_api_rust_future_poll_i16(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_I16 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_I16 -void ffi_mobile_api_rust_future_cancel_i16(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_I16 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_I16 -void ffi_mobile_api_rust_future_free_i16(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_I16 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_I16 -int16_t ffi_mobile_api_rust_future_complete_i16(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_U32 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_U32 -void ffi_mobile_api_rust_future_poll_u32(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_U32 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_U32 -void ffi_mobile_api_rust_future_cancel_u32(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_U32 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_U32 -void ffi_mobile_api_rust_future_free_u32(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_U32 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_U32 -uint32_t ffi_mobile_api_rust_future_complete_u32(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_I32 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_I32 -void ffi_mobile_api_rust_future_poll_i32(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_I32 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_I32 -void ffi_mobile_api_rust_future_cancel_i32(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_I32 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_I32 -void ffi_mobile_api_rust_future_free_i32(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_I32 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_I32 -int32_t ffi_mobile_api_rust_future_complete_i32(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_U64 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_U64 -void ffi_mobile_api_rust_future_poll_u64(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_U64 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_U64 -void ffi_mobile_api_rust_future_cancel_u64(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_U64 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_U64 -void ffi_mobile_api_rust_future_free_u64(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_U64 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_U64 -uint64_t ffi_mobile_api_rust_future_complete_u64(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_I64 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_I64 -void ffi_mobile_api_rust_future_poll_i64(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_I64 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_I64 -void ffi_mobile_api_rust_future_cancel_i64(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_I64 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_I64 -void ffi_mobile_api_rust_future_free_i64(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_I64 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_I64 -int64_t ffi_mobile_api_rust_future_complete_i64(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_F32 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_F32 -void ffi_mobile_api_rust_future_poll_f32(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_F32 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_F32 -void ffi_mobile_api_rust_future_cancel_f32(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_F32 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_F32 -void ffi_mobile_api_rust_future_free_f32(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_F32 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_F32 -float ffi_mobile_api_rust_future_complete_f32(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_F64 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_F64 -void ffi_mobile_api_rust_future_poll_f64(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_F64 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_F64 -void ffi_mobile_api_rust_future_cancel_f64(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_F64 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_F64 -void ffi_mobile_api_rust_future_free_f64(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_F64 -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_F64 -double ffi_mobile_api_rust_future_complete_f64(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_RUST_BUFFER -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_RUST_BUFFER -void ffi_mobile_api_rust_future_poll_rust_buffer(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_RUST_BUFFER -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_RUST_BUFFER -void ffi_mobile_api_rust_future_cancel_rust_buffer(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_RUST_BUFFER -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_RUST_BUFFER -void ffi_mobile_api_rust_future_free_rust_buffer(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_RUST_BUFFER -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_RUST_BUFFER -RustBuffer ffi_mobile_api_rust_future_complete_rust_buffer(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_VOID -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_POLL_VOID -void ffi_mobile_api_rust_future_poll_void(uint64_t handle, UniffiRustFutureContinuationCallback _Nonnull callback, uint64_t callback_data -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_VOID -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_CANCEL_VOID -void ffi_mobile_api_rust_future_cancel_void(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_VOID -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_FREE_VOID -void ffi_mobile_api_rust_future_free_void(uint64_t handle -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_VOID -#define UNIFFI_FFIDEF_FFI_MOBILE_API_RUST_FUTURE_COMPLETE_VOID -void ffi_mobile_api_rust_future_complete_void(uint64_t handle, RustCallStatus *_Nonnull out_status -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OPEN_BYTES -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OPEN_BYTES -uint16_t uniffi_mobile_api_checksum_func_open_bytes(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OPEN_CHESSBASE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OPEN_CHESSBASE -uint16_t uniffi_mobile_api_checksum_func_open_chessbase(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OPEN_FILE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OPEN_FILE -uint16_t uniffi_mobile_api_checksum_func_open_file(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OPEN_PATH -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OPEN_PATH -uint16_t uniffi_mobile_api_checksum_func_open_path(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_DELETE_ONLINE_DATABASE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_DELETE_ONLINE_DATABASE -uint16_t uniffi_mobile_api_checksum_func_delete_online_database(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_FIND_ACCOUNT -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_FIND_ACCOUNT -uint16_t uniffi_mobile_api_checksum_func_find_account(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_ONLINE_DATABASE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_ONLINE_DATABASE -uint16_t uniffi_mobile_api_checksum_func_online_database(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_ONLINE_TARGETS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_ONLINE_TARGETS -uint16_t uniffi_mobile_api_checksum_func_online_targets(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_VALID_NICKNAME -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_VALID_NICKNAME -uint16_t uniffi_mobile_api_checksum_func_valid_nickname(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_COMPUTER_GAME_TAGS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_COMPUTER_GAME_TAGS -uint16_t uniffi_mobile_api_checksum_func_computer_game_tags(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_HOPELESS_TURNS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_HOPELESS_TURNS -uint16_t uniffi_mobile_api_checksum_func_hopeless_turns(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_MAIA_RANGE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_MAIA_RANGE -uint16_t uniffi_mobile_api_checksum_func_maia_range(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_MOVE_PAUSE_MS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_MOVE_PAUSE_MS -uint16_t uniffi_mobile_api_checksum_func_move_pause_ms(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RIVAL_LABEL -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RIVAL_LABEL -uint16_t uniffi_mobile_api_checksum_func_rival_label(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RIVAL_NAME -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RIVAL_NAME -uint16_t uniffi_mobile_api_checksum_func_rival_name(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RODENT_BOOK_PACK -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RODENT_BOOK_PACK -uint16_t uniffi_mobile_api_checksum_func_rodent_book_pack(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RODENT_RANGE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RODENT_RANGE -uint16_t uniffi_mobile_api_checksum_func_rodent_range(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RODENT_STYLES -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RODENT_STYLES -uint16_t uniffi_mobile_api_checksum_func_rodent_styles(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RODENT_VERSION -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RODENT_VERSION -uint16_t uniffi_mobile_api_checksum_func_rodent_version(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_REVIEW_ESTIMATE_SECS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_REVIEW_ESTIMATE_SECS -uint16_t uniffi_mobile_api_checksum_func_review_estimate_secs(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OWN_CREATE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OWN_CREATE -uint16_t uniffi_mobile_api_checksum_func_own_create(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OWN_REMOVE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OWN_REMOVE -uint16_t uniffi_mobile_api_checksum_func_own_remove(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OWN_SAVE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_OWN_SAVE -uint16_t uniffi_mobile_api_checksum_func_own_save(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_TRAINER_SET_FILE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_TRAINER_SET_FILE -uint16_t uniffi_mobile_api_checksum_func_trainer_set_file(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_CHECK_RELEASE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_CHECK_RELEASE -uint16_t uniffi_mobile_api_checksum_func_check_release(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_CHECK_RELEASE_COUNTED -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_CHECK_RELEASE_COUNTED -uint16_t uniffi_mobile_api_checksum_func_check_release_counted(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RELEASE_API -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_FUNC_RELEASE_API -uint16_t uniffi_mobile_api_checksum_func_release_api(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_FIND -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_FIND -uint16_t uniffi_mobile_api_checksum_method_database_find(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_FORMAT -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_FORMAT -uint16_t uniffi_mobile_api_checksum_method_database_format(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_GAME -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_GAME -uint16_t uniffi_mobile_api_checksum_method_database_game(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_IS_EMPTY -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_IS_EMPTY -uint16_t uniffi_mobile_api_checksum_method_database_is_empty(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_LEN -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_LEN -uint16_t uniffi_mobile_api_checksum_method_database_len(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_NEWEST_FIRST -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_NEWEST_FIRST -uint16_t uniffi_mobile_api_checksum_method_database_newest_first(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_NOTES -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_NOTES -uint16_t uniffi_mobile_api_checksum_method_database_notes(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_PGN -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_PGN -uint16_t uniffi_mobile_api_checksum_method_database_pgn(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_REVIEW -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_REVIEW -uint16_t uniffi_mobile_api_checksum_method_database_review(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_ROWS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_ROWS -uint16_t uniffi_mobile_api_checksum_method_database_rows(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_ROWS_OF -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_ROWS_OF -uint16_t uniffi_mobile_api_checksum_method_database_rows_of(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_SESSION -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_SESSION -uint16_t uniffi_mobile_api_checksum_method_database_session(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_PREPARE_POSITION -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_PREPARE_POSITION -uint16_t uniffi_mobile_api_checksum_method_database_prepare_position(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_SUGGEST_PLAYERS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_DATABASE_SUGGEST_PLAYERS -uint16_t uniffi_mobile_api_checksum_method_database_suggest_players(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_ANALYZER_ANALYZE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_ANALYZER_ANALYZE -uint16_t uniffi_mobile_api_checksum_method_analyzer_analyze(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_ANALYZER_POLL -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_ANALYZER_POLL -uint16_t uniffi_mobile_api_checksum_method_analyzer_poll(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_ANALYZER_QUIT -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_ANALYZER_QUIT -uint16_t uniffi_mobile_api_checksum_method_analyzer_quit(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_ANALYZER_STOP -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_ANALYZER_STOP -uint16_t uniffi_mobile_api_checksum_method_analyzer_stop(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_ONLINEDOWNLOAD_CANCEL -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_ONLINEDOWNLOAD_CANCEL -uint16_t uniffi_mobile_api_checksum_method_onlinedownload_cancel(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_ONLINEDOWNLOAD_STATE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_ONLINEDOWNLOAD_STATE -uint16_t uniffi_mobile_api_checksum_method_onlinedownload_state(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_MAIAPLAYER_CHOOSE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_MAIAPLAYER_CHOOSE -uint16_t uniffi_mobile_api_checksum_method_maiaplayer_choose(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RESIGNJUDGE_ASK -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RESIGNJUDGE_ASK -uint16_t uniffi_mobile_api_checksum_method_resignjudge_ask(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RESIGNJUDGE_FORGET -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RESIGNJUDGE_FORGET -uint16_t uniffi_mobile_api_checksum_method_resignjudge_forget(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RESIGNJUDGE_FORGET_SCORES -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RESIGNJUDGE_FORGET_SCORES -uint16_t uniffi_mobile_api_checksum_method_resignjudge_forget_scores(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RESIGNJUDGE_HOPELESS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RESIGNJUDGE_HOPELESS -uint16_t uniffi_mobile_api_checksum_method_resignjudge_hopeless(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RESIGNJUDGE_MAY_OFFER_DRAW -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RESIGNJUDGE_MAY_OFFER_DRAW -uint16_t uniffi_mobile_api_checksum_method_resignjudge_may_offer_draw(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RESIGNJUDGE_OFFER_DRAW -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RESIGNJUDGE_OFFER_DRAW -uint16_t uniffi_mobile_api_checksum_method_resignjudge_offer_draw(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RODENTPLAYER_CHOOSE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RODENTPLAYER_CHOOSE -uint16_t uniffi_mobile_api_checksum_method_rodentplayer_choose(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RODENTPLAYER_FAILURE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RODENTPLAYER_FAILURE -uint16_t uniffi_mobile_api_checksum_method_rodentplayer_failure(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RODENTPLAYER_FORGET -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_RODENTPLAYER_FORGET -uint16_t uniffi_mobile_api_checksum_method_rodentplayer_forget(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_PREPSEARCH_CANCEL -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_PREPSEARCH_CANCEL -uint16_t uniffi_mobile_api_checksum_method_prepsearch_cancel(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_PREPSEARCH_STATE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_PREPSEARCH_STATE -uint16_t uniffi_mobile_api_checksum_method_prepsearch_state(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMEREVIEW_CANCEL -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMEREVIEW_CANCEL -uint16_t uniffi_mobile_api_checksum_method_gamereview_cancel(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMEREVIEW_START -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMEREVIEW_START -uint16_t uniffi_mobile_api_checksum_method_gamereview_start(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMEREVIEW_STATE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMEREVIEW_STATE -uint16_t uniffi_mobile_api_checksum_method_gamereview_state(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_ENDING -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_ENDING -uint16_t uniffi_mobile_api_checksum_method_gamesession_ending(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_ADD_COMMENT -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_ADD_COMMENT -uint16_t uniffi_mobile_api_checksum_method_gamesession_add_comment(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_ADD_LINE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_ADD_LINE -uint16_t uniffi_mobile_api_checksum_method_gamesession_add_line(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_CAN_REDO -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_CAN_REDO -uint16_t uniffi_mobile_api_checksum_method_gamesession_can_redo(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_CAN_UNDO -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_CAN_UNDO -uint16_t uniffi_mobile_api_checksum_method_gamesession_can_undo(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_DATA -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_DATA -uint16_t uniffi_mobile_api_checksum_method_gamesession_data(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_DELETE_FROM -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_DELETE_FROM -uint16_t uniffi_mobile_api_checksum_method_gamesession_delete_from(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_IS_MODIFIED -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_IS_MODIFIED -uint16_t uniffi_mobile_api_checksum_method_gamesession_is_modified(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_LEGAL_MOVES -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_LEGAL_MOVES -uint16_t uniffi_mobile_api_checksum_method_gamesession_legal_moves(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_MAKE_MAIN -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_MAKE_MAIN -uint16_t uniffi_mobile_api_checksum_method_gamesession_make_main(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_MARK_SAVED -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_MARK_SAVED -uint16_t uniffi_mobile_api_checksum_method_gamesession_mark_saved(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_PGN -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_PGN -uint16_t uniffi_mobile_api_checksum_method_gamesession_pgn(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_PLAY -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_PLAY -uint16_t uniffi_mobile_api_checksum_method_gamesession_play(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_PLAY_FROM -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_PLAY_FROM -uint16_t uniffi_mobile_api_checksum_method_gamesession_play_from(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_REDO -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_REDO -uint16_t uniffi_mobile_api_checksum_method_gamesession_redo(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_REVIEW -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_REVIEW -uint16_t uniffi_mobile_api_checksum_method_gamesession_review(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_SET_DATA -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_SET_DATA -uint16_t uniffi_mobile_api_checksum_method_gamesession_set_data(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_UNDO -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_UNDO -uint16_t uniffi_mobile_api_checksum_method_gamesession_undo(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_TRAINER -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_TRAINER -uint16_t uniffi_mobile_api_checksum_method_gamesession_trainer(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_TRAINING_RUNS -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_GAMESESSION_TRAINING_RUNS -uint16_t uniffi_mobile_api_checksum_method_gamesession_training_runs(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_AGAIN -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_AGAIN -uint16_t uniffi_mobile_api_checksum_method_trainer_again(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_EVENT -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_EVENT -uint16_t uniffi_mobile_api_checksum_method_trainer_event(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_FEN_AFTER -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_FEN_AFTER -uint16_t uniffi_mobile_api_checksum_method_trainer_fen_after(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_GAME -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_GAME -uint16_t uniffi_mobile_api_checksum_method_trainer_game(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_JUDGE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_JUDGE -uint16_t uniffi_mobile_api_checksum_method_trainer_judge(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_LEGAL_MOVES -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_LEGAL_MOVES -uint16_t uniffi_mobile_api_checksum_method_trainer_legal_moves(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_PROMOTION_AT -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_PROMOTION_AT -uint16_t uniffi_mobile_api_checksum_method_trainer_promotion_at(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_SHOW -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_SHOW -uint16_t uniffi_mobile_api_checksum_method_trainer_show(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_STATE -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_STATE -uint16_t uniffi_mobile_api_checksum_method_trainer_state(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_UP_TO -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_METHOD_TRAINER_UP_TO -uint16_t uniffi_mobile_api_checksum_method_trainer_up_to(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_ANALYZER_START -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_ANALYZER_START -uint16_t uniffi_mobile_api_checksum_constructor_analyzer_start(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_ONLINEDOWNLOAD_START -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_ONLINEDOWNLOAD_START -uint16_t uniffi_mobile_api_checksum_constructor_onlinedownload_start(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_MAIAPLAYER_LOAD -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_MAIAPLAYER_LOAD -uint16_t uniffi_mobile_api_checksum_constructor_maiaplayer_load(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_RESIGNJUDGE_START -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_RESIGNJUDGE_START -uint16_t uniffi_mobile_api_checksum_constructor_resignjudge_start(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_RODENTPLAYER_START -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_RODENTPLAYER_START -uint16_t uniffi_mobile_api_checksum_constructor_rodentplayer_start(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_GAMESESSION_FROM_PGN -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_GAMESESSION_FROM_PGN -uint16_t uniffi_mobile_api_checksum_constructor_gamesession_from_pgn(void - -); -#endif -#ifndef UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_GAMESESSION_NEW_GAME -#define UNIFFI_FFIDEF_UNIFFI_MOBILE_API_CHECKSUM_CONSTRUCTOR_GAMESESSION_NEW_GAME -uint16_t uniffi_mobile_api_checksum_constructor_gamesession_new_game(void - -); -#endif -#ifndef UNIFFI_FFIDEF_FFI_MOBILE_API_UNIFFI_CONTRACT_VERSION -#define UNIFFI_FFIDEF_FFI_MOBILE_API_UNIFFI_CONTRACT_VERSION -uint32_t ffi_mobile_api_uniffi_contract_version(void - -); -#endif - diff --git a/iosApp/Generated/MobileAPI/MobileAPIFFI.modulemap b/iosApp/Generated/MobileAPI/MobileAPIFFI.modulemap deleted file mode 100644 index 07713c2..0000000 --- a/iosApp/Generated/MobileAPI/MobileAPIFFI.modulemap +++ /dev/null @@ -1,9 +0,0 @@ -module MobileAPIFFI { - header "MobileAPIFFI.h" - export * - use "Darwin" - use "_Builtin_stdbool" - use "_Builtin_stdint" - link framework "CoreFoundation" - link framework "IOKit" -} \ No newline at end of file diff --git a/iosApp/Generated/MobileAPI/module.modulemap b/iosApp/Generated/MobileAPI/module.modulemap deleted file mode 100644 index 07713c2..0000000 --- a/iosApp/Generated/MobileAPI/module.modulemap +++ /dev/null @@ -1,9 +0,0 @@ -module MobileAPIFFI { - header "MobileAPIFFI.h" - export * - use "Darwin" - use "_Builtin_stdbool" - use "_Builtin_stdint" - link framework "CoreFoundation" - link framework "IOKit" -} \ No newline at end of file diff --git a/iosApp/README.md b/iosApp/README.md deleted file mode 100644 index 6943edb..0000000 --- a/iosApp/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# ChessPenguin для iPhone - -Первый вертикальный срез нативного приложения: SwiftUI, iOS 16+, только iPhone и портретная ориентация. Интерфейс повторяет основной путь Android: **Базы → Партии → Партия**. - -Что работает: - -- встроенная, неизменённая `examples/classics.pgn` открывается общим Rust `mobile-api` через UniFFI (`open_bytes` → `rows` → `game`); -- список партий со страницами по 100 записей, сведения об игроках/результате/ECO и VoiceOver для всей строки; -- доска по FEN каждого узла, последний ход, стрелки/круги из комментариев, NAG-badge и индикация мата/пата; -- основная нотация, комментарии и полное дерево вариантов с кликабельными `MoveNode.id`, включая вложенные RAV; -- предыдущий/следующий ход; долгое нажатие — в начало/конец активной линии; -- аппаратные ←/→, Shift+←/→, F и Escape; -- переход к соседней партии и переворот доски Green; -- английский и русский `Localizable.strings` + правила множественного числа. - -Намеренно вне первого среза: импорт пользовательских файлов, поиск, настройки, iPad, landscape, редактор, игра, движок и Stockfish. - -## Требования - -Для приложения и XCFramework нужны **macOS, Xcode 15 или новее с iOS SDK**, Xcode Command Line Tools, Rust 1.97+ через `rustup`, Cargo и [XcodeGen](https://github.com/yonaskolb/XcodeGen) 2.x: - -```sh -brew install xcodegen -``` - -Никаких Swift Package/CocoaPods-зависимостей и отдельно скачиваемых движков нет. Rust-зависимости фиксируются общим `Cargo.lock` (`--locked`). Файл `project.yml` — исходник проекта; `.xcodeproj` генерируется и не хранится в репозитории. - -## Сборка на macOS - -Из каталога `iosApp`: - -```sh -./scripts/build-bindings.sh -xcodegen generate -open ChessPenguin.xcodeproj -``` - -Затем выбрать схему **ChessPenguin** и iPhone Simulator с iOS 16+ (Cmd+R). Скрипт: - -1. собирает host-библиотеку `mobile-api` и генерирует `Generated/MobileAPI/MobileAPI.swift`, C header и module map существующим `uniffi-bindgen`; -2. добавляет Rust targets и выполняет `cargo check` для `aarch64-apple-ios`, `aarch64-apple-ios-sim`, `x86_64-apple-ios`; -3. выпускает staticlib для устройства и обоих вариантов симулятора, объединяет симуляторные архивы через `lipo`; -4. создаёт `Frameworks/MobileAPI.xcframework` через `xcodebuild -create-xcframework`. - -Для сокращённой сборки на Apple Silicon можно задать: - -```sh -CP_IOS_TARGETS="aarch64-apple-ios aarch64-apple-ios-sim" ./scripts/build-bindings.sh -``` - -Проверка из командной строки без подписи: - -```sh -xcodebuild -project ChessPenguin.xcodeproj -scheme ChessPenguin \ - -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' \ - CODE_SIGNING_ALLOWED=NO build -``` - -`ChessPenguinTests` содержит XCTest для гонки загрузки, страниц, полного дерева нотации, flip/FEN, marks/NAG/end, keyboard mapping и accessibility. Запуск на конкретном Simulator: - -```sh -xcodebuild test -project ChessPenguin.xcodeproj -scheme ChessPenguin \ - -destination 'platform=iOS Simulator,name=iPhone 16' \ - CODE_SIGNING_ALLOWED=NO -``` - -Имя доступного Simulator подставить из `xcrun simctl list devices`. Эти тесты не запускались на Linux. - -После изменения Rust API повторить `build-bindings.sh`, после изменения `project.yml` — `xcodegen generate`. - -## Linux - -На Linux скрипт **только** собирает host `mobile-api` и проверяет фактическую генерацию Swift UniFFI. Он завершается до Rust iOS targets, `lipo` и `xcodebuild`; XCFramework, iOS-сборка и Simulator на Linux не имитируются. Даже отдельный `cargo check --target aarch64-apple-ios` на Linux останавливается в build script `ring`: cc-rs вызывает Apple `xcrun` и ищет iOS SDK. Для полноценной проверки нужен macOS по командам выше. - -Сгенерированные Swift/header/module map оставлены в `Generated/MobileAPI` для чтения и структурной проверки; их не редактируют вручную. XCFramework не хранится в Git. - -## Ресурсы - -- `ChessPenguin/Resources/classics.pgn` — байтовая копия `examples/classics.pgn`; приложение только читает её. -- `ChessPenguin/Resources/Pieces.xcassets` — PNG-рендеры исходных cburnett SVG из `apps/desktop/assets/pieces/cburnett`; авторство и лицензия — `Resources/THIRD_PARTY_NOTICES.txt` и корневой `THIRD_PARTY_NOTICES.md`. -- Цвета тёмной темы и доски повторяют `androidApp/.../theme/Color.kt` и `data/BoardStyle.kt`. diff --git a/iosApp/project.yml b/iosApp/project.yml deleted file mode 100644 index c7744c1..0000000 --- a/iosApp/project.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: ChessPenguin -options: - deploymentTarget: - iOS: "16.0" -settings: - base: - SWIFT_VERSION: "5.0" - IPHONEOS_DEPLOYMENT_TARGET: "16.0" - ENABLE_BITCODE: NO -targets: - ChessPenguin: - type: application - platform: iOS - sources: - - path: ChessPenguin - - path: Generated/MobileAPI/MobileAPI.swift - dependencies: - - framework: Frameworks/MobileAPI.xcframework - embed: false - settings: - base: - PRODUCT_BUNDLE_IDENTIFIER: io.github.vrubelroman.chesspenguin.ios - PRODUCT_NAME: ChessPenguin - MARKETING_VERSION: 2.5.2 - CURRENT_PROJECT_VERSION: 1 - TARGETED_DEVICE_FAMILY: "1" - GENERATE_INFOPLIST_FILE: YES - INFOPLIST_KEY_UILaunchScreen_Generation: YES - INFOPLIST_KEY_UIUserInterfaceStyle: Dark - INFOPLIST_KEY_UISupportedInterfaceOrientations: UIInterfaceOrientationPortrait - SWIFT_INCLUDE_PATHS: "$(inherited) $(SRCROOT)/Generated/MobileAPI" - scheme: - gatherCoverageData: NO - testTargets: - - ChessPenguinTests - ChessPenguinTests: - type: bundle.unit-test - platform: iOS - sources: - - path: ChessPenguinTests - dependencies: - - target: ChessPenguin - settings: - base: - PRODUCT_BUNDLE_IDENTIFIER: io.github.vrubelroman.chesspenguin.ios.tests - TEST_HOST: "$(BUILT_PRODUCTS_DIR)/ChessPenguin.app/ChessPenguin" - BUNDLE_LOADER: "$(TEST_HOST)" - SWIFT_INCLUDE_PATHS: "$(inherited) $(SRCROOT)/Generated/MobileAPI" diff --git a/iosApp/scripts/build-bindings.sh b/iosApp/scripts/build-bindings.sh deleted file mode 100755 index da885cb..0000000 --- a/iosApp/scripts/build-bindings.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" -IOS="$ROOT/iosApp" -GENERATED="$IOS/Generated/MobileAPI" -TARGET_DIR="${CARGO_TARGET_DIR:-$ROOT/target}" -HOST_OS="$(uname -s)" - -case "$HOST_OS" in - Darwin) HOST_LIB="$TARGET_DIR/debug/libmobile_api.dylib" ;; - Linux) HOST_LIB="$TARGET_DIR/debug/libmobile_api.so" ;; - *) - printf 'Unsupported host for binding generation: %s\n' "$HOST_OS" >&2 - exit 1 - ;; -esac - -mkdir -p "$GENERATED" -cd "$ROOT" - -# UniFFI reads metadata from the host library; no iOS artifact is used for this step. -cargo build --locked -p mobile-api --lib -cargo run -q --locked -p mobile-api --features bindgen --bin uniffi-bindgen -- \ - generate --no-format --language swift \ - --library "$HOST_LIB" --out-dir "$GENERATED" - -# Swift/Clang discovers this fixed name through SWIFT_INCLUDE_PATHS. -cp "$GENERATED/MobileAPIFFI.modulemap" "$GENERATED/module.modulemap" -printf 'Swift UniFFI bindings: %s\n' "$GENERATED" - -if [[ "$HOST_OS" != "Darwin" ]]; then - printf '%s\n' 'Host is not macOS: skipped iOS targets and XCFramework (no iOS build was attempted).' - exit 0 -fi - -for tool in rustup xcrun xcodebuild lipo; do - if ! command -v "$tool" >/dev/null 2>&1; then - printf 'Required tool is missing: %s\n' "$tool" >&2 - exit 1 - fi -done - -# Override for a quicker local build, for example: -# CP_IOS_TARGETS="aarch64-apple-ios aarch64-apple-ios-sim" ./scripts/build-bindings.sh -read -r -a TARGETS <<< "${CP_IOS_TARGETS:-aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios}" -if [[ "${#TARGETS[@]}" -eq 0 ]]; then - printf '%s\n' 'CP_IOS_TARGETS must not be empty' >&2 - exit 1 -fi - -export IPHONEOS_DEPLOYMENT_TARGET="${IPHONEOS_DEPLOYMENT_TARGET:-16.0}" -DEVICE_LIB="" -SIM_LIBS=() -for target in "${TARGETS[@]}"; do - case "$target" in - aarch64-apple-ios|aarch64-apple-ios-sim|x86_64-apple-ios) ;; - *) printf 'Unsupported iOS target: %s\n' "$target" >&2; exit 1 ;; - esac - rustup target add "$target" - cargo check --locked -p mobile-api --target "$target" - # The shared Cargo manifest keeps Android's cdylib. This per-target rustc invocation - # additionally emits the self-contained static archive required by XCFramework. - cargo rustc --locked --release -p mobile-api --lib --target "$target" --crate-type staticlib - library="$TARGET_DIR/$target/release/libmobile_api.a" - if [[ ! -f "$library" ]]; then - printf 'Expected static library was not produced: %s\n' "$library" >&2 - exit 1 - fi - if [[ "$target" == "aarch64-apple-ios" ]]; then - DEVICE_LIB="$library" - else - SIM_LIBS+=("$library") - fi -done - -if [[ -z "$DEVICE_LIB" || "${#SIM_LIBS[@]}" -eq 0 ]]; then - printf '%s\n' 'Need aarch64-apple-ios and at least one simulator target for an XCFramework.' >&2 - exit 1 -fi - -WORK="$TARGET_DIR/ios-xcframework" -HEADERS="$WORK/Headers" -mkdir -p "$HEADERS" "$WORK/simulator" -cp "$GENERATED/MobileAPIFFI.h" "$GENERATED/module.modulemap" "$HEADERS/" -SIM_LIB="$WORK/simulator/libmobile_api.a" -lipo -create "${SIM_LIBS[@]}" -output "$SIM_LIB" - -XCFRAMEWORK="$IOS/Frameworks/MobileAPI.xcframework" -rm -rf "$XCFRAMEWORK" -xcodebuild -create-xcframework \ - -library "$DEVICE_LIB" -headers "$HEADERS" \ - -library "$SIM_LIB" -headers "$HEADERS" \ - -output "$XCFRAMEWORK" -printf 'XCFramework: %s\n' "$XCFRAMEWORK"