Skip to content

Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.

UNO: the official rules to 500, bots at three levels and cards drawn for the calculator

Mason363171544d330e0
diff --git a/.github/workflows/uno.yml b/.github/workflows/uno.yml
deleted file mode 100644
index 32f7a609..00000000
--- a/.github/workflows/uno.yml
+++ /dev/null
@@ -1,53 +0,0 @@
-name: UNO
-
-on:
- pull_request:
- paths:
- - 'games/uno/**'
- - 'games/common/**'
- - 'launcher/src/**'
- - 'games/games.json'
- - 'Makefile'
- - 'tools/emu.py'
- - 'tools/gen_games.py'
- - 'tools/npmodule.py'
- - '.github/workflows/uno.yml'
- workflow_dispatch:
-
-permissions:
- contents: read
-
-jobs:
- game:
- runs-on: ubuntu-24.04
- steps:
- - uses: actions/checkout@v4
- - name: ARM toolchain
- run: |
- v=15.2.1-1.1
- curl -fsSL "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v$v/xpack-arm-none-eabi-gcc-$v-linux-x64.tar.gz" | tar -xz -C "$RUNNER_TEMP"
- echo "$RUNNER_TEMP/xpack-arm-none-eabi-gcc-$v/bin" >> "$GITHUB_PATH"
- - uses: actions/setup-node@v4
- with:
- node-version: 20
- - uses: actions/setup-python@v5
- with:
- python-version: '3.12'
- - name: Tools
- run: |
- npm install -g [email protected]
- pip install pillow==11.3.0 numpy pyelftools unicorn==2.1.4
- - name: Standalone and NumPlay module builds
- run: make build/data/apps/UNO.nwa build/data/modules/uno.o NWLINK=nwlink
- - name: Card rules, single-game wins and save migration
- run: make -C games/uno test HOST_CC=gcc
- - name: ARM controls and firmware memory guards
- run: python3 games/uno/tests/test_arm.py --nwlink nwlink
- - name: NumPlay launcher, shared saves and reinstall backup
- run: python3 games/uno/tests/test_integration.py --nwlink nwlink
- - name: Repository save-and-exit scenario
- run: python3 tests/test_games.py build/data/apps --game uno
- - uses: actions/upload-artifact@v4
- with:
- name: UNO
- path: build/data/apps/UNO.nwa
diff --git a/games/uno/.gitignore b/games/uno/.gitignore
index fd6aad7f..342d9dda 100644
--- a/games/uno/.gitignore
+++ b/games/uno/.gitignore
@@ -1,2 +1,2 @@
output/
-__pycache__/
+build/
diff --git a/games/uno/ASSETS.md b/games/uno/ASSETS.md
deleted file mode 100644
index 35d130e2..00000000
--- a/games/uno/ASSETS.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Asset provenance
-
-Card faces, card back and green table originate from **AlexDer**,
-[UNO Card Game Asset Pack](https://alexder.itch.io/uno-card-game-asset-pack).
-The user supplied `Uno Game Assets (1).zip`; its SHA-256 is:
-
-```
-873e5243b3bc15140313becdbfb33c2afc7ed858e49c6f67a6ef5f9706ad9837
-```
-
-The author's public replies on that page permit use in projects without limits,
-including an MIT-licensed open-source game, and appreciate attribution. The pack
-does not contain a separate license text. Its font-license comments distinguish
-the original Comic Kings font from the assets: this project includes no font
-file from the pack and draws its interface with NumPlay's existing native fonts.
-Do not describe the pack as authored by this project or as MIT-licensed code.
-
-`tools/assets.py` reads only named PNG entries from the supplied ZIP and generates:
-
-- All 52 colored faces, Wild, Wild +4 and the card back at 44 × 64 pixels,
- with a shared 31-color RGB565 palette and transparent row-RLE encoding.
-- A 32 × 24 RGB565 sample of `Table_2.png`, smoothly scaled when drawn.
-- A 55 × 56 app icon composed from the supplied card art.
-
-No PDFs, Photoshop files, original-resolution textures, audio or additional
-typefaces are included in the game. The pack's “ASSET PACK” banner is not used as
-a game logo. The table and cards are the actual supplied artwork, adapted to the
-calculator's display and color format.
-
-To reproduce the generated files with Pillow:
-
-```sh
-python3 tools/assets.py '/path/to/Uno Game Assets (1).zip'
-```
-
-The generated size/provenance report is `tools/assets.json`. UNO belongs to
-Mattel; this is an unofficial fan adaptation without Mattel affiliation.
diff --git a/games/uno/Makefile b/games/uno/Makefile
index 668b026d..1bb3def9 100644
--- a/games/uno/Makefile
+++ b/games/uno/Makefile
@@ -1,20 +1,56 @@
-PYTHON ?= python3
-HOST_CC ?= cc
-NWLINK ?= nwlink
-TOOLCHAIN ?=
-.PHONY: build check module sim-module test test-arm test-integration clean
-build check module:
- $(PYTHON) tools/build.py --nwlink "$(NWLINK)" $(if $(TOOLCHAIN),--toolchain "$(TOOLCHAIN)")
-test:
- $(PYTHON) tools/test.py --cc "$(HOST_CC)"
-test-arm: build test
- $(PYTHON) tests/test_arm.py --nwlink "$(NWLINK)"
-test-integration: module
- $(PYTHON) tests/test_integration.py --nwlink "$(NWLINK)"
-sim-module:
- mkdir -p output/sim
- $(HOST_CC) -std=c11 -O2 -fPIC $(shell $(NWLINK) eadk-cflags-simulator) -DNP_MODULE=1 -Dmain=np_uno_main -c src/main.c -o output/sim/main.o
- $(HOST_CC) -std=c11 -O2 -fPIC -c src/uno.c -o output/sim/uno.o
- $(HOST_CC) -r -nostdlib output/sim/main.o output/sim/uno.o -o output/sim-module.o
+# UNO on the NumWorks calculator.
+# make output/uno.nwa
+# make check link it like the calculator does (output/uno.bin)
+# make host build/play: the game on a computer, for tests and pictures
+# make test the rules against the instruction sheet, bots playing whole games to 500, random keys, saves
+# (with the sanitizers)
+Q ?= @
+CC = arm-none-eabi-gcc
+NWLINK ?= npx --yes -- [email protected]
+BUILD_DIR = output
+L = ../../launcher/src
+
+SRC = src/main.c src/game.c src/bot.c src/draw.c src/save.c src/plat_eadk.c $(L)/gfx.c $(L)/font_data.c $(L)/xfont.c
+HEADERS = $(wildcard src/*.h) $(L)/gfx.h $(L)/font.h $(L)/np.h ../common/epsilon_app.h ../common/epsilon_files.h
+
+CFLAGS = -std=gnu11 $(shell $(NWLINK) eadk-cflags-device) -DPLATFORM_DEVICE=1 -DEPSILON_XL=1 -I$(L)
+CFLAGS += -Os -Wall -Wextra -Wno-unused-parameter -fno-math-errno -fsingle-precision-constant
+CFLAGS += -fno-tree-loop-distribute-patterns -flto -fno-fat-lto-objects -fwhole-program -fvisibility=internal
+CFLAGS += -ffunction-sections -fdata-sections
+LDFLAGS = -Wl,--relocatable -nostartfiles --specs=nano.specs
+LDFLAGS += -Wl,-e,main -Wl,-u,eadk_app_name -Wl,-u,eadk_app_icon -Wl,-u,eadk_api_level
+LDFLAGS += -Wl,--gc-sections -flinker-output=nolto-rel
+
+.PHONY: build check clean host test
+build: $(BUILD_DIR)/uno.nwa
+
+# apps get 133652 bytes of RAM on custom builds of Epsilon 25.2 (148928 or more on official ones)
+check: $(BUILD_DIR)/uno.nwa
+ $(Q) $(NWLINK) nwa-bin --ram-length 133652 $< $(BUILD_DIR)/uno.bin
+ @echo "BIN $(BUILD_DIR)/uno.bin: $$(wc -c < $(BUILD_DIR)/uno.bin) bytes"
+
+$(BUILD_DIR)/uno.nwa: $(SRC) $(HEADERS) $(BUILD_DIR)/icon.o
+ @echo "LD $@"
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(SRC) $(BUILD_DIR)/icon.o -lm -o $@
+ $(Q) arm-none-eabi-strip --strip-unneeded $@
+
+$(BUILD_DIR)/icon.o: src/icon.png | $(BUILD_DIR)
+ @echo "ICON $<"
+ $(Q) $(NWLINK) png-icon-o $< $@
+
+$(BUILD_DIR):
+ $(Q) mkdir -p $@
+
+# on a computer: tests/play.c checks the rules, plays whole games with the bots and random keys, and saves pictures
+HOST_SRC = tests/play.c src/game.c src/bot.c src/draw.c src/save.c $(L)/gfx.c $(L)/font_data.c $(L)/xfont.c
+HOST_FLAGS = -std=gnu11 -O2 -g -Wall -Wextra -Wno-unused-parameter -ffp-contract=off -Isrc -I$(L) -DHOST
+host: build/play
+build/play: $(HOST_SRC) src/main.c $(wildcard src/*.h)
+ $(Q) mkdir -p build
+ $(Q) cc $(HOST_FLAGS) -fsanitize=address,undefined -fno-sanitize-recover=undefined $(HOST_SRC) -lm -o $@
+ @echo "HOST $@"
+test: build/play
+ build/play test build
+
clean:
- $(PYTHON) -c "import shutil; shutil.rmtree('output', ignore_errors=True)"
+ $(Q) rm -rf $(BUILD_DIR) build
diff --git a/games/uno/VALIDATION.md b/games/uno/VALIDATION.md
deleted file mode 100644
index 41ea5133..00000000
--- a/games/uno/VALIDATION.md
+++ /dev/null
@@ -1,126 +0,0 @@
-# UNO validation
-
-Validated locally on 23 October 2026. These are automated host and ARM-emulator
-results, **not physical-calculator test results**.
-
-## Build and memory
-
-ARM GCC 15.2.1, `-Os`/LTO, nwlink 1.0.0. Release and debug NWAs produce identical
-installed bytes for every tested profile. The standalone game and a launcher
-module both compile. The catalogue, standalone export, credits and build tests
-add UNO only; the other games are unchanged.
-
-| Measurement | Bytes |
-| --- | ---: |
-| Distributable `UNO.nwa` | 129,120 |
-| Installed code, metadata and art | 103,624 |
-| Static RAM, including LCD strip | 11,208 |
-| Maximum stack observed during ARM scenarios | 1,040 |
-| Save record payload | 768 |
-| All 55 card sprites, palette and offsets | 60,895 |
-| Table texture | 1,536 |
-
-Installed size comes from nwlink's actual calculator link, not ELF file size.
-Static RAM is `_heap_start - _data_section_start_ram` in the installed ELF.
-The observed stack maximum is a scenario measurement, not a mathematical bound.
-No game code allocates heap memory.
-
-| ARM profile | Available application RAM | Result |
-| --- | ---: | --- |
-| N0120, Epsilon | 153,676 | Passed |
-| N0110, Epsilon | 148,928 | Passed |
-| N0115 RAM profile, Epsilon | 133,652 | Passed |
-| N0110/N0115, Upsilon | 107,674 | Passed |
-
-The N0115 test uses the older-model CPU/memory layout with its configured RAM
-limit; it is not an independently emulated physical N0115 board. Emulator work
-estimates average approximately 14 ms per redraw on the N0120 profile and 36 ms
-on the older profiles. These are not measured display refresh rates on hardware.
-The app only redraws when its visible state changes.
-
-## Rules engine
-
-`tools/test.py` builds and runs the C tests with the host compiler. Tests cover:
-
-- Color, number and action matching; legal Wilds and bluffable +4 cards.
-- Two-player Reverse/Skip and multiplayer direction changes.
-- One-card draws, voluntary draws, keeping a drawn card, and forbidding play of
- a different hand card after drawing.
-- Legal and illegal +4 challenges, offender/target penalties and skipped turns.
-- Direct victory on an empty hand for humans and bots, including when an
- opponent holds only a zero card; last-card +2/+4 resolution before victory.
-- UNO pre-call, late self-call, catching, immunity after the next action and
- automatic UNO.
-- Same-kind penalty stacking, no mixing, no challenge for stacked +4, and no
- stacking after going out; draw-until-playable and forced drawn play.
-- Exhausted-pile recycling while preserving the top discard and every card.
-- 12,000 initial deals checking opening actions and deck composition.
-- **1,152 complete single games**, spanning all 32 house-rule combinations,
- 2/3/4 players, all three bot difficulties and four seeds per combination.
- The final run used 83,450 actions, with no blocked-table redeals. Every step
- checked the exact 108-card multiset; the largest simulated hand had 39 cards.
-- Save round trips, truncated/invalid saves, semantic state rejection and every
- individual bit flip across the entire 768-byte save, without modifying the
- live state when a save is invalid.
-- A real version-1 save with a 500-point target and accumulated totals migrates
- to version 2 with the cards intact and former totals/targets zeroed. A won v1
- round migrates to a finished game. Point fields and calculations are removed
- from the live rules engine; the reserved wire slots preserve compatibility.
-
-## UI and calculator execution
-
-The host tests validate every RLE row's bounds, real-font help wrapping, large
-hands and scrolling, and render screenshots of the menus, table, settings,
-variants, instructions, color selection, challenge, evidence, table rules and result.
-
-The visual table setup has separate Players, Rules and Ready steps, with visible
-seats, five on-screen switches and a final summary. Host tests navigate each
-step, every switch, the classic reset and returning to earlier steps, verifying
-that editing preferences does not mutate an existing match. Text-width checks
-cover switch labels, descriptions, card names, action shortcuts and the gap
-between the pile labels and active-color label. Table screenshots cover two,
-three and four players, bot turns and a large hand. Browsing during bot turns
-and skipping unavailable action buttons are exercised too.
-
-`tests/test_arm.py` runs the **actual ARM application**, including Epsilon/Upsilon
-system calls. Each profile exercises menu navigation, bot turns, the real key
-mapping, pausing, all help pages, table rules, save-to-menu, new-game replacement
-cancellation, continue, Home/Power exits and reload.
-The setup scenarios select player counts, enable +2/+4 stacking, restore classic
-rules, review the table and return through all setup steps after canceling a
-replacement. Setup contains no point target; the HUD, pause menu, help and
-result screen contain no scores. Play-again uses the completed game's rules,
-even when the saved preferences for a future game differ.
-
-Additional engine-validated saved positions exercise actual keys for playing,
-calling UNO, drawing, rejecting an old hand card after drawing, keeping the new
-card, choosing a Wild color, winning and both legal/illegal +4 challenges with
-the hand-reveal screen. A completed game records its win once across reloads.
-Actual key tests also verify Play again and migration of the real v1 save with
-its old totals removed and cards preserved.
-
-Root Make targets `build/data/apps/UNO.nwa` and `build/data/modules/uno.o`
-pass, including a parallel request for both outputs. The module occupies
-81,776 bytes of code/read-only data, 4 bytes of initialized data and 11,188 bytes
-of BSS in the launcher's shared arena. Root standalone output matches the
-game's release byte for byte.
-
-`tests/test_integration.py` builds the real current launcher with a deliberately
-UNO-only test catalogue, using the production catalogue entry and generators.
-On N0120/Epsilon and N0110/Upsilon, real keys launch UNO, navigate its three-step
-setup, play, save, return to the carousel and re-enter the game. Home exits the
-launcher cleanly. The shared `numplay_saves.py` contains the game record;
-retaining only Python scripts simulates reinstalling and restores that record
-exactly. The maximum observed stack in this launcher scenario is 1,064 bytes.
-This focused test is not a complete build or playthrough of all existing games.
-The tests also cover a held launch key, a corrupt save and full storage with
-retry and explicit exit without saving. An unrelated Python record is preserved.
-
-Memory guards report no invalid accesses, firmware RAM changes or unintended
-flash writes in these scenarios. Exit releases the Home lock where supported
-and clears application RAM before returning to firmware. Upsilon makes none of
-the Epsilon-only system calls.
-
-Reports are reproducible in `output/sizes.json` and `output/arm/report.json`.
-The screenshots in `docs/` are generated from these tests. Hardware testing is
-still needed to confirm firmware-version-specific installation and LCD timing.
diff --git a/games/uno/src/assets.h b/games/uno/src/assets.h
deleted file mode 100644
index b2184d43..00000000
--- a/games/uno/src/assets.h
+++ /dev/null
@@ -1,2579 +0,0 @@
-/* Generated by tools/assets.py. AlexDer card art, see ASSETS.md. */
-#define CARD_W 44
-#define CARD_H 64
-static const uint16_t card_palette[] = {
- 65535,65535,65535,65467,65535,61374,65196,65093,65124,65092,65092,65092,65059,56920,30196,19828,13513,13513,5371,1243,11467,60140,45608,1179,
- 9353,59783,59783,59783,59751,59686,8322,
-};
-static const uint16_t card_offsets[] = {
- 0,1206,2361,3522,4675,5828,6985,8119,9255,10447,11595,12859,14140,15386,16518,17606,18694,19791,20884,21984,23059,24137,25278,26362,
- 27549,28754,29924,30992,32028,33083,34126,35185,36241,37261,38276,39350,40382,41556,42722,43866,44924,45957,47006,48048,49108,50168,51189,52210,
- 53278,54312,55466,56627,57766,58850,59787,60721,
-};
-static const uint8_t card_pixels[] = {
- 7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,
- 36,31,9,68,13,245,245,245,245,117,13,68,10,68,21,125,58,253,253,253,189,21,68,18,
- 68,21,29,26,13,3,36,3,21,28,27,250,250,250,26,29,21,68,14,68,21,28,13,164,
- 13,28,251,251,251,26,29,21,68,18,68,21,13,36,3,21,13,68,21,29,26,251,251,187,
- 26,29,21,68,18,68,21,3,4,3,26,61,13,36,13,29,251,251,219,26,29,21,68,18,
- 68,21,3,4,3,26,61,13,36,3,28,251,251,219,26,29,21,68,18,68,21,13,36,3,
- 21,13,68,13,29,26,251,251,187,26,29,21,68,18,68,53,228,21,29,26,91,90,27,60,
- 27,90,251,27,26,29,21,68,25,68,21,29,21,3,100,3,21,29,26,59,26,27,125,27,
- 26,28,93,28,58,187,26,29,21,68,26,68,21,61,26,117,27,29,26,27,26,28,29,28,
- 53,45,67,45,21,26,61,26,155,26,29,21,68,26,68,21,29,26,28,125,27,58,28,29,
- 26,21,3,228,36,5,13,21,29,27,26,91,26,29,21,68,23,68,21,29,26,27,122,27,
- 26,29,27,21,3,228,196,13,28,29,26,59,26,29,21,68,21,68,21,29,26,155,26,29,
- 21,3,228,228,36,13,26,29,26,27,26,29,21,68,18,68,21,29,26,123,26,29,21,228,
- 228,132,3,26,29,58,29,21,68,18,68,21,29,26,91,26,29,13,228,228,196,3,26,28,
- 26,29,21,68,18,68,21,29,26,59,26,29,13,228,228,228,4,13,29,26,29,21,68,16,
- 68,21,29,26,27,26,29,21,228,228,228,68,21,61,21,68,18,68,21,29,58,29,21,228,
- 68,3,45,3,228,132,13,28,29,21,68,23,68,21,29,26,28,27,3,228,13,21,26,28,
- 61,28,26,21,13,228,68,21,29,21,68,22,68,21,29,26,29,13,196,13,26,61,28,123,
- 28,61,26,13,228,4,13,29,21,68,18,68,21,29,28,26,196,21,61,58,187,58,61,21,
- 228,3,28,21,68,17,68,21,61,13,164,21,29,58,59,154,91,58,29,21,228,53,68,19,
- 68,21,29,26,5,132,13,29,26,123,157,26,123,26,29,13,196,53,68,22,68,21,29,21,
- 164,21,29,26,59,60,21,77,21,29,26,91,26,29,21,196,53,68,23,68,21,29,13,132,
- 13,29,26,91,28,13,132,21,29,26,91,26,29,13,164,13,21,68,23,68,21,27,3,132,
- 13,29,26,27,26,29,21,196,26,28,91,26,29,13,164,13,21,68,22,68,53,164,21,29,
- 26,27,26,29,13,196,21,29,26,59,26,29,21,164,13,21,68,20,68,53,164,21,29,26,
- 27,26,29,21,196,26,29,91,26,29,21,164,53,68,21,68,53,164,21,29,26,59,28,26,
- 3,132,21,29,26,91,26,29,21,164,53,68,22,68,21,13,164,13,29,26,91,29,26,13,
- 35,13,21,29,155,26,29,13,164,53,68,23,68,21,13,196,21,29,26,91,28,29,28,27,
- 61,26,123,26,29,21,164,3,27,21,68,21,68,21,13,196,13,29,26,123,26,27,28,58,
- 155,26,29,13,164,13,29,21,68,16,68,53,228,21,29,58,251,59,58,29,21,196,21,29,
- 21,68,19,68,53,228,4,21,29,28,58,187,58,28,29,21,196,5,26,29,21,68,20,68,
- 53,228,36,13,26,61,28,27,58,27,28,61,26,13,228,13,61,21,68,20,68,21,28,3,
- 228,68,13,21,26,125,26,21,13,228,36,26,28,29,21,68,17,68,21,29,13,228,132,35,
- 77,3,228,68,13,29,26,29,21,68,15,68,21,29,21,228,228,228,132,3,27,28,26,29,
- 21,68,15,68,21,29,28,13,228,228,228,100,21,29,58,29,21,68,16,68,21,61,21,228,
- 228,228,68,21,29,26,27,26,29,21,68,18,68,21,29,26,29,13,228,228,228,4,13,29,
- 26,59,26,29,21,68,18,68,21,29,26,28,26,3,228,228,196,13,29,26,91,26,29,21,
- 68,18,68,21,29,58,29,26,3,228,228,132,21,29,26,123,26,29,21,68,21,68,21,29,
- 26,27,26,29,26,13,228,228,36,3,21,29,154,27,26,29,21,68,22,68,21,29,26,59,
- 26,29,28,13,228,196,3,21,27,29,26,28,157,26,29,21,68,28,68,21,29,26,91,26,
- 28,29,21,13,5,228,36,3,21,26,29,28,26,29,26,21,45,21,26,61,21,68,25,68,
- 21,29,26,155,26,61,26,21,45,67,45,53,28,29,28,58,29,21,3,132,21,29,21,68,
- 21,68,21,29,26,187,58,28,93,28,26,27,125,27,26,27,26,29,21,228,53,68,23,68,
- 21,29,26,251,27,90,27,60,27,90,91,26,29,13,68,13,21,13,36,13,21,68,17,68,
- 21,29,26,251,251,219,28,3,36,13,93,3,4,3,21,68,20,68,21,29,26,251,251,187,
- 26,29,13,36,13,27,29,26,3,4,3,21,68,17,68,21,29,26,251,251,187,26,29,21,
- 68,3,13,3,36,53,68,14,68,21,29,26,251,251,251,29,13,164,13,29,21,68,18,68,
- 21,29,26,251,251,251,27,29,21,13,35,13,21,28,29,21,68,14,68,21,29,250,250,250,
- 90,61,58,61,26,29,21,68,9,68,21,253,253,253,253,125,21,68,9,68,13,245,245,245,
- 245,117,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,
- 228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,
- 31,228,228,228,228,228,36,31,9,68,13,245,245,245,245,117,13,68,13,68,21,93,26,21,
- 13,28,253,253,253,157,21,68,15,68,21,29,21,13,68,26,28,250,250,250,90,29,21,68,
- 16,68,21,29,13,100,21,29,26,251,251,251,27,26,29,21,68,16,68,21,29,21,100,21,
- 29,26,251,251,251,27,26,29,21,68,18,68,21,29,26,21,3,36,21,29,26,251,251,251,
- 27,26,29,21,68,17,68,21,29,28,26,68,13,29,26,251,251,251,27,26,29,21,68,16,
- 68,21,61,21,68,13,29,26,251,251,251,27,26,29,21,68,20,68,21,61,21,68,13,29,
- 26,187,90,27,60,27,90,251,27,26,29,21,68,23,68,21,61,21,68,3,26,28,123,26,
- 27,125,27,26,28,93,28,58,187,26,29,21,68,26,68,21,29,28,26,117,26,28,59,26,
- 28,29,28,53,45,67,45,21,26,61,26,155,26,29,21,68,27,68,21,29,26,28,125,28,
- 27,26,28,29,26,21,3,228,36,5,13,21,29,27,26,91,26,29,21,68,23,68,21,29,
- 26,27,122,27,26,29,27,21,3,228,196,13,28,29,26,59,26,29,21,68,21,68,21,29,
- 26,155,26,29,21,3,228,228,36,13,26,29,26,27,26,29,21,68,18,68,21,29,26,123,
- 26,29,21,228,228,132,3,26,29,58,29,21,68,18,68,21,29,26,91,26,29,13,228,228,
- 196,3,26,28,26,29,21,68,18,68,21,29,26,59,26,29,13,228,228,228,4,13,29,26,
- 29,21,68,18,68,21,29,26,27,26,29,21,228,132,3,45,228,68,21,61,21,68,21,68,
- 21,29,58,29,21,228,68,3,13,21,26,29,26,228,68,13,28,29,21,68,23,68,21,29,
- 26,28,27,3,228,3,13,21,26,61,28,27,26,3,228,68,21,29,21,68,21,68,21,29,
- 26,29,13,196,3,21,93,28,58,59,28,3,228,68,13,29,21,68,20,68,21,29,28,26,
- 228,4,21,29,58,123,26,29,13,228,68,3,28,21,68,17,68,21,61,13,228,4,21,29,
- 26,155,26,29,13,228,100,53,68,18,68,21,29,26,5,228,4,13,29,58,123,26,29,13,
- 228,100,53,68,17,68,21,29,21,228,36,3,28,61,123,26,29,21,228,100,53,68,19,68,
- 21,29,13,228,68,53,13,26,28,59,26,29,21,228,100,13,21,68,19,68,21,27,3,228,
- 68,3,4,3,29,91,26,29,21,228,100,13,21,68,15,68,53,228,164,13,29,26,91,28,
- 26,228,100,13,21,68,15,68,53,228,164,13,29,26,91,28,26,3,228,68,53,68,15,68,
- 53,228,164,21,29,26,91,26,29,13,228,68,53,68,16,68,21,13,228,164,21,29,26,91,
- 26,29,13,228,68,53,68,18,68,21,13,228,164,21,29,26,91,26,29,13,228,36,3,27,
- 21,68,17,68,21,13,228,164,26,29,123,26,29,21,228,36,13,29,21,68,17,68,53,228,
- 132,3,26,28,123,26,29,21,228,36,21,29,21,68,18,68,53,228,132,3,27,90,59,26,
- 29,21,228,4,5,26,29,21,68,15,68,53,228,132,13,157,60,29,26,228,4,13,61,21,
- 68,16,68,21,28,3,228,100,13,117,154,3,228,26,28,29,21,68,15,68,21,29,13,228,
- 228,100,35,228,13,29,26,29,21,68,15,68,21,29,21,228,228,228,132,3,27,28,26,29,
- 21,68,15,68,21,29,28,13,228,228,228,100,21,29,58,29,21,68,16,68,21,61,21,228,
- 228,228,68,21,29,26,27,26,29,21,68,18,68,21,29,26,29,13,228,228,228,4,13,29,
- 26,59,26,29,21,68,18,68,21,29,26,28,26,3,228,228,196,13,29,26,91,26,29,21,
- 68,18,68,21,29,58,29,26,3,228,228,132,21,29,26,123,26,29,21,68,21,68,21,29,
- 26,27,26,29,26,13,228,228,36,3,21,29,154,27,26,29,21,68,22,68,21,29,26,59,
- 26,29,28,13,228,196,3,21,27,29,26,157,27,26,29,21,68,28,68,21,29,26,91,26,
- 28,29,21,13,5,228,36,3,21,26,29,28,26,29,21,13,85,29,26,29,21,68,28,68,
- 21,29,26,155,26,61,26,21,45,67,45,53,28,29,28,26,27,26,29,13,68,13,29,26,
- 29,21,68,25,68,21,29,26,187,58,28,93,28,26,27,125,27,26,91,26,29,13,68,21,
- 29,26,29,21,68,22,68,21,29,26,251,27,90,27,60,27,90,155,26,29,21,68,21,29,
- 26,29,21,68,17,68,21,29,26,251,251,251,26,29,21,68,21,29,26,29,21,68,16,68,
- 21,29,26,251,251,251,26,29,21,68,53,28,29,21,68,15,68,21,29,26,251,251,251,27,
- 28,26,100,13,61,21,68,16,68,21,29,26,251,251,251,27,28,26,3,68,3,61,21,68,
- 18,68,21,29,26,251,251,251,59,29,3,4,3,13,21,27,29,21,68,15,68,21,29,250,
- 250,250,90,28,53,26,61,26,29,21,68,9,68,21,253,253,253,253,125,21,68,9,68,13,
- 245,245,245,245,117,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,
- 31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,
- 36,31,8,31,228,228,228,228,228,36,31,9,68,13,245,245,245,245,117,13,68,14,68,21,
- 29,26,35,13,21,26,253,253,253,157,21,68,15,68,21,29,21,100,3,21,29,250,250,250,
- 58,29,21,68,16,68,21,29,21,35,68,13,29,26,251,251,251,26,29,21,68,17,68,21,
- 29,26,53,3,36,3,28,251,251,251,27,26,29,21,68,15,68,21,29,13,132,13,29,26,
- 251,251,251,26,29,21,68,16,68,53,68,3,13,21,26,28,251,251,251,27,26,29,21,68,
- 17,68,21,13,68,13,21,13,21,29,251,251,251,27,26,29,21,68,19,68,21,13,164,21,
- 29,26,155,90,27,60,27,90,251,27,26,29,21,68,22,68,21,13,164,13,29,26,91,26,
- 27,125,27,26,28,93,28,58,187,26,29,21,68,26,68,53,77,35,4,3,26,28,27,26,
- 28,29,28,53,45,67,45,21,26,61,26,155,26,29,21,68,25,68,21,125,28,58,21,58,
- 27,29,26,21,3,228,36,5,13,21,29,27,26,91,26,29,21,68,23,68,21,29,90,27,
- 28,61,26,29,27,21,3,228,196,13,28,29,26,59,26,29,21,68,21,68,21,29,26,123,
- 58,29,21,3,228,228,36,13,26,29,26,27,26,29,21,68,18,68,21,29,26,123,26,29,
- 21,228,228,132,3,26,29,58,29,21,68,18,68,21,29,26,91,26,29,13,228,228,196,3,
- 26,28,26,29,21,68,19,68,21,29,26,59,26,29,13,164,77,3,228,196,13,29,26,29,
- 21,68,20,68,21,29,26,27,26,29,21,196,21,61,58,21,45,228,100,21,61,21,68,21,
- 68,21,29,58,29,21,228,21,28,26,28,125,21,13,228,36,13,28,29,21,68,23,68,21,
- 29,26,28,27,3,196,3,26,28,91,58,27,61,21,3,228,4,21,29,21,68,20,68,21,
- 29,26,29,13,228,13,29,26,187,58,29,21,228,4,13,29,21,68,21,68,21,29,28,26,
- 228,4,13,29,26,27,58,155,26,29,21,228,3,28,21,68,19,68,21,61,13,228,4,21,
- 29,28,93,28,123,26,29,21,228,4,53,68,18,68,21,29,26,5,228,4,67,77,26,28,
- 123,28,26,228,4,53,68,16,68,21,29,21,228,196,3,26,29,123,28,26,228,4,53,68,
- 20,68,21,29,13,228,36,13,85,26,29,28,123,26,29,21,228,4,13,21,68,18,68,21,
- 27,3,228,4,13,125,28,187,26,29,21,228,4,13,21,68,19,68,53,228,4,3,26,28,
- 90,91,58,28,61,21,3,228,4,13,21,68,17,68,53,228,4,13,29,26,155,28,61,26,
- 53,3,228,36,53,68,17,68,53,228,4,21,29,26,123,28,26,21,13,3,228,132,53,68,
- 18,68,21,13,228,4,26,28,123,28,26,3,36,35,45,228,36,53,68,21,68,21,13,228,
- 3,27,28,123,28,26,21,90,28,29,21,228,4,3,27,21,68,18,68,21,13,228,13,29,
- 187,28,61,60,59,26,3,228,13,29,21,68,17,68,53,228,13,29,26,187,26,123,26,29,
- 13,228,21,29,21,68,17,68,53,228,13,29,26,251,91,26,29,13,196,5,26,29,21,68,
- 15,68,53,228,13,29,186,187,26,29,21,196,13,61,21,68,18,68,21,28,3,196,13,253,
- 28,27,122,28,21,196,26,28,29,21,68,18,68,21,29,13,228,77,117,58,28,189,3,132,
- 13,29,26,29,21,68,18,68,21,29,21,228,228,35,77,85,13,100,3,27,28,26,29,21,
- 68,15,68,21,29,28,13,228,228,228,100,21,29,58,29,21,68,16,68,21,61,21,228,228,
- 228,68,21,29,26,27,26,29,21,68,18,68,21,29,26,29,13,228,228,228,4,13,29,26,
- 59,26,29,21,68,18,68,21,29,26,28,26,3,228,228,196,13,29,26,91,26,29,21,68,
- 18,68,21,29,58,29,26,3,228,228,132,21,29,58,91,26,29,21,68,21,68,21,29,26,
- 27,26,29,26,13,228,228,36,3,21,93,60,27,58,29,21,68,20,68,21,29,26,59,26,
- 29,28,13,228,196,3,21,27,29,85,58,125,21,68,26,68,21,29,26,91,26,28,29,21,
- 13,5,228,36,3,21,26,29,26,29,13,68,3,77,29,21,68,23,68,21,29,26,155,26,
- 61,26,21,45,67,45,53,28,29,28,58,29,21,196,28,21,68,23,68,21,29,26,187,58,
- 28,93,28,26,27,125,27,26,59,26,29,21,164,3,29,21,68,20,68,21,29,26,251,27,
- 90,27,60,27,90,155,28,26,85,68,13,29,21,68,15,68,21,29,26,251,251,251,28,26,
- 45,100,13,29,21,68,17,68,21,29,26,251,251,219,26,29,21,100,3,13,26,29,21,68,
- 17,68,21,29,26,251,251,219,26,29,13,68,53,26,28,29,21,68,15,68,21,29,26,251,
- 251,219,26,29,21,132,13,61,21,68,15,68,21,29,26,251,251,251,28,26,13,100,21,61,
- 21,68,17,68,21,29,250,250,250,58,27,29,21,45,3,21,29,28,21,68,9,68,21,253,
- 253,253,253,125,21,68,9,68,13,245,245,245,245,117,13,68,8,31,228,228,228,228,228,36,
- 31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,
- 164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,13,245,
- 245,245,245,117,13,68,12,68,21,29,26,85,26,253,253,253,189,21,68,15,68,21,29,13,
- 68,5,13,27,250,250,250,90,29,21,68,15,68,21,29,13,132,21,29,26,251,251,251,26,
- 29,21,68,16,68,21,29,77,3,36,21,29,26,251,251,251,26,29,21,68,16,68,21,28,
- 29,21,100,21,29,26,251,251,251,26,29,21,68,15,68,21,61,21,100,21,29,26,251,251,
- 251,26,29,21,68,16,68,21,26,53,13,68,13,29,26,251,251,251,26,29,21,68,19,68,
- 21,26,164,21,29,26,155,90,27,60,27,90,251,27,26,29,21,68,22,68,21,29,3,100,
- 13,28,155,26,27,125,27,26,28,93,28,58,187,26,29,21,68,27,68,21,29,13,3,13,
- 53,29,28,91,26,28,29,28,53,45,67,45,21,26,61,26,155,26,29,21,68,27,68,21,
- 29,26,27,93,26,59,26,28,29,26,21,3,228,36,5,13,21,29,27,26,91,26,29,21,
- 68,22,68,21,29,59,90,59,26,29,27,21,3,228,196,13,28,29,26,59,26,29,21,68,
- 21,68,21,29,26,155,26,29,21,3,228,228,36,13,26,29,26,27,26,29,21,68,18,68,
- 21,29,26,123,26,29,21,228,228,132,3,26,29,58,29,21,68,18,68,21,29,26,91,26,
- 29,13,228,228,196,3,26,28,26,29,21,68,18,68,21,29,26,59,26,29,13,228,228,228,
- 4,13,29,26,29,21,68,16,68,21,29,26,27,26,29,21,228,228,228,68,21,61,21,68,
- 18,68,21,29,58,29,21,196,13,149,45,3,228,100,13,28,29,21,68,18,68,21,29,26,
- 28,27,3,196,21,253,26,13,228,68,21,29,21,68,20,68,21,29,26,29,13,228,21,28,
- 186,27,61,21,3,228,4,13,29,21,68,21,68,21,29,28,26,228,3,26,28,59,58,123,
- 26,29,21,228,4,3,28,21,68,17,68,21,61,13,228,3,58,28,93,28,123,28,26,228,
- 36,53,68,20,68,21,29,26,5,228,13,61,26,85,26,28,91,28,26,3,228,4,53,68,
- 22,68,21,29,21,228,4,13,21,13,3,36,3,21,29,26,91,28,3,228,4,53,68,17,
- 68,21,29,13,228,100,13,58,61,155,26,3,228,4,13,21,68,18,68,21,27,3,228,100,
- 13,29,28,155,26,29,21,228,36,13,21,68,16,68,53,228,132,3,26,28,155,28,21,3,
- 228,36,13,21,68,14,68,53,228,164,21,29,26,155,28,21,228,36,53,68,15,68,53,228,
- 164,21,29,60,123,28,29,3,228,4,53,68,18,68,21,13,228,164,3,45,21,29,26,59,
- 26,29,13,228,4,53,68,17,68,21,13,228,4,3,213,26,28,123,29,13,228,3,27,21,
- 68,17,68,21,13,228,4,3,27,189,28,155,26,3,228,13,29,21,68,17,68,53,228,36,
- 21,29,122,155,26,29,21,228,4,21,29,21,68,18,68,53,228,36,21,29,26,187,58,29,
- 26,3,228,5,26,29,21,68,19,68,53,228,36,21,29,26,59,90,28,61,21,3,228,4,
- 13,61,21,68,21,68,21,28,3,228,4,13,29,26,28,125,26,21,13,228,68,26,28,29,
- 21,68,20,68,21,29,13,228,4,13,61,58,53,13,3,228,100,13,29,26,29,21,68,17,
- 68,21,29,21,228,36,45,3,228,228,3,27,28,26,29,21,68,15,68,21,29,28,13,228,
- 228,228,100,21,29,58,29,21,68,16,68,21,61,21,228,228,228,68,21,29,26,27,26,29,
- 21,68,18,68,21,29,26,29,13,228,228,228,4,13,29,26,59,26,29,21,68,18,68,21,
- 29,26,28,26,3,228,228,196,13,29,26,91,26,29,21,68,18,68,21,29,58,29,26,3,
- 228,228,132,21,29,26,123,26,29,21,68,23,68,21,29,26,27,26,29,26,13,228,228,36,
- 3,21,29,90,27,28,29,26,29,21,68,21,68,21,29,26,59,26,29,28,13,228,196,3,
- 21,27,29,58,93,90,29,21,68,28,68,21,29,26,91,26,28,29,21,13,5,228,36,3,
- 21,26,29,28,26,28,29,21,45,35,26,29,21,68,25,68,21,29,26,155,26,61,26,21,
- 45,67,45,53,28,29,28,26,59,29,13,132,21,29,21,68,23,68,21,29,26,187,58,28,
- 93,28,26,27,125,27,26,59,26,29,21,164,21,29,21,68,22,68,21,29,26,251,27,90,
- 27,60,27,90,123,26,29,21,68,13,53,26,29,21,68,17,68,21,29,26,251,251,251,28,
- 26,3,68,21,29,27,29,21,68,17,68,21,29,26,251,251,251,29,26,3,68,13,29,26,
- 29,21,68,16,68,21,29,26,251,251,219,26,29,21,68,77,26,29,21,68,15,68,21,29,
- 26,251,251,251,28,26,132,3,26,29,21,68,16,68,21,29,26,251,251,251,26,29,21,13,
- 68,13,61,21,68,15,68,21,29,250,250,250,90,29,28,26,53,58,29,21,68,9,68,21,
- 253,253,253,253,125,21,68,9,68,13,245,245,245,245,117,13,68,8,31,228,228,228,228,228,
- 36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,
- 228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,13,
- 245,245,245,245,117,13,68,12,68,21,61,26,77,21,253,253,253,157,21,68,15,68,21,28,
- 29,13,68,13,29,250,250,250,90,29,21,68,16,68,21,29,21,100,13,29,26,251,251,251,
- 27,26,29,21,68,19,68,21,29,13,4,13,5,4,13,29,28,251,251,251,27,26,29,21,
- 68,17,68,21,26,36,3,36,45,21,29,26,251,251,219,26,29,21,68,14,68,21,13,196,
- 21,29,26,251,251,219,26,29,21,68,13,68,53,45,132,26,28,251,251,251,26,29,21,68,
- 20,68,21,93,3,36,13,21,26,187,90,27,60,27,90,251,27,26,29,21,68,24,68,21,
- 29,27,26,68,13,29,26,123,26,27,125,27,26,28,93,28,58,187,26,29,21,68,25,68,
- 21,29,28,21,45,53,123,26,28,29,28,53,45,67,45,21,26,61,26,155,26,29,21,68,
- 26,68,21,29,26,28,125,59,26,28,29,26,21,3,228,36,5,13,21,29,27,26,91,26,
- 29,21,68,23,68,21,29,26,27,122,27,26,29,27,21,3,228,196,13,28,29,26,59,26,
- 29,21,68,21,68,21,29,26,155,26,29,21,3,228,228,36,13,26,29,26,27,26,29,21,
- 68,18,68,21,29,26,123,26,29,21,228,228,132,3,26,29,58,29,21,68,18,68,21,29,
- 26,91,26,29,13,228,228,196,3,26,28,26,29,21,68,18,68,21,29,26,59,26,29,13,
- 228,228,228,4,13,29,26,29,21,68,20,68,21,29,26,27,26,29,21,228,4,13,181,26,
- 3,228,4,21,61,21,68,18,68,21,29,58,29,21,228,36,26,221,3,228,4,13,28,29,
- 21,68,20,68,21,29,26,28,27,3,228,4,13,29,186,28,3,228,36,21,29,21,68,19,
- 68,21,29,26,29,13,228,36,26,29,187,28,3,228,36,13,29,21,68,21,68,21,29,28,
- 26,228,36,13,29,26,27,26,123,28,3,228,36,3,28,21,68,18,68,21,61,13,228,36,
- 26,29,26,28,29,123,28,3,228,68,53,68,21,68,21,29,26,5,228,4,13,29,26,29,
- 53,29,26,59,28,3,228,68,53,68,20,68,21,29,21,228,36,26,28,26,29,45,29,26,
- 59,28,3,228,68,53,68,23,68,21,29,13,228,4,13,29,26,28,26,3,21,29,26,59,
- 28,3,228,68,13,21,68,18,68,21,27,3,228,3,26,28,59,90,28,91,28,117,228,13,
- 21,68,16,68,53,228,4,13,29,26,91,28,187,93,26,228,13,21,68,14,68,53,228,3,
- 26,28,251,91,58,29,21,228,53,68,14,68,53,228,21,29,59,90,251,26,29,21,228,53,
- 68,16,68,21,13,228,21,58,28,93,28,187,58,29,13,228,53,68,18,68,21,13,228,36,
- 35,45,21,26,28,155,93,13,196,3,27,21,68,16,68,21,13,228,196,26,29,123,28,85,
- 5,196,13,29,21,68,16,68,53,228,164,3,28,123,26,29,13,228,36,21,29,21,68,18,
- 68,53,228,164,13,29,26,91,26,29,13,228,4,5,26,29,21,68,16,68,53,228,164,13,
- 29,90,59,29,13,228,4,13,61,21,68,18,68,21,28,3,228,132,21,125,28,58,13,228,
- 4,26,28,29,21,68,17,68,21,29,13,228,132,85,45,35,228,36,13,29,26,29,21,68,
- 15,68,21,29,21,228,228,228,132,3,27,28,26,29,21,68,15,68,21,29,28,13,228,228,
- 228,100,21,29,58,29,21,68,16,68,21,61,21,228,228,228,68,21,29,26,27,26,29,21,
- 68,18,68,21,29,26,29,13,228,228,228,4,13,29,26,59,26,29,21,68,18,68,21,29,
- 26,28,26,3,228,228,196,13,29,26,91,26,29,21,68,18,68,21,29,58,29,26,3,228,
- 228,132,21,29,26,123,26,29,21,68,21,68,21,29,26,27,26,29,26,13,228,228,36,3,
- 21,29,90,91,26,29,21,68,22,68,21,29,26,59,26,29,28,13,228,196,3,21,27,29,
- 26,125,59,26,29,21,68,28,68,21,29,26,91,26,28,29,21,13,5,228,36,3,21,26,
- 29,28,26,28,21,77,21,29,26,29,21,68,28,68,21,29,26,155,26,61,26,21,45,67,
- 45,53,28,29,28,26,27,26,29,21,68,21,29,26,29,21,68,24,68,21,29,26,187,58,
- 28,93,28,26,27,125,27,26,59,26,29,21,13,68,26,93,21,68,20,68,21,29,26,251,
- 27,90,27,60,27,90,155,29,3,100,35,13,26,21,68,14,68,21,29,26,251,251,219,28,
- 26,196,3,29,21,68,18,68,21,29,26,251,251,219,28,26,21,13,36,3,36,21,29,21,
- 68,17,68,21,29,26,251,251,251,27,29,21,36,13,4,13,61,21,68,15,68,21,29,26,
- 251,251,251,26,29,21,100,21,61,21,68,17,68,21,29,26,251,251,251,26,29,21,68,13,
- 29,26,29,21,68,16,68,21,29,250,250,250,58,29,21,77,21,29,26,29,21,68,9,68,
- 21,253,253,253,253,125,21,68,9,68,13,245,245,245,245,117,13,68,8,31,228,228,228,228,
- 228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,
- 228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,
- 13,245,245,245,245,117,13,68,11,68,85,109,3,13,253,253,253,125,21,68,13,68,21,13,
- 164,13,29,250,250,250,58,29,21,68,14,68,21,13,164,13,29,26,251,251,251,26,29,21,
- 68,15,68,21,13,68,77,21,29,26,251,251,251,26,29,21,68,15,68,53,68,3,13,21,
- 60,251,251,251,27,26,29,21,68,15,68,21,28,3,132,13,29,26,251,251,251,26,29,21,
- 68,17,68,21,29,26,53,3,36,3,28,251,251,251,27,26,29,21,68,21,68,21,29,21,
- 35,68,13,29,26,155,90,27,60,27,90,251,27,26,29,21,68,23,68,21,29,21,132,21,
- 29,26,91,26,27,125,27,26,28,93,28,58,187,26,29,21,68,28,68,21,29,21,36,3,
- 13,21,29,26,59,26,28,29,28,53,45,67,45,21,26,61,26,155,26,29,21,68,29,68,
- 21,29,26,21,26,28,61,26,28,26,28,29,26,21,3,228,36,5,13,21,29,27,26,91,
- 26,29,21,68,25,68,21,29,26,29,28,27,26,59,26,29,27,21,3,228,196,13,28,29,
- 26,59,26,29,21,68,21,68,21,29,58,123,26,29,21,3,228,228,36,13,26,29,26,27,
- 26,29,21,68,18,68,21,29,26,123,26,29,21,228,228,132,3,26,29,58,29,21,68,18,
- 68,21,29,26,91,26,29,13,228,228,196,3,26,28,26,29,21,68,20,68,21,29,26,59,
- 26,29,13,228,196,35,45,3,132,13,29,26,29,21,68,21,68,21,29,26,27,26,29,21,
- 164,35,77,117,58,28,61,13,164,21,61,21,68,22,68,21,29,58,29,21,100,13,21,58,
- 28,221,60,26,28,26,196,13,28,29,21,68,22,68,21,29,26,28,27,3,100,13,29,60,
- 27,218,59,26,29,21,228,21,29,21,68,20,68,21,29,26,29,13,132,13,29,26,251,91,
- 26,29,21,228,13,29,21,68,19,68,21,29,28,26,164,13,29,26,251,91,26,29,13,228,
- 3,28,21,68,16,68,21,61,13,164,13,29,26,187,186,27,3,228,4,53,68,15,68,21,
- 29,26,5,164,3,28,219,189,26,228,36,53,68,17,68,21,29,21,196,3,26,28,123,28,
- 26,109,85,228,36,53,68,17,68,21,29,13,228,21,29,26,123,29,21,3,228,196,13,21,
- 68,18,68,21,27,3,228,21,29,26,155,29,28,53,45,228,68,13,21,68,17,68,53,228,
- 4,13,29,26,155,26,27,125,21,228,36,13,21,68,17,68,53,228,36,21,29,59,90,59,
- 90,27,29,13,228,4,53,68,17,68,53,228,68,21,27,28,93,28,123,26,29,21,228,4,
- 53,68,17,68,21,13,228,100,35,45,21,26,28,123,29,26,228,4,53,68,16,68,21,13,
- 228,228,3,26,29,123,28,26,228,3,27,21,68,17,68,21,13,228,68,13,85,26,60,155,
- 29,21,228,13,29,21,68,15,68,53,228,68,21,125,187,26,29,21,228,21,29,21,68,18,
- 68,53,228,68,13,29,58,187,26,28,29,13,196,5,26,29,21,68,15,68,53,228,68,3,
- 28,155,90,61,13,228,13,61,21,68,20,68,21,28,3,228,68,26,28,90,27,93,21,13,
- 228,4,26,28,29,21,68,19,68,21,29,13,228,68,21,125,27,53,13,228,36,13,29,26,
- 29,21,68,19,68,21,29,21,228,68,13,53,45,3,228,100,3,27,28,26,29,21,68,15,
- 68,21,29,28,13,228,228,228,100,21,29,58,29,21,68,16,68,21,61,21,228,228,228,68,
- 21,29,26,27,26,29,21,68,18,68,21,29,26,29,13,228,228,228,4,13,29,26,59,26,
- 29,21,68,18,68,21,29,26,28,26,3,228,228,196,13,29,26,91,26,29,21,68,20,68,
- 21,29,58,29,26,3,228,228,132,21,29,26,27,58,27,26,29,21,68,23,68,21,29,26,
- 27,26,29,26,13,228,228,36,3,21,29,58,28,61,28,26,29,21,68,24,68,21,29,26,
- 59,26,29,28,13,228,196,3,21,27,29,26,61,26,53,26,28,29,21,68,28,68,21,29,
- 26,91,26,28,29,21,13,5,228,36,3,21,26,29,28,26,29,21,13,3,36,21,61,21,
- 68,24,68,21,29,26,155,26,61,26,21,45,67,45,53,28,29,28,58,29,21,132,13,61,
- 21,68,24,68,21,29,26,187,58,28,93,28,26,27,125,27,26,59,26,29,13,68,45,21,
- 61,21,68,22,68,21,29,26,251,27,90,27,60,27,90,123,26,29,13,68,13,53,28,29,
- 21,68,15,68,21,29,26,251,251,219,26,29,21,164,21,29,21,68,16,68,21,29,26,251,
- 251,251,27,29,53,13,68,13,29,21,68,15,68,21,29,26,251,251,251,29,26,77,68,3,
- 29,21,68,15,68,21,29,26,251,251,219,26,29,21,164,3,28,21,68,14,68,21,29,26,
- 251,251,219,26,29,13,196,28,21,68,15,68,21,29,250,250,250,26,29,13,3,77,85,29,
- 21,68,10,68,21,253,253,253,93,28,253,21,68,9,68,13,245,245,245,245,117,13,68,8,
- 31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,
- 95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,
- 228,36,31,9,68,13,245,245,245,245,117,13,68,9,68,21,253,253,253,253,125,21,68,13,
- 68,53,3,13,53,27,250,250,250,154,29,21,68,14,68,21,13,68,21,61,251,251,251,91,
- 26,29,21,68,17,68,21,13,36,3,21,13,21,60,251,251,251,27,26,29,21,68,14,68,
- 21,13,164,13,29,26,251,251,251,26,29,21,68,16,68,21,13,36,13,3,68,26,28,251,
- 251,251,26,29,21,68,17,68,21,13,36,21,13,68,21,29,26,251,251,219,26,29,21,68,
- 18,68,53,164,3,26,28,155,90,27,60,27,90,251,27,26,29,21,68,24,68,21,28,13,
- 100,3,21,29,26,91,26,27,125,27,26,28,93,28,58,187,26,29,21,68,26,68,21,29,
- 26,117,26,29,26,59,26,28,29,28,53,45,67,45,21,26,61,26,155,26,29,21,68,27,
- 68,21,29,26,125,28,26,28,26,28,29,26,21,3,228,36,5,13,21,29,27,26,91,26,
- 29,21,68,21,68,21,29,154,59,26,29,27,21,3,228,196,13,28,29,26,59,26,29,21,
- 68,21,68,21,29,26,155,26,29,21,3,228,228,36,13,26,29,26,27,26,29,21,68,18,
- 68,21,29,26,123,26,29,21,228,228,132,3,26,29,58,29,21,68,18,68,21,29,26,91,
- 26,29,13,228,228,196,3,26,28,26,29,21,68,18,68,21,29,26,59,26,29,13,228,228,
- 228,4,13,29,26,29,21,68,16,68,21,29,26,27,26,29,21,228,228,228,68,21,61,21,
- 68,15,68,21,29,58,29,21,228,228,228,100,13,28,29,21,68,19,68,21,29,26,28,27,
- 3,132,13,53,45,3,228,228,36,21,29,21,68,18,68,21,29,26,29,13,164,21,125,26,
- 53,13,228,196,13,29,21,68,18,68,21,29,28,26,196,26,28,90,60,29,13,228,196,3,
- 28,21,68,17,68,21,61,13,164,3,26,28,91,26,29,21,228,228,4,53,68,17,68,21,
- 29,26,5,164,13,29,26,123,29,3,228,228,4,53,68,19,68,21,29,21,196,13,29,26,
- 91,29,21,13,117,13,3,228,68,53,68,18,68,21,29,13,196,13,29,26,123,28,189,28,
- 21,228,36,13,21,68,18,68,21,27,3,196,21,29,26,155,186,27,29,21,228,4,13,21,
- 68,15,68,53,228,21,29,26,123,90,187,26,3,228,13,21,68,17,68,53,228,21,29,26,
- 91,28,93,28,123,26,29,13,228,53,68,19,68,53,228,21,29,26,59,28,26,77,26,28,
- 91,26,29,21,228,53,68,22,68,21,13,228,13,29,26,27,26,29,21,68,21,29,26,59,
- 26,29,21,228,53,68,20,68,21,13,228,13,29,26,91,28,85,28,123,26,29,21,196,3,
- 27,21,68,18,68,21,13,228,4,26,28,123,93,155,26,29,13,196,13,29,21,68,18,68,
- 53,228,4,21,29,26,91,90,123,26,29,26,228,21,29,21,68,18,68,53,228,4,3,26,
- 29,26,219,58,61,13,196,5,26,29,21,68,18,68,53,228,36,3,26,61,28,91,28,93,
- 26,13,228,13,61,21,68,21,68,21,28,3,228,36,3,53,26,60,27,26,53,13,228,36,
- 26,28,29,21,68,15,68,21,29,13,228,132,131,228,100,13,29,26,29,21,68,15,68,21,
- 29,21,228,228,228,132,3,27,28,26,29,21,68,15,68,21,29,28,13,228,228,228,100,21,
- 29,58,29,21,68,16,68,21,61,21,228,228,228,68,21,29,26,27,26,29,21,68,18,68,
- 21,29,26,29,13,228,228,228,4,13,29,26,59,26,29,21,68,18,68,21,29,26,28,26,
- 3,228,228,196,13,29,26,91,26,29,21,68,18,68,21,29,58,29,26,3,228,228,132,21,
- 29,26,123,26,29,21,68,19,68,21,29,26,27,26,29,26,13,228,228,36,3,21,29,218,
- 29,21,68,22,68,21,29,26,59,26,29,28,13,228,196,3,21,27,29,26,28,157,26,29,
- 21,68,27,68,21,29,26,91,26,28,29,21,13,5,228,36,3,21,26,29,28,26,29,26,
- 21,45,53,61,21,68,25,68,21,29,26,155,26,61,26,21,45,67,45,53,28,29,28,58,
- 29,21,3,132,21,29,21,68,23,68,21,29,26,187,58,28,93,28,26,27,125,27,26,59,
- 26,29,13,164,13,29,21,68,23,68,21,29,26,251,27,90,27,60,27,90,123,28,26,3,
- 36,13,21,36,3,27,21,68,15,68,21,29,26,251,251,251,29,13,68,3,68,26,21,68,
- 14,68,21,29,26,251,251,219,26,29,21,196,26,21,68,16,68,21,29,26,251,251,251,27,
- 29,85,13,36,3,28,21,68,16,68,21,29,26,251,251,251,27,26,61,26,68,3,29,21,
- 68,17,68,21,29,26,251,251,251,59,26,27,26,53,13,21,29,21,68,13,68,21,29,250,
- 250,250,154,27,93,28,29,21,68,9,68,21,253,253,253,253,125,21,68,9,68,13,245,245,
- 245,245,117,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,
- 95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,
- 8,31,228,228,228,228,228,36,31,9,68,13,245,245,245,245,117,13,68,12,68,21,26,149,
- 45,26,253,253,253,93,21,68,13,68,21,13,164,3,28,250,250,250,58,29,21,68,13,68,
- 53,164,21,29,26,251,251,251,26,29,21,68,15,68,53,4,35,68,21,29,26,251,251,251,
- 26,29,21,68,16,68,21,29,58,3,36,3,29,251,251,251,59,26,29,21,68,16,68,21,
- 61,13,68,13,29,26,251,251,251,27,26,29,21,68,16,68,21,29,13,100,21,29,26,251,
- 251,251,27,26,29,21,68,20,68,21,29,13,3,36,3,28,251,90,27,60,27,90,251,27,
- 26,29,21,68,24,68,21,61,26,21,3,13,29,26,155,26,27,125,27,26,28,93,28,58,
- 187,26,29,21,68,26,68,21,29,26,28,29,58,28,123,26,28,29,28,53,45,67,45,21,
- 26,61,26,155,26,29,21,68,27,68,21,29,26,27,26,60,91,26,28,29,26,21,3,228,
- 36,5,13,21,29,27,26,91,26,29,21,68,21,68,21,29,26,187,26,29,27,21,3,228,
- 196,13,28,29,26,59,26,29,21,68,21,68,21,29,26,155,26,29,21,3,228,228,36,13,
- 26,29,26,27,26,29,21,68,18,68,21,29,26,123,26,29,21,228,228,132,3,26,29,58,
- 29,21,68,18,68,21,29,26,91,26,29,13,228,228,196,3,26,28,26,29,21,68,18,68,
- 21,29,26,59,26,29,13,228,228,228,4,13,29,26,29,21,68,19,68,21,29,26,27,26,
- 29,21,228,164,35,77,21,13,164,21,61,21,68,20,68,21,29,58,29,21,100,3,109,117,
- 90,28,125,13,164,13,28,29,21,68,21,68,21,29,26,28,27,3,100,13,253,29,60,27,
- 58,27,26,228,21,29,21,68,19,68,21,29,26,29,13,132,3,28,218,155,26,29,21,228,
- 13,29,21,68,19,68,21,29,28,26,196,21,29,26,251,59,26,29,13,228,3,28,21,68,
- 17,68,21,61,13,196,21,29,26,251,59,28,26,3,228,4,53,68,20,68,21,29,26,5,
- 196,13,29,26,27,28,61,155,26,29,21,228,36,53,68,18,68,21,29,21,228,3,28,61,
- 90,28,123,26,29,13,228,36,53,68,21,68,21,29,13,228,4,77,3,4,21,29,26,91,
- 28,26,3,228,36,13,21,68,18,68,21,27,3,228,132,13,29,26,91,26,29,21,228,68,
- 13,21,68,15,68,53,228,132,13,29,155,26,29,13,228,68,13,21,68,13,68,53,228,132,
- 21,29,26,187,3,228,68,53,68,15,68,53,228,100,21,29,26,123,26,29,21,228,100,53,
- 68,16,68,21,13,228,68,13,29,26,155,26,29,13,228,100,53,68,18,68,21,13,228,36,
- 3,26,28,26,187,28,3,228,68,3,27,21,68,19,68,21,13,228,36,13,61,28,58,59,
- 26,29,21,228,100,13,29,21,68,17,68,53,228,68,3,21,26,61,90,29,13,228,100,21,
- 29,21,68,18,68,53,228,132,3,13,21,61,27,28,3,228,68,5,26,29,21,68,14,68,
- 53,228,228,13,21,29,26,228,100,13,61,21,68,16,68,21,28,3,228,228,4,3,13,228,
- 100,26,28,29,21,68,14,68,21,29,13,228,228,228,164,13,29,26,29,21,68,15,68,21,
- 29,21,228,228,228,132,3,27,28,26,29,21,68,15,68,21,29,28,13,228,228,228,100,21,
- 29,58,29,21,68,16,68,21,61,21,228,228,228,68,21,29,26,27,26,29,21,68,18,68,
- 21,29,26,29,13,228,228,228,4,13,29,26,59,26,29,21,68,18,68,21,29,26,28,26,
- 3,228,228,196,13,29,26,91,26,29,21,68,18,68,21,29,58,29,26,3,228,228,132,21,
- 29,26,123,26,29,21,68,21,68,21,29,26,27,26,29,26,13,228,228,36,3,21,29,26,
- 155,26,29,21,68,25,68,21,29,26,59,26,29,28,13,228,196,3,21,27,29,26,27,28,
- 29,58,27,26,29,21,68,28,68,21,29,26,91,26,28,29,21,13,5,228,36,3,21,26,
- 29,28,26,27,28,58,61,27,26,29,21,68,29,68,21,29,26,155,26,61,26,21,45,67,
- 45,53,28,29,28,26,59,26,29,21,4,13,21,29,27,29,21,68,24,68,21,29,26,187,
- 58,28,93,28,26,27,125,27,26,123,26,29,13,68,13,26,29,21,68,19,68,21,29,26,
- 251,27,90,27,60,27,90,187,28,26,100,13,61,21,68,17,68,21,29,26,251,251,251,26,
- 29,21,68,3,29,28,29,21,68,16,68,21,29,26,251,251,251,26,29,13,68,21,58,29,
- 21,68,17,68,21,29,26,251,251,251,28,26,3,68,3,4,21,29,21,68,15,68,21,29,
- 26,251,251,219,26,29,21,164,13,29,21,68,15,68,21,29,26,251,251,219,26,29,13,164,
- 3,27,21,68,12,68,21,29,250,250,250,58,181,58,28,21,68,9,68,21,253,253,253,253,
- 125,21,68,9,68,13,245,245,245,245,117,13,68,8,31,228,228,228,228,228,36,31,8,31,
- 228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,
- 31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,13,245,245,245,245,
- 117,13,68,11,68,21,93,26,21,253,253,253,221,21,68,16,68,21,29,26,13,36,13,26,
- 28,250,250,250,90,29,21,68,18,68,21,29,13,4,35,4,13,29,26,251,251,251,27,26,
- 29,21,68,19,68,21,29,13,4,13,3,4,13,29,26,251,251,251,27,26,29,21,68,16,
- 68,21,29,21,100,13,29,26,251,251,251,27,26,29,21,68,18,68,21,26,3,4,13,3,
- 36,21,29,26,251,251,251,26,29,21,68,16,68,53,36,21,13,36,13,29,26,251,251,251,
- 26,29,21,68,18,68,53,164,21,29,26,155,90,27,60,27,90,251,27,26,29,21,68,23,
- 68,21,29,21,3,68,13,28,155,26,27,125,27,26,28,93,28,58,187,26,29,21,68,25,
- 68,21,61,26,85,29,28,91,26,28,29,28,53,45,67,45,21,26,61,26,155,26,29,21,
- 68,27,68,21,29,26,28,93,26,59,26,28,29,26,21,3,228,36,5,13,21,29,27,26,
- 91,26,29,21,68,23,68,21,29,26,27,58,91,26,29,27,21,3,228,196,13,28,29,26,
- 59,26,29,21,68,21,68,21,29,26,155,26,29,21,3,228,228,36,13,26,29,26,27,26,
- 29,21,68,18,68,21,29,26,123,26,29,21,228,228,132,3,26,29,58,29,21,68,18,68,
- 21,29,26,91,26,29,13,228,228,196,3,26,28,26,29,21,68,18,68,21,29,26,59,26,
- 29,13,228,228,228,4,13,29,26,29,21,68,16,68,21,29,26,27,26,29,21,228,228,228,
- 68,21,61,21,68,17,68,21,29,58,29,21,228,36,3,109,228,132,13,28,29,21,68,20,
- 68,21,29,26,28,27,3,228,4,21,27,125,26,13,228,100,21,29,21,68,20,68,21,29,
- 26,29,13,228,4,21,29,27,122,61,13,228,68,13,29,21,68,24,68,21,29,28,26,228,
- 4,21,29,26,27,61,28,27,26,27,29,3,228,36,3,28,21,68,21,68,21,61,13,228,
- 4,26,28,26,28,53,26,28,27,26,29,21,228,68,53,68,20,68,21,29,26,5,228,3,
- 26,91,3,4,21,29,58,29,21,228,68,53,68,22,68,21,29,21,228,4,3,26,28,27,
- 28,53,26,28,27,26,29,21,228,68,53,68,21,68,21,29,13,228,36,21,29,26,27,61,
- 28,59,26,29,13,228,68,13,21,68,20,68,21,27,3,228,36,13,29,26,27,58,91,28,
- 26,3,228,68,13,21,68,20,68,53,228,36,3,21,28,27,58,27,26,91,28,21,3,228,
- 36,13,21,68,19,68,53,228,36,21,29,26,27,61,28,61,59,26,29,21,228,36,53,68,
- 21,68,53,228,4,13,29,26,27,29,21,77,21,29,59,26,29,13,228,4,53,68,22,68,
- 21,13,228,4,13,29,58,29,21,68,21,29,26,27,26,29,13,228,4,53,68,22,68,21,
- 13,228,4,13,29,26,59,29,53,26,29,91,26,29,13,228,3,27,21,68,19,68,21,13,
- 228,4,13,29,26,91,93,123,26,29,13,228,13,29,21,68,19,68,53,228,36,21,29,26,
- 91,26,123,26,29,21,228,4,21,29,21,68,17,68,53,228,36,3,26,29,250,29,26,3,
- 228,5,26,29,21,68,15,68,53,228,68,3,21,253,21,3,228,4,13,61,21,68,16,68,
- 21,28,3,228,100,13,181,13,228,68,26,28,29,21,68,14,68,21,29,13,228,228,228,164,
- 13,29,26,29,21,68,15,68,21,29,21,228,228,228,132,3,27,28,26,29,21,68,15,68,
- 21,29,28,13,228,228,228,100,21,29,58,29,21,68,16,68,21,61,21,228,228,228,68,21,
- 29,26,27,26,29,21,68,18,68,21,29,26,29,13,228,228,228,4,13,29,26,59,26,29,
- 21,68,18,68,21,29,26,28,26,3,228,228,196,13,29,26,91,26,29,21,68,18,68,21,
- 29,58,29,26,3,228,228,132,21,29,26,123,26,29,21,68,21,68,21,29,26,27,26,29,
- 26,13,228,228,36,3,21,29,154,27,26,29,21,68,21,68,21,29,26,59,26,29,28,13,
- 228,196,3,21,27,29,58,125,58,29,21,68,27,68,21,29,26,91,26,28,29,21,13,5,
- 228,36,3,21,26,29,28,26,27,29,117,29,27,29,21,68,26,68,21,29,26,155,26,61,
- 26,21,45,67,45,53,28,29,28,26,59,29,13,100,13,27,29,21,68,23,68,21,29,26,
- 187,58,28,93,28,26,27,125,27,26,59,26,29,21,164,21,29,21,68,24,68,21,29,26,
- 251,27,90,27,60,27,90,123,26,29,21,36,13,21,3,4,13,29,21,68,18,68,21,29,
- 26,251,251,251,28,26,3,4,35,4,5,21,29,21,68,15,68,21,29,26,251,251,251,26,
- 29,21,100,13,61,21,68,19,68,21,29,26,251,251,251,26,29,13,4,3,13,4,3,26,
- 29,21,68,17,68,21,29,26,251,251,251,26,29,21,36,3,4,13,61,21,68,18,68,21,
- 29,26,251,251,251,59,28,13,3,4,13,26,28,29,21,68,16,68,21,29,250,250,250,90,
- 27,29,58,29,28,26,29,21,68,9,68,21,253,253,253,253,125,21,68,9,68,13,245,245,
- 245,245,117,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,
- 95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,
- 8,31,228,228,228,228,228,36,31,9,68,13,245,245,245,245,117,13,68,9,68,21,253,253,
- 253,253,125,21,68,15,68,21,29,21,13,67,21,28,250,250,250,90,29,21,68,13,68,53,
- 164,21,29,26,251,251,251,26,29,21,68,17,68,21,13,36,3,13,36,3,27,28,251,251,
- 251,26,29,21,68,16,68,21,13,36,13,21,68,26,29,251,251,251,26,29,21,68,14,68,
- 21,13,196,21,29,26,251,251,219,26,29,21,68,17,68,21,26,13,4,5,3,68,26,29,
- 251,251,251,26,29,21,68,21,68,21,61,58,13,36,3,26,28,155,90,27,60,27,90,251,
- 27,26,29,21,68,26,68,21,29,26,29,26,3,36,3,29,26,91,26,27,125,27,26,28,
- 93,28,58,187,26,29,21,68,26,68,21,29,26,27,58,85,29,59,26,28,29,28,53,45,
- 67,45,21,26,61,26,155,26,29,21,68,27,68,21,29,26,59,28,93,27,26,28,29,26,
- 21,3,228,36,5,13,21,29,27,26,91,26,29,21,68,21,68,21,29,26,123,90,29,27,
- 21,3,228,196,13,28,29,26,59,26,29,21,68,21,68,21,29,26,155,26,29,21,3,228,
- 228,36,13,26,29,26,27,26,29,21,68,18,68,21,29,26,123,26,29,21,228,228,132,3,
- 26,29,58,29,21,68,18,68,21,29,26,91,26,29,13,228,228,196,3,26,28,26,29,21,
- 68,18,68,21,29,26,59,26,29,13,228,228,228,4,13,29,26,29,21,68,16,68,21,29,
- 26,27,26,29,21,228,228,228,68,21,61,21,68,15,68,21,29,58,29,21,228,228,228,100,
- 13,28,29,21,68,18,68,21,29,26,28,27,3,228,3,13,213,13,228,68,21,29,21,68,
- 19,68,21,29,26,29,13,196,3,21,27,253,29,21,228,36,13,29,21,68,21,68,21,29,
- 28,26,196,3,26,29,27,122,59,90,29,21,228,4,3,28,21,68,17,68,21,61,13,196,
- 21,29,26,251,59,26,29,13,228,4,53,68,21,68,21,29,26,5,164,13,29,26,155,28,
- 29,28,91,26,29,21,228,4,53,68,18,68,21,29,21,196,13,29,26,123,29,90,29,123,
- 28,3,228,53,68,25,68,21,29,13,196,21,29,26,59,26,29,21,3,4,3,26,29,59,
- 26,29,13,228,13,21,68,25,68,21,27,3,196,21,29,26,59,26,29,21,3,4,3,26,
- 28,59,26,29,13,228,13,21,68,19,68,53,228,13,29,26,123,29,58,27,29,91,26,29,
- 21,228,13,21,68,17,68,53,228,3,29,26,155,28,29,28,123,26,29,21,228,53,68,16,
- 68,53,228,4,21,29,58,91,58,155,26,29,21,228,53,68,18,68,21,13,228,4,3,21,
- 93,28,93,28,123,26,29,13,228,53,68,20,68,21,13,228,68,13,53,58,53,26,29,91,
- 26,29,13,196,3,27,21,68,18,68,21,13,228,228,4,3,26,28,91,26,29,13,196,13,
- 29,21,68,16,68,53,228,228,4,21,29,26,123,28,3,196,21,29,21,68,16,68,53,228,
- 228,3,28,27,122,28,26,196,5,26,29,21,68,16,68,53,228,228,13,27,28,93,28,29,
- 21,196,13,61,21,68,17,68,21,28,3,228,228,3,45,85,29,21,196,26,28,29,21,68,
- 15,68,21,29,13,228,228,164,35,164,13,29,26,29,21,68,15,68,21,29,21,228,228,228,
- 132,3,27,28,26,29,21,68,15,68,21,29,28,13,228,228,228,100,21,29,58,29,21,68,
- 16,68,21,61,21,228,228,228,68,21,29,26,27,26,29,21,68,18,68,21,29,26,29,13,
- 228,228,228,4,13,29,26,59,26,29,21,68,18,68,21,29,26,28,26,3,228,228,196,13,
- 29,26,91,26,29,21,68,18,68,21,29,58,29,26,3,228,228,132,21,29,26,123,26,29,
- 21,68,21,68,21,29,26,27,26,29,26,13,228,228,36,3,21,29,58,123,26,29,21,68,
- 23,68,21,29,26,59,26,29,28,13,228,196,3,21,27,29,28,93,28,59,26,29,21,68,
- 26,68,21,29,26,91,26,28,29,21,13,5,228,36,3,21,26,29,27,29,117,26,59,26,
- 29,21,68,27,68,21,29,26,155,26,61,26,21,45,67,45,53,28,29,28,58,29,13,68,
- 21,29,27,26,29,21,68,25,68,21,29,26,187,58,28,93,28,26,27,125,27,26,59,26,
- 29,13,36,13,53,26,61,21,68,20,68,21,29,26,251,27,90,27,60,27,90,155,28,3,
- 132,3,21,29,21,68,15,68,21,29,26,251,251,219,28,26,3,164,3,29,21,68,16,68,
- 21,29,26,251,251,251,28,3,36,21,13,68,26,21,68,16,68,21,29,26,251,251,219,26,
- 29,13,36,35,68,28,21,68,15,68,21,29,26,251,251,219,26,29,21,164,21,29,21,68,
- 15,68,21,29,26,251,251,251,26,29,21,109,21,61,21,68,12,68,21,29,250,250,250,90,
- 189,26,29,21,68,9,68,21,253,253,253,253,125,21,68,9,68,13,245,245,245,245,117,13,
- 68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,
- 228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,
- 228,228,228,36,31,10,68,13,85,58,245,245,245,213,13,68,12,68,21,61,26,45,21,253,
- 253,253,189,21,68,16,68,21,29,21,4,77,3,26,28,250,250,250,58,29,21,68,15,68,
- 53,35,21,61,45,29,26,251,251,251,26,29,21,68,18,68,26,45,26,4,21,29,26,3,
- 21,29,251,251,251,26,29,21,68,20,68,26,13,21,29,21,4,21,29,3,21,29,26,251,
- 251,219,26,29,21,68,18,68,26,21,13,61,21,3,21,3,26,28,251,251,251,26,29,21,
- 68,19,68,21,29,3,13,27,29,13,4,21,29,26,251,251,251,26,29,21,68,22,68,21,
- 29,26,13,3,13,3,21,29,219,90,27,60,27,90,251,27,26,29,21,68,23,68,21,29,
- 28,29,53,26,29,187,26,27,125,27,26,28,93,28,58,187,26,29,21,68,26,68,21,29,
- 26,27,61,28,26,123,26,28,29,28,53,45,67,45,21,26,61,26,155,26,29,21,68,26,
- 68,21,29,26,59,26,123,26,28,29,26,21,3,228,36,5,13,21,29,27,26,91,26,29,
- 21,68,21,68,21,29,26,187,26,29,27,21,3,228,196,13,28,29,26,59,26,29,21,68,
- 21,68,21,29,26,155,26,29,21,3,228,228,36,13,26,29,26,27,26,29,21,68,18,68,
- 21,29,26,123,26,29,21,228,228,132,3,26,29,58,29,21,68,18,68,21,29,26,91,26,
- 29,13,228,228,196,3,26,28,26,29,21,68,18,68,21,29,26,59,26,29,13,228,228,228,
- 4,13,29,26,29,21,68,19,68,21,29,26,27,26,29,21,228,4,3,109,3,228,100,21,
- 61,21,68,21,68,21,29,58,29,21,228,13,21,26,125,26,21,13,228,36,13,28,29,21,
- 68,20,68,21,29,26,28,27,3,164,13,26,253,61,26,13,228,4,21,29,21,68,25,68,
- 21,29,26,29,13,164,21,29,28,27,28,53,45,53,28,29,28,29,21,228,13,29,21,68,
- 24,68,21,29,28,26,164,13,29,26,28,26,3,164,13,21,29,26,29,13,196,3,28,21,
- 68,20,68,21,61,13,132,13,29,26,29,59,13,228,13,29,26,29,13,196,53,68,21,68,
- 21,29,26,5,132,26,29,27,21,27,60,13,228,13,29,28,26,196,53,68,21,68,21,29,
- 21,132,13,61,21,4,21,29,28,26,3,228,21,61,13,164,53,68,22,68,21,29,13,132,
- 21,29,28,13,36,21,61,21,228,13,28,29,21,164,13,21,68,22,68,21,27,3,100,3,
- 26,29,21,100,21,61,21,228,21,29,26,3,132,13,21,68,22,68,53,132,13,28,29,21,
- 100,3,26,28,29,21,196,21,29,28,13,132,13,21,68,19,68,53,132,13,61,13,132,13,
- 28,27,29,13,164,13,61,13,132,53,68,19,68,53,132,13,61,13,164,13,29,27,28,13,
- 132,13,61,13,132,53,68,22,68,21,13,132,13,28,29,21,196,21,29,28,26,3,100,21,
- 29,28,13,132,53,68,22,68,21,13,132,3,26,29,21,228,21,61,21,100,21,29,26,3,
- 100,3,27,21,68,22,68,21,13,164,21,29,28,13,228,21,61,21,36,13,28,29,21,132,
- 13,29,21,68,21,68,53,164,13,61,21,228,3,26,28,29,21,4,21,61,13,132,21,29,
- 21,68,21,68,53,196,26,28,29,13,228,13,60,27,21,27,29,26,132,5,26,29,21,68,
- 20,68,53,196,13,29,26,29,13,228,13,59,29,26,29,13,132,13,61,21,68,24,68,21,
- 28,3,196,13,29,26,29,21,13,164,3,26,28,26,29,13,164,26,28,29,21,68,25,68,
- 21,29,13,228,21,29,28,29,28,53,45,53,28,27,28,29,13,164,13,29,26,29,21,68,
- 20,68,21,29,21,228,4,13,26,253,61,26,13,164,3,27,28,26,29,21,68,21,68,21,
- 29,28,13,228,36,13,21,26,125,26,21,13,228,21,29,58,29,21,68,19,68,21,61,21,
- 228,100,3,109,3,228,4,21,29,26,27,26,29,21,68,18,68,21,29,26,29,13,228,228,
- 228,4,13,29,26,59,26,29,21,68,18,68,21,29,26,28,26,3,228,228,196,13,29,26,
- 91,26,29,21,68,18,68,21,29,58,29,26,3,228,228,132,21,29,26,123,26,29,21,68,
- 21,68,21,29,26,27,26,29,26,13,228,228,36,3,21,29,26,155,26,29,21,68,21,68,
- 21,29,26,59,26,29,28,13,228,196,3,21,27,29,26,187,26,29,21,68,26,68,21,29,
- 26,91,26,28,29,21,13,5,228,36,3,21,26,29,28,26,123,26,59,26,29,21,68,26,
- 68,21,29,26,155,26,61,26,21,45,67,45,53,28,29,28,26,123,26,28,61,27,26,29,
- 21,68,23,68,21,29,26,187,58,28,93,28,26,27,125,27,26,187,29,26,53,29,28,29,
- 21,68,22,68,21,29,26,251,27,90,27,60,27,90,219,29,21,3,13,3,13,26,29,21,
- 68,19,68,21,29,26,251,251,251,26,29,21,4,13,29,27,13,3,29,21,68,18,68,21,
- 29,26,251,251,251,28,26,3,21,3,21,61,13,21,26,68,20,68,21,29,26,251,251,219,
- 26,29,21,3,29,21,4,21,29,21,13,26,68,18,68,21,29,26,251,251,251,29,21,3,
- 26,29,21,4,26,45,26,68,15,68,21,29,26,251,251,251,26,29,45,61,21,35,53,68,
- 16,68,21,29,250,250,250,58,28,26,3,77,4,21,29,21,68,12,68,21,253,253,253,189,
- 21,45,26,61,21,68,10,68,13,245,245,245,213,58,85,13,68,8,31,228,228,228,228,228,
- 36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,
- 228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,13,
- 245,245,245,245,117,13,68,14,68,21,29,28,26,29,21,28,253,253,253,189,21,68,15,68,
- 53,3,4,3,4,13,29,250,250,250,122,29,21,68,17,68,26,13,4,45,4,3,21,29,
- 251,251,251,59,26,29,21,68,17,68,26,21,3,29,90,21,29,26,251,251,251,27,26,29,
- 21,68,19,68,21,26,13,26,27,28,29,13,21,29,26,251,251,251,26,29,21,68,18,68,
- 21,29,53,29,26,29,21,13,29,26,251,251,251,26,29,21,68,18,68,21,29,26,53,13,
- 29,13,4,26,28,251,251,251,26,29,21,68,19,68,21,29,27,13,100,3,219,90,27,60,
- 27,90,251,27,26,29,21,68,26,68,21,29,27,29,13,21,13,21,26,29,123,26,27,125,
- 27,26,28,93,28,58,187,26,29,21,68,26,68,21,29,26,28,26,28,93,91,26,28,29,
- 28,53,45,67,45,21,26,61,26,155,26,29,21,68,28,68,21,29,26,27,28,27,58,59,
- 26,28,29,26,21,3,228,36,5,13,21,29,27,26,91,26,29,21,68,21,68,21,29,26,
- 187,26,29,27,21,3,228,196,13,28,29,26,59,26,29,21,68,22,68,21,29,26,155,26,
- 29,21,3,228,3,228,4,13,26,29,26,27,26,29,21,68,20,68,21,29,26,123,26,29,
- 21,228,36,21,228,36,3,26,29,58,29,21,68,21,68,21,29,26,91,26,29,13,228,68,
- 26,13,228,36,3,26,28,26,29,21,68,24,68,21,29,26,59,26,29,13,36,77,21,77,
- 3,36,28,21,228,68,13,29,26,29,21,68,23,68,21,29,26,27,26,29,21,4,13,21,
- 221,26,53,26,29,13,228,68,21,61,21,68,22,68,21,29,58,29,21,4,13,61,218,28,
- 61,59,28,13,228,36,13,28,29,21,68,26,68,21,29,26,28,27,3,4,26,29,26,59,
- 58,59,122,27,26,29,26,3,228,36,21,29,21,68,27,68,21,29,26,29,13,4,13,29,
- 26,59,26,93,28,61,28,91,26,29,21,3,228,4,13,29,21,68,28,68,21,29,28,26,
- 36,13,29,26,27,26,29,21,45,3,45,26,28,26,28,93,26,13,228,3,28,21,68,20,
- 68,21,61,13,36,13,29,58,29,21,132,3,28,61,26,149,3,228,53,68,24,68,21,29,
- 26,5,36,13,29,26,27,29,13,100,3,58,21,13,3,36,3,228,68,53,68,18,68,21,
- 29,21,68,3,28,26,29,21,132,45,164,45,228,36,53,68,18,68,21,29,13,100,21,28,
- 29,21,228,164,26,21,228,4,13,21,68,17,68,21,27,3,100,21,61,21,228,164,13,29,
- 13,228,13,21,68,16,68,53,132,3,26,29,21,228,196,21,29,13,196,13,21,68,16,68,
- 53,164,21,29,26,3,228,164,13,29,26,3,164,53,68,16,68,53,164,3,26,29,13,228,
- 164,3,27,29,21,164,53,68,15,68,21,13,196,13,29,21,228,196,26,60,3,132,53,68,
- 17,68,21,13,228,21,29,3,228,164,21,61,21,100,3,27,21,68,17,68,21,13,228,4,
- 53,228,164,21,29,28,26,100,13,29,21,68,19,68,53,228,36,21,13,164,45,132,26,29,
- 26,29,13,68,21,29,21,68,21,68,53,228,196,3,13,21,28,3,100,13,29,58,29,13,
- 36,5,26,29,21,68,21,68,53,228,3,109,53,27,61,13,100,3,21,29,58,29,21,36,
- 13,61,21,68,24,68,21,28,3,228,13,157,59,26,109,21,26,29,26,27,26,29,21,36,
- 26,28,29,21,68,26,68,21,29,13,228,4,13,26,28,26,91,28,157,28,26,59,26,29,
- 13,4,13,29,26,29,21,68,24,68,21,29,21,228,36,3,26,29,26,27,218,91,26,29,
- 26,4,3,27,28,26,29,21,68,26,68,21,29,28,13,228,36,3,27,28,26,61,28,27,
- 154,28,29,28,13,4,21,29,58,29,21,68,25,68,21,61,21,228,68,13,29,28,53,26,
- 28,157,26,21,3,4,21,29,26,27,26,29,21,68,24,68,21,29,26,29,13,228,68,21,
- 29,13,4,35,141,3,36,13,29,26,59,26,29,21,68,21,68,21,29,26,28,26,3,228,
- 68,26,13,228,36,13,29,26,91,26,29,21,68,20,68,21,29,58,29,26,3,228,36,45,
- 228,4,21,29,26,123,26,29,21,68,22,68,21,29,26,27,26,29,26,13,228,36,3,196,
- 3,21,29,26,155,26,29,21,68,21,68,21,29,26,59,26,29,28,13,228,196,3,21,27,
- 29,26,187,26,29,21,68,28,68,21,29,26,91,26,28,29,21,13,5,228,36,3,21,26,
- 29,28,26,27,26,28,29,60,58,29,21,68,27,68,21,29,26,155,26,61,26,21,45,67,
- 45,53,28,29,28,26,59,28,29,58,53,29,26,29,21,68,26,68,21,29,26,187,58,28,
- 93,28,26,27,125,27,26,91,26,29,13,36,3,4,21,28,29,21,68,24,68,21,29,26,
- 251,27,90,27,60,27,90,155,28,26,4,3,21,13,3,13,26,29,21,68,17,68,21,29,
- 26,251,251,251,60,3,21,29,21,29,53,29,21,68,18,68,21,29,26,251,251,251,26,29,
- 45,29,27,29,26,13,29,21,68,17,68,21,29,26,251,251,251,27,28,26,21,61,26,29,
- 13,53,68,18,68,21,29,26,251,251,251,27,26,29,21,45,21,26,4,13,26,68,14,68,
- 21,29,26,251,251,251,59,28,26,3,100,53,68,16,68,21,29,250,250,250,122,29,21,13,
- 21,13,21,29,21,68,9,68,21,253,253,253,253,125,21,68,9,68,13,245,245,245,245,117,
- 13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,
- 228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,
- 228,228,228,228,36,31,9,68,13,245,245,245,245,117,13,68,9,68,21,253,253,253,253,125,
- 21,68,19,68,21,29,27,29,27,29,21,13,21,26,28,250,250,250,26,29,21,68,19,68,
- 21,29,26,21,26,29,13,36,3,26,28,251,251,219,26,29,21,68,20,68,21,29,21,4,
- 21,29,21,13,36,21,29,26,251,251,187,26,29,21,68,17,68,53,68,45,3,4,3,21,
- 29,26,251,251,187,26,29,21,68,18,68,53,3,4,3,13,36,13,21,26,28,251,251,219,
- 26,29,21,68,17,68,21,29,21,3,53,100,21,29,26,251,251,187,26,29,21,68,24,68,
- 21,29,58,29,21,45,3,4,21,29,26,91,90,27,60,27,90,251,27,26,29,21,68,25,
- 68,21,29,26,28,27,93,27,58,28,59,26,27,125,27,26,28,93,28,58,187,26,29,21,
- 68,26,68,21,29,26,91,26,27,92,27,26,28,29,28,53,45,67,45,21,26,61,26,155,
- 26,29,21,68,24,68,21,29,26,219,26,28,29,26,21,3,228,36,5,13,21,29,27,26,
- 91,26,29,21,68,21,68,21,29,26,187,26,29,27,21,3,228,196,13,28,29,26,59,26,
- 29,21,68,21,68,21,29,26,155,26,29,21,3,228,228,36,13,26,29,26,27,26,29,21,
- 68,18,68,21,29,26,123,26,29,21,228,228,132,3,26,29,58,29,21,68,18,68,21,29,
- 26,91,26,29,13,228,228,196,3,26,28,26,29,21,68,18,68,21,29,26,59,26,29,13,
- 228,228,228,4,13,29,26,29,21,68,16,68,21,29,26,27,26,29,21,228,228,228,68,21,
- 61,21,68,19,68,21,29,58,29,21,228,132,13,21,45,3,228,36,13,28,29,21,68,24,
- 68,21,29,26,28,27,3,228,3,13,21,26,3,21,93,26,53,13,3,196,21,29,21,68,
- 25,68,21,29,26,29,13,196,13,21,26,93,21,26,27,58,27,93,27,53,13,100,13,29,
- 21,68,25,68,21,29,28,26,132,3,13,21,61,27,90,60,26,27,125,28,26,61,26,100,
- 3,28,21,68,26,68,21,61,13,68,13,21,26,61,26,157,28,26,29,28,53,13,21,26,
- 29,26,29,21,132,53,68,26,68,21,29,26,5,68,26,29,27,58,29,21,77,21,26,29,
- 21,3,100,3,21,61,21,132,53,68,22,68,21,29,21,100,21,29,26,27,29,13,132,3,
- 26,3,196,21,29,13,132,53,68,21,68,21,29,13,100,13,29,26,29,21,196,13,21,196,
- 3,29,3,132,13,21,68,18,68,21,27,3,132,26,29,21,228,4,13,3,196,21,164,13,
- 21,68,15,68,53,164,21,29,13,228,4,45,196,13,164,13,21,68,16,68,53,164,13,29,
- 13,228,4,3,21,164,5,13,164,53,68,16,68,53,196,21,13,228,4,3,26,3,132,3,
- 13,164,53,68,16,68,21,13,196,45,228,4,3,29,13,132,21,3,164,53,68,19,68,21,
- 13,196,3,13,228,4,13,29,21,100,13,21,164,3,27,21,68,20,68,21,13,228,13,228,
- 4,26,28,29,13,36,13,29,21,164,13,29,21,68,20,68,53,228,45,196,21,29,26,29,
- 21,3,21,27,29,13,164,21,29,21,68,23,68,53,228,4,21,13,132,21,29,26,27,28,
- 58,29,28,26,3,132,5,26,29,21,68,22,68,53,228,4,13,29,21,45,21,26,29,122,
- 27,28,26,29,21,164,13,61,21,68,21,68,21,28,3,228,3,26,125,28,26,157,28,26,
- 29,21,164,26,28,29,21,68,25,68,21,29,13,228,4,21,29,58,28,29,28,21,45,53,
- 26,61,13,132,13,29,26,29,21,68,22,68,21,29,21,228,4,13,93,26,21,3,132,3,
- 45,132,3,27,28,26,29,21,68,17,68,21,29,28,13,228,4,53,13,228,228,21,29,58,
- 29,21,68,16,68,21,61,21,228,228,228,68,21,29,26,27,26,29,21,68,18,68,21,29,
- 26,29,13,228,228,228,4,13,29,26,59,26,29,21,68,18,68,21,29,26,28,26,3,228,
- 228,196,13,29,26,91,26,29,21,68,18,68,21,29,58,29,26,3,228,228,132,21,29,26,
- 123,26,29,21,68,21,68,21,29,26,27,26,29,26,13,228,228,36,3,21,29,26,155,26,
- 29,21,68,21,68,21,29,26,59,26,29,28,13,228,196,3,21,27,29,26,187,26,29,21,
- 68,26,68,21,29,26,91,26,28,29,21,13,5,228,36,3,21,26,29,59,28,27,90,59,
- 26,29,21,68,26,68,21,29,26,155,26,61,26,21,45,67,45,53,28,29,28,26,28,58,
- 28,93,59,26,29,21,68,27,68,21,29,26,187,58,28,93,28,26,27,125,27,26,27,26,
- 29,21,35,45,21,29,28,26,29,21,68,22,68,21,29,26,251,27,90,27,60,27,90,91,
- 26,29,21,100,53,3,21,29,21,68,18,68,21,29,26,251,251,219,28,26,21,13,36,13,
- 3,4,3,53,68,18,68,21,29,26,251,251,187,26,29,21,3,4,3,45,68,21,26,68,
- 20,68,21,29,26,251,251,187,26,29,21,36,13,21,29,13,4,21,29,21,68,19,68,21,
- 29,26,251,251,219,29,26,3,36,13,29,26,21,26,29,21,68,19,68,21,29,26,251,251,
- 251,29,26,21,13,21,29,28,29,27,29,21,68,14,68,21,29,250,250,250,58,27,61,28,
- 122,29,21,68,9,68,21,253,253,253,253,125,21,68,9,68,13,245,245,245,245,117,13,68,
- 8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,
- 164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,
- 228,228,36,31,9,68,13,230,230,230,230,102,13,68,10,68,7,108,39,236,236,236,172,7,
- 68,19,68,6,12,7,6,3,36,3,6,12,11,9,235,235,203,9,12,6,68,14,68,6,
- 12,3,164,3,12,235,235,235,11,12,6,68,17,68,7,13,36,3,6,3,68,6,12,9,
- 235,235,203,12,6,68,17,68,6,3,4,3,7,44,3,36,3,12,235,235,235,12,6,68,
- 17,68,6,3,4,3,7,44,3,36,3,12,235,235,235,12,6,68,17,68,7,3,36,3,
- 6,3,68,13,12,9,235,235,203,12,6,68,15,68,7,6,228,7,12,139,41,139,41,235,
- 43,12,6,68,23,68,6,12,6,3,100,3,6,12,9,43,9,11,108,11,9,11,108,9,
- 235,12,6,68,22,68,6,44,7,102,11,12,43,9,44,11,38,163,13,6,7,44,9,171,
- 12,6,68,21,68,6,12,9,11,108,107,12,7,6,3,228,36,3,13,7,12,171,12,6,
- 68,20,68,6,12,43,105,11,9,12,11,6,3,228,196,6,44,9,75,12,6,68,19,68,
- 6,12,171,9,12,6,3,228,228,36,3,7,12,9,43,12,6,68,16,68,6,12,171,12,
- 6,228,228,132,3,7,12,43,12,6,68,15,68,6,12,139,12,6,228,228,196,3,43,9,
- 12,6,68,17,68,6,12,75,9,12,6,228,228,228,4,13,12,9,12,6,68,15,68,6,
- 12,43,9,12,6,228,228,228,68,6,44,6,68,16,68,6,12,11,9,12,6,228,68,99,
- 228,132,3,44,6,68,22,68,6,12,9,43,3,228,13,6,7,11,44,11,7,6,13,228,
- 68,6,12,6,68,20,68,6,12,9,12,6,196,3,7,76,107,76,7,3,228,4,13,12,
- 6,68,17,68,6,44,7,196,6,44,41,171,41,44,6,228,3,12,6,68,19,68,6,44,
- 13,164,6,12,9,75,9,43,9,139,9,12,6,228,39,68,20,68,6,12,7,3,132,3,
- 12,9,107,140,9,107,9,12,3,196,6,7,68,21,68,6,12,6,164,7,12,75,44,6,
- 35,13,6,12,139,12,7,196,6,7,68,22,68,6,12,3,132,3,12,9,107,3,132,6,
- 12,9,75,9,12,3,164,6,7,68,23,68,6,11,3,132,6,12,9,11,9,12,6,196,
- 7,12,75,9,12,6,164,6,7,68,22,68,39,164,6,12,9,11,9,12,3,196,6,12,
- 9,43,9,12,6,164,6,7,68,22,68,7,6,164,6,12,9,11,9,12,6,196,7,12,
- 75,9,12,6,164,6,7,68,22,68,7,6,164,6,12,9,75,7,3,132,6,12,9,75,
- 9,12,6,164,6,7,68,21,68,7,6,164,3,12,9,75,12,7,6,67,6,12,139,9,
- 12,3,164,39,68,18,68,7,6,196,7,12,107,76,11,44,171,12,7,164,3,11,6,68,
- 20,68,7,6,196,3,12,9,107,9,75,9,139,9,12,3,164,3,12,6,68,17,68,7,
- 6,228,6,12,9,235,107,9,12,6,196,6,12,6,68,18,68,7,6,228,4,6,44,9,
- 235,9,44,6,196,3,7,12,6,68,16,68,39,228,36,13,7,76,107,76,7,13,228,13,
- 44,6,68,19,68,6,12,3,228,68,13,6,7,108,7,6,13,228,36,7,44,6,68,15,
- 68,6,12,13,228,132,163,228,68,6,12,9,12,6,68,14,68,6,12,6,228,228,228,132,
- 3,43,9,12,6,68,15,68,6,44,3,228,228,228,100,6,12,9,11,12,6,68,15,68,
- 6,44,6,228,228,228,68,6,12,9,43,12,6,68,17,68,6,12,9,12,13,228,228,228,
- 4,6,12,9,75,12,6,68,15,68,6,12,9,43,3,228,228,196,6,12,139,12,6,68,
- 16,68,6,12,43,12,7,3,228,228,132,6,12,171,12,6,68,19,68,6,12,43,9,12,
- 7,3,228,228,36,3,6,12,137,43,12,6,68,19,68,6,12,75,9,44,6,228,196,3,
- 6,11,12,7,172,9,12,6,68,25,68,6,12,171,12,7,13,3,228,36,3,6,7,12,
- 11,9,12,7,6,45,6,7,44,6,68,22,68,6,12,171,9,44,7,6,13,163,38,11,
- 44,41,12,6,3,132,6,12,6,68,19,68,6,12,235,9,108,11,9,11,108,11,9,43,
- 12,6,228,6,7,68,20,68,6,12,235,43,41,139,41,107,9,12,3,68,13,6,3,36,
- 3,6,68,16,68,6,12,235,235,235,12,3,36,3,76,3,4,3,6,68,18,68,6,12,
- 235,235,235,12,3,36,3,11,12,7,3,4,3,6,68,17,68,6,12,235,235,203,9,12,
- 6,68,3,13,3,36,6,7,68,14,68,6,12,235,235,235,11,12,13,164,3,12,6,68,
- 14,68,6,12,235,235,235,43,12,6,99,6,44,6,68,16,68,6,12,9,235,235,235,41,
- 44,9,7,44,9,12,6,68,9,68,7,236,236,236,236,108,7,68,9,68,13,230,230,230,
- 230,102,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,
- 228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,
- 31,228,228,228,228,228,36,31,10,68,13,102,39,230,230,230,166,13,68,11,68,7,76,7,
- 38,236,236,236,172,7,68,17,68,6,12,6,3,68,7,12,9,235,235,235,11,9,12,6,
- 68,14,68,6,12,13,100,6,12,235,235,235,75,12,6,68,15,68,6,12,6,100,6,12,
- 9,235,235,235,43,12,6,68,17,68,6,12,7,6,3,36,6,12,9,235,235,235,43,12,
- 6,68,15,68,6,44,7,68,6,12,9,235,235,235,43,12,6,68,15,68,6,44,6,68,
- 13,12,9,235,235,235,43,12,6,68,16,68,6,44,6,68,3,12,235,41,139,41,235,43,
- 12,6,68,19,68,6,44,6,68,3,171,9,11,108,11,9,11,108,9,235,12,6,68,22,
- 68,6,12,11,7,102,9,75,9,44,11,38,163,13,6,7,44,9,171,12,6,68,22,68,
- 6,12,9,140,43,9,11,12,7,6,3,228,36,3,13,7,12,171,12,6,68,20,68,6,
- 12,43,105,11,9,12,11,6,3,228,196,6,44,9,75,12,6,68,19,68,6,12,171,9,
- 12,6,3,228,228,36,3,7,12,9,43,12,6,68,16,68,6,12,171,12,6,228,228,132,
- 3,7,12,43,12,6,68,15,68,6,12,139,12,6,228,228,196,3,43,9,12,6,68,17,
- 68,6,12,75,9,12,6,228,228,228,4,13,12,9,12,6,68,18,68,6,12,43,9,12,
- 6,228,132,3,13,6,228,68,6,44,6,68,21,68,6,12,11,9,12,6,228,68,3,13,
- 6,7,12,7,228,68,3,44,6,68,20,68,6,12,9,43,3,228,3,38,9,76,11,7,
- 3,228,68,6,12,6,68,21,68,6,12,9,12,6,196,3,6,76,11,41,43,12,3,228,
- 68,13,12,6,68,18,68,6,44,7,228,4,7,12,9,171,12,3,228,68,3,12,6,68,
- 17,68,6,44,13,228,4,6,12,9,139,9,12,13,228,100,39,68,19,68,6,12,7,3,
- 228,4,13,12,9,139,9,12,6,228,100,6,7,68,17,68,6,12,6,228,36,3,76,107,
- 9,12,6,228,100,6,7,68,19,68,6,12,3,228,68,7,6,13,7,75,9,12,6,228,
- 100,6,7,68,18,68,6,11,3,228,68,3,4,3,12,107,12,7,228,100,6,7,68,15,
- 68,39,228,164,3,12,9,75,12,7,228,100,6,7,68,15,68,7,6,228,164,13,12,9,
- 139,3,228,68,6,7,68,16,68,7,6,228,164,6,12,9,107,12,3,228,68,6,7,68,
- 16,68,7,6,228,164,6,12,9,75,9,12,3,228,68,39,68,17,68,7,6,228,164,6,
- 12,107,9,12,6,228,36,3,11,6,68,17,68,7,6,228,164,7,12,107,9,12,6,228,
- 36,3,12,6,68,18,68,7,6,228,132,3,7,12,107,9,12,6,228,36,6,12,6,68,
- 19,68,7,6,228,132,3,11,9,107,9,12,6,228,4,3,7,12,6,68,13,68,39,228,
- 132,3,236,7,228,4,13,44,6,68,17,68,6,12,3,228,100,3,70,103,9,7,3,228,
- 7,44,6,68,15,68,6,12,13,228,228,68,67,228,6,12,9,12,6,68,14,68,6,12,
- 6,228,228,228,132,3,43,9,12,6,68,15,68,6,44,3,228,228,228,100,6,12,9,11,
- 12,6,68,15,68,6,44,6,228,228,228,68,6,12,9,43,12,6,68,17,68,6,12,9,
- 12,13,228,228,228,4,6,12,9,75,12,6,68,15,68,6,12,9,43,3,228,228,196,6,
- 12,139,12,6,68,16,68,6,12,43,12,7,3,228,228,132,6,12,171,12,6,68,19,68,
- 6,12,43,9,12,7,3,228,228,36,3,6,12,105,75,12,6,68,19,68,6,12,75,9,
- 44,6,228,196,3,6,11,12,9,140,43,12,6,68,23,68,6,12,171,12,7,13,3,228,
- 36,3,6,7,12,11,9,12,134,12,9,12,6,68,25,68,6,12,171,9,44,7,6,13,
- 163,38,11,44,9,11,9,12,3,68,13,12,9,12,6,68,23,68,6,12,235,9,108,11,
- 9,11,108,11,9,75,9,12,6,68,6,12,9,12,6,68,19,68,6,12,235,43,41,139,
- 41,171,9,12,6,68,6,12,9,12,6,68,17,68,6,12,235,235,235,11,9,12,6,68,
- 6,12,9,12,6,68,15,68,6,12,235,235,235,43,12,6,68,6,7,44,6,68,14,68,
- 6,12,235,235,235,43,12,7,100,6,44,6,68,14,68,6,12,235,235,235,75,7,3,68,
- 3,44,6,68,17,68,6,12,235,235,235,75,12,3,4,3,13,6,11,12,6,68,17,68,
- 6,12,9,235,235,235,11,9,12,38,7,44,9,12,6,68,9,68,7,236,236,236,236,108,
- 7,68,9,68,13,230,230,230,230,102,13,68,8,31,228,228,228,228,228,36,31,8,31,228,
- 228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,
- 228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,10,68,13,102,39,230,230,230,
- 166,13,68,13,68,6,12,7,67,6,9,236,236,236,140,7,68,16,68,6,12,6,100,3,
- 6,12,9,235,235,235,9,12,6,68,15,68,6,12,6,35,68,3,12,235,235,235,43,12,
- 6,68,16,68,6,12,7,38,3,36,3,12,235,235,235,43,12,6,68,15,68,6,12,3,
- 132,13,12,9,235,235,235,11,12,6,68,14,68,7,6,68,35,6,9,235,235,235,75,12,
- 6,68,14,68,7,6,68,13,70,12,235,235,235,43,12,6,68,16,68,7,13,164,6,12,
- 9,171,41,139,41,235,43,12,6,68,20,68,7,3,164,3,12,9,75,9,11,108,11,9,
- 11,108,9,235,12,6,68,21,68,38,13,99,4,3,75,9,44,11,38,163,13,6,7,44,
- 9,171,12,6,68,22,68,6,108,11,39,6,9,43,12,7,6,3,228,36,3,13,7,12,
- 171,12,6,68,20,68,6,12,41,43,76,9,12,11,6,3,228,196,6,44,9,75,12,6,
- 68,19,68,6,12,171,9,12,6,3,228,228,36,3,7,12,9,43,12,6,68,16,68,6,
- 12,171,12,6,228,228,132,3,7,12,43,12,6,68,15,68,6,12,139,12,6,228,228,196,
- 3,43,9,12,6,68,19,68,6,12,75,9,12,6,164,3,13,35,228,196,13,12,9,12,
- 6,68,20,68,6,12,43,9,12,6,196,6,44,9,7,38,3,228,100,6,44,6,68,21,
- 68,6,12,11,9,12,6,228,7,12,9,11,108,6,13,228,36,3,44,6,68,21,68,6,
- 12,9,43,3,196,3,9,107,41,11,44,6,3,228,4,6,12,6,68,19,68,6,12,9,
- 12,6,228,3,12,235,9,12,7,228,4,13,12,6,68,20,68,6,44,7,228,4,13,12,
- 9,11,41,139,9,12,6,228,3,12,6,68,17,68,6,44,13,228,4,6,12,11,108,139,
- 12,6,228,4,39,68,19,68,6,12,7,3,228,4,131,6,7,12,107,12,7,228,4,6,
- 7,68,17,68,6,12,6,228,196,3,7,12,107,12,7,228,4,6,7,68,18,68,6,12,
- 3,228,36,3,70,7,44,139,12,6,228,4,6,7,68,17,68,6,11,3,228,4,13,140,
- 171,7,12,6,228,4,6,7,68,19,68,39,228,4,3,7,12,9,139,9,43,44,7,3,
- 228,4,6,7,68,18,68,7,6,228,4,13,12,9,139,76,39,6,3,228,36,6,7,68,
- 18,68,7,6,228,4,6,12,9,107,12,7,6,35,228,132,6,7,68,16,68,7,6,228,
- 4,7,12,139,9,3,36,99,228,36,39,68,18,68,7,6,228,3,203,9,6,39,9,44,
- 7,228,4,3,11,6,68,16,68,7,6,228,3,12,203,76,75,7,3,228,3,12,6,68,
- 15,68,7,6,228,3,12,235,139,12,3,228,6,12,6,68,18,68,7,6,228,3,12,9,
- 235,75,9,12,6,196,3,7,12,6,68,15,68,39,228,13,12,137,203,9,12,6,196,13,
- 44,6,68,16,68,6,12,3,196,13,236,75,73,12,7,196,7,44,6,68,18,68,6,12,
- 13,228,35,13,102,39,204,3,132,6,12,9,12,6,68,17,68,6,12,6,228,228,67,13,
- 102,3,100,3,43,9,12,6,68,15,68,6,44,3,228,228,228,100,6,12,9,11,12,6,
- 68,15,68,6,44,6,228,228,228,68,6,12,9,43,12,6,68,17,68,6,12,9,12,13,
- 228,228,228,4,6,12,9,75,12,6,68,15,68,6,12,9,43,3,228,228,196,6,12,139,
- 12,6,68,17,68,6,12,43,12,7,3,228,228,132,6,12,9,139,12,6,68,19,68,6,
- 12,43,9,12,7,3,228,228,36,3,6,108,75,9,12,6,68,19,68,6,12,75,9,44,
- 6,228,196,3,6,11,12,38,39,9,108,6,68,23,68,6,12,171,12,7,13,3,228,36,
- 3,6,7,12,11,12,3,68,67,13,12,6,68,20,68,6,12,171,9,44,7,6,13,163,
- 38,11,44,41,12,6,196,11,6,68,20,68,6,12,235,9,108,11,9,11,108,11,9,75,
- 12,6,164,3,12,6,68,16,68,6,12,235,43,41,139,41,203,7,70,68,3,12,6,68,
- 15,68,6,12,235,235,235,43,9,6,35,68,6,12,6,68,15,68,6,12,235,235,235,9,
- 12,6,100,35,7,12,6,68,16,68,6,12,235,235,235,9,12,13,68,38,7,11,12,6,
- 68,14,68,6,12,235,235,235,9,12,6,132,13,44,6,68,14,68,6,12,235,235,235,43,
- 9,3,100,6,44,6,68,16,68,6,12,9,235,235,235,9,11,12,38,35,6,44,6,68,
- 9,68,7,236,236,236,236,108,7,68,9,68,13,230,230,230,230,102,13,68,8,31,228,228,
- 228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,
- 228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,
- 10,68,13,38,39,230,230,230,230,13,68,13,68,6,12,7,38,7,9,236,236,236,172,7,
- 68,16,68,6,12,13,68,3,6,43,9,235,235,235,9,12,6,68,15,68,6,12,3,132,
- 6,12,9,235,235,235,11,12,6,68,16,68,6,12,70,3,36,6,12,9,235,235,235,11,
- 12,6,68,14,68,6,44,6,100,6,12,235,235,235,43,12,6,68,14,68,6,44,7,100,
- 6,12,235,235,235,43,12,6,68,16,68,6,7,38,35,36,6,12,9,235,235,235,11,12,
- 6,68,16,68,6,7,164,6,12,9,171,41,139,41,235,43,12,6,68,19,68,6,12,3,
- 100,13,171,9,11,108,11,9,11,108,9,235,12,6,68,21,68,6,12,67,38,12,107,9,
- 44,11,38,163,13,6,7,44,9,171,12,6,68,23,68,6,12,7,11,76,75,9,11,12,
- 7,6,3,228,36,3,13,7,12,171,12,6,68,20,68,6,12,43,41,75,9,12,11,6,
- 3,228,196,6,44,9,75,12,6,68,20,68,6,12,9,139,9,12,6,3,228,228,36,3,
- 7,12,9,43,12,6,68,16,68,6,12,171,12,6,228,228,132,3,7,12,43,12,6,68,
- 15,68,6,12,139,12,6,228,228,196,3,43,9,12,6,68,17,68,6,12,75,9,12,6,
- 228,228,228,4,13,12,9,12,6,68,15,68,6,12,43,9,12,6,228,228,228,68,6,44,
- 6,68,18,68,6,12,11,9,12,6,196,3,166,13,3,228,100,3,44,6,68,17,68,6,
- 12,9,43,3,196,6,236,7,6,228,68,6,12,6,68,20,68,6,12,9,12,6,228,6,
- 12,169,11,44,6,3,228,4,13,12,6,68,20,68,6,44,7,228,3,7,12,75,9,107,
- 7,12,6,228,4,3,12,6,68,17,68,6,44,13,228,3,11,9,11,108,107,12,7,228,
- 36,39,68,21,68,6,12,7,3,228,3,44,9,7,38,7,12,107,9,3,228,4,6,7,
- 68,21,68,6,12,6,228,4,3,6,35,36,3,6,12,107,12,3,228,4,6,7,68,16,
- 68,6,12,3,228,100,3,39,44,171,3,228,4,6,7,68,17,68,6,11,3,228,100,3,
- 12,171,9,12,6,228,36,6,7,68,15,68,39,228,132,3,7,171,12,7,3,228,36,6,
- 7,68,15,68,7,6,228,164,6,12,9,171,6,228,36,6,7,68,15,68,7,6,228,164,
- 6,12,171,44,3,228,4,6,7,68,15,68,7,6,228,164,67,6,12,107,12,3,228,4,
- 39,68,17,68,7,6,228,4,3,166,7,9,139,12,3,228,3,11,6,68,15,68,7,6,
- 228,4,3,11,172,203,3,228,3,12,6,68,18,68,7,6,228,36,6,12,9,235,9,12,
- 6,228,4,6,12,6,68,19,68,7,6,228,36,6,12,9,171,41,12,9,3,228,3,7,
- 12,6,68,19,68,39,228,36,6,12,9,75,41,11,44,6,3,228,4,13,44,6,68,20,
- 68,6,12,3,228,4,13,12,9,11,108,7,6,3,228,68,7,44,6,68,20,68,6,12,
- 13,228,4,3,44,9,7,38,35,228,100,6,12,9,12,6,68,15,68,6,12,6,228,36,
- 67,228,228,3,43,9,12,6,68,15,68,6,44,3,228,228,228,100,6,12,9,11,12,6,
- 68,15,68,6,44,6,228,228,228,68,6,12,9,43,12,6,68,17,68,6,12,9,12,13,
- 228,228,228,4,6,12,9,75,12,6,68,15,68,6,12,9,43,3,228,228,196,6,12,139,
- 12,6,68,16,68,6,12,43,12,7,3,228,228,132,6,12,171,12,6,68,21,68,6,12,
- 43,9,12,7,3,228,228,36,3,6,12,73,11,44,11,12,6,68,21,68,6,12,75,9,
- 44,6,228,196,3,6,11,12,9,11,76,39,11,12,6,68,24,68,6,12,171,12,7,13,
- 3,228,36,3,6,7,12,11,9,11,12,38,67,7,12,6,68,22,68,6,12,171,9,44,
- 7,6,13,163,38,11,44,9,43,12,13,132,6,12,6,68,20,68,6,12,235,9,108,11,
- 9,11,108,11,9,75,12,6,164,6,12,6,68,19,68,6,12,235,43,41,139,41,139,9,
- 12,6,68,3,38,7,12,6,68,17,68,6,12,235,235,235,11,12,7,3,68,6,12,11,
- 12,6,68,18,68,6,12,235,235,235,11,12,7,3,36,3,6,12,7,12,6,68,16,68,
- 6,12,235,235,235,11,12,6,68,45,3,7,12,6,68,15,68,6,12,235,235,235,11,12,
- 7,132,3,9,12,6,68,15,68,6,12,235,235,235,43,12,6,35,36,3,44,6,68,17,
- 68,6,12,9,235,235,235,11,9,44,39,6,7,11,12,6,68,9,68,7,236,236,236,236,
- 108,7,68,9,68,13,230,230,230,230,102,13,68,8,31,228,228,228,228,228,36,31,8,31,
- 228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,
- 31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,10,68,13,70,7,230,230,
- 230,230,13,68,12,68,7,44,7,67,6,236,236,236,140,7,68,16,68,6,44,13,68,13,
- 12,9,235,235,235,11,9,12,6,68,15,68,6,12,7,100,6,12,9,235,235,235,43,12,
- 6,68,16,68,6,12,13,4,35,4,6,12,235,235,235,75,12,6,68,15,68,39,36,3,
- 36,3,38,12,235,235,235,11,12,6,68,13,68,7,3,196,6,12,235,235,235,11,12,6,
- 68,13,68,38,35,132,7,12,235,235,235,11,12,6,68,16,68,6,76,3,36,3,6,235,
- 41,139,41,235,43,12,6,68,22,68,6,12,11,7,68,3,12,9,107,9,11,108,11,9,
- 11,108,9,235,12,6,68,21,68,6,44,7,3,70,107,9,44,11,38,163,13,6,7,44,
- 9,171,12,6,68,22,68,6,12,43,108,43,9,11,12,7,6,3,228,36,3,13,7,12,
- 171,12,6,68,20,68,6,12,43,73,43,9,12,11,6,3,228,196,6,44,9,75,12,6,
- 68,19,68,6,12,171,9,12,6,3,228,228,36,3,7,12,9,43,12,6,68,16,68,6,
- 12,171,12,6,228,228,132,3,7,12,43,12,6,68,15,68,6,12,139,12,6,228,228,196,
- 3,43,9,12,6,68,17,68,6,12,75,9,12,6,228,228,228,4,13,12,9,12,6,68,
- 19,68,6,12,43,9,12,6,228,4,3,134,39,3,228,4,6,44,6,68,18,68,6,12,
- 11,9,12,6,228,36,7,204,3,228,4,3,44,6,68,22,68,6,12,9,43,3,228,4,
- 13,12,7,41,43,9,12,3,228,36,6,12,6,68,19,68,6,12,9,12,6,228,36,7,
- 12,171,12,3,228,36,13,12,6,68,18,68,6,44,7,228,36,13,12,9,171,12,3,228,
- 36,3,12,6,68,17,68,6,44,13,228,36,7,12,11,44,107,12,3,228,68,39,68,22,
- 68,6,12,7,3,228,4,6,12,9,12,7,6,12,75,12,3,228,68,6,7,68,21,68,
- 6,12,6,228,36,7,12,9,12,45,12,9,43,12,3,228,68,6,7,68,22,68,6,12,
- 3,228,4,6,12,9,43,3,6,12,9,43,12,3,228,68,6,7,68,16,68,6,11,3,
- 228,3,7,12,75,7,171,102,228,6,7,68,16,68,39,228,4,6,12,9,75,12,171,76,
- 9,228,6,7,68,15,68,7,6,228,3,7,235,107,41,12,6,228,6,7,68,16,68,7,
- 6,228,6,12,43,73,235,9,12,6,228,6,7,68,14,68,7,6,228,6,39,140,203,9,
- 12,13,228,39,68,18,68,7,6,228,36,67,13,6,7,12,139,76,3,196,3,11,6,68,
- 16,68,7,6,228,196,7,12,107,12,70,3,196,3,12,6,68,16,68,7,6,228,164,3,
- 139,9,12,3,228,36,6,12,6,68,18,68,7,6,228,164,3,12,107,9,12,13,228,4,
- 3,7,12,6,68,17,68,39,228,164,6,12,7,9,75,12,6,228,4,13,44,6,68,16,
- 68,6,12,3,228,132,6,140,39,13,228,4,7,44,6,68,17,68,6,12,13,228,132,70,
- 13,67,228,36,6,12,9,12,6,68,14,68,6,12,6,228,228,228,132,3,43,9,12,6,
- 68,15,68,6,44,3,228,228,228,100,6,12,9,11,12,6,68,15,68,6,44,6,228,228,
- 228,68,6,12,9,43,12,6,68,17,68,6,12,9,12,13,228,228,228,4,6,12,9,75,
- 12,6,68,15,68,6,12,9,43,3,228,228,196,6,12,139,12,6,68,16,68,6,12,43,
- 12,7,3,228,228,132,6,12,171,12,6,68,19,68,6,12,43,9,12,7,3,228,228,36,
- 3,6,12,73,107,12,6,68,19,68,6,12,75,9,44,6,228,196,3,6,11,12,9,108,
- 75,12,6,68,26,68,6,12,171,12,7,13,3,228,36,3,6,7,12,11,9,12,38,13,
- 3,6,12,9,12,6,68,25,68,6,12,171,9,44,7,6,13,163,38,11,44,9,11,9,
- 12,6,68,6,12,7,12,6,68,21,68,6,12,235,9,108,11,9,11,108,11,9,75,12,
- 6,3,68,7,76,6,68,16,68,6,12,235,43,41,139,41,171,12,3,100,67,7,6,68,
- 13,68,6,12,235,235,235,12,7,196,3,12,6,68,17,68,6,12,235,235,235,12,7,6,
- 13,36,3,36,6,12,6,68,16,68,6,12,235,235,235,43,12,6,36,3,4,3,44,6,
- 68,15,68,6,12,235,235,235,11,9,12,6,100,6,44,6,68,17,68,6,12,235,235,235,
- 11,9,12,6,68,3,12,9,12,6,68,18,68,6,12,9,235,235,235,9,12,6,3,45,
- 6,12,9,12,6,68,9,68,7,236,236,236,236,108,7,68,9,68,13,230,230,230,230,102,
- 13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,
- 228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,
- 228,228,228,228,36,31,9,68,13,103,230,230,230,230,13,68,11,68,39,38,13,99,236,236,
- 236,108,7,68,14,68,7,3,164,3,12,9,235,235,235,9,12,6,68,14,68,7,3,164,
- 6,12,9,235,235,235,11,12,6,68,16,68,7,13,68,3,6,13,6,12,235,235,235,43,
- 12,6,68,14,68,7,6,68,3,13,6,235,235,235,107,12,6,68,15,68,6,12,3,132,
- 13,12,9,235,235,235,11,12,6,68,16,68,6,12,7,38,3,36,3,12,235,235,235,43,
- 12,6,68,17,68,6,12,6,35,68,3,12,203,41,139,41,235,43,12,6,68,20,68,6,
- 12,6,132,6,12,107,9,11,108,11,9,11,108,9,235,12,6,68,24,68,6,12,7,36,
- 3,6,7,12,75,9,44,11,38,163,13,6,7,44,9,171,12,6,68,24,68,6,12,9,
- 6,7,76,43,9,11,12,7,6,3,228,36,3,13,7,12,171,12,6,68,22,68,6,12,
- 11,44,11,9,43,9,12,11,6,3,228,196,6,44,9,75,12,6,68,19,68,6,12,171,
- 9,12,6,3,228,228,36,3,7,12,9,43,12,6,68,16,68,6,12,171,12,6,228,228,
- 132,3,7,12,43,12,6,68,15,68,6,12,139,12,6,228,228,196,3,43,9,12,6,68,
- 19,68,6,12,75,9,12,6,228,196,67,13,3,132,13,12,9,12,6,68,19,68,6,12,
- 43,9,12,6,164,99,102,39,9,76,3,164,6,44,6,68,20,68,6,12,11,9,12,6,
- 100,3,71,11,236,43,12,7,196,3,44,6,68,22,68,6,12,9,43,3,100,13,12,11,
- 12,43,105,107,9,12,6,228,6,12,6,68,20,68,6,12,9,12,6,132,3,12,9,235,
- 75,9,12,6,228,13,12,6,68,18,68,6,44,7,164,3,12,9,235,75,9,12,3,228,
- 3,12,6,68,15,68,6,44,13,164,3,12,235,137,11,3,228,4,39,68,16,68,6,12,
- 7,3,164,3,12,203,172,7,228,36,6,7,68,19,68,6,12,6,196,3,7,12,107,12,
- 7,35,13,102,228,36,6,7,68,16,68,6,12,3,228,6,12,139,12,6,3,228,196,6,
- 7,68,18,68,6,11,3,228,6,12,9,139,44,7,38,3,228,68,6,7,68,17,68,39,
- 228,4,3,12,9,139,9,11,108,6,228,36,6,7,68,19,68,7,6,228,36,6,12,75,
- 41,75,41,11,12,3,228,4,6,7,68,17,68,7,6,228,68,6,11,140,107,9,12,6,
- 228,4,6,7,68,16,68,7,6,228,100,67,13,6,7,139,12,7,228,4,39,68,16,68,
- 7,6,228,228,3,7,12,107,12,7,228,3,11,6,68,16,68,7,6,228,68,102,7,44,
- 139,12,7,228,3,12,6,68,16,68,7,6,228,68,6,108,171,9,12,6,228,6,12,6,
- 68,19,68,7,6,228,68,3,12,9,203,9,11,12,3,196,3,7,12,6,68,15,68,39,
- 228,68,3,203,9,11,44,13,228,13,44,6,68,19,68,6,12,3,228,68,7,11,73,11,
- 76,6,3,228,4,7,44,6,68,20,68,6,12,13,228,68,6,108,11,7,6,3,228,36,
- 6,12,9,12,6,68,16,68,6,12,6,228,68,102,35,228,100,3,43,9,12,6,68,15,
- 68,6,44,3,228,228,228,100,6,12,9,11,12,6,68,15,68,6,44,6,228,228,228,68,
- 6,12,9,43,12,6,68,17,68,6,12,9,12,13,228,228,228,4,6,12,9,75,12,6,
- 68,15,68,6,12,9,43,3,228,228,196,6,12,139,12,6,68,18,68,6,12,43,12,7,
- 3,228,228,132,6,12,75,9,43,12,6,68,21,68,6,12,43,9,12,7,3,228,228,36,
- 3,6,12,41,11,76,9,12,6,68,23,68,6,12,75,9,44,6,228,196,3,6,11,12,
- 9,44,9,7,6,7,11,12,6,68,25,68,6,12,171,12,7,13,3,228,36,3,6,7,
- 12,11,9,12,7,13,3,36,6,44,6,68,22,68,6,12,171,9,44,7,6,13,163,38,
- 11,44,9,11,12,6,132,13,44,6,68,22,68,6,12,235,9,108,11,9,11,108,11,9,
- 43,9,12,13,68,35,6,44,6,68,18,68,6,12,235,43,41,139,41,139,9,12,13,68,
- 13,38,44,6,68,14,68,6,12,235,235,235,9,12,6,164,6,12,6,68,15,68,6,12,
- 235,235,235,43,12,38,3,68,3,12,6,68,15,68,6,12,235,235,235,11,12,7,67,68,
- 3,12,6,68,14,68,6,12,235,235,235,9,12,6,164,3,12,6,68,13,68,6,12,235,
- 235,235,9,12,6,196,11,6,68,16,68,6,12,9,235,235,203,9,12,13,35,13,102,12,
- 6,68,9,68,7,236,236,236,236,108,6,68,9,68,13,230,230,230,230,102,13,68,8,31,
- 228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,
- 7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,
- 36,31,9,68,13,230,230,230,230,102,13,68,9,68,7,236,236,236,236,108,7,68,16,68,
- 7,6,3,13,38,11,9,235,235,235,75,9,12,6,68,13,68,7,13,68,7,44,235,235,
- 235,107,12,6,68,14,68,7,3,36,3,70,12,235,235,235,75,12,6,68,13,68,6,3,
- 164,13,12,235,235,235,43,12,6,68,15,68,6,3,36,35,68,7,12,235,235,235,11,12,
- 6,68,15,68,7,3,36,38,68,7,12,235,235,235,11,12,6,68,15,68,7,6,164,3,
- 9,203,41,139,41,235,43,12,6,68,21,68,6,12,3,100,3,6,12,107,9,11,108,11,
- 9,11,108,9,235,12,6,68,22,68,6,12,11,102,7,12,75,9,44,11,38,163,13,6,
- 7,44,9,171,12,6,68,22,68,6,12,11,140,43,9,11,12,7,6,3,228,36,3,13,
- 7,12,171,12,6,68,19,68,6,12,137,43,9,12,11,6,3,228,196,6,44,9,75,12,
- 6,68,19,68,6,12,171,9,12,6,3,228,228,36,3,7,12,9,43,12,6,68,16,68,
- 6,12,171,12,6,228,228,132,3,7,12,43,12,6,68,15,68,6,12,139,12,6,228,228,
- 196,3,43,9,12,6,68,17,68,6,12,75,9,12,6,228,228,228,4,13,12,9,12,6,
- 68,15,68,6,12,43,9,12,6,228,228,228,68,6,44,6,68,15,68,6,12,11,9,12,
- 6,228,228,228,100,3,44,6,68,19,68,6,12,9,43,3,132,6,7,6,13,35,228,228,
- 36,6,12,6,68,19,68,6,12,9,12,6,164,6,108,9,7,6,13,228,196,13,12,6,
- 68,17,68,6,44,7,196,7,12,41,43,44,3,228,196,3,12,6,68,15,68,6,44,13,
- 164,3,139,9,12,6,228,228,4,39,68,17,68,6,12,7,3,164,3,12,139,12,3,228,
- 228,4,6,7,68,19,68,6,12,6,196,13,12,9,75,12,7,13,134,3,228,68,6,7,
- 68,16,68,6,12,3,196,6,12,9,139,204,6,228,36,6,7,68,18,68,6,11,3,196,
- 6,12,9,139,169,11,12,6,228,4,6,7,68,16,68,39,228,6,12,9,107,9,11,9,
- 203,3,228,6,7,68,17,68,7,6,228,6,12,9,75,140,107,9,12,13,228,6,7,68,
- 23,68,7,6,228,6,12,9,43,12,7,13,3,13,7,12,75,9,12,6,228,6,7,68,
- 21,68,7,6,228,13,12,9,43,12,7,68,6,12,9,43,9,12,6,228,39,68,19,68,
- 7,6,228,3,12,107,12,70,12,107,9,12,6,196,3,11,6,68,18,68,7,6,228,4,
- 7,12,107,76,139,9,12,3,196,3,12,6,68,19,68,7,6,228,4,6,12,9,107,9,
- 139,9,12,7,228,6,12,6,68,19,68,7,6,228,4,3,7,12,9,203,41,44,3,196,
- 3,7,12,6,68,16,68,39,228,36,3,7,44,107,108,7,3,228,13,44,6,68,21,68,
- 6,12,3,228,36,3,6,7,9,44,11,39,6,13,228,36,7,44,6,68,15,68,6,12,
- 13,228,132,131,228,100,6,12,9,12,6,68,14,68,6,12,6,228,228,228,132,3,43,9,
- 12,6,68,15,68,6,44,3,228,228,228,100,6,12,9,11,12,6,68,15,68,6,44,6,
- 228,228,228,68,6,12,9,43,12,6,68,17,68,6,12,9,12,13,228,228,228,4,6,12,
- 9,75,12,6,68,15,68,6,12,9,43,3,228,228,196,6,12,139,12,6,68,16,68,6,
- 12,43,12,7,3,228,228,132,6,12,171,12,6,68,19,68,6,12,43,9,12,7,3,228,
- 228,36,3,6,12,137,43,12,6,68,19,68,6,12,75,9,44,6,228,196,3,6,11,12,
- 9,172,9,12,6,68,25,68,6,12,171,12,7,13,3,228,36,3,6,7,12,11,9,12,
- 7,38,13,6,7,44,6,68,22,68,6,12,171,9,44,7,6,13,163,38,11,44,41,12,
- 6,3,132,6,12,6,68,20,68,6,12,235,9,108,11,9,11,108,11,9,75,12,3,164,
- 3,12,6,68,19,68,6,12,235,43,41,139,41,171,9,3,36,3,6,36,3,11,6,68,
- 15,68,6,12,235,235,235,11,12,3,36,35,68,7,6,68,13,68,6,12,235,235,235,9,
- 12,6,196,7,6,68,16,68,6,12,235,235,235,43,12,7,38,3,36,3,12,6,68,14,
- 68,6,12,235,235,235,75,44,9,68,3,12,6,68,14,68,6,12,235,235,235,139,7,38,
- 3,6,12,6,68,15,68,6,12,9,235,235,235,75,9,11,76,11,12,6,68,9,68,7,
- 236,236,236,236,108,7,68,9,68,13,230,230,230,230,102,13,68,8,31,228,228,228,228,228,
- 36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,
- 228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,11,68,13,
- 7,6,167,230,230,230,102,13,68,13,68,6,9,7,134,13,9,236,236,236,76,7,68,14,
- 68,6,3,164,3,12,9,235,235,235,9,12,6,68,14,68,7,6,164,6,12,9,235,235,
- 235,11,12,6,68,14,68,39,4,35,68,6,12,235,235,235,43,12,6,68,15,68,6,12,
- 39,3,36,3,12,235,235,235,75,12,6,68,15,68,6,44,3,68,6,12,9,235,235,235,
- 43,12,6,68,14,68,6,12,6,100,6,12,235,235,235,75,12,6,68,18,68,6,12,6,
- 3,36,3,12,235,11,41,139,41,235,43,12,6,68,22,68,6,44,7,6,3,6,12,9,
- 139,9,11,108,11,9,11,108,9,235,12,6,68,22,68,6,12,9,44,11,7,139,9,44,
- 11,38,163,13,6,7,44,9,171,12,6,68,22,68,6,12,43,9,139,9,11,12,7,6,
- 3,228,36,3,13,7,12,171,12,6,68,18,68,6,12,203,9,12,11,6,3,228,196,6,
- 44,9,75,12,6,68,19,68,6,12,171,9,12,6,3,228,228,36,3,7,12,9,43,12,
- 6,68,16,68,6,12,171,12,6,228,228,132,3,7,12,43,12,6,68,15,68,6,12,139,
- 12,6,228,228,196,3,43,9,12,6,68,17,68,6,12,75,9,12,6,228,228,228,4,13,
- 12,9,12,6,68,18,68,6,12,43,9,12,6,228,132,131,13,6,3,164,6,44,6,68,
- 20,68,6,12,11,9,12,6,100,67,13,134,39,9,140,13,164,3,44,6,68,19,68,6,
- 12,9,43,3,100,6,236,44,75,9,11,7,228,6,12,6,68,19,68,6,12,9,12,6,
- 132,3,12,169,171,9,12,6,228,13,12,6,68,17,68,6,44,7,196,7,12,235,75,9,
- 12,13,228,3,12,6,68,17,68,6,44,13,196,6,12,9,235,43,12,7,3,228,4,39,
- 68,20,68,6,12,7,3,196,3,12,9,43,44,139,9,12,6,228,36,6,7,68,20,68,
- 6,12,6,228,3,11,44,9,39,12,107,9,12,13,228,36,6,7,68,19,68,6,12,3,
- 228,4,45,35,4,6,12,139,9,3,228,36,6,7,68,18,68,6,11,3,228,132,6,12,
- 9,75,9,12,6,228,68,6,7,68,15,68,39,228,132,3,12,139,9,12,13,228,68,6,
- 7,68,14,68,7,6,228,132,7,12,203,3,228,68,6,7,68,16,68,7,6,228,100,6,
- 12,9,139,12,6,228,100,6,7,68,15,68,7,6,228,68,3,12,171,9,12,6,228,100,
- 39,68,18,68,7,6,228,36,3,7,12,9,171,12,3,228,68,3,11,6,68,17,68,7,
- 6,228,36,13,76,9,107,12,6,228,100,3,12,6,68,19,68,7,6,228,68,3,6,7,
- 44,11,41,12,6,228,100,6,12,6,68,19,68,7,6,228,132,3,6,7,44,11,12,3,
- 228,68,3,7,12,6,68,14,68,39,228,228,3,6,12,7,228,100,13,44,6,68,14,68,
- 6,12,3,228,228,4,35,228,100,7,44,6,68,14,68,6,12,13,228,228,228,164,6,12,
- 9,12,6,68,14,68,6,12,6,228,228,228,132,3,43,9,12,6,68,15,68,6,44,3,
- 228,228,228,100,6,12,9,11,12,6,68,15,68,6,44,6,228,228,228,68,6,12,9,43,
- 12,6,68,17,68,6,12,9,12,13,228,228,228,4,6,12,9,75,12,6,68,15,68,6,
- 12,9,43,3,228,228,196,6,12,139,12,6,68,16,68,6,12,43,12,7,3,228,228,132,
- 6,12,171,12,6,68,19,68,6,12,43,9,12,7,3,228,228,36,3,6,12,9,171,12,
- 6,68,21,68,6,12,75,9,44,6,228,196,3,6,11,12,9,11,44,9,75,12,6,68,
- 24,68,6,12,171,12,7,13,3,228,36,3,6,7,12,11,9,11,12,39,44,43,12,6,
- 68,26,68,6,12,171,9,44,7,6,13,163,38,11,44,9,43,9,12,6,4,13,6,12,
- 11,12,6,68,22,68,6,12,235,9,108,11,9,11,108,11,9,107,9,12,3,68,3,7,
- 12,6,68,16,68,6,12,235,43,41,139,41,203,12,7,100,13,44,6,68,15,68,6,12,
- 235,235,235,11,9,12,6,68,3,76,6,68,16,68,6,12,235,235,235,11,9,12,3,68,
- 6,39,12,6,68,17,68,6,12,235,235,235,11,12,7,3,68,3,4,6,12,6,68,14,
- 68,6,12,235,235,235,9,12,6,164,3,12,6,68,14,68,6,12,235,235,235,9,12,3,
- 164,3,11,6,68,13,68,6,12,9,235,235,235,11,134,71,12,6,68,9,68,7,236,236,
- 236,236,108,6,68,9,68,13,230,230,230,230,102,13,68,8,31,228,228,228,228,228,36,31,
- 8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,
- 95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,13,230,230,
- 230,230,102,13,68,10,68,7,76,39,236,236,236,204,7,68,18,68,6,12,7,3,36,3,
- 7,12,9,235,235,235,11,9,12,6,68,17,68,6,12,13,4,35,4,3,12,9,235,235,
- 235,43,12,6,68,17,68,6,12,3,4,13,3,4,3,12,235,235,235,75,12,6,68,15,
- 68,6,12,6,100,13,12,9,235,235,235,43,12,6,68,17,68,6,7,3,4,35,36,6,
- 12,9,235,235,235,11,12,6,68,16,68,7,6,36,38,36,13,12,9,235,235,235,11,12,
- 6,68,15,68,39,164,6,12,9,171,41,139,41,235,43,12,6,68,21,68,6,12,6,3,
- 68,13,12,139,9,11,108,11,9,11,108,9,235,12,6,68,22,68,6,44,7,38,7,12,
- 107,9,44,11,38,163,13,6,7,44,9,171,12,6,68,23,68,6,12,9,108,9,43,9,
- 11,12,7,6,3,228,36,3,13,7,12,171,12,6,68,20,68,6,12,43,41,75,9,12,
- 11,6,3,228,196,6,44,9,75,12,6,68,19,68,6,12,171,9,12,6,3,228,228,36,
- 3,7,12,9,43,12,6,68,16,68,6,12,171,12,6,228,228,132,3,7,12,43,12,6,
- 68,15,68,6,12,139,12,6,228,228,196,3,43,9,12,6,68,17,68,6,12,75,9,12,
- 6,228,228,228,4,13,12,9,12,6,68,15,68,6,12,43,9,12,6,228,228,228,68,6,
- 44,6,68,19,68,6,12,11,9,12,6,228,36,3,13,38,3,228,132,3,44,6,68,19,
- 68,6,12,9,43,3,228,4,6,11,108,7,3,228,100,6,12,6,68,20,68,6,12,9,
- 12,6,228,4,6,12,11,105,44,13,228,68,13,12,6,68,20,68,6,44,7,228,4,6,
- 12,9,11,44,107,12,3,228,36,3,12,6,68,20,68,6,44,13,228,4,7,12,11,12,
- 7,6,75,9,12,6,228,68,39,68,20,68,6,12,7,3,228,3,107,3,4,6,12,41,
- 12,6,228,68,6,7,68,22,68,6,12,6,228,4,3,9,43,12,38,7,12,11,9,12,
- 6,228,68,6,7,68,19,68,6,12,3,228,36,6,12,43,76,43,9,12,13,228,68,6,
- 7,68,19,68,6,11,3,228,36,3,12,9,11,41,107,7,3,228,68,6,7,68,18,68,
- 39,228,36,3,6,12,107,9,75,12,6,3,228,36,6,7,68,19,68,7,6,228,36,6,
- 12,9,11,140,43,9,12,6,228,36,6,7,68,23,68,7,6,228,4,3,12,9,11,12,
- 6,67,6,12,43,9,12,3,228,4,6,7,68,22,68,7,6,228,4,6,12,41,12,6,
- 68,6,12,9,11,9,12,6,228,4,39,68,23,68,7,6,228,4,6,12,9,43,12,7,
- 6,7,12,75,9,12,6,228,3,11,6,68,19,68,7,6,228,4,3,12,9,75,76,107,
- 9,12,3,228,3,12,6,68,18,68,7,6,228,36,6,12,9,235,9,12,6,228,4,6,
- 12,6,68,22,68,7,6,228,36,3,7,12,11,9,107,9,11,12,7,3,228,3,7,12,
- 6,68,15,68,39,228,68,3,6,236,6,3,228,4,13,44,6,68,15,68,6,12,3,228,
- 100,3,166,3,228,68,7,44,6,68,14,68,6,12,13,228,228,228,164,6,12,9,12,6,
- 68,14,68,6,12,6,228,228,228,132,3,43,9,12,6,68,15,68,6,44,3,228,228,228,
- 100,6,12,9,11,12,6,68,15,68,6,44,6,228,228,228,68,6,12,9,43,12,6,68,
- 17,68,6,12,9,12,13,228,228,228,4,6,12,9,75,12,6,68,15,68,6,12,9,43,
- 3,228,228,196,6,12,139,12,6,68,16,68,6,12,43,12,7,3,228,228,132,6,12,171,
- 12,6,68,21,68,6,12,43,9,12,7,3,228,228,36,3,6,12,9,11,41,75,12,6,
- 68,21,68,6,12,75,9,44,6,228,196,3,6,11,12,9,11,108,11,9,12,6,68,24,
- 68,6,12,171,12,7,13,3,228,36,3,6,7,12,11,9,11,12,102,12,11,12,6,68,
- 23,68,6,12,171,9,44,7,6,13,163,38,11,44,9,43,12,6,100,13,11,12,6,68,
- 21,68,6,12,235,9,108,11,9,11,108,11,9,43,9,12,6,164,6,12,6,68,21,68,
- 6,12,235,43,41,139,41,139,9,12,6,36,3,6,3,4,13,12,6,68,18,68,6,12,
- 235,235,235,11,12,7,3,4,35,4,3,6,12,6,68,15,68,6,12,235,235,235,11,9,
- 12,6,100,3,44,6,68,19,68,6,12,235,235,235,11,9,12,13,4,3,6,4,3,9,
- 12,6,68,17,68,6,12,235,235,235,11,9,12,6,36,3,4,3,44,6,68,16,68,6,
- 12,235,235,235,75,12,6,3,4,3,7,44,6,68,17,68,6,12,9,235,235,235,11,9,
- 11,12,39,44,9,12,6,68,9,68,7,236,236,236,236,108,7,68,9,68,13,230,230,230,
- 230,102,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,
- 228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,
- 31,228,228,228,228,228,36,31,9,68,13,230,230,230,230,102,13,68,9,68,7,236,236,236,
- 236,108,7,68,15,68,6,12,6,99,6,12,235,235,235,43,9,12,6,68,14,68,7,6,
- 164,6,12,9,235,235,235,11,12,6,68,14,68,7,3,36,35,36,3,235,235,235,75,12,
- 6,68,16,68,6,3,36,3,6,68,7,12,235,235,235,11,12,6,68,13,68,7,13,196,
- 7,12,235,235,235,11,12,6,68,16,68,6,7,3,4,35,68,7,12,235,235,235,11,12,
- 6,68,19,68,6,44,7,9,3,36,3,7,12,171,41,139,41,235,43,12,6,68,23,68,
- 6,12,9,12,7,3,36,3,12,107,9,11,108,11,9,11,108,9,235,12,6,68,23,68,
- 6,12,43,9,39,38,12,43,9,44,11,38,163,13,6,7,44,9,171,12,6,68,22,68,
- 6,12,75,108,11,9,11,12,7,6,3,228,36,3,13,7,12,171,12,6,68,20,68,6,
- 12,139,9,11,9,12,11,6,3,228,196,6,44,9,75,12,6,68,19,68,6,12,171,9,
- 12,6,3,228,228,36,3,7,12,9,43,12,6,68,16,68,6,12,171,12,6,228,228,132,
- 3,7,12,43,12,6,68,15,68,6,12,139,12,6,228,228,196,3,43,9,12,6,68,17,
- 68,6,12,75,9,12,6,228,228,228,4,13,12,9,12,6,68,15,68,6,12,43,9,12,
- 6,228,228,228,68,6,44,6,68,15,68,6,12,11,9,12,6,228,228,228,100,3,44,6,
- 68,19,68,6,12,9,43,3,228,3,13,70,39,38,3,228,68,6,12,6,68,19,68,6,
- 12,9,12,6,196,3,6,11,236,12,6,228,36,13,12,6,68,20,68,6,44,7,196,3,
- 7,12,11,41,139,41,12,6,228,4,3,12,6,68,17,68,6,44,13,196,6,12,9,235,
- 43,9,12,13,228,4,39,68,19,68,6,12,7,3,164,3,12,9,139,44,139,12,7,228,
- 4,6,7,68,20,68,6,12,6,196,6,12,9,107,12,39,9,12,107,12,3,228,6,7,
- 68,24,68,6,12,3,196,6,12,9,75,12,6,3,4,3,7,12,43,9,12,13,228,6,
- 7,68,24,68,6,11,3,196,6,12,9,75,12,6,3,4,3,7,12,43,9,12,6,228,
- 6,7,68,20,68,39,228,13,12,9,107,12,9,7,11,12,75,9,12,6,228,6,7,68,
- 16,68,7,6,228,3,12,203,12,139,9,12,6,228,6,7,68,18,68,7,6,228,4,6,
- 12,41,75,41,139,9,12,6,228,6,7,68,15,68,7,6,228,4,3,6,236,107,9,12,
- 6,228,39,68,20,68,7,6,228,68,13,6,71,38,7,12,75,9,12,13,196,3,11,6,
- 68,16,68,7,6,228,228,4,3,7,139,12,3,196,3,12,6,68,17,68,7,6,228,228,
- 4,6,12,9,107,12,3,196,6,12,6,68,17,68,7,6,228,228,3,12,11,105,12,7,
- 196,3,7,12,6,68,13,68,39,228,228,6,11,172,6,196,13,44,6,68,17,68,6,12,
- 3,228,228,35,13,38,7,12,6,196,7,44,6,68,15,68,6,12,13,228,228,164,35,164,
- 6,12,9,12,6,68,14,68,6,12,6,228,228,228,132,3,43,9,12,6,68,15,68,6,
- 44,3,228,228,228,100,6,12,9,11,12,6,68,15,68,6,44,6,228,228,228,68,6,12,
- 9,43,12,6,68,17,68,6,12,9,12,13,228,228,228,4,6,12,9,75,12,6,68,15,
- 68,6,12,9,43,3,228,228,196,6,12,139,12,6,68,16,68,6,12,43,12,7,3,228,
- 228,132,6,12,171,12,6,68,19,68,6,12,43,9,12,7,3,228,228,36,3,6,12,41,
- 139,12,6,68,17,68,6,12,75,9,44,6,228,196,3,6,11,172,75,12,6,68,22,68,
- 6,12,171,12,7,13,3,228,36,3,6,7,12,11,12,70,39,75,12,6,68,24,68,6,
- 12,171,9,44,7,6,13,163,38,11,44,41,12,13,68,6,12,11,9,12,6,68,23,68,
- 6,12,235,9,108,11,9,11,108,11,9,75,12,3,36,3,7,6,7,44,6,68,16,68,
- 6,12,235,43,41,139,41,203,3,132,3,6,12,6,68,14,68,6,12,235,235,235,11,9,
- 3,164,3,12,6,68,15,68,6,12,235,235,235,11,12,3,36,38,68,7,6,68,15,68,
- 6,12,235,235,235,9,12,3,36,35,68,11,6,68,14,68,6,12,235,235,235,11,12,6,
- 164,6,12,6,68,15,68,6,12,235,235,235,43,12,6,67,13,6,44,6,68,14,68,6,
- 12,9,235,235,235,11,9,172,9,12,6,68,9,68,7,236,236,236,236,108,7,68,9,68,
- 13,230,230,230,230,102,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,
- 36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,
- 228,36,31,8,31,228,228,228,228,228,36,31,10,68,13,70,71,230,230,230,166,13,68,13,
- 68,7,44,7,6,13,6,236,236,236,172,7,68,18,68,6,12,6,4,13,6,35,7,11,
- 9,235,235,235,9,12,6,68,15,68,39,35,6,44,13,3,12,235,235,235,43,12,6,68,
- 19,68,7,6,13,9,4,6,12,7,3,7,12,235,235,235,11,12,6,68,19,68,7,13,
- 6,12,6,4,7,12,3,6,12,235,235,235,11,12,6,68,18,68,7,6,3,44,6,3,
- 6,3,7,12,235,235,235,11,12,6,68,19,68,6,12,3,6,11,12,13,4,6,12,9,
- 235,235,235,11,12,6,68,16,68,6,12,7,99,6,12,235,41,139,41,235,43,12,6,68,
- 19,68,6,76,38,7,12,171,9,11,108,11,9,11,108,9,235,12,6,68,22,68,6,12,
- 9,11,76,9,107,9,44,11,38,163,13,6,7,44,9,171,12,6,68,20,68,6,12,235,
- 9,11,12,7,6,3,228,36,3,13,7,12,171,12,6,68,18,68,6,12,203,9,12,11,
- 6,3,228,196,6,44,9,75,12,6,68,19,68,6,12,171,9,12,6,3,228,228,36,3,
- 7,12,9,43,12,6,68,16,68,6,12,171,12,6,228,228,132,3,7,12,43,12,6,68,
- 15,68,6,12,139,12,6,228,228,196,3,43,9,12,6,68,17,68,6,12,75,9,12,6,
- 228,228,228,4,13,12,9,12,6,68,18,68,6,12,43,9,12,6,228,4,35,45,35,228,
- 100,6,44,6,68,19,68,6,12,11,9,12,6,228,38,9,108,9,38,228,36,3,44,6,
- 68,19,68,6,12,9,43,3,164,3,7,236,44,7,3,228,4,6,12,6,68,21,68,6,
- 12,9,12,6,164,6,44,11,12,38,45,38,108,6,228,13,12,6,68,23,68,6,44,7,
- 164,6,12,9,12,7,3,164,3,6,12,9,12,6,196,3,12,6,68,20,68,6,44,13,
- 132,3,12,9,12,43,3,228,6,12,9,12,3,196,39,68,21,68,6,12,7,3,132,7,
- 12,11,6,11,44,3,228,6,44,7,196,6,7,68,21,68,6,12,6,132,13,44,6,4,
- 6,44,7,3,228,6,44,13,164,6,7,68,20,68,6,12,3,132,6,44,3,36,6,44,
- 6,228,3,44,6,164,6,7,68,22,68,6,11,3,100,3,7,12,6,100,6,44,6,228,
- 6,12,7,3,132,6,7,68,20,68,39,132,3,44,6,100,3,7,11,12,6,196,6,44,
- 3,132,6,7,68,21,68,7,6,132,3,44,6,132,3,12,11,12,13,164,6,44,3,132,
- 6,7,68,21,68,7,6,132,3,44,6,164,13,12,11,12,3,132,6,44,3,132,6,7,
- 68,20,68,7,6,132,3,44,6,196,6,12,11,7,3,100,6,44,3,132,39,68,22,68,
- 7,6,132,3,7,12,6,228,6,44,6,100,6,12,7,3,100,3,11,6,68,20,68,7,
- 6,164,6,44,3,228,6,44,6,36,3,44,6,132,3,12,6,68,21,68,7,6,164,13,
- 44,6,228,3,7,44,6,4,6,44,13,132,6,12,6,68,21,68,7,6,196,7,44,6,
- 228,3,44,11,6,11,12,7,132,3,7,12,6,68,20,68,39,196,3,12,9,12,6,228,
- 3,43,12,9,12,3,132,13,44,6,68,23,68,6,12,3,196,6,12,9,12,6,3,164,
- 3,7,12,9,12,6,164,7,44,6,68,22,68,6,12,13,228,6,76,11,38,45,38,12,
- 11,44,6,164,6,12,9,12,6,68,19,68,6,12,6,228,4,3,7,236,44,7,3,164,
- 3,43,9,12,6,68,19,68,6,44,3,228,36,38,9,108,9,38,228,6,12,9,11,12,
- 6,68,18,68,6,44,6,228,100,35,45,35,228,4,6,12,9,43,12,6,68,17,68,6,
- 12,9,12,13,228,228,228,4,6,12,9,75,12,6,68,15,68,6,12,9,43,3,228,228,
- 196,6,12,139,12,6,68,16,68,6,12,43,12,7,3,228,228,132,6,12,171,12,6,68,
- 19,68,6,12,43,9,12,7,3,228,228,36,3,6,12,9,171,12,6,68,18,68,6,12,
- 75,9,44,6,228,196,3,6,11,12,9,203,12,6,68,20,68,6,12,171,12,7,13,3,
- 228,36,3,6,7,12,11,9,235,12,6,68,22,68,6,12,171,9,44,7,6,13,163,38,
- 11,44,9,107,9,76,11,9,12,6,68,19,68,6,12,235,9,108,11,9,11,108,11,9,
- 171,12,7,38,76,6,68,16,68,6,12,235,43,41,139,41,235,12,6,99,7,12,6,68,
- 19,68,6,12,235,235,235,11,9,12,6,4,13,12,11,6,3,12,6,68,18,68,6,12,
- 235,235,235,11,12,7,3,6,3,6,44,3,6,7,68,19,68,6,12,235,235,235,11,12,
- 6,3,12,7,4,6,12,6,13,7,68,19,68,6,12,235,235,235,11,12,7,3,7,12,
- 6,4,9,13,6,7,68,15,68,6,12,235,235,235,43,12,3,13,44,6,35,39,68,18,
- 68,6,12,9,235,235,235,9,11,7,35,6,13,4,6,12,6,68,13,68,7,236,236,236,
- 172,6,13,6,7,44,7,68,10,68,13,230,230,230,166,71,70,13,68,8,31,228,228,228,
- 228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,
- 228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,
- 68,13,230,230,230,230,102,13,68,12,68,6,44,7,12,6,236,236,236,204,7,68,17,68,
- 6,7,3,4,35,6,12,9,235,235,235,43,9,12,6,68,17,68,7,6,4,6,13,4,
- 3,6,12,235,235,235,75,12,6,68,15,68,7,6,3,12,71,6,12,235,235,235,75,12,
- 6,68,15,68,39,3,43,44,13,6,12,235,235,235,43,12,6,68,18,68,6,12,6,7,
- 12,9,12,6,3,12,235,235,235,43,12,6,68,17,68,6,12,7,70,12,13,4,7,12,
- 235,235,235,11,12,6,68,16,68,6,12,11,6,100,3,235,41,139,41,235,43,12,6,68,
- 22,68,6,12,11,12,13,70,7,12,107,9,11,108,11,9,11,108,9,235,12,6,68,22,
- 68,6,12,9,12,7,108,75,9,44,11,38,163,13,6,7,44,9,171,12,6,68,22,68,
- 6,12,107,41,43,9,11,12,7,6,3,228,36,3,13,7,12,171,12,6,68,18,68,6,
- 12,203,9,12,11,6,3,228,196,6,44,9,75,12,6,68,20,68,6,12,171,9,12,6,
- 3,228,3,228,4,3,7,12,9,43,12,6,68,18,68,6,12,171,12,6,228,36,6,228,
- 36,3,7,12,43,12,6,68,18,68,6,12,139,12,6,228,68,7,3,228,36,3,43,9,
- 12,6,68,24,68,6,12,75,9,12,6,36,3,13,70,13,35,36,12,6,228,68,13,12,
- 9,12,6,68,22,68,6,12,43,9,12,6,4,3,6,204,7,38,9,12,6,228,68,6,
- 44,6,68,23,68,6,12,11,9,12,6,4,3,44,11,137,11,76,43,12,3,228,36,3,
- 44,6,68,24,68,6,12,9,43,3,4,7,12,9,75,9,75,73,43,12,7,3,228,36,
- 6,12,6,68,23,68,6,12,9,12,6,4,3,12,9,75,204,75,9,12,7,3,228,4,
- 13,12,6,68,25,68,6,44,7,36,13,12,9,43,12,7,13,67,13,7,11,9,108,11,
- 3,228,3,12,6,68,20,68,6,44,13,36,6,12,9,11,12,6,132,3,76,7,134,3,
- 228,39,68,24,68,6,12,7,3,36,13,12,9,11,12,3,100,3,39,6,35,36,3,228,
- 68,6,7,68,19,68,6,12,6,68,3,12,11,12,7,132,45,164,38,228,36,6,7,68,
- 17,68,6,12,3,100,7,44,6,228,164,7,6,228,4,6,7,68,17,68,6,11,3,100,
- 6,44,6,228,164,3,12,6,228,6,7,68,16,68,39,132,3,9,12,7,228,196,6,12,
- 3,196,6,7,68,18,68,7,6,164,6,12,7,3,228,164,13,12,7,3,164,6,7,68,
- 18,68,7,6,164,3,7,12,3,228,164,3,11,12,6,164,6,7,68,15,68,7,6,196,
- 3,12,6,228,196,7,44,3,132,39,68,17,68,7,6,228,6,12,3,228,164,6,44,6,
- 100,3,11,6,68,17,68,7,6,228,4,38,228,164,6,12,11,7,100,3,12,6,68,21,
- 68,7,6,228,36,6,3,164,3,13,132,7,12,9,12,3,68,6,12,6,68,23,68,7,
- 6,228,196,3,6,7,11,3,100,3,12,11,9,12,6,36,3,7,12,6,68,21,68,39,
- 228,99,70,11,44,3,100,3,7,12,11,9,12,6,36,13,44,6,68,23,68,6,12,3,
- 228,6,140,43,7,13,67,6,7,12,43,9,12,6,36,7,44,6,68,23,68,6,12,13,
- 228,4,3,7,12,9,107,172,75,9,12,13,4,6,12,9,12,6,68,24,68,6,12,6,
- 228,36,3,7,12,75,73,43,9,75,9,12,7,4,3,43,9,12,6,68,24,68,6,44,
- 3,228,36,3,11,12,11,76,11,105,43,44,3,4,6,12,9,11,12,6,68,22,68,6,
- 44,6,228,68,3,44,38,7,172,7,6,3,4,6,12,9,43,12,6,68,23,68,6,12,
- 9,12,13,228,68,6,12,3,4,67,77,35,36,6,12,9,75,12,6,68,18,68,6,12,
- 9,43,3,228,68,7,13,228,36,6,12,139,12,6,68,18,68,6,12,43,12,7,3,228,
- 36,45,228,4,6,12,171,12,6,68,20,68,6,12,43,9,12,7,3,228,36,3,196,3,
- 6,12,9,171,12,6,68,18,68,6,12,75,9,44,6,228,196,3,6,11,12,9,203,12,
- 6,68,24,68,6,12,171,12,7,13,3,228,36,3,6,7,12,11,9,43,44,11,12,43,
- 12,6,68,23,68,6,12,171,9,44,7,6,13,163,38,11,44,9,75,12,71,6,12,9,
- 12,6,68,22,68,6,12,235,9,108,11,9,11,108,11,9,107,12,6,36,3,4,6,44,
- 6,68,20,68,6,12,235,43,41,139,41,171,12,7,4,3,6,35,13,9,12,6,68,17,
- 68,6,12,235,235,235,43,12,3,6,12,6,12,38,12,6,68,18,68,6,12,235,235,235,
- 11,9,12,38,12,11,12,7,3,12,6,68,16,68,6,12,235,235,235,75,9,6,44,7,
- 12,3,6,7,68,16,68,6,12,235,235,235,75,12,38,3,6,7,4,13,7,68,13,68,
- 6,12,235,235,235,107,7,3,100,6,7,68,15,68,6,12,9,235,235,235,43,9,12,7,
- 102,12,6,68,9,68,7,236,236,236,236,108,6,68,9,68,13,230,230,230,230,102,13,68,
- 8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,
- 164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,
- 228,228,36,31,9,68,13,230,230,230,230,102,13,68,9,68,7,236,236,236,236,108,7,68,
- 18,68,6,12,11,12,11,12,70,9,12,9,235,235,203,9,12,6,68,18,68,6,12,7,
- 6,7,12,13,36,3,7,12,235,235,235,12,6,68,19,68,6,12,6,4,6,12,6,13,
- 36,6,12,9,235,235,203,12,6,68,16,68,7,6,68,13,35,4,3,6,12,235,235,235,
- 12,6,68,17,68,7,6,3,4,35,36,3,6,9,235,235,235,11,12,6,68,15,68,6,
- 12,6,3,38,100,6,12,235,235,235,12,6,68,19,68,6,12,41,12,6,99,6,12,9,
- 107,41,139,41,235,43,12,6,68,20,68,6,12,75,76,11,39,75,9,11,108,11,9,11,
- 108,9,235,12,6,68,22,68,6,12,107,9,43,44,11,9,44,11,38,163,13,6,7,44,
- 9,171,12,6,68,20,68,6,12,235,9,11,12,7,6,3,228,36,3,13,7,12,171,12,
- 6,68,18,68,6,12,203,9,12,11,6,3,228,196,6,44,9,75,12,6,68,19,68,6,
- 12,171,9,12,6,3,228,228,36,3,7,12,9,43,12,6,68,16,68,6,12,171,12,6,
- 228,228,132,3,7,12,43,12,6,68,15,68,6,12,139,12,6,228,228,196,3,43,9,12,
- 6,68,17,68,6,12,75,9,12,6,228,228,228,4,13,12,9,12,6,68,15,68,6,12,
- 43,9,12,6,228,228,228,68,6,44,6,68,18,68,6,12,11,9,12,6,228,132,3,38,
- 35,228,36,3,44,6,68,22,68,6,12,9,43,3,228,3,13,6,7,3,7,76,7,38,
- 35,196,6,12,6,68,26,68,6,12,9,12,6,196,3,6,7,76,6,7,11,41,11,76,
- 11,7,6,3,100,13,12,6,68,24,68,6,44,7,132,3,6,7,44,11,73,12,11,9,
- 11,108,43,44,7,100,3,12,6,68,23,68,6,44,13,68,3,6,9,44,9,172,9,12,
- 11,102,7,12,9,12,6,132,39,68,28,68,6,12,7,3,68,7,12,11,41,12,6,13,
- 35,6,7,12,6,3,100,3,6,44,6,132,6,7,68,23,68,6,12,6,100,6,12,9,
- 11,12,6,132,3,7,3,196,6,12,13,132,6,7,68,21,68,6,12,3,100,13,12,7,
- 12,6,196,3,6,196,3,12,3,132,6,7,68,18,68,6,11,3,132,7,12,7,228,4,
- 6,3,196,6,164,6,7,68,16,68,39,164,6,12,6,228,4,3,13,196,6,164,6,7,
- 68,17,68,7,6,164,3,12,3,228,4,3,6,164,35,164,6,7,68,17,68,7,6,196,
- 6,3,228,4,3,7,3,132,35,164,6,7,68,17,68,7,6,196,6,3,228,4,3,12,
- 6,132,6,3,164,39,68,18,68,7,6,196,35,228,4,6,12,6,100,3,6,164,3,11,
- 6,68,19,68,7,6,228,13,228,4,7,44,3,36,3,12,6,164,3,12,6,68,22,68,
- 7,6,228,3,13,196,6,12,9,12,6,3,6,11,12,3,164,6,12,6,68,21,68,7,
- 6,228,4,6,13,132,6,12,107,9,12,43,3,132,3,7,12,6,68,21,68,39,228,4,
- 6,12,38,13,6,7,12,105,43,9,12,7,164,13,44,6,68,20,68,6,12,3,228,3,
- 9,108,11,9,140,11,9,12,6,164,7,44,6,68,25,68,6,12,13,228,4,6,12,7,
- 9,44,11,6,45,38,9,44,13,132,6,12,9,12,6,68,21,68,6,12,6,228,4,3,
- 76,7,6,3,132,35,13,132,3,43,9,12,6,68,17,68,6,44,3,228,4,38,3,228,
- 228,6,12,9,11,12,6,68,15,68,6,44,6,228,228,228,68,6,12,9,43,12,6,68,
- 17,68,6,12,9,12,13,228,228,228,4,6,12,9,75,12,6,68,15,68,6,12,9,43,
- 3,228,228,196,6,12,139,12,6,68,16,68,6,12,43,12,7,3,228,228,132,6,12,171,
- 12,6,68,19,68,6,12,43,9,12,7,3,228,228,36,3,6,12,9,171,12,6,68,18,
- 68,6,12,75,9,44,6,228,196,3,6,11,12,9,203,12,6,68,22,68,6,12,171,12,
- 7,13,3,228,36,3,6,7,12,43,12,43,9,107,12,6,68,21,68,6,12,171,9,44,
- 7,6,13,163,38,11,44,9,11,39,108,75,12,6,68,24,68,6,12,235,9,108,11,9,
- 11,108,11,9,11,9,12,6,67,13,6,12,43,12,6,68,19,68,6,12,235,43,41,139,
- 41,107,9,12,6,100,38,3,6,12,6,68,17,68,6,12,235,235,235,11,9,6,3,36,
- 35,4,3,6,7,68,15,68,6,12,235,235,235,12,6,3,4,67,68,6,7,68,19,68,
- 6,12,235,235,203,9,12,6,36,13,6,12,6,4,6,12,6,68,18,68,6,12,235,235,
- 235,12,7,3,36,13,12,7,6,7,12,6,68,17,68,6,12,235,235,235,11,12,7,70,
- 12,11,12,11,12,6,68,14,68,6,12,9,235,235,235,9,11,76,105,12,6,68,9,68,
- 7,236,236,236,236,108,7,68,9,68,13,230,230,230,230,102,13,68,8,31,228,228,228,228,
- 228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,
- 228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,
- 13,240,240,240,240,112,13,68,10,68,16,120,48,248,248,248,184,16,68,14,68,16,24,16,
- 14,101,14,241,241,241,81,24,16,68,13,68,16,17,13,164,13,241,241,241,49,24,16,68,
- 16,68,16,14,36,5,14,13,68,14,24,241,241,241,24,16,68,17,68,16,5,4,5,16,
- 56,13,36,13,24,241,241,241,24,16,68,17,68,14,5,4,5,16,56,13,36,5,241,241,
- 241,17,24,16,68,16,68,16,13,36,5,14,13,68,13,24,241,241,241,24,16,68,12,68,
- 48,196,5,16,24,241,241,241,24,16,68,18,68,16,24,14,5,100,5,16,24,145,120,81,
- 120,241,17,24,16,68,22,68,16,56,16,110,17,24,81,56,17,16,14,45,69,13,46,16,
- 56,209,24,16,68,21,68,16,24,16,17,120,113,24,16,14,5,228,36,5,13,16,24,177,
- 24,16,68,17,68,16,24,241,24,17,14,5,228,196,14,17,24,113,24,16,68,17,68,16,
- 24,209,24,16,5,228,228,36,13,16,24,81,24,16,68,16,68,16,24,177,24,14,228,228,
- 132,5,16,24,49,24,16,68,14,68,16,24,145,24,14,228,228,196,5,81,24,16,68,16,
- 68,16,24,113,24,14,228,228,228,4,13,24,16,24,16,68,14,68,16,24,81,24,14,228,
- 228,228,68,14,56,16,68,17,68,16,24,49,24,16,228,36,37,45,37,228,100,13,56,16,
- 68,23,68,16,24,81,5,196,5,13,14,16,17,56,17,16,14,13,5,228,36,14,24,16,
- 68,20,68,16,24,16,24,14,196,13,16,88,113,88,16,13,228,4,13,24,16,68,18,68,
- 16,24,17,16,5,164,14,56,241,49,56,14,228,5,24,16,68,14,68,16,56,14,164,14,
- 24,241,177,24,14,228,48,68,17,68,16,24,16,5,132,13,24,145,152,177,24,13,196,14,
- 16,68,19,68,16,24,14,164,16,24,145,14,77,16,24,145,24,16,196,14,16,68,19,68,
- 16,24,13,132,13,24,145,13,132,14,24,145,24,13,164,14,16,68,21,68,16,17,5,132,
- 14,24,81,24,14,164,5,16,24,113,24,14,164,14,16,68,18,68,48,164,14,24,81,24,
- 13,196,14,24,113,24,14,164,14,16,68,19,68,16,14,164,14,24,81,24,14,196,16,24,
- 113,24,14,164,14,16,68,19,68,16,14,164,14,24,113,16,13,132,14,24,145,24,14,164,
- 14,16,68,21,68,16,14,164,13,24,113,24,16,14,13,5,13,14,24,177,24,13,164,48,
- 68,18,68,16,14,196,16,24,145,56,17,56,177,24,16,164,5,17,16,68,15,68,16,14,
- 196,13,24,241,241,24,13,164,13,24,16,68,15,68,16,14,228,14,24,241,177,24,14,196,
- 14,24,16,68,17,68,16,14,228,4,14,56,241,49,56,14,196,5,16,24,16,68,16,68,
- 48,228,36,13,16,56,177,56,16,13,228,14,56,16,68,20,68,16,24,5,228,36,5,14,
- 48,120,48,14,5,228,5,16,17,24,16,68,17,68,16,24,13,228,132,5,109,5,228,68,
- 14,24,16,24,16,68,13,68,16,24,14,228,228,228,132,5,81,24,16,68,14,68,16,56,
- 13,228,228,228,100,16,24,49,24,16,68,14,68,16,56,14,228,228,228,68,14,24,81,24,
- 16,68,16,68,16,24,16,24,13,228,228,228,4,14,24,113,24,16,68,14,68,16,24,81,
- 5,228,228,196,14,24,145,24,16,68,16,68,16,24,49,24,16,5,228,228,132,14,24,177,
- 24,16,68,17,68,16,24,81,24,16,13,228,228,36,5,16,24,209,24,16,68,19,68,16,
- 24,113,24,17,14,228,196,5,14,17,24,16,184,16,24,16,68,25,68,16,24,177,24,16,
- 13,5,228,36,5,14,16,24,17,16,24,16,14,45,14,16,56,16,68,24,68,16,24,209,
- 56,16,46,13,69,45,14,16,17,56,49,24,14,5,100,5,14,24,16,68,15,68,16,24,
- 241,17,120,81,120,113,24,16,228,14,16,68,16,68,16,24,241,241,241,24,13,68,13,14,
- 13,36,13,16,68,16,68,16,24,241,241,241,17,5,36,13,88,5,4,5,14,68,18,68,
- 16,24,241,241,241,24,13,36,13,17,24,16,5,4,5,16,68,16,68,16,24,241,241,241,
- 24,14,68,5,13,5,36,14,16,68,14,68,16,24,241,241,241,17,24,14,164,13,24,16,
- 68,17,68,16,24,241,241,241,49,24,14,13,37,13,14,17,24,16,68,14,68,16,24,241,
- 241,241,81,56,48,56,16,24,16,68,9,68,16,248,248,248,248,120,16,68,9,68,13,240,
- 240,240,240,112,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,
- 7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,
- 31,8,31,228,228,228,228,228,36,31,9,68,13,240,240,240,240,112,13,68,12,68,16,88,
- 16,46,17,248,248,248,152,16,68,15,68,16,24,14,13,5,36,16,241,241,241,113,24,16,
- 68,14,68,16,24,13,100,16,24,241,241,241,81,24,16,68,16,68,16,24,14,4,5,36,
- 14,24,241,241,241,81,24,16,68,15,68,16,24,48,5,36,14,24,241,241,241,81,24,16,
- 68,15,68,16,56,16,5,36,14,24,241,241,241,81,24,16,68,14,68,16,56,16,68,13,
- 24,241,241,241,81,24,16,68,14,68,16,56,14,68,13,24,241,241,241,81,24,16,68,15,
- 68,16,56,14,68,5,241,120,81,120,241,17,24,16,68,21,68,16,24,17,16,110,145,56,
- 17,16,14,45,69,13,46,16,56,209,24,16,68,20,68,16,24,17,152,113,24,16,14,5,
- 228,36,5,13,16,24,177,24,16,68,17,68,16,24,241,24,17,14,5,228,196,14,17,24,
- 113,24,16,68,17,68,16,24,209,24,16,5,228,228,36,13,16,24,81,24,16,68,16,68,
- 16,24,177,24,14,228,228,132,5,16,24,49,24,16,68,14,68,16,24,145,24,14,228,228,
- 196,5,81,24,16,68,16,68,16,24,113,24,14,228,228,228,4,13,24,16,24,16,68,17,
- 68,16,24,81,24,14,228,132,5,13,14,228,68,14,56,16,68,20,68,16,24,49,24,16,
- 228,68,5,13,14,16,24,16,228,68,13,56,16,68,20,68,16,24,81,5,228,13,14,16,
- 17,56,49,16,5,228,68,14,24,16,68,18,68,16,24,16,24,14,196,5,16,88,177,5,
- 228,68,13,24,16,68,19,68,16,24,17,16,5,228,16,24,16,177,24,13,228,68,5,24,
- 16,68,15,68,16,56,14,228,4,14,24,209,24,13,228,100,48,68,18,68,16,24,16,5,
- 228,4,13,24,16,177,24,14,228,100,14,16,68,16,68,16,24,14,228,36,5,88,145,24,
- 14,228,100,14,16,68,18,68,16,24,13,228,68,16,14,13,16,113,24,14,228,100,14,16,
- 68,18,68,16,17,5,228,68,5,4,5,24,113,24,16,228,100,14,16,68,15,68,48,228,
- 164,13,24,113,24,16,5,228,68,14,16,68,14,68,16,14,228,164,14,24,177,5,228,68,
- 14,16,68,15,68,16,14,228,164,14,24,145,24,13,228,68,14,16,68,14,68,16,14,228,
- 164,14,24,145,24,13,228,68,48,68,16,68,16,14,228,164,16,24,145,24,14,228,36,5,
- 17,16,68,16,68,16,14,228,164,16,24,145,24,14,228,36,13,24,16,68,16,68,16,14,
- 228,132,5,16,177,24,14,228,36,14,24,16,68,16,68,16,14,228,132,5,209,24,16,228,
- 4,5,16,24,16,68,15,68,48,228,132,13,184,17,24,16,228,4,14,56,16,68,18,68,
- 16,24,5,228,100,13,16,14,208,5,196,5,16,17,24,16,68,15,68,16,24,13,228,228,
- 36,101,228,14,24,16,24,16,68,13,68,16,24,14,228,228,228,132,5,81,24,16,68,14,
- 68,16,56,13,228,228,228,100,16,24,49,24,16,68,14,68,16,56,14,228,228,228,68,14,
- 24,81,24,16,68,16,68,16,24,16,24,13,228,228,228,4,14,24,113,24,16,68,14,68,
- 16,24,81,5,228,228,196,14,24,145,24,16,68,16,68,16,24,49,24,16,5,228,228,132,
- 14,24,177,24,16,68,18,68,16,24,81,24,16,13,228,228,36,5,16,24,16,177,24,16,
- 68,19,68,16,24,113,24,17,14,228,196,5,14,17,24,17,152,49,24,16,68,22,68,16,
- 24,177,24,16,13,5,228,36,5,14,16,24,49,24,142,24,17,24,16,68,24,68,16,24,
- 209,56,16,46,13,69,45,14,16,17,56,81,24,13,68,13,24,16,24,16,68,20,68,16,
- 24,241,17,120,81,120,177,24,14,4,5,4,14,24,16,24,16,68,16,68,16,24,241,241,
- 241,49,24,14,68,14,24,16,24,16,68,16,68,16,24,241,241,241,49,24,14,68,16,24,
- 16,24,16,68,17,68,16,24,241,241,241,49,24,16,36,5,14,16,17,24,16,68,15,68,
- 16,24,241,241,241,49,24,16,5,68,14,56,16,68,14,68,16,24,241,241,241,81,16,5,
- 68,13,56,16,68,17,68,16,24,241,241,241,81,24,5,4,5,13,14,17,24,16,68,14,
- 68,16,24,241,241,241,113,46,16,56,17,24,16,68,9,68,16,248,248,248,248,120,16,68,
- 9,68,13,240,240,240,240,112,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,
- 228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,
- 228,228,228,36,31,8,31,228,228,228,228,228,36,31,11,68,13,48,14,15,240,240,240,240,
- 13,68,14,68,16,24,16,37,13,14,17,248,248,248,152,16,68,15,68,16,24,14,100,5,
- 16,24,241,241,241,49,24,16,68,15,68,16,24,14,37,68,13,24,241,241,241,49,24,16,
- 68,16,68,16,24,48,14,5,36,5,24,241,241,241,49,24,16,68,14,68,16,24,13,132,
- 13,24,241,241,241,49,24,16,68,15,68,16,14,68,5,13,14,16,241,241,241,81,24,16,
- 68,15,68,16,14,68,13,46,16,24,241,241,241,49,24,16,68,13,68,16,13,164,14,24,
- 241,241,241,49,24,16,68,15,68,16,13,164,13,24,177,120,81,120,241,17,24,16,68,22,
- 68,16,46,45,37,4,5,113,56,17,16,14,45,69,13,46,16,56,209,24,16,68,20,68,
- 16,120,17,80,81,24,16,14,5,228,36,5,13,16,24,177,24,16,68,20,68,16,24,16,
- 113,56,17,24,17,14,5,228,196,14,17,24,113,24,16,68,17,68,16,24,209,24,16,5,
- 228,228,36,13,16,24,81,24,16,68,16,68,16,24,177,24,14,228,228,132,5,16,24,49,
- 24,16,68,14,68,16,24,145,24,14,228,228,196,5,81,24,16,68,17,68,16,24,113,24,
- 14,164,77,5,228,196,13,24,16,24,16,68,19,68,16,24,81,24,14,196,14,56,17,16,
- 46,13,228,100,14,56,16,68,19,68,16,24,49,24,16,228,16,24,49,120,16,13,228,36,
- 13,56,16,68,18,68,16,24,81,5,196,5,16,209,56,15,5,228,4,14,24,16,68,19,
- 68,16,24,16,24,14,228,13,24,241,17,24,16,5,228,13,24,16,68,19,68,16,24,17,
- 16,5,228,14,24,241,17,16,24,14,228,5,24,16,68,17,68,16,56,14,228,4,14,24,
- 17,88,177,24,16,228,4,48,68,19,68,16,24,16,5,228,4,5,109,14,16,145,24,16,
- 5,228,14,16,68,17,68,16,24,14,228,196,13,16,24,113,24,16,5,228,14,16,68,18,
- 68,16,24,13,228,36,13,14,80,56,145,24,16,228,4,14,16,68,17,68,16,17,5,228,
- 4,13,152,177,16,24,14,228,4,14,16,68,16,68,48,228,4,5,16,241,49,56,16,5,
- 228,4,14,16,68,17,68,16,14,228,4,14,24,177,88,48,14,5,228,36,14,16,68,18,
- 68,16,14,228,4,14,24,145,24,16,14,13,5,228,132,14,16,68,16,68,16,14,228,5,
- 16,24,177,5,4,69,45,228,36,48,68,16,68,16,14,228,5,241,80,49,24,16,228,4,
- 5,17,16,68,16,68,16,14,228,13,24,209,56,113,16,5,228,13,24,16,68,15,68,16,
- 14,228,13,24,241,145,24,13,228,14,24,16,68,16,68,16,14,228,13,24,241,145,24,14,
- 196,5,16,24,16,68,15,68,48,228,13,24,16,241,113,24,14,196,14,56,16,68,18,68,
- 16,24,5,196,13,248,145,16,24,16,164,5,16,17,24,16,68,19,68,16,24,13,196,5,
- 45,110,80,17,184,5,132,14,24,16,24,16,68,17,68,16,24,14,228,196,69,45,78,16,
- 13,100,5,81,24,16,68,14,68,16,56,13,228,228,228,100,16,24,49,24,16,68,14,68,
- 16,56,14,228,228,228,68,14,24,81,24,16,68,16,68,16,24,16,24,13,228,228,228,4,
- 14,24,113,24,16,68,14,68,16,24,81,5,228,228,196,14,24,145,24,16,68,16,68,16,
- 24,49,24,16,5,228,228,132,14,24,177,24,16,68,18,68,16,24,81,24,16,13,228,228,
- 36,5,16,120,81,16,24,16,68,19,68,16,24,113,24,17,14,228,196,5,14,17,24,46,
- 48,17,120,16,68,24,68,16,24,177,24,16,13,5,228,36,5,14,16,24,17,24,13,36,
- 37,45,14,24,16,68,22,68,16,24,209,56,16,46,13,69,45,14,16,17,56,49,24,14,
- 164,5,17,16,68,16,68,16,24,241,17,120,81,120,145,24,15,164,5,24,16,68,15,68,
- 16,24,241,241,241,49,16,78,5,36,13,24,16,68,15,68,16,24,241,241,241,81,14,13,
- 5,68,14,24,16,68,16,68,16,24,241,241,241,17,24,14,68,37,13,16,24,16,68,16,
- 68,16,24,241,241,241,17,24,13,68,14,48,17,24,16,68,14,68,16,24,241,241,241,17,
- 24,14,132,13,56,16,68,13,68,16,24,241,241,241,81,13,100,14,56,16,68,15,68,16,
- 24,241,241,241,81,24,46,13,5,14,56,16,68,9,68,16,248,248,248,248,120,16,68,9,
- 68,13,240,240,240,240,112,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,
- 228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,
- 228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,13,240,240,240,240,112,13,68,11,
- 68,16,24,112,17,248,248,248,184,16,68,14,68,16,24,13,68,5,14,241,241,241,113,24,
- 16,68,14,68,16,24,13,132,14,24,241,241,241,49,24,16,68,15,68,16,24,78,5,36,
- 14,24,241,241,241,49,24,16,68,15,68,16,56,14,68,5,16,24,241,241,241,49,24,16,
- 68,15,68,16,56,16,68,5,14,24,241,241,241,49,24,16,68,15,68,48,46,13,5,36,
- 14,24,241,241,241,49,24,16,68,12,68,48,164,14,24,241,241,241,49,24,16,68,15,68,
- 16,24,5,100,13,241,120,81,120,241,17,24,16,68,24,68,16,24,13,5,13,14,16,24,
- 145,56,17,16,14,45,69,13,46,16,56,209,24,16,68,21,68,16,24,16,17,88,145,24,
- 16,14,5,228,36,5,13,16,24,177,24,16,68,17,68,16,24,241,24,17,14,5,228,196,
- 14,17,24,113,24,16,68,17,68,16,24,209,24,16,5,228,228,36,13,16,24,81,24,16,
- 68,16,68,16,24,177,24,14,228,228,132,5,16,24,49,24,16,68,14,68,16,24,145,24,
- 14,228,228,196,5,81,24,16,68,16,68,16,24,113,24,14,228,228,228,4,13,24,16,24,
- 16,68,14,68,16,24,81,24,14,228,228,228,68,14,56,16,68,16,68,16,24,49,24,16,
- 196,13,174,45,228,100,13,56,16,68,17,68,16,24,81,5,196,16,248,16,14,5,228,36,
- 14,24,16,68,19,68,16,24,16,24,14,228,16,24,209,56,16,5,228,4,13,24,16,68,
- 20,68,16,24,17,16,5,196,5,16,241,17,16,24,14,228,4,5,24,16,68,15,68,16,
- 56,14,228,5,81,120,113,24,16,228,36,48,68,20,68,16,24,16,5,228,13,56,17,16,
- 46,16,24,145,5,228,4,14,16,68,19,68,16,24,14,228,4,13,14,13,101,16,24,145,
- 5,228,4,14,16,68,16,68,16,24,13,228,100,13,48,56,177,5,228,4,14,16,68,16,
- 68,16,17,5,228,100,13,24,209,24,14,228,36,14,16,68,15,68,48,228,132,5,16,177,
- 24,16,5,228,36,14,16,68,14,68,16,14,228,164,16,24,209,14,228,36,14,16,68,15,
- 68,16,14,228,164,14,24,209,24,5,228,4,14,16,68,15,68,16,14,228,164,77,16,24,
- 113,24,13,228,4,48,68,15,68,16,14,228,4,5,208,177,24,13,228,5,17,16,68,15,
- 68,16,14,228,4,5,17,184,209,5,228,13,24,16,68,18,68,16,14,228,36,16,24,241,
- 17,16,24,16,228,4,14,24,16,68,18,68,16,14,228,36,14,24,241,17,24,16,13,228,
- 5,16,24,16,68,16,68,48,228,36,14,24,209,56,16,5,228,4,14,56,16,68,21,68,
- 16,24,5,228,4,13,24,49,120,16,14,13,228,36,5,16,17,24,16,68,20,68,16,24,
- 13,228,4,13,56,48,46,13,5,228,100,14,24,16,24,16,68,16,68,16,24,14,228,4,
- 5,45,5,228,228,5,81,24,16,68,14,68,16,56,13,228,228,228,100,16,24,49,24,16,
- 68,14,68,16,56,14,228,228,228,68,14,24,81,24,16,68,16,68,16,24,16,24,13,228,
- 228,228,4,14,24,113,24,16,68,14,68,16,24,81,5,228,228,196,14,24,145,24,16,68,
- 16,68,16,24,49,24,16,5,228,228,132,14,24,177,24,16,68,19,68,16,24,81,24,16,
- 13,228,228,36,5,16,24,145,24,17,24,16,68,20,68,16,24,113,24,17,14,228,196,5,
- 14,17,24,49,88,48,17,24,16,68,24,68,16,24,177,24,16,13,5,228,36,5,14,16,
- 24,81,24,16,14,13,37,16,24,16,68,22,68,16,24,209,56,16,46,13,69,45,14,16,
- 17,56,81,24,14,132,16,24,16,68,16,68,16,24,241,17,120,81,120,145,24,16,164,14,
- 24,16,68,16,68,16,24,241,241,241,17,24,14,68,13,14,48,24,16,68,16,68,16,24,
- 241,241,241,49,16,5,68,14,24,17,24,16,68,18,68,16,24,241,241,241,17,24,16,5,
- 36,5,14,24,16,24,16,68,16,68,16,24,241,241,241,17,24,14,68,14,45,16,24,16,
- 68,15,68,16,24,241,241,241,17,24,16,132,5,17,24,16,68,16,68,16,24,241,241,241,
- 49,24,14,13,5,36,13,56,16,68,13,68,16,24,241,241,241,81,56,112,17,24,16,68,
- 9,68,16,248,248,248,248,120,16,68,9,68,13,240,240,240,240,112,13,68,8,31,228,228,
- 228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,
- 228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,
- 9,68,13,240,240,240,240,112,13,68,12,68,16,56,16,77,14,248,248,248,152,16,68,16,
- 68,16,17,24,13,68,14,24,16,241,241,241,49,24,16,68,14,68,16,24,16,100,14,24,
- 241,241,241,81,24,16,68,17,68,16,24,13,4,13,5,4,14,24,241,241,241,81,24,16,
- 68,17,68,48,5,4,5,36,13,14,16,24,241,241,241,17,24,16,68,13,68,16,13,196,
- 16,24,241,241,241,17,24,16,68,14,68,16,14,45,5,100,16,241,241,241,49,24,16,68,
- 14,68,16,88,13,36,13,14,241,241,241,81,24,16,68,17,68,16,24,17,16,68,13,24,
- 209,120,81,120,241,17,24,16,68,22,68,16,56,16,13,46,16,145,56,17,16,14,45,69,
- 13,46,16,56,209,24,16,68,20,68,16,24,49,120,113,24,16,14,5,228,36,5,13,16,
- 24,177,24,16,68,17,68,16,24,241,24,17,14,5,228,196,14,17,24,113,24,16,68,17,
- 68,16,24,209,24,16,5,228,228,36,13,16,24,81,24,16,68,16,68,16,24,177,24,14,
- 228,228,132,5,16,24,49,24,16,68,14,68,16,24,145,24,14,228,228,196,5,81,24,16,
- 68,17,68,16,24,113,24,14,228,196,5,228,4,13,24,16,24,16,68,18,68,16,24,81,
- 24,14,228,4,13,78,112,5,228,4,14,56,16,68,18,68,16,24,49,24,16,228,4,5,
- 16,216,13,228,4,13,56,16,68,18,68,16,24,81,5,228,4,13,24,16,177,13,228,36,
- 14,24,16,68,20,68,16,24,16,24,14,228,4,5,16,24,177,24,13,228,36,13,24,16,
- 68,19,68,16,24,17,16,5,228,4,14,24,209,24,13,228,36,5,24,16,68,18,68,16,
- 56,14,228,4,5,16,24,17,56,113,24,13,228,68,48,68,22,68,16,24,16,5,228,4,
- 14,24,16,24,16,14,24,81,24,13,228,68,14,16,68,21,68,16,24,14,228,4,5,16,
- 24,17,24,45,24,81,24,13,228,68,14,16,68,20,68,16,24,13,228,4,14,24,81,5,
- 14,24,81,24,5,228,68,14,16,68,16,68,16,17,5,228,5,16,113,16,177,110,5,196,
- 14,16,68,15,68,48,228,4,14,24,241,81,88,16,5,196,14,16,68,15,68,16,14,228,
- 5,16,241,145,16,24,14,228,14,16,68,14,68,16,14,228,14,24,241,177,24,14,228,14,
- 16,68,16,68,16,14,196,5,14,48,17,88,241,16,24,13,228,48,68,17,68,16,14,228,
- 36,37,13,46,16,177,88,13,196,5,17,16,68,18,68,16,14,228,196,16,24,113,24,15,
- 14,16,5,196,13,24,16,68,15,68,16,14,228,164,5,177,24,13,228,36,14,24,16,68,
- 17,68,16,14,228,164,13,24,145,24,14,228,4,5,16,24,16,68,16,68,48,228,164,14,
- 24,16,113,24,14,228,4,14,56,16,68,18,68,16,24,5,228,132,14,120,17,48,13,228,
- 5,16,17,24,16,68,17,68,16,24,13,228,132,78,45,37,228,36,14,24,16,24,16,68,
- 13,68,16,24,14,228,228,228,132,5,81,24,16,68,14,68,16,56,13,228,228,228,100,16,
- 24,49,24,16,68,14,68,16,56,14,228,228,228,68,14,24,81,24,16,68,16,68,16,24,
- 16,24,13,228,228,228,4,14,24,113,24,16,68,14,68,16,24,81,5,228,228,196,14,24,
- 145,24,16,68,16,68,16,24,49,24,16,5,228,228,132,14,24,177,24,16,68,17,68,16,
- 24,81,24,16,13,228,228,36,5,16,24,209,24,16,68,19,68,16,24,113,24,17,14,228,
- 196,5,14,17,24,16,120,81,24,16,68,25,68,16,24,177,24,16,13,5,228,36,5,14,
- 16,24,49,24,16,14,45,14,24,17,24,16,68,24,68,16,24,209,56,16,46,13,69,45,
- 14,16,17,56,81,24,14,68,16,24,16,24,16,68,18,68,16,24,241,17,120,81,120,145,
- 24,14,13,36,5,16,88,16,68,14,68,16,24,241,241,241,17,24,5,100,5,45,48,68,
- 13,68,16,24,241,241,241,24,16,196,5,24,16,68,18,68,16,24,241,241,241,17,16,14,
- 13,36,13,5,4,14,24,16,68,16,68,16,24,241,241,241,49,24,14,36,13,4,13,56,
- 16,68,14,68,16,24,241,241,241,49,24,14,100,14,56,16,68,16,68,16,24,241,241,241,
- 49,24,14,68,13,24,17,24,16,68,16,68,16,24,241,241,241,49,24,14,77,16,24,16,
- 24,16,68,9,68,16,248,248,248,248,120,16,68,9,68,13,240,240,240,240,112,13,68,8,
- 31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,
- 95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,
- 228,36,31,10,68,13,176,46,240,240,240,112,13,68,12,68,48,46,77,5,13,248,248,248,
- 120,16,68,14,68,16,13,164,13,24,16,241,241,241,17,24,16,68,13,68,16,13,164,14,
- 24,241,241,241,49,24,16,68,16,68,16,14,68,13,14,13,16,24,241,241,241,49,24,16,
- 68,13,68,16,14,68,5,46,241,241,241,113,24,16,68,14,68,16,17,5,132,14,24,241,
- 241,241,49,24,16,68,16,68,16,24,48,14,5,36,5,24,241,241,241,49,24,16,68,16,
- 68,16,24,14,13,5,68,13,24,241,241,241,49,24,16,68,17,68,16,24,14,100,5,15,
- 24,177,120,81,120,241,17,24,16,68,25,68,16,24,16,4,5,13,14,16,24,113,56,17,
- 16,14,45,69,13,46,16,56,209,24,16,68,22,68,16,24,17,48,17,56,113,24,16,14,
- 5,228,36,5,13,16,24,177,24,16,68,19,68,16,24,17,56,145,24,17,14,5,228,196,
- 14,17,24,113,24,16,68,17,68,16,24,209,24,16,5,228,228,36,13,16,24,81,24,16,
- 68,16,68,16,24,177,24,14,228,228,132,5,16,24,49,24,16,68,14,68,16,24,145,24,
- 14,228,228,196,5,81,24,16,68,18,68,16,24,113,24,14,228,164,37,77,5,132,13,24,
- 16,24,16,68,18,68,16,24,81,24,14,164,37,45,110,80,88,13,164,14,56,16,68,19,
- 68,16,24,49,24,16,100,13,80,17,248,81,16,5,164,13,56,16,68,17,68,16,24,81,
- 5,100,13,24,241,145,24,14,228,14,24,16,68,18,68,16,24,16,24,14,132,13,24,241,
- 145,24,14,228,13,24,16,68,18,68,16,24,17,16,5,132,13,24,241,145,24,13,228,5,
- 24,16,68,14,68,16,56,14,164,13,24,241,177,5,228,4,48,68,15,68,16,24,16,5,
- 164,5,241,184,16,228,36,14,16,68,16,68,16,24,14,196,5,16,177,16,77,110,228,36,
- 14,16,68,16,68,16,24,13,228,16,24,145,24,14,5,228,196,14,16,68,18,68,16,17,
- 5,228,14,24,177,24,17,16,46,13,228,68,14,16,68,14,68,48,228,4,13,24,241,120,
- 14,228,36,14,16,68,16,68,16,14,228,36,14,24,241,81,24,13,228,4,14,16,68,17,
- 68,16,14,228,36,5,14,49,88,177,24,14,228,4,14,16,68,16,68,16,14,228,100,5,
- 77,14,16,145,24,16,228,4,48,68,17,68,16,14,228,228,5,16,24,113,24,16,5,196,
- 5,17,16,68,19,68,16,14,228,68,14,16,15,48,17,24,145,24,16,228,13,24,16,68,
- 15,68,16,14,228,68,14,120,209,24,14,228,14,24,16,68,18,68,16,14,228,68,13,24,
- 16,241,17,24,13,196,5,16,24,16,68,14,68,48,228,68,5,241,17,56,13,228,14,56,
- 16,68,19,68,16,24,5,228,36,5,16,145,88,14,13,228,5,16,17,24,16,68,20,68,
- 16,24,13,228,68,16,120,17,16,14,13,228,36,14,24,16,24,16,68,18,68,16,24,14,
- 228,68,14,16,46,13,5,228,100,5,81,24,16,68,14,68,16,56,13,228,228,228,100,16,
- 24,49,24,16,68,14,68,16,56,14,228,228,228,68,14,24,81,24,16,68,16,68,16,24,
- 16,24,13,228,228,228,4,14,24,113,24,16,68,14,68,16,24,81,5,228,228,196,14,24,
- 145,24,16,68,16,68,16,24,49,24,16,5,228,228,132,14,24,177,24,16,68,19,68,16,
- 24,81,24,16,13,228,228,36,5,16,24,81,56,49,24,16,68,22,68,16,24,113,24,17,
- 14,228,196,5,14,17,24,16,56,48,14,16,17,24,16,68,24,68,16,24,177,24,16,13,
- 5,228,36,5,14,16,24,49,24,16,13,5,36,14,56,16,68,23,68,16,24,209,56,16,
- 46,13,69,45,14,16,17,56,49,24,16,5,100,14,56,16,68,17,68,16,24,241,17,120,
- 81,120,145,24,14,68,45,14,56,16,68,15,68,16,24,241,241,241,17,24,13,68,46,16,
- 56,16,68,14,68,16,24,241,241,241,17,24,14,164,16,24,16,68,16,68,16,24,241,241,
- 241,49,24,16,14,13,68,13,24,16,68,15,68,16,24,241,241,241,17,24,16,77,68,5,
- 24,16,68,14,68,16,24,241,241,241,17,24,14,164,5,24,16,68,14,68,16,24,241,241,
- 241,17,24,14,164,5,17,16,68,16,68,16,24,241,241,241,17,24,13,5,45,78,16,24,
- 16,68,10,68,16,248,248,248,88,17,248,16,68,9,68,13,240,240,240,240,112,13,68,8,
- 31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,
- 95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,
- 228,36,31,9,68,13,240,240,240,240,112,13,68,9,68,16,248,248,248,248,120,16,68,16,
- 68,16,14,5,13,14,16,17,16,241,241,241,113,24,16,68,13,68,16,14,68,16,56,241,
- 241,241,113,24,16,68,13,68,16,13,36,13,78,241,241,241,113,24,16,68,13,68,16,13,
- 164,14,24,241,241,241,49,24,16,68,15,68,16,13,36,45,68,16,24,241,241,241,17,24,
- 16,68,15,68,16,13,36,46,68,16,24,241,241,241,17,24,16,68,12,68,16,14,164,5,
- 241,241,241,81,24,16,68,17,68,16,24,13,100,5,14,24,177,120,81,120,241,17,24,16,
- 68,22,68,16,24,17,110,16,24,113,56,17,16,14,45,69,13,46,16,56,209,24,16,68,
- 20,68,16,24,17,120,145,24,16,14,5,228,36,5,13,16,24,177,24,16,68,17,68,16,
- 24,241,24,17,14,5,228,196,14,17,24,113,24,16,68,17,68,16,24,209,24,16,5,228,
- 228,36,13,16,24,81,24,16,68,16,68,16,24,177,24,14,228,228,132,5,16,24,49,24,
- 16,68,14,68,16,24,145,24,14,228,228,196,5,81,24,16,68,16,68,16,24,113,24,14,
- 228,228,228,4,13,24,16,24,16,68,14,68,16,24,81,24,14,228,228,228,68,14,56,16,
- 68,14,68,16,24,49,24,16,228,228,228,100,13,56,16,68,18,68,16,24,81,5,132,14,
- 16,46,13,5,228,228,36,14,24,16,68,19,68,16,24,16,24,14,164,14,120,17,16,15,
- 13,228,196,13,24,16,68,17,68,16,24,17,16,5,164,16,145,56,13,228,196,5,24,16,
- 68,14,68,16,56,14,164,5,177,24,14,228,228,4,48,68,17,68,16,24,16,5,164,13,
- 24,145,24,5,228,228,4,14,16,68,18,68,16,24,14,196,13,24,113,24,16,13,142,5,
- 228,68,14,16,68,16,68,16,24,13,196,14,24,177,184,17,14,228,36,14,16,68,16,68,
- 16,17,5,196,14,24,241,145,24,14,228,4,14,16,68,12,68,48,228,14,24,241,209,5,
- 228,14,16,68,15,68,16,14,228,14,24,145,120,145,24,13,228,14,16,68,18,68,16,14,
- 228,14,24,113,16,77,16,24,113,24,14,228,14,16,68,18,68,16,14,228,13,24,81,24,
- 16,68,14,24,113,24,14,228,48,68,18,68,16,14,228,13,24,145,16,14,16,177,24,14,
- 196,5,17,16,68,17,68,16,14,228,5,16,24,113,88,177,24,13,196,13,24,16,68,18,
- 68,16,14,228,4,14,24,16,241,81,24,16,5,196,14,24,16,68,19,68,16,14,228,4,
- 5,16,24,16,241,17,56,13,196,5,16,24,16,68,16,68,48,228,36,13,16,56,145,88,
- 16,13,228,14,56,16,68,21,68,16,24,5,228,36,5,14,48,81,48,14,13,5,228,5,
- 16,17,24,16,68,15,68,16,24,13,228,132,133,228,100,14,24,16,24,16,68,13,68,16,
- 24,14,228,228,228,132,5,81,24,16,68,14,68,16,56,13,228,228,228,100,16,24,49,24,
- 16,68,14,68,16,56,14,228,228,228,68,14,24,81,24,16,68,16,68,16,24,16,24,13,
- 228,228,228,4,14,24,113,24,16,68,14,68,16,24,81,5,228,228,196,14,24,145,24,16,
- 68,16,68,16,24,49,24,16,5,228,228,132,14,24,177,24,16,68,17,68,16,24,81,24,
- 16,13,228,228,36,5,16,24,209,24,16,68,20,68,16,24,113,24,17,14,228,196,5,14,
- 17,24,16,17,152,17,24,16,68,22,68,16,24,177,24,16,13,5,228,36,5,14,16,24,
- 49,24,16,110,16,56,16,68,24,68,16,24,209,56,16,46,13,69,45,14,16,17,56,49,
- 24,16,5,100,5,16,24,16,68,16,68,16,24,241,17,120,81,120,145,24,13,164,13,24,
- 16,68,17,68,16,24,241,241,241,49,5,36,13,14,5,4,5,17,16,68,14,68,16,24,
- 241,241,241,17,24,13,36,37,68,48,68,14,68,16,24,241,241,241,17,24,14,5,132,5,
- 48,68,16,68,16,24,241,241,241,49,24,16,46,13,36,5,17,16,68,15,68,16,24,241,
- 241,241,81,56,17,5,36,13,24,16,68,14,68,16,24,241,241,241,145,16,46,13,14,24,
- 16,68,12,68,16,24,241,241,241,177,88,17,24,16,68,9,68,16,248,248,248,248,120,16,
- 68,9,68,13,240,240,240,240,112,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,
- 228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,
- 228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,13,240,240,240,240,112,13,
- 68,12,68,16,17,48,142,16,248,248,248,88,16,68,12,68,16,13,164,5,241,241,241,81,
- 24,16,68,13,68,16,14,164,14,24,241,241,241,49,24,16,68,13,68,48,69,68,16,24,
- 241,241,241,49,24,16,68,15,68,16,24,48,5,36,13,24,241,241,241,81,24,16,68,14,
- 68,16,56,13,68,14,24,241,241,241,81,24,16,68,14,68,16,24,14,100,16,24,241,241,
- 241,81,24,16,68,14,68,16,24,14,5,36,5,241,241,241,145,24,16,68,17,68,16,56,
- 16,14,5,14,24,241,120,81,120,241,17,24,16,68,23,68,16,24,16,17,24,17,16,177,
- 56,17,16,14,45,69,13,46,16,56,209,24,16,68,19,68,16,24,241,49,24,16,14,5,
- 228,36,5,13,16,24,177,24,16,68,17,68,16,24,241,24,17,14,5,228,196,14,17,24,
- 113,24,16,68,17,68,16,24,209,24,16,5,228,228,36,13,16,24,81,24,16,68,16,68,
- 16,24,177,24,14,228,228,132,5,16,24,49,24,16,68,14,68,16,24,145,24,14,228,228,
- 196,5,81,24,16,68,16,68,16,24,113,24,14,228,228,228,4,13,24,16,24,16,68,17,
- 68,16,24,81,24,14,228,132,69,77,14,13,164,14,56,16,68,19,68,16,24,49,24,16,
- 100,5,45,142,80,49,120,13,164,13,56,16,68,17,68,16,24,81,5,100,14,248,24,177,
- 16,5,196,14,24,16,68,17,68,16,24,16,24,14,132,13,241,177,24,14,228,13,24,16,
- 68,18,68,16,24,17,16,5,164,16,24,241,113,24,13,228,5,24,16,68,15,68,16,56,
- 14,196,14,24,241,113,16,5,228,4,48,68,19,68,16,24,16,5,196,13,24,16,49,56,
- 177,24,14,228,36,14,16,68,18,68,16,24,14,228,5,17,56,17,48,177,24,13,228,36,
- 14,16,68,17,68,16,24,13,228,4,77,37,16,24,177,5,228,36,14,16,68,16,68,16,
- 17,5,228,132,14,24,145,24,14,228,68,14,16,68,14,68,48,228,132,13,24,177,24,14,
- 228,68,14,16,68,15,68,16,14,228,100,5,16,24,209,5,228,68,14,16,68,15,68,16,
- 14,228,100,14,24,177,24,16,228,100,14,16,68,14,68,16,14,228,68,13,24,209,24,14,
- 228,100,48,68,16,68,16,14,228,36,5,16,241,17,5,228,68,5,17,16,68,16,68,16,
- 14,228,36,14,56,177,24,16,228,100,13,24,16,68,18,68,16,14,228,68,13,14,16,56,
- 81,24,14,228,100,14,24,16,68,19,68,16,14,228,132,5,14,16,56,17,24,13,228,68,
- 5,16,24,16,68,14,68,48,228,228,13,14,24,16,228,100,14,56,16,68,16,68,16,24,
- 5,228,228,4,45,228,68,5,16,17,24,16,68,14,68,16,24,13,228,228,228,164,14,24,
- 16,24,16,68,13,68,16,24,14,228,228,228,132,5,81,24,16,68,14,68,16,56,13,228,
- 228,228,100,16,24,49,24,16,68,14,68,16,56,14,228,228,228,68,14,24,81,24,16,68,
- 16,68,16,24,16,24,13,228,228,228,4,14,24,113,24,16,68,14,68,16,24,81,5,228,
- 228,196,14,24,145,24,16,68,16,68,16,24,49,24,16,5,228,228,132,14,24,177,24,16,
- 68,17,68,16,24,81,24,16,13,228,228,36,5,16,24,209,24,16,68,19,68,16,24,113,
- 24,17,14,228,196,5,14,17,24,81,24,113,24,16,68,21,68,16,24,177,24,16,13,5,
- 228,36,5,14,16,24,113,48,56,49,24,16,68,25,68,16,24,209,56,16,46,13,69,45,
- 14,16,17,56,113,24,14,5,13,16,24,17,24,16,68,17,68,16,24,241,17,120,81,120,
- 209,24,13,68,13,16,24,16,68,14,68,16,24,241,241,241,81,16,5,68,13,56,16,68,
- 16,68,16,24,241,241,241,49,24,14,68,13,24,17,24,16,68,16,68,16,24,241,241,241,
- 49,24,13,36,5,14,48,24,16,68,16,68,16,24,241,241,241,49,16,5,68,5,4,14,
- 24,16,68,14,68,16,24,241,241,241,17,24,14,164,13,24,16,68,14,68,16,24,241,241,
- 241,17,24,13,132,37,17,16,68,12,68,16,24,241,241,241,49,110,112,24,16,68,9,68,
- 16,248,248,248,248,120,16,68,9,68,13,240,240,240,240,112,13,68,8,31,228,228,228,228,
- 228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,
- 228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,
- 13,240,240,240,240,112,13,68,10,68,16,88,48,248,248,248,216,16,68,15,68,16,24,16,
- 13,36,13,16,241,241,241,113,24,16,68,17,68,16,24,13,4,13,5,4,13,24,241,241,
- 241,81,24,16,68,17,68,16,24,13,4,13,5,4,13,24,241,241,241,81,24,16,68,14,
- 68,16,24,14,100,13,24,241,241,241,81,24,16,68,15,68,48,5,4,45,36,14,24,241,
- 241,241,49,24,16,68,15,68,16,14,36,46,36,13,24,241,241,241,49,24,16,68,12,68,
- 48,164,14,24,241,241,241,49,24,16,68,16,68,16,24,14,5,68,14,241,120,81,120,241,
- 17,24,16,68,22,68,16,56,16,46,16,24,145,56,17,16,14,45,69,13,46,16,56,209,
- 24,16,68,21,68,16,24,16,17,88,145,24,16,14,5,228,36,5,13,16,24,177,24,16,
- 68,17,68,16,24,241,24,17,14,5,228,196,14,17,24,113,24,16,68,17,68,16,24,209,
- 24,16,5,228,228,36,13,16,24,81,24,16,68,16,68,16,24,177,24,14,228,228,132,5,
- 16,24,49,24,16,68,14,68,16,24,145,24,14,228,228,196,5,81,24,16,68,16,68,16,
- 24,113,24,14,228,228,228,4,13,24,16,24,16,68,14,68,16,24,81,24,14,228,228,228,
- 68,14,56,16,68,19,68,16,24,49,24,16,228,36,5,13,46,13,5,228,100,13,56,16,
- 68,18,68,16,24,81,5,228,5,14,17,120,16,13,228,100,14,24,16,68,21,68,16,24,
- 16,24,14,228,5,16,24,17,48,49,56,14,228,68,13,24,16,68,21,68,16,24,17,16,
- 5,228,14,24,16,17,56,113,24,5,228,36,5,24,16,68,18,68,16,56,14,228,5,16,
- 49,24,16,14,113,24,14,228,68,48,68,20,68,16,24,16,5,228,5,113,5,4,14,24,
- 49,24,14,228,68,14,16,68,20,68,16,24,14,228,4,5,16,49,24,46,16,81,24,14,
- 228,68,14,16,68,18,68,16,24,13,228,36,16,24,49,56,113,24,13,228,68,14,16,68,
- 16,68,16,17,5,228,36,13,24,241,16,5,228,68,14,16,68,16,68,48,228,36,5,16,
- 24,241,24,16,5,228,36,14,16,68,17,68,16,14,228,36,14,24,49,152,81,24,14,228,
- 36,14,16,68,21,68,16,14,228,4,13,24,49,24,16,77,16,24,81,24,13,228,4,14,
- 16,68,20,68,16,14,228,4,14,24,49,24,14,68,14,24,81,24,14,228,4,48,68,21,
- 68,16,14,228,4,14,24,81,24,16,15,16,24,113,24,14,228,5,17,16,68,17,68,16,
- 14,228,4,13,24,113,88,145,24,13,228,13,24,16,68,18,68,16,14,228,36,16,24,16,
- 241,16,24,16,228,4,14,24,16,68,18,68,16,14,228,36,5,16,24,241,24,16,5,228,
- 5,16,24,16,68,15,68,48,228,68,5,14,248,14,5,228,4,14,56,16,68,19,68,16,
- 24,5,228,100,13,46,48,46,13,228,36,5,16,17,24,16,68,14,68,16,24,13,228,228,
- 228,164,14,24,16,24,16,68,13,68,16,24,14,228,228,228,132,5,81,24,16,68,14,68,
- 16,56,13,228,228,228,100,16,24,49,24,16,68,14,68,16,56,14,228,228,228,68,14,24,
- 81,24,16,68,16,68,16,24,16,24,13,228,228,228,4,14,24,113,24,16,68,14,68,16,
- 24,81,5,228,228,196,14,24,145,24,16,68,16,68,16,24,49,24,16,5,228,228,132,14,
- 24,177,24,16,68,17,68,16,24,81,24,16,13,228,228,36,5,16,24,209,24,16,68,19,
- 68,16,24,113,24,17,14,228,196,5,14,17,24,49,120,49,24,16,68,24,68,16,24,177,
- 24,16,13,5,228,36,5,14,16,24,81,24,16,46,16,24,17,24,16,68,23,68,16,24,
- 209,56,16,46,13,69,45,14,16,17,56,81,24,14,100,13,17,24,16,68,16,68,16,24,
- 241,17,120,81,120,145,24,14,164,14,24,16,68,18,68,16,24,241,241,241,17,24,14,36,
- 13,15,5,4,14,24,16,68,18,68,16,24,241,241,241,17,24,16,5,4,37,4,5,16,
- 24,16,68,14,68,16,24,241,241,241,49,24,14,100,13,56,16,68,18,68,16,24,241,241,
- 241,49,24,14,4,5,14,4,5,16,24,16,68,16,68,16,24,241,241,241,49,24,14,36,
- 5,4,13,56,16,68,17,68,16,24,241,241,241,81,24,14,5,4,13,16,17,24,16,68,
- 15,68,16,24,241,241,241,113,24,48,24,17,16,24,16,68,9,68,16,248,248,248,248,120,
- 16,68,9,68,13,240,240,240,240,112,13,68,8,31,228,228,228,228,228,36,31,8,31,228,
- 228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,
- 228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,13,240,240,240,240,112,
- 13,68,9,68,16,248,248,248,248,120,16,68,14,68,16,24,14,13,69,14,241,241,241,113,
- 24,16,68,13,68,16,14,164,14,24,241,241,241,49,24,16,68,15,68,16,13,36,5,13,
- 36,5,241,241,241,81,24,16,68,17,68,16,13,36,13,14,5,36,16,24,241,241,241,17,
- 24,16,68,13,68,16,14,196,16,24,241,241,241,17,24,16,68,15,68,48,13,69,36,5,
- 16,24,241,241,241,17,24,16,68,15,68,16,56,48,13,36,5,16,241,241,241,49,24,16,
- 68,19,68,16,24,16,24,16,5,36,13,24,177,120,81,120,241,17,24,16,68,22,68,16,
- 24,81,48,46,24,81,56,17,16,14,45,69,13,46,16,56,209,24,16,68,20,68,16,24,
- 113,88,81,24,16,14,5,228,36,5,13,16,24,177,24,16,68,17,68,16,24,241,24,17,
- 14,5,228,196,14,17,24,113,24,16,68,17,68,16,24,209,24,16,5,228,228,36,13,16,
- 24,81,24,16,68,16,68,16,24,177,24,14,228,228,132,5,16,24,49,24,16,68,14,68,
- 16,24,145,24,14,228,228,196,5,81,24,16,68,16,68,16,24,113,24,14,228,228,228,4,
- 13,24,16,24,16,68,14,68,16,24,81,24,14,228,228,228,68,14,56,16,68,14,68,16,
- 24,49,24,16,228,228,228,100,13,56,16,68,18,68,16,24,81,5,228,5,13,46,112,14,
- 13,228,68,14,24,16,68,20,68,16,24,16,24,14,196,5,14,17,248,24,14,5,228,4,
- 13,24,16,68,20,68,16,24,17,16,5,164,5,16,24,241,49,24,14,228,4,5,24,16,
- 68,17,68,16,56,14,196,16,24,16,241,49,16,24,13,228,4,48,68,18,68,16,24,16,
- 5,164,13,24,209,24,145,24,16,228,4,14,16,68,19,68,16,24,14,196,14,24,145,24,
- 48,17,24,113,24,5,228,14,16,68,22,68,16,24,13,196,14,24,113,24,16,5,4,5,
- 16,24,81,24,13,228,14,16,68,20,68,16,17,5,196,14,24,113,24,16,69,16,24,81,
- 24,14,228,14,16,68,18,68,48,228,14,24,145,24,17,16,17,24,113,24,14,228,14,16,
- 68,15,68,16,14,228,13,24,209,24,177,24,14,228,14,16,68,16,68,16,14,228,4,14,
- 24,16,241,113,24,14,228,14,16,68,14,68,16,14,228,4,5,16,248,145,24,14,228,48,
- 68,19,68,16,14,228,68,13,14,112,14,16,24,113,24,13,196,5,17,16,68,17,68,16,
- 14,228,164,37,4,5,16,145,24,13,196,13,24,16,68,15,68,16,14,228,228,4,14,24,
- 177,5,196,14,24,16,68,15,68,16,14,228,228,5,209,16,5,164,5,16,24,16,68,13,
- 68,48,228,228,14,49,152,16,196,14,56,16,68,19,68,16,24,5,228,228,5,45,46,16,
- 24,14,164,5,16,17,24,16,68,15,68,16,24,13,228,228,164,37,164,14,24,16,24,16,
- 68,13,68,16,24,14,228,228,228,132,5,81,24,16,68,14,68,16,56,13,228,228,228,100,
- 16,24,49,24,16,68,14,68,16,56,14,228,228,228,68,14,24,81,24,16,68,16,68,16,
- 24,16,24,13,228,228,228,4,14,24,113,24,16,68,14,68,16,24,81,5,228,228,196,14,
- 24,145,24,16,68,16,68,16,24,49,24,16,5,228,228,132,14,24,177,24,16,68,18,68,
- 16,24,81,24,16,13,228,228,36,5,16,24,16,177,24,16,68,19,68,16,24,113,24,17,
- 14,228,196,5,14,17,24,17,88,113,24,16,68,22,68,16,24,177,24,16,13,5,228,36,
- 5,14,16,24,17,24,78,48,81,24,16,68,24,68,16,24,209,56,16,46,13,69,45,14,
- 16,17,56,49,24,13,68,16,24,49,24,16,68,17,68,16,24,241,17,120,81,120,145,24,
- 13,36,13,80,56,16,68,16,68,16,24,241,241,241,49,5,36,5,36,5,14,24,16,68,
- 13,68,16,24,241,241,241,49,5,164,5,24,16,68,13,68,16,24,241,241,241,49,5,36,
- 46,68,48,68,16,68,16,24,241,241,241,17,24,13,36,37,36,5,17,16,68,14,68,16,
- 24,241,241,241,17,24,16,164,14,24,16,68,14,68,16,24,241,241,241,49,24,16,109,14,
- 56,16,68,12,68,16,24,241,241,241,81,184,16,24,16,68,9,68,16,248,248,248,248,120,
- 16,68,9,68,13,240,240,240,240,112,13,68,8,31,228,228,228,228,228,36,31,8,31,228,
- 228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,
- 228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,11,68,13,16,15,240,240,240,
- 240,48,13,68,11,68,16,56,16,78,248,248,248,184,16,68,16,68,16,24,14,4,46,13,
- 5,16,241,241,241,81,24,16,68,14,68,48,37,14,56,45,24,241,241,241,49,24,16,68,
- 18,68,16,46,17,4,14,24,16,5,16,24,241,241,241,17,24,16,68,19,68,16,13,14,
- 24,14,5,16,24,5,16,24,241,241,241,17,24,16,68,17,68,16,14,13,56,14,5,16,
- 5,16,241,241,241,49,24,16,68,18,68,16,24,5,14,17,24,13,4,14,24,241,241,241,
- 49,24,16,68,17,68,16,24,16,13,5,13,5,14,24,241,241,241,81,24,16,68,16,68,
- 16,88,16,14,16,24,241,120,81,120,241,17,24,16,68,20,68,16,24,49,88,177,56,17,
- 16,14,45,69,13,46,16,56,209,24,16,68,19,68,16,24,241,49,24,16,14,5,228,36,
- 5,13,16,24,177,24,16,68,17,68,16,24,241,24,17,14,5,228,196,14,17,24,113,24,
- 16,68,17,68,16,24,209,24,16,5,228,228,36,13,16,24,81,24,16,68,16,68,16,24,
- 177,24,14,228,228,132,5,16,24,49,24,16,68,14,68,16,24,145,24,14,228,228,196,5,
- 81,24,16,68,16,68,16,24,113,24,14,228,228,228,4,13,24,16,24,16,68,17,68,16,
- 24,81,24,14,228,4,5,109,5,228,100,14,56,16,68,22,68,16,24,49,24,16,196,5,
- 14,16,17,120,17,16,14,5,228,4,13,56,16,68,18,68,16,24,81,5,164,13,16,248,
- 56,16,13,228,4,14,24,16,68,23,68,16,24,16,24,14,164,14,56,49,16,110,16,17,
- 24,17,24,14,228,13,24,16,68,25,68,16,24,17,16,5,132,14,24,16,17,16,5,164,
- 13,14,24,17,24,14,196,5,24,16,68,20,68,16,56,14,132,13,24,17,24,49,13,228,
- 14,24,17,24,13,196,48,68,25,68,16,24,16,5,100,5,16,24,17,14,17,24,17,13,
- 228,14,24,17,16,5,164,14,16,68,22,68,16,24,14,132,13,56,14,4,14,24,17,16,
- 5,228,14,56,13,164,14,16,68,20,68,16,24,13,132,16,56,13,36,14,56,16,228,13,
- 56,16,164,14,16,68,23,68,16,17,5,100,5,16,24,16,68,5,16,56,14,228,16,24,
- 16,5,132,14,16,68,20,68,48,132,13,56,14,100,5,16,17,24,14,196,14,56,13,132,
- 14,16,68,21,68,16,14,132,13,56,14,132,13,24,17,24,13,164,14,56,13,132,14,16,
- 68,21,68,16,14,132,13,56,14,164,13,24,17,24,13,132,14,56,13,132,14,16,68,20,
- 68,16,14,132,13,56,14,196,14,24,17,16,5,100,14,56,13,132,48,68,23,68,16,14,
- 132,5,16,24,16,228,14,56,16,5,68,16,24,16,5,100,5,17,16,68,20,68,16,14,
- 164,16,56,13,228,16,56,14,36,13,56,16,132,13,24,16,68,22,68,16,14,164,13,56,
- 14,228,5,16,17,24,14,4,14,56,13,132,14,24,16,68,25,68,16,14,164,5,16,17,
- 24,14,228,13,17,24,17,14,17,24,16,5,100,5,16,24,16,68,20,68,48,196,13,24,
- 17,24,14,228,13,49,24,17,24,13,132,14,56,16,68,25,68,16,24,5,196,14,24,17,
- 24,14,13,164,5,16,17,16,24,14,132,5,16,17,24,16,68,23,68,16,24,13,228,14,
- 24,17,24,17,16,110,16,49,56,14,164,14,24,16,24,16,68,18,68,16,24,14,228,4,
- 13,16,248,56,16,13,164,5,81,24,16,68,22,68,16,56,13,228,4,5,14,16,17,120,
- 17,16,14,5,196,16,24,49,24,16,68,17,68,16,56,14,228,100,5,109,5,228,4,14,
- 24,81,24,16,68,16,68,16,24,16,24,13,228,228,228,4,14,24,113,24,16,68,14,68,
- 16,24,81,5,228,228,196,14,24,145,24,16,68,16,68,16,24,49,24,16,5,228,228,132,
- 14,24,177,24,16,68,17,68,16,24,81,24,16,13,228,228,36,5,16,24,209,24,16,68,
- 17,68,16,24,113,24,17,14,228,196,5,14,17,24,241,24,16,68,19,68,16,24,177,24,
- 16,13,5,228,36,5,14,16,24,241,49,24,16,68,20,68,16,24,209,56,16,46,13,69,
- 45,14,16,17,56,177,88,49,24,16,68,16,68,16,24,241,17,120,81,120,241,24,16,14,
- 16,88,16,68,17,68,16,24,241,241,241,81,24,14,5,13,5,13,16,24,16,68,18,68,
- 16,24,241,241,241,49,24,14,4,13,24,17,14,5,24,16,68,17,68,16,24,241,241,241,
- 49,16,5,16,5,14,56,13,14,16,68,19,68,16,24,241,241,241,17,24,16,5,24,16,
- 5,14,24,14,13,16,68,18,68,16,24,241,241,241,17,24,16,5,16,24,14,4,17,46,
- 16,68,14,68,16,24,241,241,241,49,24,45,56,14,37,48,68,16,68,16,24,241,241,241,
- 81,16,5,13,46,4,14,24,16,68,11,68,16,248,248,248,184,78,16,56,16,68,11,68,
- 13,240,240,240,240,48,15,16,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,
- 228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,
- 228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,13,240,240,240,240,112,13,68,
- 13,68,16,56,16,24,16,17,248,248,248,184,16,68,14,68,48,5,4,37,14,24,241,241,
- 241,113,24,16,68,16,68,16,14,4,46,4,5,16,24,241,241,241,81,24,16,68,15,68,
- 16,14,5,24,80,14,24,241,241,241,81,24,16,68,14,68,48,13,49,56,46,24,241,241,
- 241,49,24,16,68,18,68,16,24,14,16,24,17,24,14,13,24,241,241,241,49,24,16,68,
- 17,68,16,24,16,78,24,14,4,16,24,241,241,241,17,24,16,68,16,68,16,24,17,14,
- 36,5,4,5,241,241,241,81,24,16,68,17,68,16,24,17,24,110,16,24,177,120,81,120,
- 241,17,24,16,68,21,68,16,24,49,16,120,113,56,17,16,14,45,69,13,46,16,56,209,
- 24,16,68,19,68,16,24,241,49,24,16,14,5,228,36,5,13,16,24,177,24,16,68,17,
- 68,16,24,241,24,17,14,5,228,196,14,17,24,113,24,16,68,18,68,16,24,209,24,16,
- 5,228,5,228,4,13,16,24,81,24,16,68,19,68,16,24,177,24,14,228,4,5,14,228,
- 36,5,16,24,49,24,16,68,18,68,16,24,145,24,14,228,36,5,16,13,228,36,5,81,
- 24,16,68,23,68,16,24,113,24,14,36,45,78,45,5,4,5,17,16,228,68,13,24,16,
- 24,16,68,21,68,16,24,81,24,14,4,13,16,216,48,14,16,24,14,228,68,14,56,16,
- 68,20,68,16,24,49,24,16,4,13,56,241,56,49,24,13,228,36,13,56,16,68,18,68,
- 16,24,81,37,16,24,241,145,24,16,5,228,36,14,24,16,68,23,68,16,24,16,24,14,
- 4,13,24,113,88,17,88,113,24,16,5,228,4,13,24,16,68,26,68,16,24,17,16,5,
- 4,14,24,81,24,16,14,13,5,45,16,81,88,17,13,228,5,24,16,68,20,68,16,56,
- 14,36,14,24,49,24,16,5,100,5,88,48,110,5,228,48,68,24,68,16,24,16,5,36,
- 13,24,49,24,13,100,5,48,14,13,5,36,5,228,68,14,16,68,19,68,16,24,14,68,
- 5,49,24,16,132,14,13,164,46,228,36,14,16,68,17,68,16,24,13,100,16,56,14,228,
- 164,16,14,228,4,14,16,68,17,68,16,17,5,100,14,56,16,228,164,13,24,14,228,14,
- 16,68,16,68,48,132,5,17,24,16,228,196,16,24,13,196,14,16,68,18,68,16,14,164,
- 14,24,16,5,228,164,14,24,16,5,164,14,16,68,18,68,16,14,164,5,16,24,13,228,
- 164,5,17,24,14,164,14,16,68,16,68,16,14,196,13,24,14,228,164,5,16,56,5,132,
- 48,68,17,68,16,14,228,14,24,5,228,164,16,56,14,100,5,17,16,68,18,68,16,14,
- 228,4,46,228,164,16,24,17,16,5,68,13,24,16,68,21,68,16,14,228,36,14,13,164,
- 13,14,132,16,24,17,24,13,68,14,24,16,68,24,68,16,14,228,68,5,68,5,14,16,
- 17,5,100,13,24,49,24,14,36,5,16,24,16,68,22,68,48,228,5,77,46,16,17,56,
- 13,100,5,16,24,49,24,14,36,14,56,16,68,24,68,16,24,5,196,5,14,152,49,16,
- 109,14,16,24,81,24,14,4,5,16,17,24,16,68,22,68,16,24,13,228,4,13,16,17,
- 16,113,184,113,24,13,4,14,24,16,24,16,68,19,68,16,24,14,228,36,5,16,24,241,
- 113,16,24,16,37,81,24,16,68,20,68,16,56,13,228,36,13,81,56,241,24,17,13,4,
- 16,24,49,24,16,68,22,68,16,56,14,228,68,13,24,17,80,17,152,16,14,13,4,14,
- 24,81,24,16,68,22,68,16,24,16,24,13,228,68,14,24,13,4,37,141,5,36,14,24,
- 113,24,16,68,18,68,16,24,81,5,228,36,5,16,13,228,36,14,24,145,24,16,68,19,
- 68,16,24,49,24,16,5,228,36,14,13,228,4,14,24,177,24,16,68,18,68,16,24,81,
- 24,16,13,228,4,37,196,5,16,24,209,24,16,68,17,68,16,24,113,24,17,14,228,196,
- 5,14,17,24,241,24,16,68,22,68,16,24,177,24,16,13,5,228,36,5,14,16,24,113,
- 56,17,24,49,24,16,68,23,68,16,24,209,56,16,46,13,69,45,14,16,17,56,113,24,
- 80,14,24,17,24,16,68,18,68,16,24,241,17,120,81,120,177,24,14,36,37,16,17,24,
- 16,68,19,68,16,24,241,241,241,17,24,16,4,5,14,13,5,14,16,24,16,68,16,68,
- 16,24,241,241,241,81,5,14,24,16,24,48,24,16,68,17,68,16,24,241,241,241,49,24,
- 46,24,17,24,16,13,24,16,68,16,68,16,24,241,241,241,81,16,14,56,16,24,13,14,
- 16,68,17,68,16,24,241,241,241,81,24,15,14,13,14,16,5,14,16,68,15,68,16,24,
- 241,241,241,113,16,5,4,5,36,14,16,68,13,68,16,24,241,241,241,113,24,16,110,24,
- 16,68,9,68,16,248,248,248,248,120,16,68,11,68,13,240,240,240,240,48,15,16,13,68,
- 8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,
- 164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,
- 228,228,36,31,9,68,13,240,240,240,240,112,13,68,9,68,16,248,248,248,248,120,16,68,
- 18,68,16,24,17,24,17,24,16,46,17,24,241,241,241,17,24,16,68,16,68,16,24,80,
- 24,13,36,13,16,24,241,241,241,24,16,68,19,68,16,24,14,4,14,24,14,13,5,4,
- 14,24,241,241,241,24,16,68,18,68,16,14,4,5,4,45,5,4,5,16,24,241,241,241,
- 24,16,68,17,68,16,14,5,4,5,13,36,13,14,241,241,241,49,24,16,68,16,68,16,
- 24,14,5,15,14,100,15,24,241,241,241,24,16,68,17,68,16,24,17,16,24,14,45,37,
- 14,24,241,241,241,24,16,68,16,68,16,24,81,88,17,48,145,120,81,120,241,17,24,16,
- 68,20,68,16,24,209,24,81,56,17,16,14,45,69,13,46,16,56,209,24,16,68,19,68,
- 16,24,241,49,24,16,14,5,228,36,5,13,16,24,177,24,16,68,17,68,16,24,241,24,
- 17,14,5,228,196,14,17,24,113,24,16,68,17,68,16,24,209,24,16,5,228,228,36,13,
- 16,24,81,24,16,68,16,68,16,24,177,24,14,228,228,132,5,16,24,49,24,16,68,14,
- 68,16,24,145,24,14,228,228,196,5,81,24,16,68,16,68,16,24,113,24,14,228,228,228,
- 4,13,24,16,24,16,68,14,68,16,24,81,24,14,228,228,228,68,14,56,16,68,20,68,
- 16,24,49,24,16,228,68,5,4,13,46,13,5,228,36,13,56,16,68,21,68,16,24,81,
- 5,228,5,14,48,5,16,88,48,14,13,5,196,14,24,16,68,24,68,16,24,16,24,14,
- 196,13,14,16,88,14,16,113,88,17,16,14,13,100,13,24,16,68,24,68,16,24,17,16,
- 5,100,5,14,16,56,81,16,113,120,49,56,16,5,68,5,24,16,68,23,68,16,56,14,
- 68,13,14,17,56,17,152,49,24,17,110,16,24,16,24,16,132,48,68,27,68,16,24,16,
- 5,36,5,16,24,81,24,16,77,14,16,24,14,13,100,5,14,56,14,132,14,16,68,22,
- 68,16,24,14,100,15,24,49,24,14,132,5,16,5,196,14,24,13,132,14,16,68,21,68,
- 16,24,13,100,13,24,16,24,14,196,13,14,196,5,24,5,132,14,16,68,20,68,16,17,
- 5,100,5,16,24,16,228,4,14,5,196,14,5,132,14,16,68,15,68,48,164,14,24,14,
- 228,4,45,196,14,164,14,16,68,18,68,16,14,164,13,24,13,228,4,5,14,164,5,13,
- 164,14,16,68,17,68,16,14,196,16,13,228,4,5,16,5,132,45,164,14,16,68,17,68,
- 16,14,196,14,13,228,4,13,24,14,132,14,5,164,48,68,19,68,16,14,196,5,13,228,
- 4,14,24,16,100,13,16,164,5,17,16,68,20,68,16,14,228,13,228,5,16,17,24,13,
- 36,13,24,14,164,13,24,16,68,21,68,16,14,228,45,196,14,24,16,24,14,5,14,17,
- 24,13,164,14,24,16,68,21,68,16,14,228,4,16,13,100,5,14,24,145,24,49,5,132,
- 5,16,24,16,68,21,68,48,228,4,14,24,46,13,14,16,24,16,145,16,24,16,164,14,
- 56,16,68,21,68,16,24,5,228,5,16,120,49,152,17,16,24,14,132,5,16,17,24,16,
- 68,25,68,16,24,13,228,4,14,24,48,17,24,17,14,45,14,48,56,13,132,14,24,16,
- 24,16,68,20,68,16,24,14,228,4,13,88,16,14,5,132,5,45,132,5,81,24,16,68,
- 17,68,16,56,13,228,4,46,13,5,228,196,16,24,49,24,16,68,14,68,16,56,14,228,
- 228,228,68,14,24,81,24,16,68,16,68,16,24,16,24,13,228,228,228,4,14,24,113,24,
- 16,68,14,68,16,24,81,5,228,228,196,14,24,145,24,16,68,16,68,16,24,49,24,16,
- 5,228,228,132,14,24,177,24,16,68,17,68,16,24,81,24,16,13,228,228,36,5,16,24,
- 209,24,16,68,17,68,16,24,113,24,17,14,228,196,5,14,17,24,241,24,16,68,19,68,
- 16,24,177,24,16,13,5,228,36,5,14,16,24,241,49,24,16,68,22,68,16,24,209,56,
- 16,46,13,69,45,14,16,17,56,49,48,17,88,81,24,16,68,19,68,16,24,241,17,120,
- 81,120,113,24,14,5,77,14,24,49,24,16,68,16,68,16,24,241,241,241,24,14,100,14,
- 15,5,14,24,16,68,18,68,16,24,241,241,241,17,16,14,13,36,13,5,4,5,14,16,
- 68,18,68,16,24,241,241,241,24,16,5,4,5,45,4,5,4,14,16,68,19,68,16,24,
- 241,241,241,24,14,4,5,13,14,24,14,4,14,24,16,68,18,68,16,24,241,241,241,24,
- 16,5,36,13,24,16,15,16,24,16,68,18,68,16,24,241,241,241,17,24,16,46,16,24,
- 17,24,17,24,16,68,13,68,16,24,241,241,241,81,56,113,16,24,16,68,9,68,16,248,
- 248,248,248,120,16,68,9,68,13,240,240,240,240,112,13,68,8,31,228,228,228,228,228,36,
- 31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,
- 164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,13,242,
- 242,242,242,114,13,68,10,68,18,119,50,247,247,247,183,18,68,15,68,18,23,18,14,101,
- 14,23,243,243,243,51,23,18,68,14,68,18,23,5,164,13,23,243,243,243,19,23,18,68,
- 16,68,18,14,36,5,14,5,68,14,23,243,243,243,23,18,68,17,68,18,5,4,5,19,
- 55,5,36,5,23,243,243,243,23,18,68,17,68,18,5,4,5,18,55,5,36,5,23,243,
- 243,243,23,18,68,16,68,18,5,36,5,14,5,68,13,23,243,243,243,23,18,68,14,68,
- 50,196,5,18,23,243,19,23,243,179,23,18,68,18,68,18,23,15,5,100,5,18,23,147,
- 119,83,119,243,19,23,18,68,23,68,18,55,18,15,46,18,19,23,83,87,18,14,13,133,
- 14,15,18,55,211,23,18,68,20,68,18,23,19,151,115,23,18,14,5,228,36,5,13,18,
- 23,179,23,18,68,16,68,18,23,243,23,19,14,5,228,196,14,55,115,23,18,68,17,68,
- 18,23,211,23,18,5,228,228,36,5,18,23,83,23,18,68,16,68,18,23,179,23,14,228,
- 228,132,5,18,23,51,23,18,68,16,68,18,23,147,23,14,228,228,196,5,19,23,19,23,
- 18,68,16,68,18,23,115,23,14,228,228,228,4,13,23,19,23,18,68,14,68,18,23,83,
- 23,14,228,228,228,68,18,55,18,68,15,68,18,23,51,23,18,228,36,165,228,100,5,55,
- 18,68,17,68,18,23,83,5,228,13,50,119,50,13,228,68,18,23,18,68,20,68,18,23,
- 19,23,14,196,13,18,87,115,87,18,13,228,4,13,23,18,68,17,68,18,55,18,5,164,
- 14,55,243,51,55,14,228,5,23,18,68,14,68,18,55,14,164,14,23,243,179,23,14,228,
- 50,68,17,68,18,23,18,5,132,5,23,147,151,179,23,5,196,15,18,68,21,68,18,23,
- 15,164,18,23,83,55,14,37,13,18,23,147,23,18,196,14,18,68,19,68,18,23,5,132,
- 5,23,147,5,132,15,23,147,23,5,164,14,18,68,20,68,18,19,5,132,14,23,83,23,
- 14,196,18,23,115,23,14,164,14,18,68,18,68,50,164,15,23,83,23,13,196,18,23,115,
- 23,15,164,14,18,68,19,68,18,15,164,15,23,83,23,14,196,18,23,115,23,15,164,14,
- 18,68,20,68,18,14,164,14,23,83,23,18,5,132,14,23,147,23,14,164,15,18,68,19,
- 68,18,14,164,5,23,115,23,18,14,69,15,23,179,23,5,164,50,68,18,68,18,14,196,
- 18,23,115,87,19,55,179,23,18,164,5,19,18,68,15,68,18,14,196,13,23,243,243,23,
- 13,164,5,23,18,68,15,68,18,14,228,14,23,243,179,23,14,196,15,23,18,68,17,68,
- 18,15,228,4,14,55,243,51,55,14,196,5,18,23,18,68,16,68,50,228,36,13,18,87,
- 115,87,18,13,228,14,55,18,68,19,68,18,23,5,228,36,5,14,50,119,50,14,5,228,
- 5,18,55,18,68,15,68,18,23,13,228,132,165,228,68,14,23,19,23,18,68,13,68,18,
- 23,18,228,228,228,132,5,83,23,18,68,14,68,18,55,5,228,228,228,100,18,23,51,23,
- 18,68,14,68,18,55,18,228,228,228,68,14,23,83,23,18,68,16,68,18,23,19,23,13,
- 228,228,228,4,14,23,115,23,18,68,16,68,18,23,19,23,19,5,228,228,196,14,23,147,
- 23,18,68,16,68,18,23,51,23,18,5,228,228,132,14,23,179,23,18,68,17,68,18,23,
- 83,23,18,5,228,228,36,5,18,23,211,23,18,68,18,68,18,23,115,55,14,228,196,5,
- 14,19,23,19,183,19,23,18,68,24,68,18,23,179,23,18,13,5,228,36,5,14,18,55,
- 19,23,18,14,45,14,18,55,18,68,23,68,18,23,211,55,18,15,14,133,13,14,18,87,
- 51,23,15,5,100,5,14,23,18,68,14,68,18,23,243,19,119,83,119,115,23,18,228,50,
- 68,18,68,18,23,243,179,23,243,19,23,13,68,13,14,5,36,5,18,68,16,68,18,23,
- 243,243,243,23,5,36,5,87,5,4,5,18,68,18,68,18,23,243,243,243,23,5,36,5,
- 19,23,18,5,4,5,18,68,16,68,18,23,243,243,243,23,15,68,5,13,5,36,14,18,
- 68,14,68,18,23,243,243,243,19,23,14,164,5,23,18,68,14,68,18,23,243,243,243,51,
- 23,15,101,14,55,18,68,14,68,18,23,243,243,243,83,55,51,55,19,23,18,68,9,68,
- 18,247,247,247,247,119,18,68,9,68,13,242,242,242,242,114,13,68,8,31,228,228,228,228,
- 228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,
- 228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,
- 13,242,242,242,242,114,13,68,12,68,18,87,18,15,14,247,247,247,183,18,68,15,68,18,
- 23,15,37,36,18,23,243,243,243,83,23,18,68,14,68,18,23,14,100,18,23,243,243,243,
- 83,23,18,68,14,68,18,23,15,100,18,23,243,243,243,83,23,18,68,15,68,18,23,50,
- 5,36,14,23,243,243,243,83,23,18,68,15,68,18,55,18,5,36,14,23,243,243,243,83,
- 23,18,68,14,68,18,55,18,68,13,23,243,243,243,83,23,18,68,15,68,18,55,18,68,
- 5,23,243,115,23,243,179,23,18,68,15,68,18,55,14,68,5,243,119,83,119,243,19,23,
- 18,68,21,68,18,55,50,79,19,23,83,87,18,14,13,133,14,15,18,55,211,23,18,68,
- 20,68,18,23,19,151,115,23,18,14,5,228,36,5,13,18,23,179,23,18,68,16,68,18,
- 23,243,23,19,14,5,228,196,14,55,115,23,18,68,17,68,18,23,211,23,18,5,228,228,
- 36,5,18,23,83,23,18,68,16,68,18,23,179,23,14,228,228,132,5,18,23,51,23,18,
- 68,16,68,18,23,147,23,14,228,228,196,5,19,23,19,23,18,68,16,68,18,23,115,23,
- 14,228,228,228,4,13,23,19,23,18,68,17,68,18,23,83,23,14,228,132,5,13,14,228,
- 68,18,55,18,68,19,68,18,23,51,23,18,228,68,5,14,50,23,18,228,68,5,55,18,
- 68,20,68,18,23,83,5,228,5,14,18,19,87,19,18,5,228,68,18,23,18,68,19,68,
- 18,23,19,23,14,196,5,18,87,147,23,5,228,68,13,23,18,68,17,68,18,55,18,5,
- 228,18,23,211,23,5,228,68,5,23,18,68,15,68,18,55,14,228,4,14,23,211,23,13,
- 228,100,50,68,17,68,18,23,18,5,228,4,13,23,211,23,14,228,100,15,18,68,16,68,
- 18,23,15,228,36,5,87,147,23,15,228,100,14,18,68,19,68,18,23,5,228,68,18,15,
- 13,19,23,83,23,18,228,100,14,18,68,18,68,18,19,5,228,68,5,4,5,23,115,23,
- 18,228,100,14,18,68,15,68,50,228,164,13,23,115,23,18,5,228,68,14,18,68,14,68,
- 18,15,228,164,14,23,179,5,228,68,14,18,68,15,68,18,14,228,164,14,23,147,23,5,
- 228,68,15,18,68,14,68,18,14,228,164,15,23,147,23,13,228,68,50,68,16,68,18,14,
- 228,164,18,23,147,23,14,228,36,5,19,18,68,16,68,18,14,228,164,18,23,147,23,14,
- 228,36,5,23,18,68,17,68,18,14,228,132,5,18,23,147,23,15,228,36,15,23,18,68,
- 16,68,18,15,228,132,5,211,23,18,228,4,5,18,23,18,68,13,68,50,228,132,5,247,
- 18,228,4,14,55,18,68,17,68,18,23,5,228,100,5,210,19,18,5,196,5,18,55,18,
- 68,15,68,18,23,13,228,228,36,101,228,14,23,19,23,18,68,13,68,18,23,18,228,228,
- 228,132,5,83,23,18,68,14,68,18,55,5,228,228,228,100,18,23,51,23,18,68,14,68,
- 18,55,18,228,228,228,68,14,23,83,23,18,68,16,68,18,23,19,23,13,228,228,228,4,
- 14,23,115,23,18,68,16,68,18,23,19,23,19,5,228,228,196,14,23,147,23,18,68,16,
- 68,18,23,51,23,18,5,228,228,132,14,23,179,23,18,68,17,68,18,23,83,23,18,5,
- 228,228,36,5,18,23,211,23,18,68,18,68,18,23,115,55,14,228,196,5,14,19,23,19,
- 151,51,23,18,68,23,68,18,23,179,23,18,13,5,228,36,5,14,18,23,51,23,110,18,
- 23,19,23,18,68,23,68,18,23,211,55,18,15,14,133,13,14,18,87,83,23,5,68,13,
- 23,19,23,18,68,20,68,18,23,243,19,119,83,119,179,23,14,4,5,4,14,23,19,23,
- 18,68,17,68,18,23,243,179,23,243,83,23,14,68,15,23,19,23,18,68,16,68,18,23,
- 243,243,243,51,23,18,68,18,23,19,23,18,68,15,68,18,23,243,243,243,51,23,18,68,
- 14,18,55,18,68,14,68,18,23,243,243,243,51,23,18,100,14,55,18,68,15,68,18,23,
- 243,243,243,51,23,19,5,68,5,55,18,68,17,68,18,23,243,243,243,83,23,5,4,5,
- 13,15,19,23,18,68,16,68,18,23,243,243,243,83,23,14,15,18,55,19,23,18,68,9,
- 68,18,247,247,247,247,119,18,68,9,68,13,242,242,242,242,114,13,68,8,31,228,228,228,
- 228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,
- 228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,
- 68,13,242,242,242,242,114,13,68,14,68,18,23,18,37,13,14,19,247,247,247,151,18,68,
- 15,68,18,23,15,100,5,18,23,243,243,243,51,23,18,68,15,68,18,23,14,37,68,5,
- 23,243,243,243,51,23,18,68,16,68,18,23,50,15,5,36,5,23,243,243,243,51,23,18,
- 68,14,68,18,23,5,132,13,23,243,243,243,51,23,18,68,15,68,50,68,5,13,14,19,
- 23,243,243,243,51,23,18,68,15,68,18,14,68,13,46,18,23,243,243,243,51,23,18,68,
- 14,68,18,13,164,14,23,243,83,23,243,179,23,18,68,15,68,18,5,164,13,23,179,119,
- 83,119,243,19,23,18,68,22,68,18,15,14,13,69,4,5,115,87,18,14,13,133,14,15,
- 18,55,211,23,18,68,19,68,18,151,82,83,23,18,14,5,228,36,5,13,18,23,179,23,
- 18,68,18,68,18,23,115,87,19,23,19,14,5,228,196,14,55,115,23,18,68,17,68,18,
- 23,211,23,18,5,228,228,36,5,18,23,83,23,18,68,16,68,18,23,179,23,14,228,228,
- 132,5,18,23,51,23,18,68,16,68,18,23,147,23,14,228,228,196,5,19,23,19,23,18,
- 68,18,68,18,23,115,23,14,164,5,13,37,228,196,13,23,19,23,18,68,19,68,18,23,
- 83,23,14,196,18,55,19,50,14,5,228,100,18,55,18,68,19,68,18,23,51,23,18,228,
- 18,23,51,119,18,13,228,36,5,55,18,68,19,68,18,23,83,5,196,5,19,23,179,55,
- 18,5,228,4,18,23,18,68,19,68,18,23,19,23,14,228,5,23,243,19,23,18,5,228,
- 13,23,18,68,17,68,18,55,18,5,228,14,23,243,51,23,14,228,5,23,18,68,15,68,
- 18,55,14,228,4,15,183,147,23,18,228,4,50,68,19,68,18,23,18,5,228,4,133,14,
- 18,23,115,23,18,5,228,15,18,68,17,68,18,23,15,228,196,5,18,23,115,23,18,5,
- 228,14,18,68,18,68,18,23,5,228,36,5,15,82,55,147,23,18,228,4,14,18,68,16,
- 68,18,19,5,228,4,13,151,211,23,14,228,4,14,18,68,16,68,50,228,4,5,19,23,
- 243,87,18,5,228,4,14,18,68,18,68,18,15,228,4,14,23,179,87,19,18,14,5,228,
- 36,14,18,68,17,68,18,14,228,4,18,23,147,23,18,14,37,228,132,15,18,68,15,68,
- 18,14,228,4,18,23,179,5,36,101,228,36,50,68,18,68,18,14,228,5,179,23,19,82,
- 19,55,18,228,4,5,19,18,68,15,68,18,14,228,5,23,211,119,83,5,228,5,23,18,
- 68,15,68,18,14,228,5,23,243,147,23,5,228,15,23,18,68,16,68,18,15,228,13,23,
- 243,147,23,14,196,5,18,23,18,68,14,68,50,228,13,23,243,147,23,15,196,14,55,18,
- 68,17,68,18,23,5,196,13,247,23,147,23,18,164,5,18,55,18,68,20,68,18,23,13,
- 196,37,13,46,15,82,19,215,5,132,14,23,19,23,18,68,18,68,18,23,18,228,228,69,
- 13,46,15,18,5,100,5,83,23,18,68,14,68,18,55,5,228,228,228,100,18,23,51,23,
- 18,68,14,68,18,55,18,228,228,228,68,14,23,83,23,18,68,16,68,18,23,19,23,13,
- 228,228,228,4,14,23,115,23,18,68,16,68,18,23,19,23,19,5,228,228,196,14,23,147,
- 23,18,68,16,68,18,23,51,23,18,5,228,228,132,14,23,179,23,18,68,17,68,18,23,
- 83,23,18,5,228,228,36,5,18,151,83,23,18,68,17,68,18,23,115,55,14,228,196,5,
- 14,19,23,114,19,119,18,68,23,68,18,23,179,23,18,13,5,228,36,5,14,18,23,19,
- 23,13,36,101,14,23,18,68,20,68,18,23,211,55,18,15,14,133,13,14,18,87,51,23,
- 14,196,23,18,68,16,68,18,23,243,19,119,83,119,147,23,18,164,5,23,18,68,17,68,
- 18,23,243,179,23,243,51,23,18,47,14,68,5,23,18,68,16,68,18,23,243,243,243,19,
- 23,19,14,37,68,14,23,18,68,15,68,18,23,243,243,243,19,23,14,68,69,18,23,18,
- 68,15,68,18,23,243,243,243,19,23,13,68,14,50,55,18,68,14,68,18,23,243,243,243,
- 19,23,14,132,13,55,18,68,15,68,18,23,243,243,243,19,23,19,13,100,14,55,18,68,
- 15,68,18,23,243,243,243,83,23,18,14,37,18,55,18,68,9,68,18,247,247,247,247,119,
- 18,68,9,68,13,242,242,242,242,114,13,68,8,31,228,228,228,228,228,36,31,8,31,228,
- 228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,
- 228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,13,242,242,242,242,114,
- 13,68,11,68,18,23,114,19,247,247,247,183,18,68,14,68,18,23,14,68,5,14,243,243,
- 243,115,23,18,68,14,68,18,23,5,132,15,23,243,243,243,51,23,18,68,15,68,18,23,
- 78,5,36,14,23,243,243,243,51,23,18,68,14,68,18,55,15,100,18,23,243,243,243,51,
- 23,18,68,14,68,18,55,18,100,18,23,243,243,243,51,23,18,68,15,68,50,46,13,5,
- 36,14,23,243,243,243,51,23,18,68,13,68,50,164,15,23,243,83,23,243,179,23,18,68,
- 16,68,18,23,5,100,14,23,211,119,83,119,243,19,23,18,68,22,68,18,23,37,13,14,
- 18,55,115,87,18,14,13,133,14,15,18,55,211,23,18,68,20,68,18,23,51,87,147,23,
- 18,14,5,228,36,5,13,18,23,179,23,18,68,16,68,18,23,243,23,19,14,5,228,196,
- 14,55,115,23,18,68,17,68,18,23,211,23,18,5,228,228,36,5,18,23,83,23,18,68,
- 16,68,18,23,179,23,14,228,228,132,5,18,23,51,23,18,68,16,68,18,23,147,23,14,
- 228,228,196,5,19,23,19,23,18,68,16,68,18,23,115,23,14,228,228,228,4,13,23,19,
- 23,18,68,14,68,18,23,83,23,14,228,228,228,68,18,55,18,68,19,68,18,23,51,23,
- 18,196,13,46,47,46,13,5,228,100,5,55,18,68,17,68,18,23,83,5,196,18,247,18,
- 14,5,228,36,18,23,18,68,19,68,18,23,19,23,14,228,18,23,211,55,18,5,228,4,
- 13,23,18,68,19,68,18,55,18,5,196,5,18,23,243,19,23,14,228,4,5,23,18,68,
- 15,68,18,55,14,228,5,51,151,115,23,18,228,36,50,68,20,68,18,23,18,5,228,5,
- 55,19,50,15,18,23,147,5,228,4,15,18,68,19,68,18,23,15,228,4,5,14,133,18,
- 23,115,23,5,228,4,14,18,68,16,68,18,23,5,228,100,13,50,55,179,5,228,4,14,
- 18,68,16,68,18,19,5,228,100,5,55,179,23,18,228,36,14,18,68,16,68,50,228,132,
- 5,18,23,147,23,18,5,228,36,14,18,68,14,68,18,15,228,164,18,23,211,14,228,36,
- 14,18,68,15,68,18,14,228,164,15,87,115,55,5,228,4,15,18,68,16,68,18,14,228,
- 164,5,45,18,23,115,23,5,228,4,50,68,15,68,18,14,228,4,5,210,179,23,5,228,
- 5,19,18,68,15,68,18,14,228,4,5,19,215,179,5,228,5,23,18,68,17,68,18,14,
- 228,36,18,23,243,51,23,18,228,4,15,23,18,68,18,68,18,15,228,36,15,23,243,19,
- 23,18,5,228,5,18,23,18,68,16,68,50,228,36,14,23,179,87,18,5,228,4,14,55,
- 18,68,19,68,18,23,5,228,4,13,23,19,151,50,13,228,36,5,18,55,18,68,21,68,
- 18,23,13,228,4,5,55,19,50,14,13,5,228,100,14,23,19,23,18,68,14,68,18,23,
- 18,228,4,101,228,228,5,83,23,18,68,14,68,18,55,5,228,228,228,100,18,23,51,23,
- 18,68,14,68,18,55,18,228,228,228,68,14,23,83,23,18,68,16,68,18,23,19,23,13,
- 228,228,228,4,14,23,115,23,18,68,16,68,18,23,19,23,19,5,228,228,196,14,23,147,
- 23,18,68,16,68,18,23,51,23,18,5,228,228,132,14,23,179,23,18,68,19,68,18,23,
- 83,23,18,5,228,228,36,5,18,23,115,55,19,23,18,68,19,68,18,23,115,55,14,228,
- 196,5,14,19,23,51,87,50,19,23,18,68,23,68,18,23,179,23,18,13,5,228,36,5,
- 14,18,23,83,23,18,14,69,18,23,18,68,21,68,18,23,211,55,18,15,14,133,13,14,
- 18,87,83,23,14,132,18,23,18,68,16,68,18,23,243,19,119,83,119,147,23,18,164,15,
- 23,18,68,17,68,18,23,243,179,23,243,51,23,15,68,5,15,50,23,18,68,17,68,18,
- 23,243,243,243,19,23,18,5,68,14,23,19,23,18,68,18,68,18,23,243,243,243,19,23,
- 18,5,36,5,14,23,18,23,18,68,17,68,18,23,243,243,243,19,23,18,68,14,13,5,
- 18,23,18,68,15,68,18,23,243,243,243,19,23,18,132,5,19,23,18,68,15,68,18,23,
- 243,243,243,51,23,18,37,36,5,55,18,68,13,68,18,23,243,243,243,83,55,114,19,23,
- 18,68,9,68,18,247,247,247,247,119,18,68,9,68,13,242,242,242,242,114,13,68,8,31,
- 228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,
- 7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,
- 36,31,9,68,13,242,242,242,242,114,13,68,13,68,18,55,18,13,37,14,247,247,247,151,
- 18,68,14,68,18,55,13,68,14,23,243,243,243,83,23,18,68,14,68,18,23,18,100,14,
- 23,243,243,243,83,23,18,68,17,68,18,23,13,4,13,5,4,14,23,243,243,243,83,23,
- 18,68,16,68,50,36,5,36,5,14,18,23,243,243,243,19,23,18,68,13,68,18,13,196,
- 18,23,243,243,243,19,23,18,68,15,68,18,14,13,37,100,18,23,243,243,243,19,23,18,
- 68,15,68,18,87,5,36,5,15,243,115,23,243,179,23,18,68,17,68,18,23,19,18,68,
- 13,23,211,119,83,119,243,19,23,18,68,21,68,18,55,18,13,46,18,147,87,18,14,13,
- 133,14,15,18,55,211,23,18,68,20,68,18,23,19,151,115,23,18,14,5,228,36,5,13,
- 18,23,179,23,18,68,16,68,18,23,243,23,19,14,5,228,196,14,55,115,23,18,68,17,
- 68,18,23,211,23,18,5,228,228,36,5,18,23,83,23,18,68,16,68,18,23,179,23,14,
- 228,228,132,5,18,23,51,23,18,68,16,68,18,23,147,23,14,228,228,196,5,19,23,19,
- 23,18,68,16,68,18,23,115,23,14,228,228,228,4,13,23,19,23,18,68,18,68,18,23,
- 83,23,14,228,4,5,47,146,5,228,4,18,55,18,68,17,68,18,23,51,23,18,228,36,
- 18,215,5,228,4,5,55,18,68,18,68,18,23,83,5,228,4,14,23,179,23,5,228,36,
- 18,23,18,68,20,68,18,23,19,23,14,228,4,5,18,23,179,23,5,228,36,13,23,18,
- 68,18,68,18,55,18,5,228,4,14,23,211,23,5,228,36,5,23,18,68,18,68,18,55,
- 14,228,4,5,18,23,19,55,115,23,5,228,68,50,68,22,68,18,23,18,5,228,4,14,
- 23,19,23,18,14,23,83,23,5,228,68,15,18,68,22,68,18,23,15,228,4,5,18,23,
- 19,23,13,14,23,83,23,5,228,68,14,18,68,22,68,18,23,5,228,4,14,23,19,23,
- 19,5,18,23,83,23,5,228,68,14,18,68,19,68,18,19,5,228,5,18,23,83,18,147,
- 23,15,78,5,196,14,18,68,16,68,50,228,4,14,23,115,23,179,87,19,5,196,14,18,
- 68,15,68,18,15,228,5,18,23,243,147,23,18,228,14,18,68,14,68,18,14,228,14,23,
- 243,179,23,14,228,15,18,68,13,68,18,14,228,15,50,151,243,23,13,228,50,68,17,68,
- 18,14,228,36,69,46,18,23,147,87,5,196,5,19,18,68,16,68,18,14,228,196,18,23,
- 115,23,82,5,196,5,23,18,68,16,68,18,14,228,164,5,23,147,23,13,228,36,15,23,
- 18,68,17,68,18,15,228,164,5,23,147,23,14,228,4,5,18,23,18,68,16,68,50,228,
- 164,14,23,18,115,23,14,228,4,14,55,18,68,16,68,18,23,5,228,132,15,151,50,14,
- 228,5,18,55,18,68,19,68,18,23,13,228,132,14,15,14,13,69,228,36,14,23,19,23,
- 18,68,13,68,18,23,18,228,228,228,132,5,83,23,18,68,14,68,18,55,5,228,228,228,
- 100,18,23,51,23,18,68,14,68,18,55,18,228,228,228,68,14,23,83,23,18,68,16,68,
- 18,23,19,23,13,228,228,228,4,14,23,115,23,18,68,16,68,18,23,19,23,19,5,228,
- 228,196,14,23,147,23,18,68,16,68,18,23,51,23,18,5,228,228,132,14,23,179,23,18,
- 68,17,68,18,23,83,23,18,5,228,228,36,5,18,23,211,23,18,68,18,68,18,23,115,
- 55,14,228,196,5,14,19,23,19,119,83,23,18,68,26,68,18,23,179,23,18,13,5,228,
- 36,5,14,18,23,51,23,18,14,13,5,18,23,19,23,18,68,23,68,18,23,211,55,18,
- 15,14,133,13,14,18,87,83,23,14,68,18,23,19,23,18,68,18,68,18,23,243,19,119,
- 83,119,147,23,15,5,36,5,18,87,18,68,14,68,18,23,243,179,23,243,51,23,5,100,
- 69,50,68,13,68,18,23,243,243,243,23,18,196,5,23,18,68,17,68,18,23,243,243,243,
- 23,18,14,13,36,37,4,18,23,18,68,16,68,18,23,243,243,243,51,23,18,36,13,4,
- 5,55,18,68,14,68,18,23,243,243,243,51,23,15,100,18,55,18,68,16,68,18,23,243,
- 243,243,51,23,15,68,5,23,19,23,18,68,17,68,18,23,243,243,243,51,23,18,5,45,
- 18,23,19,23,18,68,9,68,18,247,247,247,247,119,18,68,9,68,13,242,242,242,242,114,
- 13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,
- 228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,
- 228,228,228,228,36,31,10,68,13,210,15,242,242,242,114,13,68,11,68,50,46,13,101,247,
- 247,247,119,18,68,13,68,18,5,164,5,23,243,243,243,51,23,18,68,13,68,18,13,164,
- 14,23,243,243,243,51,23,18,68,16,68,18,14,68,13,14,13,18,23,243,243,243,51,23,
- 18,68,15,68,18,15,68,5,14,15,23,243,243,243,83,23,18,68,14,68,18,23,5,132,
- 14,23,243,243,243,51,23,18,68,16,68,18,23,50,14,5,36,5,23,243,243,243,51,23,
- 18,68,16,68,18,23,14,37,68,5,23,243,83,23,243,179,23,18,68,17,68,18,23,15,
- 100,5,18,23,179,119,83,119,243,19,23,18,68,23,68,18,23,18,4,37,14,18,23,115,
- 87,18,14,13,133,14,15,18,55,211,23,18,68,21,68,18,23,19,50,87,115,23,18,14,
- 5,228,36,5,13,18,23,179,23,18,68,18,68,18,23,19,55,147,23,19,14,5,228,196,
- 14,55,115,23,18,68,17,68,18,23,211,23,18,5,228,228,36,5,18,23,83,23,18,68,
- 16,68,18,23,179,23,14,228,228,132,5,18,23,51,23,18,68,16,68,18,23,147,23,14,
- 228,228,196,5,19,23,19,23,18,68,18,68,18,23,115,23,14,228,164,101,13,5,132,13,
- 23,19,23,18,68,20,68,18,23,83,23,14,164,69,13,46,15,82,19,87,5,164,18,55,
- 18,68,19,68,18,23,51,23,18,100,5,82,247,55,19,23,18,196,5,55,18,68,19,68,
- 18,23,83,5,100,13,23,19,23,243,83,23,18,228,18,23,18,68,18,68,18,23,19,23,
- 14,132,13,23,243,147,23,14,228,13,23,18,68,17,68,18,55,18,5,132,13,23,243,147,
- 23,13,228,5,23,18,68,14,68,18,55,14,164,5,23,243,179,5,228,4,50,68,16,68,
- 18,23,18,5,164,5,23,211,183,18,228,36,15,18,68,20,68,18,23,15,196,5,18,23,
- 115,23,19,37,78,15,14,228,36,14,18,68,16,68,18,23,5,228,18,23,147,23,14,5,
- 228,196,14,18,68,18,68,18,19,5,228,14,23,179,55,18,15,14,5,228,68,14,18,68,
- 14,68,50,228,4,5,23,243,119,14,228,36,14,18,68,16,68,18,15,228,36,15,23,243,
- 83,23,13,228,4,14,18,68,17,68,18,14,228,36,5,15,19,151,147,23,18,228,4,15,
- 18,68,17,68,18,14,228,100,69,13,14,18,23,115,23,18,228,4,50,68,17,68,18,14,
- 228,228,5,18,23,115,23,18,5,196,5,19,18,68,16,68,18,14,228,68,14,114,55,147,
- 23,18,228,5,23,18,68,15,68,18,14,228,68,14,119,211,23,15,228,15,23,18,68,17,
- 68,18,15,228,68,13,23,243,19,55,5,196,5,18,23,18,68,14,68,50,228,68,5,23,
- 243,55,13,228,14,55,18,68,18,68,18,23,5,228,68,18,23,115,87,18,5,228,5,18,
- 55,18,68,20,68,18,23,13,228,68,18,119,19,18,14,5,228,36,14,23,19,23,18,68,
- 18,68,18,23,18,228,68,14,18,46,13,5,228,100,5,83,23,18,68,14,68,18,55,5,
- 228,228,228,100,18,23,51,23,18,68,14,68,18,55,18,228,228,228,68,14,23,83,23,18,
- 68,16,68,18,23,19,23,13,228,228,228,4,14,23,115,23,18,68,16,68,18,23,19,23,
- 19,5,228,228,196,14,23,147,23,18,68,16,68,18,23,51,23,18,5,228,228,132,14,23,
- 179,23,18,68,19,68,18,23,83,23,18,5,228,228,36,5,18,23,51,119,19,23,18,68,
- 19,68,18,23,115,55,14,228,196,5,14,19,23,19,55,19,82,55,18,68,24,68,18,23,
- 179,23,18,13,5,228,36,5,14,18,55,19,23,18,13,5,36,15,55,18,68,22,68,18,
- 23,211,55,18,15,14,133,13,14,18,87,51,23,18,5,100,14,55,18,68,18,68,18,23,
- 243,19,119,83,119,147,23,14,68,5,13,14,55,18,68,17,68,18,23,243,179,23,243,51,
- 23,13,68,14,15,18,55,18,68,14,68,18,23,243,243,243,19,23,18,164,18,23,18,68,
- 16,68,18,23,243,243,243,51,23,18,14,13,68,13,23,18,68,16,68,18,23,243,243,243,
- 19,23,18,5,45,68,5,23,18,68,14,68,18,23,243,243,243,19,23,15,164,5,23,18,
- 68,14,68,18,23,243,243,243,19,23,14,164,5,23,18,68,17,68,18,23,243,243,243,19,
- 23,13,37,13,46,15,18,23,18,68,9,68,18,247,247,247,247,119,18,68,9,68,13,242,
- 242,242,242,114,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,
- 7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,
- 31,8,31,228,228,228,228,228,36,31,9,68,13,242,242,242,242,114,13,68,9,68,18,247,
- 247,247,247,119,18,68,14,68,18,15,5,13,14,18,243,243,243,179,23,18,68,13,68,18,
- 14,68,18,55,243,243,243,115,23,18,68,15,68,18,5,36,5,46,15,23,243,243,243,83,
- 23,18,68,13,68,18,5,164,14,23,243,243,243,51,23,18,68,15,68,18,5,36,37,68,
- 18,23,243,243,243,19,23,18,68,15,68,18,5,36,46,68,18,23,243,243,243,19,23,18,
- 68,13,68,18,14,164,5,243,115,23,243,179,23,18,68,17,68,18,23,5,100,5,18,23,
- 179,119,83,119,243,19,23,18,68,22,68,18,23,19,18,46,50,23,115,87,18,14,13,133,
- 14,15,18,55,211,23,18,68,20,68,18,23,19,151,115,23,18,14,5,228,36,5,13,18,
- 23,179,23,18,68,16,68,18,23,243,23,19,14,5,228,196,14,55,115,23,18,68,17,68,
- 18,23,211,23,18,5,228,228,36,5,18,23,83,23,18,68,16,68,18,23,179,23,14,228,
- 228,132,5,18,23,51,23,18,68,16,68,18,23,147,23,14,228,228,196,5,19,23,19,23,
- 18,68,16,68,18,23,115,23,14,228,228,228,4,13,23,19,23,18,68,14,68,18,23,83,
- 23,14,228,228,228,68,18,55,18,68,14,68,18,23,51,23,18,228,228,228,100,5,55,18,
- 68,17,68,18,23,83,5,132,14,18,46,37,228,228,36,18,23,18,68,18,68,18,23,19,
- 23,14,164,18,119,19,50,13,228,196,13,23,18,68,17,68,18,55,18,5,164,18,23,83,
- 87,5,228,196,5,23,18,68,14,68,18,55,14,164,5,179,23,18,228,228,4,50,68,17,
- 68,18,23,18,5,164,5,23,147,23,5,228,228,4,15,18,68,19,68,18,23,15,196,13,
- 23,115,23,18,46,47,46,5,228,68,14,18,68,15,68,18,23,5,196,14,23,179,215,14,
- 228,36,14,18,68,16,68,18,19,5,196,14,23,243,147,23,14,228,4,14,18,68,12,68,
- 50,228,14,23,243,211,5,228,14,18,68,15,68,18,15,228,14,23,115,151,147,23,13,228,
- 14,18,68,21,68,18,14,228,14,23,83,23,18,14,5,13,18,23,115,23,14,228,15,18,
- 68,18,68,18,14,228,14,23,83,23,18,68,18,23,115,23,14,228,50,68,20,68,18,14,
- 228,5,23,115,23,18,15,18,23,147,23,14,196,5,19,18,68,17,68,18,14,228,5,18,
- 23,115,87,179,23,13,196,5,23,18,68,17,68,18,14,228,4,14,23,243,115,23,18,5,
- 196,15,23,18,68,18,68,18,15,228,4,5,18,23,243,51,55,5,196,5,18,23,18,68,
- 16,68,50,228,36,5,18,87,83,119,18,5,228,14,55,18,68,22,68,18,23,5,228,36,
- 5,14,18,19,55,19,50,15,13,5,228,5,18,55,18,68,15,68,18,23,13,228,132,133,
- 228,100,14,23,19,23,18,68,13,68,18,23,18,228,228,228,132,5,83,23,18,68,14,68,
- 18,55,5,228,228,228,100,18,23,51,23,18,68,14,68,18,55,18,228,228,228,68,14,23,
- 83,23,18,68,16,68,18,23,19,23,13,228,228,228,4,14,23,115,23,18,68,16,68,18,
- 23,19,23,19,5,228,228,196,14,23,147,23,18,68,16,68,18,23,51,23,18,5,228,228,
- 132,14,23,179,23,18,68,17,68,18,23,83,23,18,5,228,228,36,5,18,23,211,23,18,
- 68,18,68,18,23,115,55,14,228,196,5,14,19,23,19,183,19,23,18,68,23,68,18,23,
- 179,23,18,13,5,228,36,5,14,18,55,19,23,18,15,78,18,55,18,68,23,68,18,23,
- 211,55,18,15,14,133,13,14,18,87,51,23,18,5,100,5,18,23,18,68,16,68,18,23,
- 243,19,119,83,119,147,23,5,164,5,23,18,68,17,68,18,23,243,179,23,243,83,5,36,
- 13,18,36,5,19,18,68,14,68,18,23,243,243,243,19,23,5,36,37,68,50,68,12,68,
- 18,23,243,243,243,19,23,15,196,50,68,16,68,18,23,243,243,243,51,23,18,47,13,36,
- 5,23,18,68,15,68,18,23,243,243,243,83,55,19,5,36,5,23,18,68,15,68,18,23,
- 243,243,243,147,18,15,14,13,14,23,18,68,10,68,18,23,243,243,243,179,151,18,68,9,
- 68,18,247,247,247,247,119,18,68,9,68,13,242,242,242,242,114,13,68,8,31,228,228,228,
- 228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,228,
- 228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,9,
- 68,13,242,242,242,242,114,13,68,11,68,146,15,78,19,247,247,247,87,18,68,13,68,18,
- 13,164,5,23,243,243,243,51,23,18,68,13,68,18,14,164,14,23,243,243,243,51,23,18,
- 68,13,68,50,69,68,18,23,243,243,243,51,23,18,68,15,68,18,23,50,5,36,5,23,
- 243,243,243,83,23,18,68,14,68,18,55,5,68,14,23,243,243,243,83,23,18,68,14,68,
- 18,23,14,100,18,23,243,243,243,83,23,18,68,16,68,18,23,14,5,36,5,23,243,147,
- 23,243,179,23,18,68,17,68,18,55,18,14,5,14,23,243,119,83,119,243,19,23,18,68,
- 22,68,18,23,19,55,19,18,23,147,87,18,14,13,133,14,15,18,55,211,23,18,68,20,
- 68,18,23,115,23,147,23,18,14,5,228,36,5,13,18,23,179,23,18,68,16,68,18,23,
- 243,23,19,14,5,228,196,14,55,115,23,18,68,17,68,18,23,211,23,18,5,228,228,36,
- 5,18,23,83,23,18,68,16,68,18,23,179,23,14,228,228,132,5,18,23,51,23,18,68,
- 16,68,18,23,147,23,14,228,228,196,5,19,23,19,23,18,68,16,68,18,23,115,23,14,
- 228,228,228,4,13,23,19,23,18,68,17,68,18,23,83,23,14,228,132,101,45,14,13,164,
- 18,55,18,68,20,68,18,23,51,23,18,100,37,13,78,15,114,19,151,13,164,5,55,18,
- 68,17,68,18,23,83,5,100,14,247,87,115,18,5,196,18,23,18,68,18,68,18,23,19,
- 23,14,132,5,23,243,147,23,15,228,13,23,18,68,17,68,18,55,18,5,164,18,23,243,
- 115,23,13,228,5,23,18,68,16,68,18,55,14,196,14,23,243,83,23,18,5,228,4,50,
- 68,18,68,18,23,18,5,196,13,23,51,87,179,23,18,228,36,15,18,68,18,68,18,23,
- 15,228,5,87,19,50,23,147,23,13,228,36,14,18,68,19,68,18,23,5,228,4,45,69,
- 18,23,115,23,19,5,228,36,14,18,68,16,68,18,19,5,228,132,14,23,147,23,18,228,
- 68,14,18,68,14,68,50,228,132,5,23,179,23,14,228,68,14,18,68,14,68,18,15,228,
- 132,18,23,211,5,228,68,14,18,68,15,68,18,14,228,100,14,23,179,23,18,228,100,15,
- 18,68,14,68,18,14,228,68,5,23,211,23,14,228,100,50,68,17,68,18,14,228,36,5,
- 18,23,211,23,5,228,68,5,19,18,68,16,68,18,14,228,36,14,87,147,23,18,228,100,
- 5,23,18,68,18,68,18,14,228,68,5,14,18,55,83,23,14,228,100,15,23,18,68,19,
- 68,18,15,228,132,5,14,18,55,19,23,5,228,68,5,18,23,18,68,14,68,50,228,228,
- 5,15,23,18,228,100,14,55,18,68,15,68,18,23,5,228,228,4,37,228,68,5,18,55,
- 18,68,14,68,18,23,13,228,228,228,164,14,23,19,23,18,68,13,68,18,23,18,228,228,
- 228,132,5,83,23,18,68,14,68,18,55,5,228,228,228,100,18,23,51,23,18,68,14,68,
- 18,55,18,228,228,228,68,14,23,83,23,18,68,16,68,18,23,19,23,13,228,228,228,4,
- 14,23,115,23,18,68,16,68,18,23,19,23,19,5,228,228,196,14,23,147,23,18,68,16,
- 68,18,23,51,23,18,5,228,228,132,14,23,179,23,18,68,17,68,18,23,83,23,18,5,
- 228,228,36,5,18,23,211,23,18,68,18,68,18,23,115,55,14,228,196,5,14,19,23,51,
- 55,115,23,18,68,22,68,18,23,179,23,18,13,5,228,36,5,14,18,23,83,23,50,55,
- 51,23,18,68,24,68,18,23,211,55,18,15,14,133,13,14,18,87,115,23,15,4,13,18,
- 23,19,23,18,68,17,68,18,23,243,19,119,83,119,211,23,13,68,5,18,23,18,68,16,
- 68,18,23,243,179,23,243,83,23,18,5,68,13,55,18,68,14,68,18,23,243,243,243,51,
- 23,15,68,5,87,18,68,14,68,18,23,243,243,243,51,23,13,68,82,23,18,68,17,68,
- 18,23,243,243,243,19,23,18,5,68,5,4,14,23,18,68,14,68,18,23,243,243,243,19,
- 23,18,164,5,23,18,68,14,68,18,23,243,243,243,19,23,13,132,37,19,18,68,13,68,
- 18,23,243,243,243,51,46,47,114,23,18,68,9,68,18,247,247,247,247,119,18,68,9,68,
- 13,242,242,242,242,114,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,
- 36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,
- 228,36,31,8,31,228,228,228,228,228,36,31,9,68,13,242,242,242,242,114,13,68,10,68,
- 18,87,50,247,247,247,215,18,68,16,68,18,23,18,5,36,5,18,23,243,243,243,83,23,
- 18,68,16,68,18,23,14,4,37,4,13,23,243,243,243,83,23,18,68,17,68,18,23,13,
- 4,13,5,4,5,23,243,243,243,83,23,18,68,14,68,18,23,14,100,13,23,243,243,243,
- 83,23,18,68,15,68,50,5,4,37,36,15,23,243,243,243,51,23,18,68,15,68,18,15,
- 36,46,36,13,23,243,243,243,51,23,18,68,13,68,50,164,14,23,243,83,23,243,179,23,
- 18,68,17,68,18,23,14,5,68,14,23,211,119,83,119,243,19,23,18,68,19,68,18,55,
- 114,23,147,87,18,14,13,133,14,15,18,55,211,23,18,68,20,68,18,23,19,119,147,23,
- 18,14,5,228,36,5,13,18,23,179,23,18,68,16,68,18,23,243,23,19,14,5,228,196,
- 14,55,115,23,18,68,17,68,18,23,211,23,18,5,228,228,36,5,18,23,83,23,18,68,
- 16,68,18,23,179,23,14,228,228,132,5,18,23,51,23,18,68,16,68,18,23,147,23,14,
- 228,228,196,5,19,23,19,23,18,68,16,68,18,23,115,23,14,228,228,228,4,13,23,19,
- 23,18,68,14,68,18,23,83,23,14,228,228,228,68,18,55,18,68,18,68,18,23,51,23,
- 18,228,36,5,13,46,5,228,132,5,55,18,68,18,68,18,23,83,5,228,5,14,19,119,
- 18,13,228,100,18,23,18,68,19,68,18,23,19,23,14,228,5,18,23,147,55,14,228,68,
- 13,23,18,68,19,68,18,55,18,5,228,14,23,51,55,115,23,5,228,36,5,23,18,68,
- 18,68,18,55,14,228,5,18,23,19,23,50,115,23,14,228,68,50,68,20,68,18,23,18,
- 5,228,5,115,5,4,15,23,51,23,15,228,68,15,18,68,23,68,18,23,15,228,4,5,
- 19,23,19,23,18,14,18,23,51,23,15,228,68,14,18,68,18,68,18,23,5,228,36,18,
- 23,51,87,83,23,13,228,68,14,18,68,17,68,18,19,5,228,36,13,23,211,23,18,5,
- 228,68,14,18,68,16,68,50,228,36,5,18,23,243,23,18,5,228,36,14,18,68,17,68,
- 18,15,228,36,18,23,51,151,83,23,18,228,36,14,18,68,22,68,18,14,228,4,5,23,
- 51,23,18,37,13,18,23,83,23,5,228,4,15,18,68,20,68,18,14,228,4,14,23,51,
- 23,14,68,14,23,83,23,14,228,4,50,68,19,68,18,14,228,4,14,23,83,23,82,23,
- 115,23,14,228,5,19,18,68,17,68,18,14,228,4,5,23,115,87,147,23,5,228,5,23,
- 18,68,17,68,18,14,228,36,18,23,243,51,23,18,228,4,15,23,18,68,18,68,18,15,
- 228,36,5,18,23,243,23,18,5,228,5,18,23,18,68,15,68,50,228,68,5,18,247,18,
- 5,228,4,14,55,18,68,18,68,18,23,5,228,100,5,14,114,14,5,228,36,5,18,55,
- 18,68,14,68,18,23,13,228,228,228,164,14,23,19,23,18,68,13,68,18,23,18,228,228,
- 228,132,5,83,23,18,68,14,68,18,55,5,228,228,228,100,18,23,51,23,18,68,14,68,
- 18,55,18,228,228,228,68,14,23,83,23,18,68,16,68,18,23,19,23,13,228,228,228,4,
- 14,23,115,23,18,68,16,68,18,23,19,23,19,5,228,228,196,14,23,147,23,18,68,16,
- 68,18,23,51,23,18,5,228,228,132,14,23,179,23,18,68,17,68,18,23,83,23,18,5,
- 228,228,36,5,18,23,211,23,18,68,18,68,18,23,115,55,14,228,196,5,14,19,23,51,
- 119,51,23,18,68,24,68,18,23,179,23,18,13,5,228,36,5,14,18,23,83,23,18,46,
- 18,23,19,23,18,68,22,68,18,23,211,55,18,15,14,133,13,14,18,87,83,23,14,100,
- 13,19,23,18,68,16,68,18,23,243,19,119,83,119,147,23,18,164,14,23,18,68,19,68,
- 18,23,243,179,23,243,51,23,14,36,13,18,5,4,14,23,18,68,18,68,18,23,243,243,
- 243,19,23,18,5,4,37,4,5,18,23,18,68,14,68,18,23,243,243,243,51,23,14,100,
- 13,55,18,68,18,68,18,23,243,243,243,51,23,14,4,5,14,4,5,19,23,18,68,16,
- 68,18,23,243,243,243,51,23,14,36,5,4,5,55,18,68,16,68,18,23,243,243,243,83,
- 23,14,5,4,5,18,55,18,68,14,68,18,23,243,243,243,115,23,50,55,19,23,18,68,
- 9,68,18,247,247,247,247,119,18,68,9,68,13,242,242,242,242,114,13,68,8,31,228,228,
- 228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,
- 228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,
- 9,68,13,242,242,242,242,114,13,68,9,68,18,247,247,247,247,119,18,68,14,68,18,23,
- 15,101,14,23,243,243,243,83,23,18,68,13,68,18,15,164,14,23,243,243,243,51,23,18,
- 68,14,68,18,5,36,37,36,5,243,243,243,83,23,18,68,17,68,18,5,36,5,15,5,
- 36,18,23,243,243,243,19,23,18,68,13,68,18,14,196,18,23,243,243,243,19,23,18,68,
- 13,68,50,101,68,18,23,243,243,243,19,23,18,68,17,68,18,55,50,13,36,5,19,23,
- 243,51,23,243,179,23,18,68,19,68,18,23,19,23,18,5,36,5,23,179,119,83,119,243,
- 19,23,18,68,22,68,18,23,115,18,15,18,23,83,87,18,14,13,133,14,15,18,55,211,
- 23,18,68,20,68,18,23,83,119,83,23,18,14,5,228,36,5,13,18,23,179,23,18,68,
- 16,68,18,23,243,23,19,14,5,228,196,14,55,115,23,18,68,17,68,18,23,211,23,18,
- 5,228,228,36,5,18,23,83,23,18,68,16,68,18,23,179,23,14,228,228,132,5,18,23,
- 51,23,18,68,16,68,18,23,147,23,14,228,228,196,5,19,23,19,23,18,68,16,68,18,
- 23,115,23,14,228,228,228,4,13,23,19,23,18,68,14,68,18,23,83,23,14,228,228,228,
- 68,18,55,18,68,14,68,18,23,51,23,18,228,228,228,100,5,55,18,68,17,68,18,23,
- 83,5,228,5,46,146,14,5,228,68,18,23,18,68,20,68,18,23,19,23,14,196,5,15,
- 19,247,23,15,5,228,4,13,23,18,68,19,68,18,55,18,5,164,5,18,23,243,51,23,
- 18,228,4,5,23,18,68,15,68,18,55,14,196,18,23,243,115,23,14,228,4,50,68,18,
- 68,18,23,18,5,164,5,23,179,87,115,23,18,228,4,15,18,68,20,68,18,23,15,196,
- 14,23,147,23,19,18,19,23,115,23,5,228,14,18,68,22,68,18,23,5,196,14,23,115,
- 23,18,5,4,5,18,23,83,23,13,228,14,18,68,22,68,18,19,5,196,14,23,115,23,
- 18,5,4,5,18,23,83,23,14,228,14,18,68,18,68,50,228,14,23,147,23,19,18,19,
- 23,115,23,14,228,14,18,68,15,68,18,15,228,5,23,179,55,179,23,14,228,14,18,68,
- 15,68,18,14,228,4,15,23,243,147,23,14,228,15,18,68,14,68,18,14,228,4,5,18,
- 247,147,23,14,228,50,68,18,68,18,14,228,68,14,146,15,18,23,115,23,14,196,5,19,
- 18,68,18,68,18,14,228,164,5,36,5,18,23,115,23,5,196,5,23,18,68,16,68,18,
- 14,228,228,4,15,23,147,23,5,196,15,23,18,68,17,68,18,15,228,228,5,23,147,23,
- 18,5,164,5,18,23,18,68,13,68,50,228,228,14,18,183,18,196,14,55,18,68,18,68,
- 18,23,5,228,228,37,13,14,50,23,14,164,5,18,55,18,68,15,68,18,23,13,228,228,
- 164,37,164,14,23,19,23,18,68,13,68,18,23,18,228,228,228,132,5,83,23,18,68,14,
- 68,18,55,5,228,228,228,100,18,23,51,23,18,68,14,68,18,55,18,228,228,228,68,14,
- 23,83,23,18,68,16,68,18,23,19,23,13,228,228,228,4,14,23,115,23,18,68,16,68,
- 18,23,19,23,19,5,228,228,196,14,23,147,23,18,68,16,68,18,23,51,23,18,5,228,
- 228,132,14,23,179,23,18,68,17,68,18,23,83,23,18,5,228,228,36,5,18,23,211,23,
- 18,68,16,68,18,23,115,55,14,228,196,5,14,19,183,83,23,18,68,23,68,18,23,179,
- 23,18,13,5,228,36,5,14,18,23,19,23,18,14,82,83,23,18,68,23,68,18,23,211,
- 55,18,15,14,133,13,14,18,87,51,23,13,68,18,23,51,23,18,68,17,68,18,23,243,
- 19,119,83,119,147,23,5,36,5,82,55,18,68,16,68,18,23,243,179,23,243,51,23,5,
- 132,5,18,23,18,68,13,68,18,23,243,243,243,51,5,164,5,23,18,68,15,68,18,23,
- 243,243,243,19,23,5,36,15,14,68,50,68,16,68,18,23,243,243,243,19,23,13,36,37,
- 36,5,19,18,68,14,68,18,23,243,243,243,19,23,18,164,14,23,18,68,16,68,18,23,
- 243,243,243,51,23,18,13,37,13,18,55,18,68,12,68,18,23,243,243,243,83,183,19,23,
- 18,68,9,68,18,247,247,247,247,119,18,68,9,68,13,242,242,242,242,114,13,68,8,31,
- 228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,
- 7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,
- 36,31,9,68,13,242,242,242,242,114,13,68,12,68,18,55,18,46,15,247,247,247,183,18,
- 68,16,68,18,23,14,4,46,37,18,23,243,243,243,51,23,18,68,15,68,50,37,15,55,
- 13,5,23,243,243,243,51,23,18,68,18,68,18,46,18,4,18,23,18,5,18,23,243,243,
- 243,19,23,18,68,19,68,18,13,14,23,18,5,18,23,5,18,23,243,243,243,19,23,18,
- 68,18,68,18,14,5,55,14,5,18,5,18,23,243,243,243,19,23,18,68,18,68,18,23,
- 5,14,19,23,13,4,14,23,243,243,243,51,23,18,68,15,68,18,23,18,101,14,23,243,
- 115,23,243,179,23,18,68,14,68,18,87,82,23,243,119,83,119,243,19,23,18,68,19,68,
- 18,23,51,87,179,87,18,14,13,133,14,15,18,55,211,23,18,68,19,68,18,23,243,51,
- 23,18,14,5,228,36,5,13,18,23,179,23,18,68,16,68,18,23,243,23,19,14,5,228,
- 196,14,55,115,23,18,68,17,68,18,23,211,23,18,5,228,228,36,5,18,23,83,23,18,
- 68,16,68,18,23,179,23,14,228,228,132,5,18,23,51,23,18,68,16,68,18,23,147,23,
- 14,228,228,196,5,19,23,19,23,18,68,16,68,18,23,115,23,14,228,228,228,4,13,23,
- 19,23,18,68,17,68,18,23,83,23,14,228,4,37,45,37,228,100,18,55,18,68,22,68,
- 18,23,51,23,18,196,5,14,18,19,119,19,18,14,5,228,4,5,55,18,68,18,68,18,
- 23,83,5,164,13,18,247,55,18,13,228,4,18,23,18,68,21,68,18,23,19,23,14,164,
- 14,55,19,23,18,110,18,119,14,228,13,23,18,68,24,68,18,55,18,5,132,14,23,19,
- 23,18,5,164,5,15,23,19,23,14,196,5,23,18,68,20,68,18,55,14,132,5,23,19,
- 23,51,5,228,14,23,19,23,5,196,50,68,23,68,18,23,18,5,100,5,18,23,19,18,
- 19,55,5,228,14,55,18,5,164,15,18,68,21,68,18,23,15,132,13,55,18,4,14,55,
- 18,5,228,18,55,13,164,14,18,68,20,68,18,23,5,132,18,55,5,36,15,55,18,228,
- 5,55,18,164,14,18,68,23,68,18,19,5,100,5,18,23,18,68,5,18,55,15,228,18,
- 23,18,5,132,14,18,68,19,68,50,132,5,55,14,100,5,18,55,14,196,14,55,5,132,
- 14,18,68,21,68,18,15,132,13,55,14,132,5,23,19,23,13,164,14,55,13,132,14,18,
- 68,21,68,18,14,132,13,55,14,164,13,23,19,23,5,132,14,55,13,132,15,18,68,19,
- 68,18,14,132,5,55,14,196,14,55,18,5,100,14,55,5,132,50,68,23,68,18,14,132,
- 5,18,23,18,228,15,55,18,5,68,18,23,18,5,100,5,19,18,68,20,68,18,14,164,
- 18,55,5,228,18,55,15,36,5,55,18,132,5,23,18,68,21,68,18,14,164,13,55,18,
- 228,5,18,55,14,4,18,55,13,132,15,23,18,68,23,68,18,15,164,5,18,55,14,228,
- 5,55,19,18,19,23,18,5,100,5,18,23,18,68,20,68,50,196,5,23,19,23,14,228,
- 5,51,23,19,23,5,132,14,55,18,68,24,68,18,23,5,196,14,23,19,23,15,5,164,
- 5,18,23,19,23,14,132,5,18,55,18,68,21,68,18,23,13,228,14,119,18,110,18,23,
- 19,55,14,164,14,23,19,23,18,68,18,68,18,23,18,228,4,13,18,247,55,18,13,164,
- 5,83,23,18,68,22,68,18,55,5,228,4,5,14,18,19,119,19,18,14,5,196,18,23,
- 51,23,18,68,17,68,18,55,18,228,100,37,45,37,228,4,14,23,83,23,18,68,16,68,
- 18,23,19,23,13,228,228,228,4,14,23,115,23,18,68,16,68,18,23,19,23,19,5,228,
- 228,196,14,23,147,23,18,68,16,68,18,23,51,23,18,5,228,228,132,14,23,179,23,18,
- 68,17,68,18,23,83,23,18,5,228,228,36,5,18,23,211,23,18,68,16,68,18,23,115,
- 55,14,228,196,5,14,19,23,243,23,18,68,19,68,18,23,179,23,18,13,5,228,36,5,
- 14,18,23,243,51,23,18,68,19,68,18,23,211,55,18,15,14,133,13,14,18,87,179,87,
- 51,23,18,68,14,68,18,23,243,19,119,83,119,243,23,82,87,18,68,15,68,18,23,243,
- 179,23,243,115,23,14,101,18,23,18,68,18,68,18,23,243,243,243,51,23,14,4,13,23,
- 19,14,5,23,18,68,18,68,18,23,243,243,243,19,23,18,5,18,5,14,55,5,14,18,
- 68,19,68,18,23,243,243,243,19,23,18,5,23,18,5,18,23,14,13,18,68,18,68,18,
- 23,243,243,243,19,23,18,5,18,23,18,4,18,46,18,68,15,68,18,23,243,243,243,51,
- 23,5,13,55,15,37,50,68,16,68,18,23,243,243,243,51,23,18,37,46,4,14,23,18,
- 68,12,68,18,247,247,247,183,15,46,18,55,18,68,9,68,13,242,242,242,242,114,13,68,
- 8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,
- 164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,
- 228,228,36,31,9,68,13,242,242,242,242,114,13,68,12,68,18,55,18,23,18,247,247,247,
- 215,18,68,14,68,50,5,4,37,14,23,243,243,243,115,23,18,68,16,68,18,14,4,46,
- 4,5,18,23,243,243,243,83,23,18,68,14,68,18,14,5,23,114,23,243,243,243,83,23,
- 18,68,15,68,50,5,51,55,14,18,23,243,243,243,51,23,18,68,18,68,18,23,14,18,
- 23,19,23,15,5,23,243,243,243,51,23,18,68,18,68,18,23,18,15,46,23,14,4,18,
- 23,243,243,243,19,23,18,68,17,68,18,23,19,14,36,5,4,5,243,115,23,243,179,23,
- 18,68,17,68,18,23,19,23,110,18,23,179,119,83,119,243,19,23,18,68,21,68,18,23,
- 19,23,19,119,115,87,18,14,13,133,14,15,18,55,211,23,18,68,20,68,18,23,51,23,
- 211,23,18,14,5,228,36,5,13,18,23,179,23,18,68,16,68,18,23,243,23,19,14,5,
- 228,196,14,55,115,23,18,68,18,68,18,23,211,23,18,5,228,5,228,4,5,18,23,83,
- 23,18,68,19,68,18,23,179,23,14,228,4,5,14,228,36,5,18,23,51,23,18,68,20,
- 68,18,23,147,23,14,228,36,5,18,5,228,36,5,19,23,19,23,18,68,23,68,18,23,
- 115,23,14,36,5,13,78,13,37,36,23,18,228,68,13,23,19,23,18,68,21,68,18,23,
- 83,23,14,4,5,18,215,50,15,19,23,14,228,68,18,55,18,68,20,68,18,23,51,23,
- 18,4,5,55,211,87,51,23,5,228,36,5,55,18,68,19,68,18,23,83,5,4,18,23,
- 243,147,23,18,5,228,36,18,23,18,68,21,68,18,23,19,23,14,4,5,23,115,215,115,
- 23,18,5,228,4,13,23,18,68,25,68,18,55,18,5,4,14,23,83,23,18,14,69,13,
- 18,23,19,119,19,5,228,5,23,18,68,22,68,18,55,14,36,14,23,51,23,18,5,100,
- 5,87,82,14,15,14,5,228,50,68,23,68,18,23,18,5,36,13,23,51,23,5,100,5,
- 50,14,37,36,5,228,68,15,18,68,20,68,18,23,15,68,5,23,19,23,18,132,14,13,
- 164,46,228,36,14,18,68,17,68,18,23,5,100,18,55,18,228,164,18,14,228,4,14,18,
- 68,17,68,18,19,5,100,14,55,18,228,164,5,23,14,228,14,18,68,16,68,50,132,5,
- 19,23,18,228,196,18,23,5,196,14,18,68,18,68,18,15,164,14,23,18,5,228,164,14,
- 23,18,5,164,14,18,68,18,68,18,14,164,5,18,23,13,228,164,5,19,23,15,164,15,
- 18,68,15,68,18,14,196,5,23,15,228,196,18,55,5,132,50,68,17,68,18,14,228,14,
- 23,5,228,164,18,55,15,100,5,19,18,68,18,68,18,14,228,4,15,18,228,164,18,55,
- 18,5,68,5,23,18,68,21,68,18,14,228,36,14,13,164,13,14,132,18,23,19,23,5,
- 68,15,23,18,68,24,68,18,15,228,68,5,68,5,14,18,23,5,100,5,23,51,23,14,
- 36,5,18,23,18,68,24,68,50,228,5,13,37,14,15,18,19,55,5,100,5,18,23,51,
- 23,14,36,14,55,18,68,24,68,18,23,5,196,5,14,151,51,18,14,69,14,18,23,83,
- 23,14,4,5,18,55,18,68,21,68,18,23,13,228,4,5,18,23,115,215,115,23,13,4,
- 14,23,19,23,18,68,18,68,18,23,18,228,36,5,18,23,243,147,23,18,37,83,23,18,
- 68,21,68,18,55,5,228,36,5,19,23,19,87,179,87,5,4,18,23,51,23,18,68,20,
- 68,18,55,18,228,68,13,55,82,183,18,15,5,4,14,23,83,23,18,68,22,68,18,23,
- 19,23,13,228,68,14,23,13,4,69,77,37,36,14,23,115,23,18,68,20,68,18,23,19,
- 23,19,5,228,36,5,18,13,228,36,14,23,147,23,18,68,19,68,18,23,51,23,18,5,
- 228,36,14,13,228,4,14,23,179,23,18,68,18,68,18,23,83,23,18,5,228,4,37,196,
- 5,18,23,211,23,18,68,16,68,18,23,115,55,14,228,196,5,14,19,23,243,23,18,68,
- 20,68,18,23,179,23,18,13,5,228,36,5,14,18,23,115,119,51,23,18,68,21,68,18,
- 23,211,55,18,15,14,133,13,14,18,87,115,23,114,23,19,23,18,68,17,68,18,23,243,
- 19,119,83,119,179,23,14,36,37,18,55,18,68,19,68,18,23,243,179,23,243,51,23,18,
- 4,5,15,37,14,19,23,18,68,17,68,18,23,243,243,243,51,23,5,15,23,18,23,50,
- 23,18,68,17,68,18,23,243,243,243,51,23,46,23,19,23,18,13,23,18,68,17,68,18,
- 23,243,243,243,51,23,19,14,55,18,23,5,15,18,68,16,68,18,23,243,243,243,83,23,
- 18,14,13,50,5,14,18,68,13,68,18,23,243,243,243,115,18,5,100,15,18,68,14,68,
- 18,23,243,243,243,115,23,18,78,15,23,18,68,9,68,18,247,247,247,247,119,18,68,9,
- 68,13,242,242,242,242,114,13,68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,
- 228,36,31,7,95,228,228,228,228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,
- 228,228,36,31,8,31,228,228,228,228,228,36,31,9,68,13,242,242,242,242,114,13,68,9,
- 68,18,247,247,247,247,119,18,68,19,68,18,23,19,23,19,23,18,14,18,19,23,243,243,
- 243,19,23,18,68,16,68,18,23,82,23,13,36,5,18,23,243,243,243,23,18,68,19,68,
- 18,23,14,4,14,23,15,13,5,4,14,23,243,243,243,23,18,68,16,68,18,14,68,14,
- 37,4,5,18,23,243,243,243,23,18,68,17,68,18,15,5,4,37,36,13,14,19,23,243,
- 243,243,23,18,68,16,68,18,23,15,5,18,14,100,18,23,243,243,243,23,18,68,18,68,
- 18,23,51,23,18,13,69,14,23,243,19,23,243,179,23,18,68,19,68,18,23,19,23,19,
- 87,19,50,23,115,119,83,119,243,19,23,18,68,19,68,18,23,211,55,51,87,18,14,13,
- 133,14,15,18,55,211,23,18,68,19,68,18,23,243,51,23,18,14,5,228,36,5,13,18,
- 23,179,23,18,68,16,68,18,23,243,23,19,14,5,228,196,14,55,115,23,18,68,17,68,
- 18,23,211,23,18,5,228,228,36,5,18,23,83,23,18,68,16,68,18,23,179,23,14,228,
- 228,132,5,18,23,51,23,18,68,16,68,18,23,147,23,14,228,228,196,5,19,23,19,23,
- 18,68,16,68,18,23,115,23,14,228,228,228,4,13,23,19,23,18,68,14,68,18,23,83,
- 23,14,228,228,228,68,18,55,18,68,20,68,18,23,51,23,18,228,68,5,4,13,15,14,
- 37,228,36,5,55,18,68,21,68,18,23,83,5,228,5,14,50,5,18,87,50,14,13,5,
- 196,18,23,18,68,23,68,18,23,19,23,14,196,5,15,18,87,50,115,87,19,18,15,13,
- 100,13,23,18,68,23,68,18,55,18,5,100,5,14,18,55,115,55,51,119,51,55,18,5,
- 68,5,23,18,68,24,68,18,55,14,68,5,15,19,55,19,183,19,55,18,46,15,18,23,
- 19,23,18,132,50,68,28,68,18,23,18,5,36,5,18,23,83,23,18,13,37,14,18,23,
- 18,5,100,5,15,55,14,132,15,18,68,22,68,18,23,15,100,18,23,51,23,14,132,5,
- 18,5,196,18,23,13,132,14,18,68,21,68,18,23,5,100,13,23,19,23,14,196,5,14,
- 196,5,23,5,132,14,18,68,20,68,18,19,5,100,5,18,23,18,228,4,14,5,196,18,
- 5,132,14,18,68,16,68,50,164,14,23,14,228,4,5,13,196,14,164,14,18,68,18,68,
- 18,15,164,5,23,5,228,4,5,15,164,5,13,164,14,18,68,17,68,18,14,196,18,5,
- 228,4,5,19,5,132,37,164,15,18,68,17,68,18,14,196,14,5,228,4,5,23,14,132,
- 14,5,164,50,68,19,68,18,14,196,5,13,228,4,14,23,18,100,5,18,164,5,19,18,
- 68,19,68,18,14,228,13,228,4,18,55,5,36,5,23,14,164,5,23,18,68,22,68,18,
- 14,228,5,13,196,14,23,19,23,15,5,14,19,23,13,164,15,23,18,68,21,68,18,15,
- 228,4,18,13,100,5,14,23,147,23,51,5,132,5,18,23,18,68,20,68,50,228,4,14,
- 23,18,14,13,14,18,23,211,23,18,164,14,55,18,68,19,68,18,23,5,228,5,19,151,
- 19,183,19,23,15,132,5,18,55,18,68,25,68,18,23,13,228,4,15,23,18,19,87,18,
- 45,15,18,19,55,14,132,14,23,19,23,18,68,20,68,18,23,18,228,4,5,87,18,14,
- 5,132,37,13,132,5,83,23,18,68,16,68,18,55,5,228,4,47,5,228,228,18,23,51,
- 23,18,68,14,68,18,55,18,228,228,228,68,14,23,83,23,18,68,16,68,18,23,19,23,
- 13,228,228,228,4,14,23,115,23,18,68,16,68,18,23,19,23,19,5,228,228,196,14,23,
- 147,23,18,68,16,68,18,23,51,23,18,5,228,228,132,14,23,179,23,18,68,17,68,18,
- 23,83,23,18,5,228,228,36,5,18,23,211,23,18,68,16,68,18,23,115,55,14,228,196,
- 5,14,19,23,243,23,18,68,20,68,18,23,179,23,18,13,5,228,36,5,14,18,23,51,
- 23,211,23,18,68,20,68,18,23,211,55,18,15,14,133,13,14,18,87,51,50,119,83,23,
- 18,68,19,68,18,23,243,19,119,83,119,115,23,14,69,13,18,23,51,23,18,68,18,68,
- 18,23,243,179,23,243,19,23,18,100,14,18,5,18,23,18,68,17,68,18,23,243,243,243,
- 23,19,14,13,36,37,4,5,15,18,68,16,68,18,23,243,243,243,23,18,5,4,37,13,
- 68,14,18,68,19,68,18,23,243,243,243,23,14,4,5,14,18,23,14,4,14,23,18,68,
- 16,68,18,23,243,243,243,23,18,5,36,13,23,82,23,18,68,17,68,18,23,243,243,243,
- 19,23,18,15,14,18,87,19,23,18,68,12,68,18,23,243,243,243,83,87,115,23,18,68,
- 9,68,18,247,247,247,247,119,18,68,9,68,13,242,242,242,242,114,13,68,8,31,228,228,
- 228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,95,7,95,
- 228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,
- 11,68,14,30,24,254,254,254,254,62,14,68,10,68,126,14,45,16,254,254,254,190,68,14,
- 68,62,16,5,13,21,14,5,13,254,254,254,158,68,14,68,62,4,21,29,28,55,5,14,
- 254,254,254,126,68,16,68,30,14,13,29,25,22,19,23,15,13,254,254,254,126,68,16,68,
- 30,13,6,26,25,15,19,23,18,13,254,254,254,126,68,16,68,30,13,6,8,9,20,15,
- 23,14,13,254,254,254,126,68,15,68,30,13,6,12,7,49,24,5,16,254,254,254,126,68,
- 14,68,30,16,4,7,16,24,16,45,254,254,254,158,68,12,68,62,14,5,45,5,14,254,
- 254,254,190,68,13,68,126,16,14,254,94,46,141,14,16,254,126,68,14,68,254,190,14,13,
- 3,13,181,14,37,13,254,62,68,18,68,254,126,14,5,13,21,27,189,22,19,23,18,14,
- 5,14,254,68,18,68,254,62,17,5,13,21,61,28,154,28,15,51,55,18,37,222,68,19,
- 68,254,30,14,4,21,61,58,155,28,26,23,115,55,14,4,24,158,68,18,68,254,14,3,
- 26,29,58,219,29,22,19,23,147,23,15,4,158,68,19,68,222,14,3,28,29,26,251,26,
- 29,15,19,23,179,23,14,13,126,68,19,68,190,14,3,61,26,251,27,28,26,18,19,23,
- 211,23,5,14,94,68,19,68,158,16,4,26,29,26,251,59,28,22,19,23,243,23,18,5,
- 94,68,20,68,158,5,21,29,26,251,59,26,29,15,19,23,243,19,23,5,14,62,68,18,
- 68,126,45,29,26,251,123,28,18,19,23,243,19,23,18,5,62,68,17,68,94,17,4,26,
- 28,251,123,29,22,243,147,23,5,17,30,68,20,68,94,13,21,29,26,251,91,26,29,22,
- 19,23,243,83,23,5,14,30,68,18,68,94,3,26,28,251,155,29,15,19,23,243,83,23,
- 15,13,30,68,18,68,62,14,13,29,26,251,123,29,22,23,243,147,23,18,13,30,68,21,
- 68,62,13,21,29,28,27,58,251,26,29,22,19,23,243,115,23,18,13,17,68,23,68,62,
- 3,9,21,26,28,29,28,27,58,187,29,15,19,23,243,115,23,18,5,16,68,25,68,30,
- 16,3,12,8,11,9,21,58,29,28,27,58,59,28,26,23,243,179,23,18,5,16,68,25,
- 68,30,14,3,12,9,11,72,9,12,25,26,92,26,29,22,19,23,243,147,23,18,13,24,
- 68,23,68,30,14,6,12,9,107,72,44,21,26,28,29,15,19,23,243,147,23,18,13,30,
- 68,19,68,30,13,6,12,9,235,40,11,12,21,18,243,211,23,14,13,30,68,19,68,30,
- 13,6,12,235,107,8,7,17,52,23,243,115,23,5,14,30,68,18,68,30,13,6,12,9,
- 235,107,16,24,81,52,55,243,23,5,62,68,19,68,30,13,6,12,9,235,107,16,24,177,
- 52,55,115,23,18,5,62,68,20,68,30,14,6,12,9,235,75,7,241,113,20,15,23,19,
- 23,5,14,62,68,17,68,30,16,3,12,9,235,75,7,24,241,177,20,15,5,94,68,14,
- 68,62,3,235,139,16,24,241,177,24,14,13,94,68,16,68,62,13,6,12,235,43,7,16,
- 241,177,24,16,4,126,68,17,68,62,14,3,12,9,235,11,7,24,241,177,24,13,14,126,
- 68,17,68,94,4,7,12,235,11,16,24,241,113,16,24,14,5,158,68,17,68,94,14,3,
- 12,9,203,9,16,241,113,16,24,14,4,190,68,18,68,126,5,6,12,9,171,7,24,241,
- 81,16,24,16,4,16,190,68,18,68,126,17,4,7,12,9,139,16,24,241,81,24,14,4,
- 16,222,68,19,68,158,16,4,7,12,9,75,9,16,24,241,17,56,14,5,16,254,68,17,
- 68,190,16,4,6,44,9,11,7,24,241,56,16,45,254,62,68,19,68,222,24,5,3,7,
- 44,16,24,16,113,88,16,13,5,14,254,94,68,18,68,254,30,14,5,3,6,16,152,17,
- 16,14,13,5,14,254,158,68,16,68,254,94,15,13,37,77,37,45,16,254,30,16,17,126,
- 68,14,68,254,222,112,254,94,13,5,13,3,13,24,62,68,13,68,254,254,254,158,45,16,
- 24,12,6,5,62,68,15,68,254,254,254,126,14,5,56,16,9,12,3,14,30,68,15,68,
- 254,254,254,126,13,47,20,16,8,12,6,14,30,68,15,68,254,254,254,126,5,18,51,22,
- 21,9,6,14,30,68,14,68,254,254,254,126,5,18,55,26,61,3,16,30,68,14,68,254,
- 254,254,126,13,14,23,15,61,21,5,62,68,12,68,254,254,254,158,5,46,21,13,5,94,
- 68,10,68,254,254,254,190,14,45,14,126,68,11,68,14,254,254,254,254,62,24,30,14,68,
- 8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,
- 164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,228,
- 228,228,36,31,9,68,14,254,254,254,254,126,14,68,7,68,254,254,254,254,190,68,10,68,
- 254,14,13,14,254,254,254,94,68,13,68,94,14,16,62,16,36,13,254,254,254,94,68,14,
- 68,62,16,4,5,62,45,4,14,254,254,254,94,68,18,68,30,16,4,5,4,5,14,4,
- 5,4,5,14,254,254,254,62,68,15,68,62,13,4,5,46,13,5,36,13,254,254,254,62,
- 68,13,68,94,13,14,94,13,4,13,254,254,254,94,68,9,68,254,46,16,254,254,254,94,
- 68,7,68,254,254,254,254,190,68,11,68,254,254,30,46,141,14,16,254,126,68,12,68,254,
- 190,14,13,228,36,5,14,254,62,68,10,68,254,126,14,5,228,196,14,254,68,10,68,254,
- 94,13,228,228,36,13,222,68,10,68,254,30,16,228,228,132,13,190,68,9,68,254,14,228,
- 228,196,13,158,68,10,68,222,14,228,228,228,4,14,126,68,10,68,190,16,228,228,228,68,
- 24,94,68,13,68,190,228,196,14,18,15,14,5,228,13,94,68,20,68,158,13,228,4,3,
- 13,21,13,36,18,119,18,15,14,5,132,24,62,68,18,68,126,14,196,13,53,26,61,21,
- 4,5,18,247,5,100,14,62,68,23,68,126,5,100,3,21,26,189,26,4,5,23,18,14,
- 37,14,19,23,18,132,5,62,68,24,68,94,14,132,5,26,29,26,29,21,45,21,29,13,
- 14,18,5,100,5,23,15,164,62,68,19,68,94,5,164,21,61,13,100,13,21,14,5,164,
- 15,14,164,16,30,68,22,68,62,16,196,13,29,21,36,5,68,45,6,7,6,13,3,36,
- 37,164,14,30,68,22,68,62,13,196,3,25,3,13,14,16,68,45,6,76,11,38,13,5,
- 164,14,30,68,20,68,62,5,196,5,22,16,88,13,36,3,21,7,204,7,3,132,14,30,
- 68,25,68,62,164,13,14,16,88,17,24,14,36,13,21,12,7,6,3,13,6,44,6,164,
- 14,30,68,25,68,30,16,132,13,56,17,24,14,45,14,16,13,4,13,12,6,132,6,12,
- 6,164,14,30,68,22,68,30,14,132,5,16,17,24,14,100,5,14,5,26,6,196,7,3,
- 164,16,30,68,18,68,30,14,164,14,24,14,164,13,21,25,3,196,6,3,164,62,68,17,
- 68,30,14,164,5,24,13,164,5,22,21,228,3,164,5,62,68,16,68,30,14,196,16,13,
- 164,5,16,6,228,3,164,13,62,68,16,68,30,14,196,45,164,5,16,7,196,13,3,164,
- 16,62,68,18,68,30,16,196,5,13,164,13,24,16,6,132,3,7,164,5,94,68,18,68,
- 62,228,13,164,14,24,16,12,6,67,6,12,6,164,14,94,68,23,68,62,5,196,13,14,
- 5,36,5,14,24,16,24,9,12,11,7,76,13,132,5,126,68,19,68,62,14,228,48,46,
- 16,88,16,14,7,76,11,9,3,132,14,126,68,19,68,62,24,228,13,120,17,14,13,5,
- 36,3,38,9,6,132,13,158,68,14,68,94,13,228,16,24,16,14,13,228,35,132,190,68,
- 12,68,94,17,228,13,14,5,228,228,16,190,68,10,68,126,14,228,228,228,4,14,222,68,
- 9,68,158,13,228,228,196,14,254,68,10,68,190,13,228,228,132,16,254,30,68,10,68,222,
- 13,228,228,36,13,254,94,68,10,68,254,14,228,196,5,14,254,126,68,12,68,254,62,14,
- 5,228,36,13,14,254,190,68,11,68,254,126,16,14,141,46,254,254,30,68,7,68,254,254,
- 254,254,190,68,12,68,254,254,254,94,14,5,13,126,24,94,68,15,68,254,254,254,62,24,
- 13,4,13,94,13,4,16,62,68,14,68,254,254,254,62,13,100,45,4,5,4,16,30,68,
- 18,68,254,254,254,62,17,13,4,13,4,16,14,5,4,5,16,30,68,14,68,254,254,254,
- 94,14,4,5,13,62,14,5,94,68,10,68,254,254,254,94,14,36,24,222,68,9,68,254,
- 254,254,126,16,24,254,68,7,68,254,254,254,254,190,68,9,68,14,254,254,254,254,126,14,
- 68,8,31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,
- 228,164,95,7,95,228,228,228,228,164,95,8,31,228,228,228,228,228,36,31,8,31,228,228,
- 228,228,228,36,31,9,68,14,254,254,254,254,126,14,68,7,68,254,254,254,254,190,68,7,
- 68,254,254,254,254,190,68,7,68,254,254,254,254,190,68,7,68,254,254,254,254,190,68,7,
- 68,254,254,254,254,190,68,7,68,254,254,254,254,190,68,7,68,254,254,254,254,190,68,7,
- 68,254,254,254,254,190,68,7,68,254,254,254,254,190,68,10,68,254,254,62,54,61,86,254,
- 158,68,12,68,254,190,54,27,249,25,28,22,254,62,68,16,68,254,126,22,28,57,27,60,
- 155,60,27,25,27,22,254,68,15,68,254,94,22,25,27,28,251,123,28,27,25,22,222,68,
- 13,68,254,62,27,25,28,251,251,28,25,29,190,68,14,68,254,22,25,27,28,251,251,59,
- 28,25,22,158,68,13,68,222,22,25,28,251,251,155,28,25,22,126,68,11,68,222,25,28,
- 251,251,219,28,25,126,68,11,68,190,251,251,251,59,28,25,22,94,68,13,68,158,29,25,
- 28,251,251,59,124,123,25,94,68,20,68,126,22,25,28,251,187,60,27,28,27,121,27,28,
- 27,28,25,22,62,68,22,68,126,28,251,187,28,27,57,27,25,28,22,62,22,26,25,28,
- 27,25,28,62,68,21,68,94,22,25,28,251,59,28,59,57,54,25,22,190,22,25,28,27,
- 26,62,68,19,68,94,28,251,92,89,28,22,158,12,104,22,30,22,25,28,25,62,68,28,
- 68,94,25,28,187,28,89,29,22,29,62,22,8,22,30,11,40,11,8,11,8,22,30,25,
- 28,25,62,68,26,68,62,22,25,28,91,60,27,25,54,158,72,54,8,12,62,22,8,43,
- 30,29,26,25,22,30,68,25,68,62,28,91,121,27,126,12,8,22,30,12,40,22,12,8,
- 22,94,75,30,22,57,22,30,68,29,68,62,25,91,29,86,62,44,11,8,11,8,54,40,
- 44,8,12,62,22,8,11,12,30,29,27,25,22,30,68,27,68,62,25,28,25,190,40,44,
- 8,43,8,43,8,12,22,8,43,12,8,11,8,62,25,28,25,62,68,26,68,62,25,28,
- 26,30,22,40,22,30,12,8,11,22,235,30,22,136,22,30,28,27,28,25,62,68,31,68,
- 30,22,25,28,25,30,22,40,22,30,22,40,22,12,8,11,12,8,43,8,94,86,62,29,
- 25,28,27,25,62,68,26,68,30,22,25,28,25,30,22,40,22,62,40,54,40,54,72,62,
- 22,94,22,57,28,59,28,62,68,28,68,30,22,25,28,25,62,8,11,12,30,22,40,22,
- 30,40,12,62,12,62,22,153,91,28,25,22,62,68,22,68,62,25,28,25,29,30,139,40,
- 62,12,62,22,94,29,25,156,91,28,25,94,68,20,68,62,25,60,25,62,104,11,62,22,
- 62,28,57,28,57,251,59,28,94,68,22,68,62,26,91,28,62,54,94,27,25,28,57,28,
- 59,28,251,27,28,25,22,94,68,16,68,62,28,25,123,22,94,22,25,91,28,251,219,28,
- 126,68,16,68,62,22,25,28,91,153,28,251,251,27,28,25,22,126,68,13,68,94,25,123,
- 156,251,251,27,28,25,29,158,68,11,68,94,22,25,28,251,251,251,59,190,68,11,68,126,
- 25,28,251,251,219,28,25,222,68,13,68,126,22,25,28,251,251,155,28,25,22,222,68,14,
- 68,158,22,25,28,251,251,59,28,27,25,22,254,68,13,68,190,29,25,28,251,251,28,25,
- 27,254,62,68,15,68,222,22,25,27,28,251,123,28,27,25,22,254,94,68,16,68,254,22,
- 27,25,27,60,155,60,27,57,28,22,254,126,68,12,68,254,62,22,28,249,25,27,54,254,
- 190,68,10,68,254,158,86,61,54,254,254,62,68,7,68,254,254,254,254,190,68,7,68,254,
- 254,254,254,190,68,7,68,254,254,254,254,190,68,7,68,254,254,254,254,190,68,7,68,254,
- 254,254,254,190,68,7,68,254,254,254,254,190,68,7,68,254,254,254,254,190,68,7,68,254,
- 254,254,254,190,68,7,68,254,254,254,254,190,68,9,68,14,254,254,254,254,126,14,68,8,
- 31,228,228,228,228,228,36,31,8,31,228,228,228,228,228,36,31,7,95,228,228,228,228,164,
- 95,
-};
-static const uint16_t table_pixels[] = {
- 2209,2210,2210,4290,4290,4322,4322,4355,6435,6467,6500,6532,8612,8645,8645,8645,8645,8645,8645,8612,6532,6500,6467,6435,
- 4355,4322,4322,4290,4290,2210,2210,2209,2210,2242,4290,4322,4322,4355,6467,6500,8612,8645,8677,10757,10790,10790,10822,10822,
- 10822,10822,10790,10790,10757,8677,8645,8612,6500,6467,4355,4322,4322,4290,2242,2210,2242,4290,4322,4355,6435,6500,8612,8677,
- 10757,10822,10854,12903,12935,12967,12967,12967,12967,12967,12967,12935,12903,10854,10822,10757,8677,8612,6500,6435,4355,4322,4290,2242,
- 4290,4322,4355,6467,6532,8645,10757,10822,10854,12935,12967,12999,13000,15080,15080,15080,15080,15080,15080,13000,12999,12967,12935,10854,
- 10822,10757,8645,6532,6467,4355,4322,4290,4322,4355,6467,6532,8677,10790,10854,12935,12967,13000,15080,15112,15112,15112,15112,15112,
- 15144,15112,15112,15112,15112,15080,13000,12967,12935,10854,10790,8677,6532,6467,4355,4322,4355,6467,6532,8677,10790,10854,12967,12999,
- 15080,15112,15112,15144,15145,15145,15145,15145,15145,15145,15145,15145,15144,15112,15112,15080,12999,12967,10854,10790,8677,6532,6467,4355,
- 4387,6500,8645,10790,10854,12967,13000,15080,15112,15144,15145,15145,15177,17225,17225,17225,17225,17225,17225,15177,15145,15145,15144,15112,
- 15080,13000,12967,10854,10790,8645,6500,4387,6467,8612,10757,10822,12935,12999,15080,15112,15144,15145,15177,17225,17225,17225,17225,17225,
- 17225,17225,17225,17225,17225,15177,15145,15144,15112,15080,12999,12935,10822,10757,8612,6467,6532,8677,10790,12935,12967,15080,15112,15144,
- 15145,15177,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,15177,15145,15144,15112,15080,12967,12935,10790,8677,6532,
- 8612,8709,10822,12967,13000,15112,15112,15145,15177,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,15177,
- 15145,15112,15112,13000,12967,10822,8709,8612,8612,10757,10854,12967,15080,15112,15144,15145,17225,17225,17225,17225,17225,17225,17225,17225,
- 17225,17225,17225,17225,17225,17225,17225,17225,15145,15144,15112,15080,12967,10854,10757,8612,8645,10790,12903,12967,15080,15112,15144,15145,
- 17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,15145,15144,15112,15080,12967,12903,10790,8645,
- 8645,10790,12903,12967,15080,15112,15144,15145,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,
- 15145,15144,15112,15080,12967,12903,10790,8645,8612,10757,10854,12967,15080,15112,15144,15145,17225,17225,17225,17225,17225,17225,17225,17225,
- 17225,17225,17225,17225,17225,17225,17225,17225,15145,15144,15112,15080,12967,10854,10757,8612,8612,8709,10822,12935,13000,15112,15144,15145,
- 15177,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,15177,15145,15112,15112,13000,12967,10822,8709,8612,
- 6532,8677,10790,12935,12967,15080,15112,15144,15145,15177,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,17225,15177,15145,
- 15144,15112,15080,12967,12935,10790,8677,6532,6467,8612,10757,10822,12935,12999,15080,15112,15144,15145,15177,17225,17225,17225,17225,17225,
- 17225,17225,17225,17225,17225,15177,15145,15144,15112,15080,12999,12935,10822,10757,8612,6467,4387,6500,8645,10790,10854,12967,13000,15080,
- 15112,15144,15145,15145,15177,17225,17225,17225,17225,17225,17225,15177,15145,15145,15144,15112,15080,13000,12967,10854,10790,8645,6500,4387,
- 4355,6467,6532,8677,10790,10854,12967,12999,15080,15112,15112,15144,15145,15145,15145,15145,15145,15145,15145,15145,15144,15112,15112,15080,
- 12999,12967,10854,10790,8677,6532,6467,4355,4322,4355,6467,6532,8677,10790,10854,12935,12967,13000,15080,15112,15112,15112,15112,15112,
- 15144,15112,15112,15112,15112,15080,13000,12967,12935,10854,10790,8677,6532,6467,4355,4322,4290,4322,4355,6467,6532,8645,10757,10822,
- 10854,12935,12967,12999,13000,15080,15080,15080,15080,15080,15080,13000,12999,12967,12935,10854,10822,10757,8645,6532,6467,4355,4322,4290,
- 2242,4290,4322,4355,6435,6500,8612,8677,10757,10822,10854,12903,12935,12967,12967,12967,12967,12967,12967,12935,12903,10854,10822,10757,
- 8677,8612,6500,6435,4355,4322,4290,2242,2210,2242,4290,4322,4322,4355,6467,6500,8612,8645,8677,10757,10790,10790,10822,10822,
- 10822,10822,10790,10790,10757,8677,8645,8612,6500,6467,4355,4322,4322,4290,2242,2210,2209,2210,2210,4290,4290,4322,4322,4355,
- 6435,6467,6500,6532,8612,8645,8645,8645,8645,8645,8645,8612,6532,6500,6467,6435,4355,4322,4322,4290,4290,2210,2210,2209,
-};
diff --git a/games/uno/src/bot.c b/games/uno/src/bot.c
new file mode 100644
index 00000000..35321606
--- /dev/null
+++ b/games/uno/src/bot.c
@@ -0,0 +1,161 @@
+/* The bots. Each one sees what a player at the table sees: its own hand, the discard pile, how many cards the
+ * others hold, who drew on which colour. Easy plays any card that goes and often forgets UNO; Normal keeps its
+ * Wilds, plays its high cards and its biggest colour, and stops a player about to go out; Hard also plays to the
+ * colours the next player lacks, gets rid of its points when someone is about to win, challenges by counting
+ * the cards it has seen, and may bluff a Wild Draw Four to stop the last card. */
+#include "game.h"
+
+static uint32_t brand(uno_game *g) {
+ uint32_t x = g->brng;
+ x ^= x << 13, x ^= x >> 17, x ^= x << 5;
+ return g->brng = x ? x : 0x2545F491u;
+}
+static bool chance(uno_game *g, int pct) { return (int)(brand(g) % 100) < pct; }
+
+static int colour_count(const uno_game *g, int p, int col) {
+ int n = 0;
+ for (int i = 0; i < g->count[p]; i++) n += uno_color(g->hand[p][i]) == col;
+ return n;
+}
+
+int bot_best_color(const uno_game *g, int p, int level) {
+ int s[4] = {0, 0, 0, 0};
+ for (int i = 0; i < g->count[p]; i++) {
+ int c = g->hand[p][i];
+ if (c < 52) s[uno_color(c)] += 10 + uno_points(c) / 4; /* the colour it holds most, then the points */
+ }
+ if (level == LEVEL_HARD) {
+ int nx = uno_next(g, p);
+ for (int col = 0; col < 4; col++)
+ if (g->lacks[nx] >> col & 1) s[col] += g->count[nx] <= 3 ? 14 : 4;
+ }
+ int best = 0;
+ for (int col = 1; col < 4; col++)
+ if (s[col] > s[best]) best = col;
+ return best;
+}
+
+static bool says_uno(uno_game *g, int p, int level) {
+ if (g->count[p] != 2) return false;
+ return level == LEVEL_HARD ? true : !chance(g, level == LEVEL_EASY ? 25 : 8);
+}
+
+static bool attacks(const uno_game *g, int c) {
+ int v = uno_value(c);
+ return v == V_SKIP || v == V_DRAW2 || c == C_WILD4 || (v == V_REVERSE && g->r.players == 2);
+}
+
+/* Hard only: an illegal Wild Draw Four, when the next player is down to one card and nothing else stops them */
+static bool bluff_ok(const uno_game *g, int p) {
+ if (g->count[uno_next(g, p)] != 1) return false;
+ for (int i = 0; i < g->count[p]; i++) {
+ int c = g->hand[p][i];
+ if (c != C_WILD4 && attacks(g, c) && uno_matches(g, c)) return false;
+ }
+ return true;
+}
+
+static int score(const uno_game *g, int p, int i, int level) {
+ int c = g->hand[p][i], v = uno_value(c), col = uno_color(c), n = g->r.players, nx = uno_next(g, p);
+ bool threat = g->count[nx] <= 2;
+ int s;
+ if (c >= 52) {
+ s = g->count[p] <= 2 ? 60 : -40; /* Wilds are kept for when nothing else goes */
+ if (c == C_WILD4 && !threat) s -= 20;
+ } else {
+ s = uno_points(c) + 6 * (colour_count(g, p, col) - 1); /* high cards first, staying in a colour it holds */
+ }
+ if (threat && attacks(g, c)) s += level == LEVEL_HARD ? 120 : 70;
+ if (v == V_REVERSE && n > 2) {
+ int back = (p + n - g->dir) % n; /* who plays next after it */
+ if (g->count[back] <= 2 && !threat) s -= 60;
+ else if (threat && g->count[back] > 2) s += 50;
+ }
+ if (level == LEVEL_HARD) {
+ if (col < 4 && (g->lacks[nx] >> col & 1)) s += 15;
+ bool close = false;
+ for (int q = 0; q < n; q++) close |= q != p && g->count[q] <= 2;
+ if (close && !g->r.one_hand) s += uno_points(c) / 2; /* about to lose the hand: shed the points */
+ }
+ return s;
+}
+
+/* how likely the Wild Draw Four's player held the colour before it, from the cards this player has seen, in
+ * 65536ths: their other cards drawn at random from the ones it hasn't seen */
+static uint32_t guilt(const uno_game *g, int p) {
+ int col = g->prev_color, unseen = UNO_DECK - g->count[p] - g->pn, left = 25 - colour_count(g, p, col);
+ for (int i = 0; i < g->pn; i++) left -= uno_color(g->pile[i]) == col;
+ uint32_t none = 65536;
+ for (int k = 0; k < g->count[g->offender] && none; k++) {
+ int a = unseen - left - k, b = unseen - k;
+ if (b <= 0) break;
+ none = a <= 0 ? 0 : (uint32_t)((uint64_t)none * (uint32_t)a / (uint32_t)b);
+ }
+ return 65536 - none;
+}
+
+static bool challenges(uno_game *g, int level) {
+ if (level == LEVEL_EASY) return chance(g, 20);
+ /* honest players play it only without the colour: worth it on strong evidence (62.5%, Normal 80%) */
+ uint32_t need = level == LEVEL_HARD ? 40960 : 52429;
+ return guilt(g, g->turn) >= need;
+}
+
+uno_move bot_move(uno_game *g, int level) {
+ uno_move m = {M_DRAW, 0, false};
+ int p = g->turn;
+ if (g->phase == P_COLOR) {
+ m.act = M_COLOR;
+ m.arg = (uint8_t)(level == LEVEL_EASY && chance(g, 40) ? (int)(brand(g) % 4) : bot_best_color(g, p, level));
+ return m;
+ }
+ if (g->phase == P_DRAWN) {
+ int c = g->hand[p][g->drawn];
+ bool play = true;
+ if (!(g->r.house & H_MUST_PLAY)) {
+ if (c == C_WILD4 && !uno_legal_wild4(g, p) && !(level == LEVEL_HARD && bluff_ok(g, p))) play = false;
+ else if (level == LEVEL_EASY && chance(g, 15)) play = false;
+ }
+ m.act = play ? M_PLAY : M_KEEP, m.arg = g->drawn, m.uno = play && says_uno(g, p, level);
+ return m;
+ }
+ /* P_PLAY, or P_PENALTY with a card to stack */
+ int best = -1, best_s = -1000000;
+ for (int i = 0; i < g->count[p]; i++) {
+ if (!uno_can_play(g, i)) continue;
+ int c = g->hand[p][i];
+ if (c == C_WILD4 && g->phase == P_PLAY && !uno_legal_wild4(g, p) && !(level == LEVEL_HARD && bluff_ok(g, p))) continue;
+ int s = level == LEVEL_EASY ? (int)(brand(g) % 1000) : score(g, p, i, level);
+ if (s > best_s) best_s = s, best = i;
+ }
+ if (g->phase == P_PENALTY) {
+ if (best >= 0 && (level != LEVEL_EASY || chance(g, 70))) {
+ m.act = M_PLAY, m.arg = (uint8_t)best, m.uno = says_uno(g, p, level);
+ } else {
+ m.act = g->challengeable && challenges(g, level) ? M_CHALLENGE : M_TAKE;
+ }
+ return m;
+ }
+ if (best >= 0) m.act = M_PLAY, m.arg = (uint8_t)best, m.uno = says_uno(g, p, level);
+ return m;
+}
+
+bool bot_do(uno_game *g, uno_move m) {
+ switch (m.act) {
+ case M_PLAY: return uno_play(g, m.arg, m.uno);
+ case M_DRAW: return uno_draw(g);
+ case M_KEEP: return uno_keep(g);
+ case M_TAKE: return uno_take(g);
+ case M_CHALLENGE: return uno_challenge(g);
+ default: return uno_choose(g, m.arg);
+ }
+}
+
+bool bot_catches(uno_game *g, int by, int level, uint32_t *ms) {
+ static const uint8_t pct[3] = {35, 70, 95};
+ static const uint16_t base[3] = {1500, 1000, 600}, spread[3] = {700, 500, 400};
+ if (g->uno_open == UNO_NONE || by == g->uno_open) return false;
+ bool yes = chance(g, pct[level]);
+ *ms = base[level] + brand(g) % spread[level];
+ return yes;
+}
diff --git a/games/uno/src/draw.c b/games/uno/src/draw.c
new file mode 100644
index 00000000..3c44445d
--- /dev/null
+++ b/games/uno/src/draw.c
@@ -0,0 +1,840 @@
+/* The screens. Cards are drawn, not pictures: the white border, the colour, the tilted oval and the big number
+ * or symbol of the classic deck, sized for 320x240. */
+#include <string.h>
+#include "gfx.h"
+#include "draw.h"
+
+void plat_push(int x, int y, int w, int h, const uint16_t *px); /* (plat.h: its key names are the launcher's too) */
+
+void np_push(int x, int y, int w, int h, const color_t *px) { plat_push(x, y, w, h, px); }
+static color_t strip[SCREEN_W * STRIP_H];
+
+#define WHITE 0xFFFF
+#define INK HEX(0x111827)
+#define FOCUS HEX(0xFFD43B)
+#define MUTED HEX(0xA8B3C7)
+#define PANEL HEX(0x1B2436)
+#define CARD_BLACK HEX(0x1C1C1E)
+static const color_t CARD[5] = {HEX(0xE53935), HEX(0xF7C21B), HEX(0x2EA34F), HEX(0x1E7BD8), HEX(0x1C1C1E)};
+static const char *const COLOR_NAME[4] = {"Red", "Yellow", "Green", "Blue"};
+static const char *const NAMES[4] = {"You", "Bot 1", "Bot 2", "Bot 3"};
+
+const char *uno_name(int p) { return p >= 0 && p < 4 ? NAMES[p] : ""; }
+
+static char *put(char *p, const char *s) {
+ while (*s) *p++ = *s++;
+ *p = 0;
+ return p;
+}
+static char *num(char *p, unsigned v) {
+ char t[8];
+ int n = 0;
+ do t[n++] = (char)('0' + v % 10); while ((v /= 10) && n < 8);
+ while (n) *p++ = t[--n];
+ *p = 0;
+ return p;
+}
+
+void uno_card_name(int c, char *out) {
+ if (c == C_WILD) { put(out, "Wild"); return; }
+ if (c == C_WILD4) { put(out, "Wild +4"); return; }
+ char *p = put(out, COLOR_NAME[uno_color(c)]);
+ *p++ = ' ';
+ int v = uno_value(c);
+ if (v < 10) num(p, (unsigned)v);
+ else put(p, v == V_SKIP ? "Skip" : v == V_REVERSE ? "Reverse" : "+2");
+}
+
+/* ------------------------------------------------------------------ shapes, smoothed */
+static inline void put32(int x, int y, color_t c, int t) {
+ if (t <= 0 || x < 0 || x >= SCREEN_W || y < gfx_y0 || y >= gfx_y1) return;
+ color_t *d = &gfx_buf[(y - gfx_y0) * SCREEN_W + x];
+ *d = t >= 32 ? c : gfx_mix(*d, c, t);
+}
+static inline void plot(int x, int y, color_t c, float cov) { put32(x, y, c, (int)(cov * 32 + 0.5f)); }
+static inline float clamp01(float v) { return v < 0 ? 0 : v > 1 ? 1 : v; }
+static inline float len2(float x, float y) { return __builtin_sqrtf(x * x + y * y); }
+
+/* rows of a box that are in the strip */
+static bool rows(float y0, float y1, int *a, int *b) {
+ *a = NP_MAX((int)y0 - 1, gfx_y0), *b = NP_MIN((int)y1 + 2, gfx_y1);
+ return *a < *b;
+}
+
+/* an ellipse turned so that its long axis (a) points up and to the right, as on the cards; quarters: the Wild's
+ * four colours. Each row: the inside filled at once, the edges smoothed. */
+static void oval(float cx, float cy, float a, float b, color_t c, const color_t *quarters) {
+ const float ax = 0.5f, ay = -0.866f, bx = 0.866f, by = 0.5f;
+ float ey = __builtin_sqrtf(a * a * ay * ay + b * b * by * by);
+ int r0, r1;
+ if (!rows(cy - ey, cy + ey, &r0, &r1)) return;
+ /* u^2 + v^2 = 1 as A x^2 + B x y + C y^2 = 1, for the ellipse grown and shrunk by 0.75 pixel */
+ float Ao[2], Bo[2], Co[2];
+ for (int k = 0; k < 2; k++) {
+ float aa = a + (k ? -0.75f : 0.75f), bb = b + (k ? -0.75f : 0.75f);
+ aa = aa < 0.5f ? 0.5f : aa, bb = bb < 0.5f ? 0.5f : bb;
+ Ao[k] = ax * ax / (aa * aa) + bx * bx / (bb * bb);
+ Bo[k] = 2 * (ax * ay / (aa * aa) + bx * by / (bb * bb));
+ Co[k] = ay * ay / (aa * aa) + by * by / (bb * bb);
+ }
+ for (int y = r0; y < r1; y++) {
+ float dy = y + 0.5f - cy, sp[2][2];
+ bool has[2];
+ for (int k = 0; k < 2; k++) {
+ float qb = Bo[k] * dy, disc = qb * qb - 4 * Ao[k] * (Co[k] * dy * dy - 1);
+ has[k] = disc > 0;
+ if (has[k]) {
+ float r = __builtin_sqrtf(disc);
+ sp[k][0] = cx + (-qb - r) / (2 * Ao[k]), sp[k][1] = cx + (-qb + r) / (2 * Ao[k]);
+ }
+ }
+ if (!has[0]) continue;
+ int xo0 = (int)sp[0][0] - 1, xo1 = (int)sp[0][1] + 2;
+ int xi0 = has[1] ? (int)sp[1][0] + 1 : xo1, xi1 = has[1] ? (int)sp[1][1] : xo1;
+ if (xi1 < xi0) xi0 = xi1 = xo1;
+ for (int x = NP_MAX(xo0, 0); x < NP_MIN(xo1, SCREEN_W); x++) {
+ bool inside = x >= xi0 && x < xi1;
+ float dx = x + 0.5f - cx;
+ float u = (dx * ax + dy * ay) / a, v = (dx * bx + dy * by) / b;
+ color_t k = quarters ? quarters[(u < 0) * 2 + ((u < 0) != (v > 0))] : c;
+ if (inside) {
+ if (!quarters) { /* the whole inside of the row in one go */
+ color_t *d = &gfx_buf[(y - gfx_y0) * SCREEN_W + x];
+ for (int n = NP_MIN(xi1, SCREEN_W) - x; n > 0; n--) *d++ = c;
+ x = NP_MIN(xi1, SCREEN_W) - 1;
+ } else {
+ gfx_buf[(y - gfx_y0) * SCREEN_W + x] = k;
+ }
+ continue;
+ }
+ float r = __builtin_sqrtf(u * u + v * v), l = len2(dx, dy), d = r > 0.001f ? l - l / r : -a;
+ plot(x, y, k, clamp01(0.5f - d));
+ }
+ }
+}
+
+/* a stroke from (x0, y0) to (x1, y1), w wide, round ends */
+static void stroke(float x0, float y0, float x1, float y1, float w, color_t c) {
+ float r = w * 0.5f;
+ int r0, r1;
+ if (!rows((y0 < y1 ? y0 : y1) - r, (y0 > y1 ? y0 : y1) + r, &r0, &r1)) return;
+ int xa = (int)((x0 < x1 ? x0 : x1) - r) - 1, xb = (int)((x0 > x1 ? x0 : x1) + r) + 2;
+ float dx = x1 - x0, dy = y1 - y0, ll = dx * dx + dy * dy;
+ for (int y = r0; y < r1; y++)
+ for (int x = xa; x < xb; x++) {
+ float px = x + 0.5f - x0, py = y + 0.5f - y0;
+ float t = ll > 0 ? clamp01((px * dx + py * dy) / ll) : 0;
+ plot(x, y, c, clamp01(0.5f - (len2(px - t * dx, py - t * dy) - r)));
+ }
+}
+
+static void ring(float cx, float cy, float r, float w, color_t c) {
+ int r0, r1;
+ if (!rows(cy - r - w, cy + r + w, &r0, &r1)) return;
+ for (int y = r0; y < r1; y++)
+ for (int x = (int)(cx - r - w) - 1; x < (int)(cx + r + w) + 2; x++) {
+ float d = __builtin_fabsf(len2(x + 0.5f - cx, y + 0.5f - cy) - r) - w * 0.5f;
+ plot(x, y, c, clamp01(0.5f - d));
+ }
+}
+
+static void tri(float ax, float ay, float bx, float by, float qx, float qy, float grow, color_t c) {
+ float lo = ay < by ? ay : by, hi = ay > by ? ay : by;
+ lo = lo < qy ? lo : qy, hi = hi > qy ? hi : qy;
+ float le = ax < bx ? ax : bx, ri = ax > bx ? ax : bx;
+ le = le < qx ? le : qx, ri = ri > qx ? ri : qx;
+ lo -= grow, hi += grow, le -= grow, ri += grow;
+ float area = (bx - ax) * (qy - ay) - (by - ay) * (qx - ax), s = area < 0 ? -1.0f : 1.0f;
+ float ex[3] = {ax, bx, qx}, ey[3] = {ay, by, qy};
+ int r0, r1;
+ if (!rows(lo, hi, &r0, &r1)) return;
+ for (int y = r0; y < r1; y++)
+ for (int x = (int)le - 1; x < (int)ri + 2; x++) {
+ float px = x + 0.5f, py = y + 0.5f, d = -1e9f;
+ for (int k = 0; k < 3; k++) {
+ float x0 = ex[k], y0 = ey[k], x1 = ex[(k + 1) % 3], y1 = ey[(k + 1) % 3];
+ float nx = (y1 - y0) * s, ny = -(x1 - x0) * s, nl = len2(nx, ny);
+ float e = ((px - x0) * nx + (py - y0) * ny) / nl; /* > 0 outside this edge */
+ if (e > d) d = e;
+ }
+ plot(x, y, c, clamp01(0.5f - (d - grow)));
+ }
+}
+
+/* text from the font's 4-bit letters, scaled (q8: 256 = its size) and leant (shear: pixels per pixel up), with a
+ * dark edge e pixels wide (one at the font's own size); scaled letters are smoothed and sharpened back */
+static inline int cov_at(const uint8_t *d, const np_glyph_t *g, int i, int j) {
+ if ((unsigned)i >= g->w || (unsigned)j >= g->h) return 0;
+ int n = j * g->w + i;
+ return d[g->offset + (n >> 1)] >> ((n & 1) * 4) & 15;
+}
+static float sample(const uint8_t *d, const np_glyph_t *g, float sx, float sy) {
+ int ix = (int)(sx + 8) - 8, iy = (int)(sy + 8) - 8;
+ float fx = sx - ix, fy = sy - iy;
+ return (cov_at(d, g, ix, iy) * (1 - fx) + cov_at(d, g, ix + 1, iy) * fx) * (1 - fy) +
+ (cov_at(d, g, ix, iy + 1) * (1 - fx) + cov_at(d, g, ix + 1, iy + 1) * fx) * fy;
+}
+static int big_width(const np_font_t *f, const char *s, int q8) {
+ int w = 0;
+ for (; *s; s++) w += f->glyphs[(uint8_t)*s - f->first].advance;
+ return w * q8 >> 8;
+}
+static void big_text(const np_font_t *f, int x, int base, const char *s, int q8, float shear, color_t c, color_t edge,
+ int e) {
+ int top = base - (f->ascent * q8 >> 8) - 3, bot = base + (f->descent * q8 >> 8) + 3;
+ if (bot <= gfx_y0 || top >= gfx_y1) return;
+ const uint8_t *data = f->data;
+ float k = 256.0f / q8, pen = (float)x, ek = e * k;
+ for (; *s; s++) {
+ const np_glyph_t *g = &f->glyphs[(uint8_t)*s - f->first];
+ float gx = pen + g->x * q8 / 256.0f, gy = base + g->y * q8 / 256.0f, gw = g->w * q8 / 256.0f, gh = g->h * q8 / 256.0f;
+ int y0 = NP_MAX((int)gy - 1 - e, gfx_y0), y1 = NP_MIN((int)(gy + gh) + 2 + e, gfx_y1);
+ for (int y = y0; y < y1; y++) {
+ float lean = (base - (y + 0.5f)) * shear;
+ int xa = (int)(gx + lean) - 1 - e, xb = (int)(gx + lean + gw) + 2 + e;
+ if (q8 == 256) { /* its own size: the letter's pixels, no smoothing needed */
+ float fo = gx + lean;
+ int ox = (int)(fo + 8) - 8, oy = (int)(gy + 0.5f), j = y - oy, fx = (int)((fo - ox) * 16); /* (1/16ths) */
+ for (int xx = xa; xx < xb; xx++) {
+ int i = xx - ox, v = (cov_at(data, g, i, j) * (16 - fx) + cov_at(data, g, i - 1, j) * fx + 8) >> 4;
+ if (e) {
+ int m = 0;
+ for (int dj = -1; dj <= 1; dj++)
+ for (int di = -1; di <= 1; di++) {
+ int w = cov_at(data, g, i + di, j + dj);
+ m = w > m ? w : m;
+ }
+ if (m > v) put32(xx, y, edge, (m * 32 + 7) / 15);
+ }
+ put32(xx, y, c, (v * 32 + 7) / 15);
+ }
+ continue;
+ }
+ float sy = (y + 0.5f - gy) * k - 0.5f;
+ for (int xx = xa; xx < xb; xx++) {
+ float sx = (xx + 0.5f - gx - lean) * k - 0.5f;
+ float v = clamp01((sample(data, g, sx, sy) / 15.0f - 0.5f) * 2.2f + 0.5f);
+ if (e) {
+ float m = sample(data, g, sx - ek, sy);
+ float t = sample(data, g, sx + ek, sy);
+ m = t > m ? t : m, t = sample(data, g, sx, sy - ek), m = t > m ? t : m, t = sample(data, g, sx, sy + ek);
+ m = clamp01(((t > m ? t : m) / 15.0f - 0.5f) * 2.2f + 0.5f);
+ if (m > v) plot(xx, y, edge, m);
+ }
+ plot(xx, y, c, v);
+ }
+ }
+ pen += g->advance * q8 / 256.0f;
+ }
+}
+/* the same, centred */
+static void big_label(const np_font_t *f, int cx, int base, const char *s, int q8, float shear, color_t c, color_t edge,
+ int e) {
+ big_text(f, cx - big_width(f, s, q8) / 2, base, s, q8, shear, c, edge, e);
+}
+
+static void text(int x, int y, const char *s, color_t c) { gfx_text(&np_font_small, x, y, s, c, 256); }
+static void ctext(const np_font_t *f, int x, int y, const char *s, color_t c) { gfx_text_center(f, x, y, s, c, 256); }
+
+/* ------------------------------------------------------------------ cards */
+/* the symbol of a card, centred at (cx, cy), s high (s: about the height of a digit) */
+static void symbol(int card, float cx, float cy, float s, color_t c, color_t edge) {
+ int v = uno_value(card);
+ float w = s * (v == V_REVERSE ? 0.13f : 0.17f) + 1.0f;
+ for (int pass = 0; pass < 2; pass++) {
+ color_t k = pass ? c : edge;
+ float ww = pass ? w : w + 2.0f;
+ if (v == V_SKIP) {
+ float r = s * 0.42f;
+ ring(cx, cy, r, ww, k);
+ stroke(cx - r * 0.68f, cy - r * 0.68f, cx + r * 0.68f, cy + r * 0.68f, ww, k);
+ } else { /* Reverse: two arrows side by side, one each way */
+ const float dx = 0.7071f, dy = -0.7071f, nx = 0.7071f, ny = 0.7071f;
+ bool tiny = s < 14; /* (in a corner: bigger heads) */
+ float L = s * (tiny ? 0.55f : 0.44f), hl = s * (tiny ? 0.5f : 0.28f), hw = s * (tiny ? 0.32f : 0.2f), o = s * 0.22f;
+ float g = pass ? 0 : tiny ? 0.8f : 1.0f;
+ if (tiny) ww = pass ? 1.4f : 2.8f;
+ for (int i = 0; i < 2; i++) {
+ float sg = i ? -1.0f : 1.0f, ox = cx - sg * nx * o, oy = cy - sg * ny * o;
+ float bx = ox + sg * dx * (L - hl), by = oy + sg * dy * (L - hl);
+ stroke(ox - sg * dx * L, oy - sg * dy * L, bx, by, ww, k);
+ tri(ox + sg * dx * L, oy + sg * dy * L, bx + nx * hw, by + ny * hw, bx - nx * hw, by - ny * hw, g, k);
+ }
+ }
+ }
+}
+
+static void value_label(int card, char *b) {
+ int v = uno_value(card);
+ if (card == C_WILD4) put(b, "+4");
+ else if (card == C_WILD) b[0] = 0;
+ else if (v == V_DRAW2) put(b, "+2");
+ else if (v < 10) num(b, (unsigned)v);
+ else b[0] = 0;
+}
+
+/* the corner index, top left (and bottom right on big cards) */
+static void corner(int card, int x, int y, int w, int h) {
+ char b[4];
+ value_label(card, b);
+ int v = uno_value(card);
+ bool small = w < 44;
+ const np_font_t *f = small ? &np_font_small : &np_font_body;
+ int ix = x + (small ? 3 : 5), iy = y + (small ? 11 : 15);
+ for (int k = 0; k < (small ? 1 : 2); k++) {
+ int px = k ? x + w - (small ? 3 : 5) : ix, py = k ? y + h - (small ? 5 : 6) : iy;
+ if (card != C_WILD && (v < 10 || v == V_DRAW2 || card == C_WILD4)) {
+ int tw = gfx_text_width(f, b);
+ int tx = k ? px - tw : px;
+ gfx_text(f, tx + 1, py + 1, b, CARD_BLACK, 200);
+ gfx_text(f, tx, py, b, WHITE, 256);
+ } else if (card != C_WILD) {
+ float s = small ? 10.0f : 12.0f, cx = k ? px - s * 0.5f : px + s * 0.5f, cy = py - s * 0.4f;
+ symbol(card, cx, cy, s, WHITE, CARD_BLACK);
+ }
+ }
+}
+
+static void card_face(int card, int x, int y, int w, int h) {
+ if (y >= gfx_y1 || y + h <= gfx_y0) return;
+ int r = w / 6 + 1, bd = w >= 44 ? 3 : 2;
+ gfx_rrect(x - 1, y - 1, w + 2, h + 2, r + 1, HEX(0x374151), 150);
+ gfx_rrect(x, y, w, h, r, WHITE, 256);
+ int col = uno_color(card);
+ gfx_rrect(x + bd, y + bd, w - 2 * bd, h - 2 * bd, r - 1, CARD[col], 256);
+ float cx = x + w * 0.5f, cy = y + h * 0.5f, a = (h - 2 * bd) * 0.47f, b = (w - 2 * bd) * 0.37f;
+ const np_font_t *big = &np_font_title;
+ int q8 = w >= 44 ? 360 : 256; /* the number's size */
+ if (card == C_WILD) {
+ static const color_t quarters[4] = {HEX(0xE53935), HEX(0x1E7BD8), HEX(0xF7C21B), HEX(0x2EA34F)};
+ oval(cx, cy, a, b, WHITE, 0);
+ oval(cx, cy, a - 1.5f, b - 1.5f, 0, quarters);
+ } else if (card == C_WILD4) {
+ /* four little cards, one of each colour */
+ static const uint8_t order[4] = {BLUE, GREEN, RED, YELLOW};
+ int mw = w * 26 / 100 + 1, mh = h * 30 / 100 + 1;
+ for (int i = 0; i < 4; i++) {
+ int mx = (int)(cx - mw * 0.5f + (i - 1.5f) * w * 0.12f), my = (int)(cy - mh * 0.5f + (1.5f - i) * h * 0.06f);
+ gfx_rrect(mx, my, mw, mh, 2, WHITE, 256);
+ gfx_rrect(mx + 1, my + 1, mw - 2, mh - 2, 2, CARD[order[i]], 256);
+ }
+ } else {
+ oval(cx, cy, a, b, WHITE, 0);
+ int v = uno_value(card);
+ if (v == V_SKIP || v == V_REVERSE) {
+ symbol(card, cx, cy, h * 0.4f, CARD[col], CARD_BLACK);
+ } else {
+ char t[4];
+ value_label(card, t);
+ int base = (int)(cy + (big->ascent * q8 >> 8) * 0.5f);
+ big_label(big, (int)cx, base, t, q8, 0.18f, CARD[col], CARD_BLACK, 1);
+ if (v == 6 || v == 9) gfx_fill((int)cx - 3, base + 2, 7, 2, CARD[col]); /* 6 and 9 underlined */
+ }
+ }
+ corner(card, x, y, w, h);
+}
+
+static void card_back(int x, int y, int w, int h) {
+ if (y >= gfx_y1 || y + h <= gfx_y0) return;
+ int r = w / 6 + 1, bd = w >= 30 ? 3 : w >= 16 ? 2 : 1;
+ if (w >= 16) gfx_rrect(x - 1, y - 1, w + 2, h + 2, r + 1, HEX(0x374151), 150);
+ gfx_rrect(x, y, w, h, r, WHITE, 256);
+ gfx_rrect(x + bd, y + bd, w - 2 * bd, h - 2 * bd, r - 1, CARD_BLACK, 256);
+ float cx = x + w * 0.5f, cy = y + h * 0.5f;
+ oval(cx, cy, (h - 2 * bd) * 0.45f, (w - 2 * bd) * 0.36f, CARD[RED], 0);
+ if (w >= 30) {
+ int q8 = w * 256 / 66;
+ big_label(&np_font_title, (int)cx, (int)(cy + (np_font_title.ascent * q8 >> 8) * 0.5f), "UNO", q8, 0.2f,
+ CARD[YELLOW], CARD_BLACK, 1);
+ }
+}
+
+static void dim_card(int x, int y, int w, int h) { gfx_rrect(x, y, w, h, w / 6 + 1, HEX(0x0B1020), 150); }
+
+/* ------------------------------------------------------------------ pieces of the screens */
+static void background(void) { gfx_vgrad(0, 0, SCREEN_W, SCREEN_H, 0x23304A, 0x0F1626); }
+static void table_bg(void) { gfx_vgrad(0, 0, SCREEN_W, SCREEN_H, 0x1F6B4A, 0x0B3324); }
+
+static void panel(int x, int y, int w, int h) {
+ gfx_shadow(x, y, w, h, 10, 6, 160);
+ gfx_rrect(x, y, w, h, 10, PANEL, 250);
+ gfx_rrect_outline(x, y, w, h, 10, 1, HEX(0x3B4A66), 256);
+}
+
+static void button(int x, int y, int w, int h, const char *s, bool focus) {
+ gfx_rrect(x, y, w, h, h / 2, focus ? FOCUS : HEX(0x2A3650), 256);
+ if (focus) gfx_rrect_outline(x - 2, y - 2, w + 4, h + 4, h / 2 + 2, 2, WHITE, 256);
+ ctext(&np_font_body, x + w / 2, y + h / 2 + 5, s, focus ? INK : WHITE);
+}
+
+/* the key line: "key|what|key|what...", keys in yellow */
+static int keyline_draw(const char *s, bool draw) {
+ char b[24];
+ int x = 6, i = 0;
+ while (*s) {
+ int n = 0;
+ while (*s && *s != '|' && n < 23) b[n++] = *s++;
+ b[n] = 0;
+ if (*s == '|') s++;
+ if (draw) gfx_text(&np_font_small, x, 236, b, i % 2 ? WHITE : FOCUS, 256);
+ x += gfx_text_width(&np_font_small, b) + (i % 2 ? 9 : 4);
+ i++;
+ }
+ return x - 9;
+}
+int uno_keyline_width(const char *s) { return keyline_draw(s, false); }
+int uno_text_width(const char *s) { return gfx_text_width(&np_font_small, s); }
+static void keyline(const char *s) {
+ gfx_fill(0, 226, SCREEN_W, 14, HEX(0x0A0F1A));
+ keyline_draw(s, true);
+}
+
+static void logo(int cx, int cy, int q8) {
+ oval((float)cx, (float)cy, 30.0f * q8 / 256, 52.0f * q8 / 256, CARD_BLACK, 0);
+ oval((float)cx, (float)cy, 27.0f * q8 / 256, 49.0f * q8 / 256, CARD[RED], 0);
+ int tq = q8 * 2;
+ big_label(&np_font_title, cx, cy + (np_font_title.ascent * tq >> 8) / 2, "UNO", tq, 0.22f, CARD[YELLOW], CARD_BLACK, 2);
+}
+
+/* ------------------------------------------------------------------ the table */
+typedef struct { int x, y; } seat_t;
+static seat_t seat(int n, int p) {
+ if (n == 2) return (seat_t){123, 4};
+ if (n == 3) return p == 1 ? (seat_t){4, 50} : (seat_t){242, 50};
+ return p == 1 ? (seat_t){4, 56} : p == 2 ? (seat_t){123, 4} : (seat_t){242, 56};
+}
+
+static void opponent(const uno_game *g, int p, bool live) {
+ seat_t s = seat(g->r.players, p);
+ int w = 74, h = 62, x = s.x, y = s.y;
+ if (y >= gfx_y1 || y + h <= gfx_y0) return;
+ bool turn = live && g->turn == p && g->phase < P_HAND_OVER;
+ gfx_rrect(x, y, w, h, 9, HEX(0x0B1A14), 150);
+ if (turn) gfx_rrect_outline(x - 2, y - 2, w + 4, h + 4, 11, 3, FOCUS, 256);
+ gfx_text(&np_font_body, x + 6, y + 15, uno_name(p), turn ? FOCUS : WHITE, 256);
+ char b[8];
+ if (!g->r.one_hand) {
+ num(b, g->score[p]);
+ gfx_text_right(&np_font_small, x + w - 6, y + 14, b, MUTED, 256);
+ }
+ int n = g->count[p], fan = NP_MIN(n, 6);
+ for (int i = 0; i < fan; i++) card_back(x + 6 + i * 5, y + 21, 13, 19);
+ num(b, (unsigned)n);
+ big_label(&np_font_title, x + w - 16, y + 41, b, 256, 0, WHITE, 0, 0);
+ if (live && g->uno_open == p) {
+ gfx_rrect(x + 6, y + 44, w - 12, 14, 7, FOCUS, 256);
+ ctext(&np_font_small, x + w / 2, y + 55, "Forgot UNO!", INK);
+ } else if (n == 1) {
+ gfx_rrect(x + 6, y + 44, w - 12, 14, 7, CARD[RED], 256);
+ ctext(&np_font_small, x + w / 2, y + 55, "UNO!", WHITE);
+ }
+}
+
+/* two arrows round in a circle: the way play goes */
+static void direction(int cx, int cy, int dir) {
+ float r = 11;
+ for (int pass = 0; pass < 2; pass++) {
+ color_t c = pass ? HEX(0xE8F0EA) : HEX(0x0B3324);
+ float w = pass ? 2.5f : 4.5f, g = pass ? 0 : 1.2f;
+ for (int i = 0; i < 2; i++) {
+ float a0 = i * 3.14159f + 0.5f, a1 = a0 + 1.75f, px = 0, py = 0;
+ for (int k = 0; k <= 8; k++) {
+ float a = a0 + (a1 - a0) * k / 8, qx = cx + r * __builtin_cosf(a), qy = cy + r * __builtin_sinf(a) * (float)dir;
+ if (k) stroke(px, py, qx, qy, w, c);
+ px = qx, py = qy;
+ }
+ /* the head, along the circle at its end */
+ float tx = -__builtin_sinf(a1), ty = __builtin_cosf(a1) * (float)dir, nx = __builtin_cosf(a1), ny = __builtin_sinf(a1) * (float)dir;
+ tri(px + tx * 6, py + ty * 6, px + nx * 4.5f, py + ny * 4.5f, px - nx * 4.5f, py - ny * 4.5f, g, c);
+ }
+ }
+}
+
+static int hand_layout(int n, int pick, int *first, int *shown) {
+ int maxn = 28;
+ *shown = NP_MIN(n, maxn);
+ *first = NP_CLAMP(pick - *shown / 2, 0, n - *shown);
+ return *shown > 1 ? NP_MIN(40, (310 - 36) / (*shown - 1)) : 0;
+}
+
+static void your_hand(const uno_game *g, const uno_ui *v) {
+ int n = g->count[0];
+ if (!n || gfx_y1 <= 156) return;
+ int first, shown, sp = hand_layout(n, v->pick, &first, &shown);
+ int w = 36, h = 54, total = w + (shown - 1) * sp, x0 = (SCREEN_W - total) / 2;
+ bool mine = g->turn == 0 && g->phase < P_HAND_OVER && g->phase != P_COLOR;
+ bool panel_up = g->phase == P_PENALTY && g->turn == 0 && g->challengeable;
+ for (int k = 0; k < shown; k++) {
+ int i = first + k, x = x0 + k * sp, y = i == v->pick ? 160 : 168;
+ if (i == v->pick) continue;
+ card_face(g->hand[0][i], x, y, w, h);
+ if (mine && !panel_up && !uno_can_play(g, i)) dim_card(x, y, w, h);
+ }
+ if (v->pick >= first && v->pick < first + shown) {
+ int x = x0 + (v->pick - first) * sp, y = 160;
+ card_face(g->hand[0][v->pick], x, y, w, h);
+ if (mine && !panel_up && !uno_can_play(g, v->pick)) dim_card(x, y, w, h);
+ gfx_rrect_outline(x - 3, y - 3, w + 6, h + 6, 9, 3, mine ? FOCUS : WHITE, 256);
+ }
+ if (first) text(1, 200, "<", FOCUS);
+ if (first + shown < n) text(313, 200, ">", FOCUS);
+}
+
+static void uno_button(const uno_game *g, const uno_ui *v) {
+ (void)v;
+ int x = 262, y = 137, w = 54, h = 18;
+ if (y >= gfx_y1 || y + h <= gfx_y0) return;
+ bool catchable = g->uno_open != UNO_NONE && g->uno_open != 0;
+ bool mine = g->uno_open == 0 || (g->turn == 0 && g->count[0] == 2 && g->uno_said != 0 &&
+ (g->phase == P_PLAY || g->phase == P_DRAWN || g->phase == P_PENALTY));
+ if (g->phase >= P_HAND_OVER) catchable = mine = false;
+ if (catchable) {
+ gfx_rrect(x, y, w, h, 9, FOCUS, 256);
+ ctext(&np_font_body, x + w / 2, y + 14, "Catch!", INK);
+ } else if (mine) {
+ gfx_rrect(x, y, w, h, 9, CARD[RED], 256);
+ gfx_rrect_outline(x - 2, y - 2, w + 4, h + 4, 11, 2, FOCUS, 256);
+ ctext(&np_font_body, x + w / 2, y + 14, "UNO!", WHITE);
+ } else {
+ gfx_rrect_outline(x, y, w, h, 9, 1, HEX(0x5C8A73), 256);
+ ctext(&np_font_body, x + w / 2, y + 14, g->uno_said == 0 ? "Said!" : "UNO", HEX(0x7FA893));
+ }
+}
+
+static void info(const uno_game *g) {
+ if (gfx_y0 >= 44) return;
+ char b[24], *p;
+ if (g->r.one_hand) {
+ text(6, 14, "One hand", MUTED);
+ } else {
+ p = put(b, "Hand ");
+ num(p, g->hands);
+ text(6, 14, b, MUTED);
+ text(6 + gfx_text_width(&np_font_small, b) + 6, 14, "to 500", HEX(0x7FA893));
+ p = put(b, "You ");
+ num(p, g->score[0]);
+ gfx_text(&np_font_body, 6, 32, b, WHITE, 256);
+ }
+}
+
+static void piles(const uno_game *g) {
+ if (gfx_y0 >= 142 || gfx_y1 <= 46) return;
+ card_back(96, 58, 40, 58);
+ char b[8];
+ num(b, g->dn);
+ ctext(&np_font_small, 116, 128, b, MUTED);
+ int top = g->pile[g->pn - 1], col = g->color;
+ if (col < 4) gfx_rrect_outline(143, 47, 60, 84, 12, 4, CARD[col], 256);
+ card_face(top, 147, 50, 52, 78);
+ if (col < 4) ctext(&np_font_small, 173, 140, COLOR_NAME[col], col == RED ? HEX(0xFF8A80) : CARD[col]);
+ if (g->r.players > 2) direction(222, 88, g->dir);
+}
+
+static void color_picker(const uno_ui *v) {
+ panel(40, 54, 240, 112);
+ ctext(&np_font_body, 160, 76, "Call a colour", WHITE);
+ for (int i = 0; i < 4; i++) {
+ int x = 56 + i * 54, y = 88, s = 44;
+ bool f = v->sel == i;
+ if (f) y -= 3, gfx_rrect_outline(x - 4, y - 4, s + 8, s + 8, 12, 3, WHITE, 256);
+ gfx_rrect(x, y, s, s, 9, CARD[i], 256);
+ ctext(&np_font_small, x + s / 2, 152, COLOR_NAME[i], f ? WHITE : MUTED);
+ }
+}
+
+int uno_pen_count(const uno_game *g) { return 2 + uno_can_stack(g); }
+
+static void penalty_panel(const uno_game *g, const uno_ui *v) {
+ panel(36, 40, 248, 136);
+ char b[48], *p = put(b, uno_name(g->offender));
+ put(p, " played a Wild Draw Four");
+ ctext(&np_font_body, 160, 60, b, WHITE);
+ p = put(b, "The colour was ");
+ put(p, COLOR_NAME[g->prev_color]);
+ ctext(&np_font_small, 160, 78, b, MUTED);
+ int n = uno_pen_count(g);
+ for (int i = 0; i < n; i++) {
+ int item = i;
+ const char *s = item == PEN_TAKE ? "Take 4 cards" : item == PEN_CHALLENGE ? "Challenge: a bluff?" : "Play your Wild Draw Four";
+ if (item == PEN_TAKE) {
+ p = put(b, "Take ");
+ p = num(p, g->pending);
+ put(p, " cards");
+ s = b;
+ }
+ button(56, 88 + i * 28, 208, 22, s, v->sel == i);
+ }
+}
+
+static void end_panel(const uno_game *g, const uno_ui *v) {
+ bool over = g->phase == P_GAME_OVER;
+ int n = g->r.players, h = 96 + n * 18;
+ int y = (226 - h) / 2;
+ panel(28, y, 264, h);
+ char b[48], *p;
+ p = put(b, uno_name(g->winner));
+ put(p, g->winner ? (over ? " wins the game" : " wins the hand") : (over ? " win the game!" : " win the hand!"));
+ ctext(&np_font_body, 160, y + 22, b, g->winner == 0 ? FOCUS : WHITE);
+ p = put(b, "+");
+ p = num(p, g->gained);
+ put(p, " points");
+ ctext(&np_font_small, 160, y + 40, b, MUTED);
+ for (int q = 0; q < n; q++) {
+ int ry = y + 50 + q * 18;
+ bool w = q == g->winner;
+ gfx_text(&np_font_body, 48, ry + 13, uno_name(q), w ? FOCUS : WHITE, 256);
+ num(b, g->score[q]);
+ gfx_text_right(&np_font_body, 140, ry + 13, b, w ? FOCUS : WHITE, 256);
+ if (!g->r.one_hand) {
+ int bw = 120, fill = NP_MIN(bw, g->score[q] * bw / UNO_GOAL);
+ gfx_rrect(152, ry + 5, bw, 8, 4, HEX(0x2A3650), 256);
+ if (fill > 0) gfx_rrect(152, ry + 5, NP_MAX(fill, 8), 8, 4, w ? FOCUS : HEX(0x7FA8D8), 256);
+ }
+ }
+ int by = y + 56 + n * 18;
+ if (over) {
+ button(48, by, 104, 24, "Play again", v->sel == 0);
+ button(168, by, 104, 24, "Menu", v->sel == 1);
+ } else {
+ button(90, by, 140, 24, "Next hand", true);
+ }
+}
+
+static void reveal_panel(const uno_ui *v) {
+ panel(16, 36, 288, 160);
+ char b[56], *p = put(b, uno_name(v->reveal_who));
+ put(p, "'s hand");
+ ctext(&np_font_body, 160, 58, b, WHITE);
+ int n = v->reveal_n, sp = n > 1 ? NP_MIN(32, 228 / (n - 1)) : 0, w = 30, h = 45, x0 = 160 - (w + (n - 1) * sp) / 2;
+ for (int i = 0; i < n; i++) {
+ int c = v->reveal[i], x = x0 + i * sp;
+ card_face(c, x, 70, w + 2, h);
+ if (uno_color(c) != v->reveal_color) dim_card(x, 70, w + 2, h);
+ }
+ p = v->reveal_guilty ? put(b, "It had ") : put(b, "No ");
+ p = put(p, COLOR_NAME[v->reveal_color]);
+ put(p, v->reveal_guilty ? ": a bluff" : ": no bluff");
+ ctext(&np_font_body, 160, 140, b, v->reveal_guilty ? FOCUS : WHITE);
+ p = v->reveal_guilty ? put(b, uno_name(v->reveal_who)) : put(b, "You");
+ put(p, v->reveal_guilty ? " takes 4 cards, and you play" : " take 6 cards");
+ ctext(&np_font_small, 160, 160, b, MUTED);
+}
+
+static void table(const uno_game *g, const uno_ui *v) {
+ table_bg();
+ bool live = v->screen == V_PLAY || v->screen == V_REVEAL;
+ info(g);
+ for (int p = 1; p < g->r.players; p++) opponent(g, p, live);
+ piles(g);
+ if (gfx_y1 > 140 && gfx_y0 < 158) {
+ ctext(&np_font_small, 130, 152, v->msg, WHITE);
+ uno_button(g, v);
+ }
+ if (g->turn == 0 && g->phase < P_HAND_OVER && gfx_y1 > 156) { /* your turn: your side lights up */
+ gfx_fill_alpha(0, 157, SCREEN_W, 69, FOCUS, 30);
+ gfx_fill(0, 156, SCREEN_W, 2, FOCUS);
+ }
+ your_hand(g, v);
+ if (v->screen != V_PLAY) return;
+ if (g->phase == P_COLOR && g->turn == 0) color_picker(v);
+ else if (g->phase == P_PENALTY && g->turn == 0 && g->challengeable) penalty_panel(g, v);
+ else if (g->phase >= P_HAND_OVER && v->show_end) end_panel(g, v);
+}
+
+/* ------------------------------------------------------------------ the other screens */
+int uno_menu_count(const uno_ui *v) { return v->has_game ? 3 : 2; }
+int uno_menu_item(const uno_ui *v, int n) { return v->has_game ? n : n + 1; }
+
+static void title_screen(const uno_ui *v) {
+ background();
+ /* a fan of cards behind the name */
+ static const uint8_t fan[5] = {7, 13 + V_SKIP, 26 + V_REVERSE, 39 + V_DRAW2, C_WILD4};
+ for (int i = 0; i < 5; i++) {
+ int x = 180 + i * 22, y = 26 + (i == 2 ? 0 : i == 1 || i == 3 ? 4 : 10);
+ card_face(fan[i], x, y, 44, 66);
+ }
+ logo(84, 62, 250);
+ int n = uno_menu_count(v);
+ static const char *const items[3] = {"Continue", "New game", "How to play"};
+ for (int i = 0; i < n; i++) button(60, 124 + i * 32, 200, 24, items[uno_menu_item(v, i)], v->sel == i);
+}
+
+static const char *const LEVELS[3] = {"Easy", "Normal", "Hard"};
+static const char *const HOUSE[5] = {"Stack Draw Twos", "Stack Wild Draw Fours", "Draw until you can play",
+ "Must play a drawn card", "UNO said for everyone"};
+
+static void setup_screen(const uno_ui *v) {
+ background();
+ ctext(&np_font_body, 160, 20, "New game", WHITE);
+ const uno_rules *r = &v->setup;
+ char b[32], *p;
+ for (int i = 0; i < 3; i++) {
+ int y = 28 + i * 21;
+ bool f = v->sel == i;
+ gfx_rrect(10, y, 300, 19, 8, f ? FOCUS : HEX(0x1E2940), 256);
+ static const char *const label[3] = {"Players", "Bots", "Game"};
+ gfx_text(&np_font_body, 20, y + 14, label[i], f ? INK : WHITE, 256);
+ if (i == 0) {
+ p = put(b, "You + ");
+ p = num(p, (unsigned)(r->players - 1));
+ put(p, r->players == 2 ? " bot" : " bots");
+ } else if (i == 1) {
+ put(b, LEVELS[r->level]);
+ } else {
+ put(b, r->one_hand ? "One hand" : "To 500 points");
+ }
+ gfx_text_right(&np_font_body, f ? 286 : 298, y + 14, b, f ? INK : WHITE, 256);
+ if (f) text(292, y + 13, ">", INK), text(286 - gfx_text_width(&np_font_body, b) - 10, y + 13, "<", INK);
+ }
+ text(14, 103, "House rules", MUTED);
+ for (int k = 0; k < 5; k++) {
+ int y = 107 + k * 18, row = ROW_HOUSE + k;
+ bool f = v->sel == row, on = r->house >> k & 1;
+ gfx_rrect(10, y, 300, 16, 7, f ? FOCUS : HEX(0x1E2940), 256);
+ gfx_text(&np_font_small, 20, y + 12, HOUSE[k], f ? INK : WHITE, 256);
+ gfx_rrect(262, y + 2, 40, 12, 6, on ? HEX(0x2EA34F) : f ? HEX(0xC9A92C) : HEX(0x37425A), 256);
+ ctext(&np_font_small, 282, y + 12, on ? "On" : "Off", WHITE);
+ }
+ button(90, 199, 140, 22, "Deal", v->sel == ROW_DEAL);
+}
+
+static const char *const HELP_TITLE[UNO_HELP_PAGES] = {"Your turn", "Action cards", "Wild Draw Four", "UNO!", "Scoring"};
+static const char *const HELP[UNO_HELP_PAGES] = {
+ "Match the top card by colour, number or symbol, or play a Wild. Or draw a card, and play it if it goes. "
+ "Play all your cards to win the hand.",
+ "Skip: the next player misses a turn. Reverse: play changes direction (a Skip with two players). Draw Two: "
+ "the next player draws 2 and misses a turn.",
+ "Call a colour; the next player draws 4 and misses a turn. Only allowed with no card of the colour in play. "
+ "Challenge it: a bluffer draws 4, else you draw 6.",
+ "Press shift as you play your next-to-last card. Caught without it before the next player starts: draw 2. "
+ "Shift also catches a bot that forgot.",
+ "The winner scores the cards left in the others' hands: numbers as shown, Skip, Reverse, Draw Two 20, Wilds "
+ "50. First to 500 points wins."};
+
+/* where page `page`'s text ends (its last baseline + a line): for the tests */
+int uno_help_bottom(int page) {
+ int y0 = gfx_y0, y1 = gfx_y1;
+ gfx_y0 = gfx_y1 = -100;
+ int end = gfx_paragraph(&np_font_body, 160, 86, 268, 19, HELP[page], WHITE, 256);
+ gfx_y0 = y0, gfx_y1 = y1;
+ return end;
+}
+
+static void help_screen(const uno_ui *v) {
+ background();
+ panel(12, 10, 296, 208);
+ char b[24], *p = put(b, "How to play ");
+ p = num(p, (unsigned)v->page + 1);
+ p = put(p, "/");
+ num(p, UNO_HELP_PAGES);
+ ctext(&np_font_small, 160, 28, b, MUTED);
+ ctext(&np_font_title, 160, 56, HELP_TITLE[v->page], FOCUS);
+ gfx_paragraph(&np_font_body, 160, 86, 268, 19, HELP[v->page], WHITE, 256);
+ /* a card to look at on each page */
+ static const uint8_t show[UNO_HELP_PAGES][3] = {{3, 16, C_WILD},
+ {V_SKIP, 13 + V_REVERSE, 26 + V_DRAW2},
+ {C_WILD4, C_WILD4, C_WILD4},
+ {39 + 5, 39 + 5, 39 + 5},
+ {9, 26 + V_SKIP, C_WILD}};
+ int n = show[v->page][0] == show[v->page][1] ? 1 : 3;
+ for (int i = 0; i < n; i++) card_face(show[v->page][i], 160 - (n * 40 - 4) / 2 + i * 40, 158, 36, 54);
+}
+
+static void scene(void *ctx) {
+ const void *const *pair = ctx;
+ const uno_game *g = pair[0];
+ const uno_ui *v = pair[1];
+ switch (v->screen) {
+ case V_TITLE: title_screen(v); break;
+ case V_SETUP: setup_screen(v); break;
+ case V_HELP: help_screen(v); break;
+ default: table(g, v); break;
+ }
+ if (v->screen == V_REVEAL) reveal_panel(v);
+ if (v->screen == V_PAUSE) {
+ panel(60, 40, 200, 160);
+ ctext(&np_font_body, 160, 62, "Paused", WHITE);
+ static const char *const items[PAUSE_COUNT] = {"Resume", "New game", "How to play", "Quit game"};
+ for (int i = 0; i < PAUSE_COUNT; i++) button(84, 76 + i * 30, 152, 24, items[i], v->sel == i);
+ } else if (v->screen == V_QUIT) {
+ panel(50, 66, 220, 104);
+ ctext(&np_font_body, 160, 90, "Quit the game?", WHITE);
+ ctext(&np_font_small, 160, 108, "It's saved for next time", MUTED);
+ button(64, 122, 92, 24, "Keep playing", v->sel == 0);
+ button(164, 122, 92, 24, "Quit", v->sel == 1);
+ }
+ if (gfx_y1 > 226) keyline(uno_keys(g, v));
+}
+
+const char *uno_keys(const uno_game *g, const uno_ui *v) {
+ switch (v->screen) {
+ case V_TITLE: return "Up Down|choose|OK|open|Back|quit";
+ case V_SETUP: return v->sel < ROW_HOUSE ? "Up Down|choose|Left Right|change|OK|deal|Back|menu" :
+ v->sel < ROW_DEAL ? "Up Down|choose|OK|on or off|Back|menu" : "Up Down|choose|OK|deal|Back|menu";
+ case V_HELP: return v->first_run ? "Left Right|pages|OK|next|Back|skip" : "Left Right|pages|Back|close";
+ case V_REVEAL: return "OK|go on";
+ case V_PAUSE: return "Up Down|choose|OK|select|Back|resume";
+ case V_QUIT: return "Left Right|choose|OK|select";
+ default: break;
+ }
+ if (g->phase >= P_HAND_OVER) return !v->show_end ? "Back|menu" : g->phase == P_GAME_OVER ? "Left Right|choose|OK|select" : "OK|next hand|Back|menu";
+ bool catchable = g->uno_open != UNO_NONE && g->uno_open != 0;
+ if (g->turn != 0)
+ return catchable ? "Left Right|look|shift|catch!|Back|menu" : g->uno_open == 0 ? "Left Right|look|shift|UNO!|Back|menu" :
+ "Left Right|look at your cards|Back|menu";
+ switch (g->phase) {
+ case P_COLOR: return "Left Right|colour|OK|call it";
+ case P_DRAWN:
+ return g->r.house & H_MUST_PLAY ? "OK|play the new card|shift|UNO|Back|menu" : "OK|play it|Up|keep it|shift|UNO|Back|menu";
+ case P_PENALTY:
+ if (g->challengeable) return "Up Down|choose|OK|select";
+ return "Left Right|pick|OK|stack|Up|take|Back|menu";
+ default:
+ if (catchable) return "Left Right|pick|OK|play|Up|draw|shift|catch!";
+ if (g->count[0] == 2) return "Left Right|pick|OK|play|Up|draw|shift|UNO!";
+ return "Left Right|pick|OK|play|Up|draw|Back|menu";
+ }
+}
+
+void uno_render(const uno_game *g, const uno_ui *v) {
+ const void *pair[2] = {g, v};
+ color_t *old = gfx_buf;
+ gfx_buf = strip;
+ gfx_render(scene, (void *)pair, 0, SCREEN_H);
+ gfx_buf = old;
+}
+
+#ifdef HOST
+/* every kind of card, at the hand's size and the discard pile's: for looking at them */
+static void cards_scene(void *ctx) {
+ (void)ctx;
+ table_bg();
+ static const uint8_t kinds[15] = {0, 14, 28, 42, 4, 18, 32, 46, V_SKIP, 13 + V_REVERSE, 26 + V_DRAW2, C_WILD, C_WILD4, 39 + 6, 9};
+ for (int i = 0; i < 8; i++) card_face(kinds[i], 4 + i * 39, 4, 36, 54);
+ for (int i = 8; i < 15; i++) card_face(kinds[i], 4 + (i - 8) * 39, 62, 36, 54);
+ for (int i = 0; i < 6; i++) card_face(kinds[8 + i], 4 + i * 53, 122, 52, 78);
+ card_back(4 + 6 * 53, 160, 13, 19);
+}
+/* the app's icon, 55 x 56, over a background colour (twice: black and white make its transparency) */
+static color_t icon_bg;
+static void icon_scene(void *ctx) {
+ (void)ctx;
+ gfx_fill(0, gfx_y0, SCREEN_W, gfx_y1 - gfx_y0, icon_bg);
+ gfx_rrect(0, 0, 55, 56, 12, HEX(0x1F6B4A), 256);
+ card_face(13 + 1, 3, 11, 25, 37);
+ card_face(7, 13, 6, 25, 37);
+ card_back(23, 9, 30, 44);
+}
+void uno_render_icon(color_t bg) {
+ color_t *old = gfx_buf;
+ gfx_buf = strip, icon_bg = bg;
+ gfx_render(icon_scene, 0, 0, 64);
+ gfx_buf = old;
+}
+void uno_render_cards(void) {
+ color_t *old = gfx_buf;
+ gfx_buf = strip;
+ gfx_render(cards_scene, 0, 0, SCREEN_H);
+ gfx_buf = old;
+}
+#endif
diff --git a/games/uno/src/draw.h b/games/uno/src/draw.h
new file mode 100644
index 00000000..921c88b5
--- /dev/null
+++ b/games/uno/src/draw.h
@@ -0,0 +1,40 @@
+/* The screens (draw.c), drawn with NumPlay's launcher graphics and fonts, in strips. */
+#ifndef UNO_DRAW_H
+#define UNO_DRAW_H
+#include "game.h"
+
+enum { V_TITLE, V_SETUP, V_HELP, V_PLAY, V_REVEAL, V_PAUSE, V_QUIT };
+enum { MENU_CONTINUE, MENU_NEW, MENU_HELP };
+enum { PAUSE_RESUME, PAUSE_NEW, PAUSE_HELP, PAUSE_QUIT, PAUSE_COUNT };
+enum { ROW_PLAYERS, ROW_LEVEL, ROW_LENGTH, ROW_HOUSE, ROW_DEAL = ROW_HOUSE + 5, SETUP_ROWS };
+enum { PEN_TAKE, PEN_CHALLENGE, PEN_STACK };
+#define UNO_HELP_PAGES 5
+
+typedef struct {
+ uint8_t screen, under; /* under: what a pause or how to play sits on */
+ uint8_t sel; /* the menu's or the panel's choice */
+ uint8_t page; /* how to play */
+ uint8_t first_run; /* how to play before the first game: OK deals */
+ uint8_t pick; /* the card chosen in your hand */
+ uint8_t has_game;
+ uint8_t show_end; /* the hand's end: the scores are up */
+ uno_rules setup;
+ /* a challenge you made: the hand you were shown */
+ uint8_t reveal[UNO_DECK], reveal_n, reveal_who, reveal_color, reveal_guilty;
+ char msg[72];
+ uint32_t clock;
+} uno_ui;
+
+const char *uno_name(int p);
+void uno_card_name(int card, char *out);
+const char *uno_keys(const uno_game *g, const uno_ui *v);
+void uno_render(const uno_game *g, const uno_ui *v);
+int uno_keyline_width(const char *keys); /* (pixels) */
+int uno_text_width(const char *s); /* the small font's */
+int uno_help_bottom(int page);
+/* the menus' items: how many there are, and the n-th */
+int uno_menu_count(const uno_ui *v);
+int uno_menu_item(const uno_ui *v, int n);
+/* the +4 panel's choices: PEN_TAKE, PEN_CHALLENGE and, stacking, PEN_STACK */
+int uno_pen_count(const uno_game *g);
+#endif
diff --git a/games/uno/src/game.c b/games/uno/src/game.c
new file mode 100644
index 00000000..d5eaf4ad
--- /dev/null
+++ b/games/uno/src/game.c
@@ -0,0 +1,417 @@
+/* UNO's rules: see game.h, and the instruction sheet's numbers in the spec kept with the reference. */
+#include <string.h>
+#include "game.h"
+
+static uint32_t next_rand(uint32_t *s) {
+ uint32_t x = *s;
+ x ^= x << 13, x ^= x >> 17, x ^= x << 5;
+ return *s = x ? x : 0x6C8E9CF5u;
+}
+
+int uno_points(int c) {
+ if (c >= 52) return 50;
+ int v = uno_value(c);
+ return v >= 10 ? 20 : v;
+}
+
+int uno_next(const uno_game *g, int p) {
+ int n = g->r.players;
+ return (p + n + g->dir) % n;
+}
+
+static void event(uno_game *g, int e, int who, int card, int n) {
+ g->ev = (uint8_t)e, g->ev_who = (uint8_t)who, g->ev_card = (uint8_t)card, g->ev_n = (uint8_t)n;
+ g->ev_victim = g->ev_by = UNO_NONE;
+}
+
+void uno_fill_deck(uint8_t *d) {
+ int n = 0;
+ for (int c = 0; c < 52; c++) {
+ d[n++] = (uint8_t)c;
+ if (c % 13) d[n++] = (uint8_t)c; /* one 0 of each colour, two of everything else */
+ }
+ for (int i = 0; i < 4; i++) d[n++] = C_WILD, d[n++] = C_WILD4;
+}
+
+static void shuffle(uno_game *g, uint8_t *a, int n) {
+ for (int i = n - 1; i > 0; i--) {
+ int j = (int)(next_rand(&g->rng) % (uint32_t)(i + 1));
+ uint8_t t = a[i];
+ a[i] = a[j], a[j] = t;
+ }
+}
+
+/* one card from the draw pile into p's hand; an empty pile is made again from the discards under the top one */
+static bool take_one(uno_game *g, int p) {
+ if (!g->dn && g->pn > 1) {
+ uint8_t top = g->pile[g->pn - 1];
+ g->dn = (uint8_t)(g->pn - 1);
+ memcpy(g->deck, g->pile, g->dn);
+ g->pile[0] = top, g->pn = 1;
+ shuffle(g, g->deck, g->dn);
+ }
+ if (!g->dn) return false;
+ g->hand[p][g->count[p]++] = g->deck[--g->dn];
+ return true;
+}
+
+static int take(uno_game *g, int p, int n) {
+ int k = 0;
+ while (k < n && take_one(g, p)) k++;
+ if (n > 1) g->lacks[p] = 0; /* new cards: what the table knew of that hand is gone */
+ return k;
+}
+
+/* the player whose turn it is starts doing something: too late to catch whoever forgot UNO */
+static void begin(uno_game *g) { g->uno_open = g->uno_said = UNO_NONE; }
+
+static void hand_over(uno_game *g, int w) {
+ int pts = 0;
+ for (int p = 0; p < g->r.players; p++)
+ if (p != w)
+ for (int i = 0; i < g->count[p]; i++) pts += uno_points(g->hand[p][i]);
+ g->winner = (uint8_t)w, g->gained = (uint16_t)pts;
+ g->score[w] = (uint16_t)(g->score[w] + pts > 60000 ? 60000 : g->score[w] + pts);
+ g->out = g->uno_open = g->uno_said = UNO_NONE;
+ g->pending = 0;
+ g->phase = g->r.one_hand || g->score[w] >= UNO_GOAL ? P_GAME_OVER : P_HAND_OVER;
+}
+
+void uno_deal(uno_game *g) {
+ int n = g->r.players;
+ memset(g->hand, 0, sizeof g->hand);
+ memset(g->count, 0, sizeof g->count);
+ memset(g->lacks, 0, sizeof g->lacks);
+ g->pn = 0, g->dir = 1, g->pending = 0, g->challengeable = g->guilty = 0, g->opening = 0;
+ g->offender = g->drawn = g->uno_open = g->uno_said = g->out = g->winner = UNO_NONE;
+ g->gained = 0;
+ /* seven cards each, one at a time, from the dealer's left */
+ for (int k = 0; k < 7; k++)
+ for (int i = 1; i <= n; i++) take_one(g, (g->dealer + i) % n);
+ /* the first card: a Wild Draw Four goes back into the deck, which is shuffled, and another is turned */
+ for (int tries = 0; g->deck[g->dn - 1] == C_WILD4; tries++) {
+ if (tries < 32) {
+ shuffle(g, g->deck, g->dn);
+ } else {
+ int i = g->dn - 1;
+ while (g->deck[i] == C_WILD4) i--;
+ g->deck[g->dn - 1] = g->deck[i], g->deck[i] = C_WILD4;
+ }
+ }
+ int c = g->deck[--g->dn], left = uno_next(g, g->dealer), v = uno_value(c);
+ g->pile[g->pn++] = (uint8_t)c;
+ g->color = (uint8_t)uno_color(c), g->turn = (uint8_t)left, g->phase = P_PLAY;
+ event(g, E_DEAL, g->dealer, c, 0);
+ if (c == C_WILD) {
+ g->phase = P_COLOR, g->opening = 1; /* the player on the dealer's left calls the colour, then plays */
+ } else if (v == V_SKIP) {
+ g->turn = (uint8_t)uno_next(g, left);
+ } else if (v == V_REVERSE) {
+ if (n > 2) g->dir = -1; /* the dealer starts, and play goes to the right */
+ g->turn = g->dealer;
+ } else if (v == V_DRAW2) {
+ g->ev_n = (uint8_t)take(g, left, 2), g->ev_victim = (uint8_t)left;
+ g->turn = (uint8_t)uno_next(g, left);
+ }
+}
+
+void uno_next_hand(uno_game *g) {
+ if (g->hands) g->dealer = (uint8_t)((g->dealer + 1) % g->r.players); /* the deal passes to the left */
+ g->hands++;
+ uno_fill_deck(g->deck);
+ g->dn = UNO_DECK;
+ shuffle(g, g->deck, UNO_DECK);
+ uno_deal(g);
+}
+
+void uno_new_game(uno_game *g, uno_rules r, uint32_t seed) {
+ memset(g, 0, sizeof *g);
+ g->r.players = (uint8_t)(r.players < 2 ? 2 : r.players > 4 ? 4 : r.players);
+ g->r.level = (uint8_t)(r.level > LEVEL_HARD ? LEVEL_NORMAL : r.level);
+ g->r.one_hand = r.one_hand ? 1 : 0;
+ g->r.house = (uint8_t)(r.house & H_ALL);
+ g->rng = seed ? seed : 1;
+ g->brng = seed * 2654435761u + 0x9E3779B9u;
+ if (!g->brng) g->brng = 1;
+ g->dir = 1;
+ /* the dealer: everyone picks a card, the highest number deals (a symbol counts as zero), the tied pick again */
+ int n = g->r.players, at = 0;
+ uint8_t pool[UNO_DECK];
+ uno_fill_deck(pool);
+ shuffle(g, pool, UNO_DECK);
+ unsigned in = (1u << n) - 1;
+ while ((in & (in - 1)) && at + n <= UNO_DECK) {
+ int best = -1;
+ unsigned tied = 0;
+ for (int p = 0; p < n; p++) {
+ if (!(in >> p & 1)) continue;
+ int v = uno_value(pool[at++]);
+ if (v > 9) v = 0;
+ if (v > best) best = v, tied = 1u << p;
+ else if (v == best) tied |= 1u << p;
+ }
+ in = tied;
+ }
+ for (int p = n - 1; p >= 0; p--)
+ if (in >> p & 1) g->dealer = (uint8_t)p;
+ uno_next_hand(g);
+}
+
+bool uno_matches(const uno_game *g, int c) {
+ int top = g->pile[g->pn - 1];
+ return c >= 52 || uno_color(c) == g->color || (top < 52 && uno_value(c) == uno_value(top));
+}
+
+static bool stacks(const uno_game *g, int c) {
+ if (g->out != UNO_NONE) return false; /* no stacking on a last card: the hand is over */
+ if (g->pending_kind == V_DRAW2) return (g->r.house & H_STACK2) && uno_value(c) == V_DRAW2;
+ return (g->r.house & H_STACK4) && c == C_WILD4;
+}
+
+bool uno_can_play(const uno_game *g, int i) {
+ if (g->phase == P_COLOR || g->phase >= P_HAND_OVER || i < 0 || i >= g->count[g->turn]) return false;
+ int c = g->hand[g->turn][i];
+ if (g->phase == P_PENALTY) return stacks(g, c);
+ if (g->phase == P_DRAWN && i != g->drawn) return false;
+ return uno_matches(g, c);
+}
+
+bool uno_can_stack(const uno_game *g) {
+ if (g->phase != P_PENALTY) return false;
+ for (int i = 0; i < g->count[g->turn]; i++)
+ if (stacks(g, g->hand[g->turn][i])) return true;
+ return false;
+}
+
+bool uno_legal_wild4(const uno_game *g, int p) {
+ for (int i = 0; i < g->count[p]; i++)
+ if (uno_color(g->hand[p][i]) == g->color) return false;
+ return true;
+}
+
+/* a card's effect, once its colour is known (p played it) */
+static void effect(uno_game *g, int p, int c) {
+ int v = uno_value(c);
+ g->phase = P_PLAY;
+ if (c == C_WILD4) {
+ g->pending = (uint8_t)(g->pending + 4), g->pending_kind = C_WILD4, g->offender = (uint8_t)p;
+ g->turn = (uint8_t)uno_next(g, p), g->phase = P_PENALTY;
+ return;
+ }
+ if (v == V_DRAW2) {
+ int victim = uno_next(g, p);
+ if ((g->r.house & H_STACK2) && g->out == UNO_NONE) {
+ g->pending = (uint8_t)(g->pending + 2), g->pending_kind = V_DRAW2, g->offender = (uint8_t)p;
+ g->challengeable = 0, g->turn = (uint8_t)victim, g->phase = P_PENALTY;
+ return;
+ }
+ g->ev_n = (uint8_t)take(g, victim, g->pending + 2), g->ev_victim = (uint8_t)victim;
+ g->pending = 0;
+ g->turn = (uint8_t)uno_next(g, victim);
+ } else if (v == V_SKIP) {
+ g->turn = (uint8_t)uno_next(g, uno_next(g, p));
+ } else if (v == V_REVERSE) {
+ if (g->r.players == 2) {
+ g->turn = (uint8_t)p; /* with two players, a Reverse is a Skip */
+ } else {
+ g->dir = (int8_t)-g->dir;
+ g->turn = (uint8_t)uno_next(g, p);
+ }
+ } else {
+ g->turn = (uint8_t)uno_next(g, p);
+ }
+ if (g->out != UNO_NONE) hand_over(g, g->out);
+}
+
+bool uno_play(uno_game *g, int i, bool say_uno) {
+ if (!uno_can_play(g, i)) return false;
+ int p = g->turn, c = g->hand[p][i];
+ bool stacking = g->phase == P_PENALTY;
+ bool said = say_uno || g->uno_said == p || (g->r.house & H_AUTO_UNO);
+ if (c == C_WILD4) {
+ /* a Wild Draw Four may be played with a card of the colour in play: that's a bluff, which only a challenge
+ finds out */
+ g->guilty = !uno_legal_wild4(g, p);
+ g->prev_color = g->color;
+ g->challengeable = !stacking;
+ }
+ begin(g);
+ memmove(&g->hand[p][i], &g->hand[p][i + 1], (size_t)(g->count[p] - i - 1));
+ g->count[p]--;
+ g->pile[g->pn++] = (uint8_t)c;
+ g->drawn = UNO_NONE;
+ if (c < 52) g->lacks[p] &= (uint8_t)~(1u << uno_color(c));
+ event(g, E_PLAY, p, c, 0);
+ if (g->count[p] == 1) {
+ if (said) g->ev_by = (uint8_t)p; /* (with UNO!) */
+ else g->uno_open = (uint8_t)p;
+ }
+ if (!g->count[p]) g->out = (uint8_t)p;
+ if (c >= 52) {
+ if (c == C_WILD && g->out == p) { /* out on a Wild: no colour to call */
+ hand_over(g, p);
+ return true;
+ }
+ g->phase = P_COLOR, g->opening = 0, g->color = NO_COLOR;
+ return true;
+ }
+ g->color = (uint8_t)uno_color(c);
+ effect(g, p, c);
+ return true;
+}
+
+bool uno_choose(uno_game *g, int color) {
+ if (g->phase != P_COLOR || color < 0 || color > 3) return false;
+ int p = g->turn, c = g->pile[g->pn - 1];
+ g->color = (uint8_t)color;
+ event(g, E_COLOR, p, c, color);
+ if (g->opening) {
+ g->opening = 0, g->phase = P_PLAY;
+ return true;
+ }
+ effect(g, p, c);
+ return true;
+}
+
+bool uno_draw(uno_game *g) {
+ if (g->phase != P_PLAY) return false;
+ int p = g->turn, k = 0;
+ begin(g);
+ g->lacks[p] |= (uint8_t)(1u << g->color);
+ do {
+ if (!take_one(g, p)) break;
+ k++;
+ } while ((g->r.house & H_DRAW_UNTIL) && !uno_matches(g, g->hand[p][g->count[p] - 1]));
+ event(g, E_DRAW, p, 0, k);
+ if (k && uno_matches(g, g->hand[p][g->count[p] - 1])) {
+ g->phase = P_DRAWN, g->drawn = (uint8_t)(g->count[p] - 1);
+ return true;
+ }
+ /* (nothing to draw: every other card is in someone's hand, so someone can play) */
+ g->turn = (uint8_t)uno_next(g, p);
+ return true;
+}
+
+bool uno_keep(uno_game *g) {
+ if (g->phase != P_DRAWN || (g->r.house & H_MUST_PLAY)) return false;
+ int p = g->turn;
+ g->drawn = UNO_NONE, g->phase = P_PLAY, g->turn = (uint8_t)uno_next(g, p);
+ event(g, E_KEEP, p, 0, 0);
+ return true;
+}
+
+bool uno_take(uno_game *g) {
+ if (g->phase != P_PENALTY) return false;
+ int p = g->turn;
+ begin(g);
+ int k = take(g, p, g->pending);
+ event(g, E_TAKE, p, g->pending_kind, k);
+ g->pending = 0, g->challengeable = 0, g->phase = P_PLAY, g->turn = (uint8_t)uno_next(g, p);
+ if (g->out != UNO_NONE) hand_over(g, g->out);
+ return true;
+}
+
+bool uno_challenge(uno_game *g) {
+ if (g->phase != P_PENALTY || !g->challengeable) return false;
+ int p = g->turn, o = g->offender;
+ begin(g);
+ g->phase = P_PLAY, g->challengeable = 0;
+ if (g->guilty) {
+ /* the bluffer draws the 4 instead, and the challenger plays (never someone out: a last card is always allowed) */
+ int k = take(g, o, g->pending);
+ g->pending = 0;
+ event(g, E_CHALLENGE_WON, p, C_WILD4, k);
+ g->ev_victim = (uint8_t)o;
+ } else {
+ /* the challenger draws 4 and 2 more, and loses the turn */
+ int k = take(g, p, g->pending + 2);
+ g->pending = 0;
+ event(g, E_CHALLENGE_LOST, p, C_WILD4, k);
+ g->ev_victim = (uint8_t)p;
+ g->turn = (uint8_t)uno_next(g, p);
+ if (g->out != UNO_NONE) hand_over(g, g->out);
+ }
+ return true;
+}
+
+bool uno_call(uno_game *g, int p) {
+ if (g->phase >= P_HAND_OVER || p < 0 || p >= g->r.players) return false;
+ if (g->uno_open == p) { /* caught yourself before anyone else did: safe */
+ g->uno_open = UNO_NONE;
+ event(g, E_UNO, p, 0, 0);
+ return true;
+ }
+ if (p == g->turn && g->count[p] == 2 && g->uno_said != p &&
+ (g->phase == P_PLAY || g->phase == P_DRAWN || g->phase == P_PENALTY)) {
+ g->uno_said = (uint8_t)p; /* said with the next-to-last card */
+ event(g, E_UNO, p, 0, 0);
+ return true;
+ }
+ return false;
+}
+
+bool uno_catch(uno_game *g, int by) {
+ int o = g->uno_open;
+ if (o == UNO_NONE || by == o || by < 0 || by >= g->r.players || g->phase >= P_HAND_OVER) return false;
+ g->uno_open = UNO_NONE;
+ int k = take(g, o, 2);
+ event(g, E_CAUGHT, o, 0, k);
+ g->ev_by = (uint8_t)by;
+ return true;
+}
+
+bool uno_valid(const uno_game *g) {
+ const uno_rules *r = &g->r;
+ int n = r->players;
+ if (n < 2 || n > 4 || r->level > LEVEL_HARD || r->one_hand > 1 || r->house > H_ALL) return false;
+ if (!g->rng || !g->brng || g->phase > P_GAME_OVER || (g->dir != 1 && g->dir != -1)) return false;
+ if (g->turn >= n || g->dealer >= n || !g->pn || g->pn > UNO_DECK || g->dn > UNO_DECK || g->opening > 1) return false;
+ if (g->color > NO_COLOR || (g->color == NO_COLOR) != (g->phase == P_COLOR)) return false;
+ if (g->challengeable > 1 || g->guilty > 1 || g->prev_color > 3 || g->pending > UNO_DECK) return false;
+ if (g->phase != P_DRAWN && g->drawn != UNO_NONE) return false;
+ const uint8_t who[] = {g->offender, g->uno_open, g->uno_said, g->out};
+ for (unsigned i = 0; i < sizeof who; i++)
+ if (who[i] != UNO_NONE && who[i] >= n) return false;
+ if (g->winner != UNO_NONE && g->winner >= n) return false;
+ for (int p = 0; p < 4; p++)
+ if (g->score[p] > 60000 || (p >= n && (g->count[p] || g->score[p]))) return false;
+ int top = g->pile[g->pn - 1];
+ if (top >= UNO_KINDS) return false;
+ switch (g->phase) {
+ case P_PLAY: if (g->pending || g->out != UNO_NONE) return false; break;
+ case P_DRAWN: if (g->pending || g->out != UNO_NONE || g->drawn >= g->count[g->turn]) return false; break;
+ case P_COLOR: if (top < 52 || (g->opening && g->pn != 1)) return false; break;
+ case P_PENALTY:
+ if (!g->pending || g->pending & 1 || g->offender == UNO_NONE) return false;
+ if (g->pending_kind != C_WILD4 && g->pending_kind != V_DRAW2) return false;
+ if (g->challengeable && (g->pending_kind != C_WILD4 || g->pending != 4)) return false;
+ break;
+ case P_GAME_OVER: if (g->winner == UNO_NONE) return false; break;
+ default: break;
+ }
+ if (g->out != UNO_NONE && (g->count[g->out] || (g->phase != P_COLOR && g->phase != P_PENALTY))) return false;
+ if (g->uno_open != UNO_NONE && g->count[g->uno_open] != 1) return false;
+ /* every card of the deck, once */
+ uint8_t seen[UNO_KINDS] = {0};
+ int total = g->dn + g->pn;
+ for (int i = 0; i < g->dn; i++) {
+ if (g->deck[i] >= UNO_KINDS) return false;
+ seen[g->deck[i]]++;
+ }
+ for (int i = 0; i < g->pn; i++) {
+ if (g->pile[i] >= UNO_KINDS) return false;
+ seen[g->pile[i]]++;
+ }
+ for (int p = 0; p < 4; p++) {
+ if (g->count[p] > UNO_DECK) return false;
+ total += g->count[p];
+ for (int i = 0; i < g->count[p]; i++) {
+ if (g->hand[p][i] >= UNO_KINDS) return false;
+ seen[g->hand[p][i]]++;
+ }
+ }
+ if (total != UNO_DECK) return false;
+ for (int c = 0; c < UNO_KINDS; c++)
+ if (seen[c] != (c >= 52 ? 4 : c % 13 ? 2 : 1)) return false;
+ return true;
+}
diff --git a/games/uno/src/game.h b/games/uno/src/game.h
new file mode 100644
index 00000000..0c207d47
--- /dev/null
+++ b/games/uno/src/game.h
@@ -0,0 +1,109 @@
+/* UNO's rules (game.c) and its bots (bot.c), as Mattel's instruction sheet has them: the 108-card deck, the
+ * action cards, the Wild Draw Four and its challenge, UNO calls and their penalty, and hands scored until
+ * someone has 500 points. No screen, clock or files here: the tests drive it on a computer. */
+#ifndef UNO_GAME_H
+#define UNO_GAME_H
+#include <stdbool.h>
+#include <stdint.h>
+
+#define UNO_DECK 108
+#define UNO_NONE 0xFF
+#define UNO_GOAL 500
+
+/* A card: colour * 13 + value for the 100 coloured ones (0 to 9, then Skip, Reverse, Draw Two), then the Wild
+ * and the Wild Draw Four. */
+enum { V_SKIP = 10, V_REVERSE = 11, V_DRAW2 = 12, C_WILD = 52, C_WILD4 = 53, UNO_KINDS = 54 };
+enum { RED, YELLOW, GREEN, BLUE, NO_COLOR = 4 };
+static inline int uno_color(int c) { return c < 52 ? c / 13 : NO_COLOR; }
+static inline int uno_value(int c) { return c < 52 ? c % 13 : c; }
+
+/* house rules, none of them official: all off by default */
+enum { H_STACK2 = 1, H_STACK4 = 2, H_DRAW_UNTIL = 4, H_MUST_PLAY = 8, H_AUTO_UNO = 16, H_ALL = 31 };
+enum { LEVEL_EASY, LEVEL_NORMAL, LEVEL_HARD };
+
+typedef struct {
+ uint8_t players; /* 2 to 4: you (player 0) and 1 to 3 bots */
+ uint8_t level; /* the bots' */
+ uint8_t one_hand; /* 1: a single hand; 0: hands until someone has 500 points */
+ uint8_t house;
+} uno_rules;
+
+/* what the player whose turn it is has to do */
+enum {
+ P_PLAY, /* play a card or draw one */
+ P_DRAWN, /* play the card just drawn (only that one), or keep it */
+ P_COLOR, /* call the colour of the Wild just played */
+ P_PENALTY, /* a Wild Draw Four (or, stacking, a Draw Two) waits: take it, challenge it, or stack on it */
+ P_HAND_OVER, /* the hand is over and scored */
+ P_GAME_OVER,
+};
+
+/* what happened last, for the screen */
+enum { E_NONE, E_DEAL, E_PLAY, E_DRAW, E_KEEP, E_COLOR, E_TAKE, E_CHALLENGE_WON, E_CHALLENGE_LOST, E_UNO, E_CAUGHT };
+
+typedef struct {
+ uno_rules r;
+ uint8_t hand[4][UNO_DECK];
+ uint8_t count[4];
+ uint8_t deck[UNO_DECK]; /* the draw pile, its top the last */
+ uint8_t pile[UNO_DECK]; /* the discard pile, its top the last */
+ uint8_t dn, pn;
+ uint16_t score[4];
+ uint16_t hands; /* hands dealt in this game */
+ uint32_t rng; /* the shuffles' */
+ uint32_t brng; /* the bots' choices */
+ uint8_t dealer, turn, phase;
+ int8_t dir; /* 1: clockwise, to the left; -1 */
+ uint8_t color; /* the colour to match: the top card's, or the one called for a Wild */
+ uint8_t opening; /* P_COLOR: the first player calls the colour of the first card, then plays */
+ uint8_t pending; /* P_PENALTY: the cards to take */
+ uint8_t pending_kind; /* V_DRAW2 or C_WILD4 */
+ uint8_t offender; /* who played the Wild Draw Four waiting */
+ uint8_t challengeable; /* it can be challenged (not one stacked on another) */
+ uint8_t guilty; /* its player had a card of the colour before it */
+ uint8_t prev_color; /* that colour */
+ uint8_t drawn; /* P_DRAWN: the card's place in the hand */
+ uint8_t uno_open; /* someone down to one card who did not call UNO, until the next player starts */
+ uint8_t uno_said; /* the player whose turn it is called UNO before playing the next-to-last card */
+ uint8_t out; /* who played the last card, while its Draw Two or Wild Draw Four waits */
+ uint8_t winner; /* the hand's, or the game's at P_GAME_OVER */
+ uint8_t spare0;
+ uint16_t gained; /* the points the hand's winner scored */
+ uint8_t lacks[4]; /* colours a player drew on rather than play (what everyone at the table saw) */
+ uint8_t ev, ev_who, ev_card, ev_n, ev_victim, ev_by;
+ uint8_t spare[2];
+} uno_game;
+_Static_assert(sizeof(uno_game) == 708, "uno_game: packed bytes, no padding");
+
+int uno_points(int card);
+int uno_next(const uno_game *g, int p);
+void uno_new_game(uno_game *g, uno_rules r, uint32_t seed);
+void uno_next_hand(uno_game *g);
+void uno_fill_deck(uint8_t *deck); /* the 108 cards, in order */
+void uno_deal(uno_game *g); /* deals from g->deck as it is (uno_next_hand shuffles first) */
+bool uno_matches(const uno_game *g, int card);
+bool uno_can_play(const uno_game *g, int i); /* card i of the hand of the player whose turn it is */
+bool uno_legal_wild4(const uno_game *g, int p); /* p holds no card of the colour in play */
+bool uno_play(uno_game *g, int i, bool say_uno);
+bool uno_choose(uno_game *g, int color);
+bool uno_draw(uno_game *g);
+bool uno_keep(uno_game *g);
+bool uno_take(uno_game *g);
+bool uno_challenge(uno_game *g);
+bool uno_call(uno_game *g, int p);
+bool uno_catch(uno_game *g, int by);
+bool uno_can_stack(const uno_game *g); /* P_PENALTY: the player has a card to stack */
+bool uno_valid(const uno_game *g); /* every card once, every field in range (a save to trust) */
+
+/* the bots (bot.c): what the player whose turn it is does, at a level, from what that player can see */
+enum { M_PLAY, M_DRAW, M_KEEP, M_TAKE, M_CHALLENGE, M_COLOR };
+typedef struct {
+ uint8_t act, arg; /* arg: the card's place (M_PLAY), the colour (M_COLOR) */
+ bool uno; /* say UNO with this card */
+} uno_move;
+uno_move bot_move(uno_game *g, int level);
+bool bot_do(uno_game *g, uno_move m);
+/* whether bot `by` catches the player who forgot UNO, and how long it takes (ms) */
+bool bot_catches(uno_game *g, int by, int level, uint32_t *ms);
+int bot_best_color(const uno_game *g, int p, int level);
+#endif
diff --git a/games/uno/src/icon.png b/games/uno/src/icon.png
index c685d848..c5bb1037 100644
Binary files a/games/uno/src/icon.png and b/games/uno/src/icon.png differ
diff --git a/games/uno/src/main.c b/games/uno/src/main.c
index 3fbf4199..50a5e3f9 100644
--- a/games/uno/src/main.c
+++ b/games/uno/src/main.c
@@ -1,466 +1,409 @@
-/* UNO for NumPlay. Fixed-size state, shared sprites, strip rendering. */
-#include <eadk.h>
+/* UNO on the NumWorks calculator: you against one to three bots, with the official rules and scoring to 500
+ * points (game.c), the bots (bot.c) and the screens (draw.c).
+ *
+ * Keys: Left and Right pick a card, OK plays it, Up draws, shift says UNO (or catches a bot that forgot), Back
+ * pauses; Home saves and quits. */
#include <string.h>
-#include "../../../launcher/src/gfx.h"
-#include "uno.h"
+#include "draw.h"
+#include "game.h"
+#include "plat.h"
#include "save.h"
-#include "assets.h"
-#if NP_MODULE
-#define np_app_begin()
-#define np_app_end() 0
-#else
-#include "../../common/epsilon_app.h"
-#include "../../common/epsilon_files.h"
-#define np_file_read ef_read
-#define np_file_write ef_write
-const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name")))="UNO";
-const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level")))=0;
-void np_push(int x,int y,int w,int h,const color_t*p){eadk_display_push_rect((eadk_rect_t){x,y,w,h},p);}
+
+static uno_progress sv;
+#define G (&sv.g)
+static uno_ui ui;
+static uint32_t now, bot_at, catch_at, end_at, saved_at;
+static uint8_t catcher = UNO_NONE, open_seen = UNO_NONE;
+static bool dirty;
+/* frames drawn, the slowest (ms) and those over 33 ms: read by tools/emu.py */
+#ifndef HOST
+__attribute__((used, externally_visible))
#endif
-#define WHITE 0xffff
-#define INK HEX(0x0B2925)
-#define GOLD HEX(0xFFD75B)
-#define MUTED HEX(0xBED2C7)
-#define SAVE_NAME "uno.sav"
-enum { S_MENU,S_SETTINGS,S_PLAY,S_PAUSE,S_HELP,S_CREDITS,S_REPLACE,S_EXIT,S_SAVE_ERROR,S_EVIDENCE,S_TABLE_INFO };
-static UnoSave sv;
-#define G (&sv.game)
-static color_t strip[SCREEN_W*STRIP_H];
-static int screen,sel,selected,action,color_sel,help_page,return_to,replace_to;
-static int setup_page;
-static uint32_t clock_ms,bot_at,last_action;
-static bool redraw,dirty,reported,exit_after_save;
-static bool attempted_uno;
-static char message[84];
-static uint8_t evidence[108],evidence_count,evidence_color;
-static uint32_t ui_random=1;
-static const char*const WHO[4]={"You","Bot 1","Bot 2","Bot 3"};
-static const char*const COLORS[4]={"Red","Yellow","Green","Blue"};
-static const color_t COLOR[4]={HEX(0xE84D50),HEX(0xEAC643),HEX(0x33B878),HEX(0x4D9DE0)};
-static bool action_available(int i);
-static uint32_t random_ui(void){ui_random^=ui_random<<13;ui_random^=ui_random>>17;return ui_random^=ui_random<<5;}
-static char* number(char*p,unsigned v){char a[10];int n=0;do{a[n++]='0'+v%10;}while((v/=10));while(n)*p++=a[--n];*p=0;return p;}
-static char* text(char*p,const char*s){while(*s)*p++=*s++;*p=0;return p;}
-static void box(int x,int y,int w,int h,color_t c){gfx_rrect(x,y,w,h,7,c,256);}
-static void label(int x,int y,const char*s,color_t c){gfx_text(&np_font_small,x,y,s,c,256);}
-static void center(int x,int y,const char*s,color_t c){gfx_text_center(&np_font_body,x,y,s,c,256);}
-static void title(int x,int y,const char*s){gfx_text_center(&np_font_title,x,y,s,WHITE,256);}
-static void background(void){
- for(int y=gfx_y0;y<gfx_y1;y++){
- int sy=y/10,ny=NP_MIN(23,sy+1),fy=y%10*32/10;color_t row[32];
- for(int x=0;x<32;x++)row[x]=gfx_mix(table_pixels[sy*32+x],table_pixels[ny*32+x],fy);
- color_t*out=gfx_buf+(y-gfx_y0)*320;
- for(int x=0;x<31;x++)for(int i=0;i<10;i++)*out++=gfx_mix(row[x],row[x+1],i*32/10);
- for(int i=0;i<10;i++)*out++=row[31];
- }
-}
-/* Row RLE is decoded only for the current LCD strip. One 44-byte row is
- * enough, even for the enlarged menu cards; transparency is palette 31. */
-static void card(int id,int dx,int dy,int w,int h){
- if(id<0||id>54||dy>=gfx_y1||dy+h<=gfx_y0||dx>=320||dx+w<=0)return;
- const uint8_t*p=card_pixels+card_offsets[id];uint8_t row[CARD_W];
- int first=NP_MAX(dy,gfx_y0),last=NP_MIN(dy+h,gfx_y1),sy=-1;
- for(int y=first;y<last;y++){
- int target=(y-dy)*CARD_H/h;
- while(sy<target){int n=*p++;sy++;if(sy==target){int x=0;for(int i=0;i<n;i++){int t=p[i],run=(t>>5)+1;while(run--)row[x++]=t&31;}}p+=n;}
- for(int x=NP_MAX(0,dx);x<NP_MIN(320,dx+w);x++){
- int v=row[(x-dx)*CARD_W/w];if(v!=31)gfx_buf[(y-gfx_y0)*320+x]=card_palette[v];
- }
- }
+uint32_t perf_frames, perf_max, perf_slow;
+
+static const char *const COLOR_NAME[4] = {"Red", "Yellow", "Green", "Blue"};
+
+static char *cat(char *p, const char *s) {
+ while (*s) *p++ = *s++;
+ *p = 0;
+ return p;
}
-static void button(int x,int y,int w,const char*s,bool focus){
- box(x,y,w,26,focus?GOLD:INK);gfx_text_center(&np_font_body,x+w/2,y+18,s,focus?INK:WHITE,256);
+static char *num(char *p, unsigned v) {
+ char t[8];
+ int n = 0;
+ do t[n++] = (char)('0' + v % 10); while ((v /= 10) && n < 8);
+ while (n) *p++ = t[--n];
+ *p = 0;
+ return p;
}
-static void name_card(int c,char*s){
- char*p=s;if(c<52){p=text(p,COLORS[c/13]);p=text(p," ");}
- int v=uno_value(c);
- if(v<10)number(p,v);else text(p,v==UNO_SKIP?"Skip":v==UNO_REVERSE?"Reverse":v==UNO_DRAW2?"+2":c==UNO_WILD?"Wild":"Wild +4");
+/* "Bot 1 draws" / "You draw" (mid: "you draw") */
+static char *verb_as(char *p, int who, const char *one, const char *you, bool mid) {
+ p = cat(p, who || !mid ? uno_name(who) : "you");
+ *p++ = ' ';
+ return cat(p, who ? one : you);
}
-static void set_message(const char*s){text(message,s);}
-static bool save(void){
- uint8_t b[UNO_SAVE_BYTES];save_encode(&sv,b);bool ok=np_file_write(SAVE_NAME,b,sizeof b);if(ok)dirty=false;return ok;
+static char *verb(char *p, int who, const char *one, const char *you) { return verb_as(p, who, one, you, false); }
+static char *verb_mid(char *p, int who, const char *one, const char *you) { return verb_as(p, who, one, you, true); }
+
+static void save(void) {
+ sv.setup = ui.setup, sv.has_game = ui.has_game;
+ save_write(&sv);
+ saved_at = now;
}
-static void notice(void){
- Uno*g=G;char*p=message;int e=g->event;
- if(e==E_PLAY)attempted_uno=false;
- if(e==E_START){text(p,"Seven cards. Match a color or symbol.");}
- else if(e==E_STALEMATE)text(p,"No cards can move. Redeal this round.");
- else{
- p=text(p,WHO[g->actor%4]);
- if(e==E_PLAY){p=text(p," played ");name_card(g->card,p);}
- else if(e==E_COLOR){p=text(p," chose ");text(p,COLORS[g->color&3]);}
- else if(e==E_DRAW||e==E_PENALTY){p=text(p," drew ");p=number(p,g->amount);text(p,g->amount==1?" card":" cards");}
- else if(e==E_PASS)text(p," kept the card");
- else if(e==E_UNO)text(p,g->count[g->actor]==2?": UNO call ready":" called UNO!");
- else if(e==E_CAUGHT)text(p," forgot UNO: draw 2");
- else if(e==E_CHALLENGE_WON)text(p,": challenge won! Offender draws 4");
- else if(e==E_CHALLENGE_LOST)text(p,": challenge lost! Draw 6");
- else text(p," won the game!");
- }
- dirty=redraw=true;last_action=clock_ms;bot_at=clock_ms+1300;
- if(g->uno_player==0)bot_at=clock_ms+2200;
- selected=NP_CLAMP(selected,0,(int)g->count[0]-1);if(selected<0)selected=0;
- if(g->turn==0&&g->phase==U_DRAWN){selected=g->drawn;action=-1;}
- if(action>=0&&!action_available(action))action=-1;
- if(g->phase>=U_ROUND&&!reported){
- reported=true;sel=0;if(g->phase==U_MATCH){if(sv.played<65535)sv.played++;if(g->winner==0&&sv.wins<65535)sv.wins++;}
+
+/* the message line, from what just happened */
+static void describe(void) {
+ uno_game *g = G;
+ char *p = ui.msg, card[24];
+ int who = g->ev_who;
+ switch (g->ev) {
+ case E_DEAL:
+ p = verb(p, g->dealer, "deals: ", "deal: ");
+ uno_card_name(g->ev_card, card);
+ p = cat(p, card);
+ if (g->ev_victim != UNO_NONE) p = cat(p, ", "), p = verb_mid(p, g->ev_victim, "draws 2", "draw 2");
+ break;
+ case E_PLAY:
+ uno_card_name(g->ev_card, card);
+ p = verb(p, who, "played ", "played ");
+ p = cat(p, card);
+ if (g->ev_victim != UNO_NONE) {
+ p = cat(p, ": ");
+ p = verb_mid(p, g->ev_victim, "draws ", "draw ");
+ p = num(p, g->ev_n);
+ }
+ if (g->ev_by == who) p = cat(p, ", UNO!");
+ break;
+ case E_COLOR: p = verb(p, who, "called ", "called "), p = cat(p, COLOR_NAME[g->ev_n & 3]); break;
+ case E_DRAW:
+ if (!g->ev_n) p = verb(p, who, "had nothing to draw", "had nothing to draw");
+ else if (g->ev_n == 1) p = verb(p, who, "drew a card", "drew a card");
+ else p = verb(p, who, "drew ", "drew "), p = num(p, g->ev_n), p = cat(p, " cards");
+ break;
+ case E_KEEP: p = verb(p, who, "kept it", "kept it"); break;
+ case E_TAKE: p = verb(p, who, "took ", "took "), p = num(p, g->ev_n), p = cat(p, " cards"); break;
+ case E_CHALLENGE_WON:
+ p = verb(p, who, "challenged: ", "challenged: ");
+ p = verb_mid(p, g->ev_victim, "bluffed, draws 4", "bluffed, draw 4");
+ break;
+ case E_CHALLENGE_LOST: p = verb(p, who, "challenged and took ", "challenged and took "), p = num(p, g->ev_n); break;
+ case E_UNO: p = cat(p, uno_name(who)), p = cat(p, ": UNO!"); break;
+ case E_CAUGHT:
+ p = verb(p, g->ev_by, "caught ", "caught ");
+ p = cat(p, who ? uno_name(who) : "you");
+ p = cat(p, ": 2 cards");
+ break;
+ default: break;
}
+ *p = 0;
}
-static void start_game(UnoRules rules){
- uno_new(G,rules,random_ui());sv.active=1;reported=false;attempted_uno=false;screen=S_PLAY;selected=0;action=-1;color_sel=0;notice();
-}
-static void new_game(void){start_game(sv.prefs);}
-static void next_round(void){uno_next_round(G);reported=false;selected=0;action=-1;color_sel=0;notice();}
-static void panel(const char*heading){gfx_fill_alpha(0,0,320,240,0,140);box(15,18,290,204,INK);title(160,48,heading);}
-static const char*const HELP_TITLE[7]={"Your turn","Action cards","Wild +4 challenge","Call UNO!","Winning","House rules","Controls"};
-static const char*const HELP[7]={
- "Match the top card's color, number or symbol. Wilds choose a color. You may draw instead of playing. After drawing, only that new card can be played; you may also keep it. Seven cards each.",
- "+2: the next player draws two and loses a turn. Skip: skip the next player. Reverse: change direction. With two players, Reverse acts like Skip. Official rules never stack penalties.",
- "A +4 is legal only if you have no card of the active color. You may bluff. Its target may challenge: a guilty offender draws 4; an innocent offender makes the challenger draw 6. The hand is revealed on a challenge.",
- "Press 0 to call UNO before playing your next-to-last card, or right after. Forget it and another player can catch you for two cards, until the next player draws or plays. Press 0 to catch a bot that forgot.",
- "The first player with no cards left wins the game. A final +2 or +4 is still resolved, including a possible +4 challenge. After the result, choose Play again for another game with the same table rules, or return to the menu.",
- "Options are separate from classic rules. Stack only +2 on +2, or +4 on +4. Stacked +4 has no challenge. No stacking after a last card. You may also enable drawing until playable, forced play, or automatic UNO.",
- "Left / Right: select a card. OK / EXE: play. Up: action buttons; Down: hand. 1: draw or accept penalty. 2: keep drawn card. 0: call UNO or catch. Back: pause. Home / Power: save and quit."
-};
-static const char*const VARIANT[5]={"Stack +2","Stack +4","Draw until playable","Force drawn play","Automatic UNO"};
-static const char*const VARIANT_HELP[6]={"Restore classic card rules; all variants off.",
- "Pass accumulated +2 cards to the next player.","Pass +4 cards on. Challenges are disabled.",
- "Keep drawing until a playable card appears.","A playable drawn card must be played.","Call UNO automatically for every player."};
-static bool custom_rules(const UnoRules*r){return r->flags!=0;}
-static void setting_value(int row,char*s){
- const UnoRules*r=&sv.prefs;
- if(row==0){number(s,r->players);text(s+1," players");}
- else text(s,(const char*const[]){"Casual","Normal","Clever"}[r->difficulty]);
-}
-static void settings_change(int dx){
- UnoRules*r=&sv.prefs;
- if(setup_page==0){
- if(sel==0)r->players=2+(r->players-2+dx+3)%3;
- else if(sel==1)r->difficulty=(r->difficulty+dx+3)%3;
- }else if(setup_page==1){
- if(sel==0)r->flags=0;
- else if(sel<=5)r->flags^=1u<<(sel-1);
+
+/* someone just forgot UNO: the bots that will catch them, and when */
+static void plan_catch(void) {
+ uno_game *g = G;
+ open_seen = g->uno_open, catcher = UNO_NONE;
+ if (open_seen == UNO_NONE) return;
+ uint32_t best = 0xFFFFFFFFu;
+ for (int b = 1; b < g->r.players; b++) {
+ uint32_t ms;
+ if (b != open_seen && bot_catches(g, b, g->r.level, &ms) && ms < best) best = ms, catcher = (uint8_t)b;
}
- dirty=true;
+ if (catcher != UNO_NONE) catch_at = now + best;
+ /* time for the forgetful to catch themselves, or for you to catch a bot, before the next player starts */
+ if ((int32_t)(bot_at - (now + 1800)) < 0) bot_at = now + 1800;
}
-static void setup_seats(int y){
- for(int p=0;p<4;p++){
- int x=12+p*76;bool active=p<sv.prefs.players;
- box(x,y,68,55,INK);
- if(active)gfx_rrect_outline(x,y,68,55,7,1,p?MUTED:GOLD,256);
- if(active&&p){card(54,x+24,y+5,16,23);card(54,x+29,y+7,16,23);}
- else if(active){gfx_circle(x+34,y+13,6,GOLD,256);gfx_rrect(x+23,y+20,22,10,5,GOLD,256);}
- else gfx_rrect_outline(x+25,y+8,18,24,4,1,MUTED,100);
- gfx_text_center(&np_font_small,x+34,y+45,active?WHO[p]:"Empty",active?WHITE:MUTED,active?256:150);
+
+static void after(uint32_t wait) {
+ uno_game *g = G;
+ bot_at = now + wait;
+ if (g->uno_open != open_seen) plan_catch();
+ if (g->phase >= P_HAND_OVER) {
+ end_at = now + 1500, ui.show_end = 0, ui.sel = 0;
+ if (g->phase == P_GAME_OVER) ui.has_game = 0;
+ save();
}
+ if (g->turn == 0 && g->phase == P_DRAWN) ui.pick = g->drawn;
+ if (g->count[0] && ui.pick >= g->count[0]) ui.pick = (uint8_t)(g->count[0] - 1);
+ if (!g->count[0]) ui.pick = 0;
+ dirty = true;
}
-static void toggle(int x,int y,bool on,bool focus){
- box(x,y,43,16,on?GOLD:HEX(0x37544B));
- gfx_circle(x+(on?34:9),y+8,5,on?INK:MUTED,256);
- label(x+(on?5:17),y+12,on?"ON":"OFF",on?INK:WHITE);
- if(focus)gfx_rrect_outline(x-2,y-2,47,20,8,1,WHITE,256);
+
+static void start(void) {
+ uno_new_game(G, ui.setup, plat_random() ^ now ^ 0x5EED);
+ ui.has_game = 1, ui.pick = 0, ui.show_end = 0, ui.screen = V_PLAY;
+ open_seen = catcher = UNO_NONE;
+ describe();
+ after(1200);
+ save();
}
-static void setup_scene(void){
- char s[90];title(160,23,"Create table");
- const char*const steps[3]={"1 Players","2 Rules","3 Ready"};
- for(int i=0;i<3;i++){
- box(12+i*102,30,92,20,i==setup_page?GOLD:INK);
- gfx_text_center(&np_font_small,58+i*102,44,steps[i],i==setup_page?INK:MUTED,256);
- }
- if(setup_page==0){
- setup_seats(57);
- for(int i=0;i<2;i++){
- int y=116+i*28;bool focus=sel==i;color_t c=focus?INK:WHITE;
- box(12,y,296,23,focus?GOLD:INK);label(22,y+16,i?"Bot level":"Players",c);
- if(i==0){
- for(int n=2;n<=4;n++){
- int x=178+(n-2)*37;bool chosen=n==sv.prefs.players;
- box(x,y+2,30,19,chosen?INK:focus?GOLD:HEX(0x37544B));number(s,n);
- gfx_text_center(&np_font_small,x+15,y+16,s,chosen?GOLD:c,256);
- }
- }else{setting_value(i,s);gfx_text_right(&np_font_small,285,y+16,s,c,256);label(293,y+16,">",c);}
- }
- box(12,175,296,20,INK);gfx_text_center(&np_font_small,160,189,"First empty hand wins",WHITE,256);
- button(12,201,296,"Next: rules >",sel==2);
- }else if(setup_page==1){
- box(12,57,296,25,sel==0?GOLD:INK);
- label(22,74,custom_rules(&sv.prefs)?"Custom rules":"Classic rules",sel==0?INK:WHITE);
- gfx_text_right(&np_font_small,296,74,"OK: restore classic",sel==0?INK:MUTED,256);
- for(int i=0;i<5;i++){
- int y=85+i*20;box(12,y,296,20,INK);
- if(sel==i+1)gfx_rrect_outline(12,y,296,20,7,1,GOLD,256);
- label(23,y+14,VARIANT[i],WHITE);toggle(253,y+2,sv.prefs.flags&(1u<<i),sel==i+1);
- }
- gfx_text_center(&np_font_small,160,196,sel<6?VARIANT_HELP[sel]:"Review your table before dealing the cards.",MUTED,256);
- button(12,201,296,"Next: review table >",sel==6);
- }else{
- setup_seats(57);
- char*p=number(s,sv.prefs.players-1);p=text(p,sv.prefs.players==2?" bot / ":" bots / ");setting_value(1,p);
- gfx_text_center(&np_font_small,160,128,s,WHITE,256);
- gfx_text_center(&np_font_body,160,151,custom_rules(&sv.prefs)?"Custom table":"Classic UNO",GOLD,256);
- const char*const short_rule[5]={"+2 stacking","+4 stacking","Draw until match","Forced draw play","Auto UNO"};
- for(int i=0;i<5;i++){
- int x=12+(i%2)*152,y=158+(i/2)*15;bool on=sv.prefs.flags&(1u<<i);
- gfx_circle(x+5,y+6,3,on?GOLD:HEX(0x537366),256);label(x+13,y+10,short_rule[i],on?WHITE:MUTED);
- label(x+123,y+10,on?"On":"Off",on?GOLD:MUTED);
- }
- button(12,201,296,"Deal cards",true);
+
+/* Deal: how to play first, the first time */
+static void deal(void) {
+ if (!sv.guide) {
+ sv.guide = 1;
+ ui.first_run = 1, ui.page = 0, ui.under = V_SETUP, ui.screen = V_HELP;
+ return;
}
- gfx_text_center(&np_font_small,160,238,setup_page==2?"OK: start Back: edit rules":"Up / Down: select OK: confirm Back: return",MUTED,256);
-}
-static void bot_badge(int p,int x,int y,int w){
- bool current=G->turn==p&&G->phase<U_ROUND;
- box(x,y,w,39,INK);if(current)gfx_rrect_outline(x,y,w,39,7,2,GOLD,256);
- label(x+6,y+13,WHO[p],current?GOLD:WHITE);card(54,x+6,y+18,10,15);
- char s[24];char*z=number(s,G->count[p]);text(z," cards");label(x+21,y+30,s,WHITE);
- if(G->count[p]==1)label(x+w-28,y+13,"UNO",G->uno_player==p?GOLD:MUTED);
+ start();
}
-static bool draw_available(void){return !G->turn&&(G->phase==U_TURN||(G->phase==U_DRAWN&&!(G->rules.flags&R_FORCE)));}
-static bool uno_available(void){return G->phase<U_ROUND&&(G->uno_player!=UNO_NONE||(!G->turn&&G->count[0]==2&&(G->phase==U_TURN||G->phase==U_DRAWN)));}
-static bool action_available(int i){return i==2||(i==0?draw_available():uno_available());}
-static void hand_card(int i,int x,bool focus){
- int c=G->hands[0][i],y=focus?160:172,w=focus?44:38,h=focus?64:55;
- if(focus)gfx_rrect_outline(x-2,y-2,w+4,h+4,7,2,G->turn?WHITE:GOLD,256);
- card(c,x,y,w,h);
- char s[8];int v=uno_value(c);if(v<10)number(s,v);else text(s,v==10?"S":v==11?"R":v==12?"+2":c==52?"W":"+4");
- box(x+2,y+2,23,15,c<52?COLOR[c/13]:INK);label(x+5,y+13,s,c<52&&c/13==1?INK:WHITE);
- if(G->turn==0&&uno_can_play(G,i))gfx_circle(x+8,y+h-7,3,GOLD,256);
+
+static void bot_step(void) {
+ uno_game *g = G;
+ int p = g->turn;
+ uno_move m = bot_move(g, g->r.level);
+ bot_do(g, m);
+ describe();
+ if (g->phase == P_COLOR && g->turn == p) { /* its Wild: the colour at once */
+ bool said = g->ev_by == p;
+ bot_do(g, bot_move(g, g->r.level));
+ char card[24], *q = ui.msg;
+ uno_card_name(g->pile[g->pn - 1], card);
+ q = cat(q, uno_name(p)), q = cat(q, " played "), q = cat(q, card), q = cat(q, ": ");
+ q = cat(q, COLOR_NAME[g->color & 3]);
+ if (said) cat(q, ", UNO!");
+ }
+ after(m.act == M_DRAW && g->phase == P_DRAWN ? 700 : 1000);
}
-static void hand(void){
- Uno*g=G;int n=g->count[0],visible=NP_MIN(n,8),first=NP_CLAMP(selected-3,0,n-visible);
- int spacing=visible>1?NP_MIN(38,260/(visible-1)):0,w=visible?44+(visible-1)*spacing:0,x0=(320-w)/2;
- gfx_fill_alpha(0,158,320,70,INK,110);
- for(int j=0;j<visible;j++)if(first+j!=selected)hand_card(first+j,x0+j*spacing+(first+j>selected?6:0),false);
- if(n)hand_card(selected,x0+(selected-first)*spacing,true);
- if(first)label(3,204,"<",GOLD);if(first+visible<n)label(309,204,">",GOLD);
- char s[60];gfx_fill(0,228,320,12,INK);
- if(n)name_card(g->hands[0][selected],s);else text(s,"No cards left");label(6,238,s,WHITE);
- char*p=number(s,n?selected+1:0);p=text(p,"/");number(p,n);gfx_text_center(&np_font_small,160,238,s,MUTED,256);
- const char*hint=g->turn?"Wait for your turn":n&&uno_can_play(g,selected)?"OK: play":"Not playable";
- if(!g->turn&&g->phase==U_DRAWN&&!uno_can_play(g,selected))hint="New card only";
- if(action>=0)hint="Down: your hand";
- gfx_text_right(&np_font_small,314,238,hint,!g->turn&&n&&uno_can_play(g,selected)?GOLD:MUTED,256);
+
+static void shift_key(void) {
+ uno_game *g = G;
+ if (g->uno_open != UNO_NONE && g->uno_open != 0) {
+ if (uno_catch(g, 0)) describe(), after(1000);
+ } else if (uno_call(g, 0)) {
+ describe();
+ after(g->turn == 0 ? 0 : 1000);
+ } else {
+ strcpy(ui.msg, "UNO is for your next-to-last card");
+ dirty = true;
+ }
}
-static void table_action(int x,int w,const char*s,int id,bool enabled){
- bool focus=action==id;box(x,136,w,21,focus?GOLD:INK);
- gfx_text_center(&np_font_small,x+w/2,151,s,focus?INK:enabled?WHITE:MUTED,256);
+
+static void human_play(int i) {
+ uno_game *g = G;
+ if (!uno_play(g, i, false)) {
+ strcpy(ui.msg, g->phase == P_DRAWN ? "Only the new card can be played" : "That card doesn't go");
+ dirty = true;
+ return;
+ }
+ describe();
+ if (g->phase == P_COLOR) ui.sel = (uint8_t)bot_best_color(g, 0, LEVEL_NORMAL);
+ after(1000);
}
-static void table(void){
- Uno*g=G;char s[60];bool human=g->turn==0&&g->phase<U_ROUND;
- bool alert=g->uno_player!=UNO_NONE&&g->phase<U_ROUND;
- gfx_fill(0,0,320,20,human||alert?GOLD:INK);color_t bar=human||alert?INK:WHITE;
- label(7,14,custom_rules(&g->rules)?"Custom":"Classic",bar);char*p;
- p=text(s,g->phase>=U_ROUND?(g->phase==U_MATCH?"GAME OVER":"REDEAL"):human?"YOUR TURN":WHO[g->turn]);
- if(!human&&g->phase<U_ROUND)text(p,"'s turn");
- if(alert)text(s,g->uno_player==0?"0: CALL UNO!":"0: CATCH UNO!");
- gfx_text_center(&np_font_body,153,15,s,bar,256);
- p=number(s,g->rules.players);text(p," players");
- gfx_text_right(&np_font_small,313,14,s,bar,256);
- if(g->rules.players==2)bot_badge(1,119,22,82);
- else if(g->rules.players==3){bot_badge(1,5,77,65);bot_badge(2,250,77,65);}
- else{bot_badge(1,5,77,65);bot_badge(2,119,22,82);bot_badge(3,250,77,65);}
- if(g->rules.players==3){gfx_text_center(&np_font_small,160,39,custom_rules(&g->rules)?"Custom table":"Classic table",MUTED,256);}
- gfx_text_center(&np_font_small,99,70,"DRAW",MUTED,256);gfx_text_center(&np_font_small,172,70,"DISCARD",MUTED,256);
- card(54,80,75,38,55);card(g->discard[g->xn-1],151,72,42,61);
- box(85,111,28,15,INK);number(s,g->dn);gfx_text_center(&np_font_small,99,123,s,WHITE,256);
- gfx_text_center(&np_font_small,222,69,"COLOR",MUTED,256);
- if(g->color<4){box(201,74,42,36,COLOR[g->color]);gfx_text_center(&np_font_small,222,96,COLORS[g->color],g->color==1?INK:WHITE,256);}
- gfx_text_center(&np_font_small,222,128,g->rules.players==2?"2 players":g->direction==1?"Clockwise":"Counter-CW",MUTED,256);
- hand();
- box(5,136,64,21,human?GOLD:INK);p=text(s,"YOU ");number(p,g->count[0]);gfx_text_center(&np_font_small,37,151,s,human?INK:MUTED,256);
- if(g->phase==U_DRAWN)text(s,g->rules.flags&R_FORCE?"Must play":"2 Keep");
- else if(g->pending){p=text(s,"1 Draw +");number(p,g->pending);}else text(s,"1 Draw");
- table_action(74,72,s,0,draw_available());
- table_action(151,72,g->uno_player!=UNO_NONE&&g->uno_player!=0?"0 Catch!":g->uno_armed==0?"UNO ready":"0 UNO!",1,uno_available());
- table_action(228,87,"Back: pause",2,true);
- if(screen==S_PLAY&&human&&g->phase==U_COLOR){
- panel("Choose a color");
- for(int i=0;i<4;i++){int x=34+i*66;box(x,84,54,58,COLOR[i]);if(i==color_sel)gfx_rrect_outline(x-3,81,60,64,9,3,WHITE,256);gfx_text_center(&np_font_small,x+27,119,COLORS[i],i==1?INK:WHITE,256);}
- center(160,180,"Left / Right, then OK",MUTED);
- }else if(screen==S_PLAY&&human&&g->phase==U_CHALLENGE){
- panel("Wild +4");gfx_paragraph(&np_font_small,160,73,255,16,"Did the offender have a card of the previous color? Challenge to reveal their hand.",WHITE,256);
- button(36,127,248,"Accept: draw 4",sel==0);button(36,159,248,"Challenge: risk drawing 6",sel==1);
- gfx_text_center(&np_font_small,160,205,"Previous color",MUTED,256);gfx_circle(246,201,6,COLOR[g->old_color&3],256);
- }else if(screen==S_PLAY&&g->phase>=U_ROUND){
- if(g->winner==UNO_NONE){
- panel("Table blocked");center(160,106,"Nobody can play or draw.",WHITE);
- button(36,171,248,"Redeal cards",true);
- }else{
- p=text(s,g->winner?WHO[g->winner]:"You");text(p,g->winner?" wins!":" win!");panel(s);
- card(g->discard[g->xn-1],138,61,44,64);
- gfx_text_center(&np_font_small,160,146,"First empty hand. Game won!",GOLD,256);
- button(36,160,248,"Play again",sel==0);button(36,190,248,"Back to menu",sel==1);
+
+static void play_keys(uint32_t hit) {
+ uno_game *g = G;
+ if (hit & K_BACK) {
+ ui.screen = V_PAUSE, ui.sel = PAUSE_RESUME;
+ save();
+ return;
+ }
+ if (g->phase >= P_HAND_OVER) {
+ if (!ui.show_end) return;
+ if (g->phase == P_GAME_OVER) {
+ if (hit & (K_LEFT | K_RIGHT | K_UP | K_DOWN)) ui.sel ^= 1;
+ if (hit & K_OK) {
+ if (ui.sel == 0) start();
+ else ui.screen = V_TITLE, ui.sel = 0, save();
+ }
+ } else if (hit & K_OK) {
+ uno_next_hand(g);
+ ui.pick = 0, ui.show_end = 0;
+ describe();
+ after(1200);
}
+ return;
}
-}
-static void scene(void*unused){
- (void)unused;background();char s[90];
- if(screen==S_MENU||screen==S_SETTINGS||screen==S_REPLACE||screen==S_EXIT||screen==S_SAVE_ERROR){
- if(screen==S_MENU||screen==S_EXIT||screen==S_SAVE_ERROR){
- gfx_text(&np_font_title,24,53,"UNO",WHITE,256);label(26,75,"The classic card game",MUTED);
- card(0,239,53,47,68);card(53,222,44,47,68);card(54,206,36,47,68);
- static const char*const items[4]={"Continue","New game","How to play","Credits"};
- for(int i=0;i<4;i++)button(23,91+i*31,274,i==0&&!sv.active?"Continue - no saved match":items[i],sel==i);
- label(24,233,"By Bobydeluxe",MUTED);gfx_text_right(&np_font_small,297,233,"Back: exit",MUTED,256);
- }else setup_scene();
- }else if(screen==S_HELP||screen==S_CREDITS){
- title(160,34,screen==S_HELP?HELP_TITLE[help_page]:"Credits");
- box(14,48,292,161,INK);
- gfx_paragraph(&np_font_body,160,72,266,20,screen==S_HELP?HELP[help_page]:"Game made by Bobydeluxe.\nCard and table art by AlexDer.\nUNO is a Mattel game.\nUnofficial fan adaptation.",WHITE,256);
- if(screen==S_HELP){char*p=number(s,help_page+1);p=text(p," / 7 Left / Right Back");(void)p;}else text(s,"Back: return");
- gfx_text_center(&np_font_small,160,232,s,MUTED,256);
- }else if(sv.active)table();
- if(screen==S_PAUSE){
- panel("Paused");static const char*const items[4]={"Resume","Table rules","Save to menu","Save and exit"};
- for(int i=0;i<4;i++)button(36,62+i*33,248,items[i],sel==i);
- }else if(screen==S_REPLACE){
- panel("Replace this game?");gfx_paragraph(&np_font_body,160,83,254,21,"Starting a new game replaces your current game.",WHITE,256);
- button(36,132,248,"Keep current game",sel==0);button(36,166,248,"Start new game",sel==1);
- }else if(screen==S_EXIT){
- panel("Save and exit?");button(36,90,248,"Stay",sel==0);button(36,127,248,"Save and exit",sel==1);
- }else if(screen==S_SAVE_ERROR){
- panel("Save failed");gfx_paragraph(&np_font_small,160,76,256,17,"Calculator storage is full or unavailable. Your existing files were kept.",WHITE,256);
- button(36,119,248,"Retry saving",sel==0);button(36,153,248,exit_after_save?"Exit without saving":"Return without saving",sel==1);
- }else if(screen==S_TABLE_INFO){
- panel("Table rules");
- for(int i=0;i<5;i++){int y=66+i*24;label(30,y+13,VARIANT[i],WHITE);toggle(245,y,G->rules.flags&(1u<<i),false);}
- gfx_text_center(&np_font_small,160,195,"First empty hand wins",GOLD,256);
- gfx_text_center(&np_font_small,160,206,"OK: read rules Back: pause",WHITE,256);
- }else if(screen==S_EVIDENCE){
- panel("Challenge evidence");char*p=text(s,"Cards: ");number(p,evidence_count);label(30,73,s,WHITE);
- label(174,73,"Color:",MUTED);gfx_circle(216,69,6,COLOR[evidence_color&3],256);label(230,73,COLORS[evidence_color&3],WHITE);
- int first=NP_CLAMP(selected-2,0,NP_MAX(0,evidence_count-5));
- for(int j=0;j<5&&first+j<evidence_count;j++)card(evidence[first+j],30+j*53,85,44,64);
- if(evidence_count){name_card(evidence[selected],s);gfx_text_center(&np_font_small,160,168,s,WHITE,256);}
- gfx_text_center(&np_font_small,160,190,G->event==E_CHALLENGE_WON?"Illegal +4: offender draws 4":"Legal +4: challenger draws 6",GOLD,256);
- gfx_text_center(&np_font_small,160,211,"Left / Right: cards OK: continue",MUTED,256);
+ if (hit & K_SHIFT) shift_key();
+ int n = g->count[0];
+ bool mine = g->turn == 0;
+ if (mine && g->phase == P_COLOR) {
+ if (hit & (K_LEFT | K_UP)) ui.sel = (uint8_t)((ui.sel + 3) % 4);
+ if (hit & (K_RIGHT | K_DOWN)) ui.sel = (uint8_t)((ui.sel + 1) % 4);
+ if ((hit & K_OK) && uno_choose(g, ui.sel)) describe(), after(1000);
+ return;
}
-}
-static bool key(uint64_t k,int id){return (k>>id)&1;}
-static void uno_action(void){
- if(G->uno_player!=UNO_NONE&&G->uno_player!=0){if(uno_catch(G,0))notice();}
- else if(uno_call(G,0))notice();
- else{set_message("Call UNO when you have two cards.");redraw=true;}
-}
-static void draw_action(void){
- if(G->turn)return;
- if(G->phase==U_DRAWN){if(uno_keep(G))notice();}
- else if(G->phase==U_TURN||G->phase==U_CHALLENGE){if(G->pending?uno_accept(G):uno_draw(G))notice();}
-}
-static void start_requested(void){
- if(sv.active){replace_to=S_SETTINGS;screen=S_REPLACE;sel=0;}else new_game();
-}
-static void setup_input(int dx,int dy,bool ok,bool back){
- if(back){
- if(setup_page){setup_page--;sel=setup_page?6:2;}
- else{screen=S_MENU;sel=1;}
+ if (mine && g->phase == P_PENALTY && g->challengeable) {
+ int k = uno_pen_count(g);
+ if (hit & K_UP) ui.sel = (uint8_t)((ui.sel + k - 1) % k);
+ if (hit & K_DOWN) ui.sel = (uint8_t)((ui.sel + 1) % k);
+ if (!(hit & K_OK)) return;
+ int item = ui.sel % k;
+ if (item == PEN_TAKE) {
+ uno_take(g);
+ } else if (item == PEN_CHALLENGE) {
+ /* the challenged player shows their hand to the challenger */
+ int o = g->offender;
+ memcpy(ui.reveal, g->hand[o], g->count[o]);
+ ui.reveal_n = g->count[o], ui.reveal_who = (uint8_t)o, ui.reveal_color = g->prev_color, ui.reveal_guilty = g->guilty;
+ uno_challenge(g);
+ ui.screen = V_REVEAL;
+ } else {
+ for (int i = 0; i < n; i++)
+ if (uno_can_play(g, i)) {
+ human_play(i);
+ return;
+ }
+ }
+ describe();
+ after(1000);
return;
}
- int rows=setup_page==0?3:setup_page==1?7:1;
- if(dy)sel=(sel+dy+rows)%rows;
- if(dx)settings_change(dx);
- if(ok){
- if(setup_page==2)start_requested();
- else if(sel==rows-1){setup_page++;sel=0;}
- else settings_change(1);
+ if (n && (hit & (K_LEFT | K_RIGHT)) && !(mine && g->phase == P_DRAWN)) {
+ ui.pick = (uint8_t)((ui.pick + (hit & K_RIGHT ? 1 : n - 1)) % n);
+ dirty = true;
+ }
+ if (!mine) return;
+ if (g->phase == P_DRAWN) {
+ if (hit & K_OK) human_play(g->drawn);
+ else if ((hit & K_UP) && uno_keep(g)) describe(), after(1000);
+ } else if (g->phase == P_PENALTY) {
+ if ((hit & K_OK) && n) human_play(ui.pick);
+ else if ((hit & K_UP) && uno_take(g)) describe(), after(1000);
+ } else if (g->phase == P_PLAY) {
+ if ((hit & K_OK) && n) human_play(ui.pick);
+ else if ((hit & K_UP) && uno_draw(g)) describe(), after(g->phase == P_DRAWN ? 0 : 1000);
}
}
-static void play_input(int dx,int dy,bool ok,bool draw,bool keep,bool call){
- Uno*g=G;
- if(call){uno_action();return;}
- if(g->phase>=U_ROUND){
- if(g->phase==U_MATCH){if(dy)sel^=1;if(ok){if(sel){sv.active=0;screen=S_MENU;sel=1;dirty=true;}else start_game(g->rules);}}
- else if(ok)next_round();
+
+/* what happens by itself: the bots' turns, their catches, a penalty you can only take, the end of a hand */
+static void tick(void) {
+ uno_game *g = G;
+ if (ui.screen != V_PLAY) return;
+ if (g->phase >= P_HAND_OVER) {
+ if (!ui.show_end && (int32_t)(now - end_at) >= 0) ui.show_end = 1, dirty = true;
return;
}
- if(g->turn==0&&g->phase==U_COLOR){color_sel=(color_sel+dx+4)%4;if(ok&&uno_choose_color(g,color_sel)){action=-1;notice();}return;}
- if(g->turn==0&&g->phase==U_CHALLENGE){
- if(dy)sel^=1;
- if(draw||(ok&&!sel)){uno_accept(g);notice();}
- else if(ok){
- evidence_count=g->count[g->offender];memcpy(evidence,g->hands[g->offender],evidence_count);evidence_color=g->old_color;
- uno_challenge(g);notice();selected=0;screen=S_EVIDENCE;
- }return;
- }
- if(draw){draw_action();return;}
- if(keep&&g->turn==0&&uno_keep(g)){notice();return;}
- if(dy){action=dy<0?0:-1;while(action>=0&&!action_available(action))action++;}
- if(action>=0){
- action=(action+dx+3)%3;
- while(!action_available(action))action=(action+(dx<0?2:1))%3;
- if(ok){if(action==0)draw_action();else if(action==1)uno_action();else{screen=S_PAUSE;sel=0;}}
- }else{
- int n=g->count[0];if(dx&&n){selected=(selected+dx+n)%n;last_action=clock_ms-1800;}
- if(ok&&!g->turn&&uno_play(g,selected,false)){color_sel=uno_bot_color(g,0);sel=0;notice();}
- else if(ok&&!g->turn){set_message("Match the active color, number or symbol.");redraw=true;}
+ if (catcher != UNO_NONE && g->uno_open == open_seen && (int32_t)(now - catch_at) >= 0) {
+ int by = catcher;
+ catcher = UNO_NONE;
+ if (uno_catch(g, by)) describe(), after(1000);
+ return;
}
+ if ((int32_t)(now - bot_at) < 0) return;
+ if (g->turn != 0) bot_step();
+ else if (g->phase == P_PENALTY && !g->challengeable && !uno_can_stack(g)) uno_take(g), describe(), after(1000);
}
-static void cpu_tick(void){
- Uno*g=G;
- if(screen!=S_PLAY||g->phase>=U_ROUND||(int32_t)(clock_ms-bot_at)<0)return;
- if(g->uno_player==0&&!attempted_uno){attempted_uno=true;if(random_ui()%100<70){uno_catch(g,1);notice();}bot_at=clock_ms+700;return;}
- if(!g->turn)return;
- if(g->uno_player!=UNO_NONE&&g->uno_player!=g->turn&&random_ui()%100<45){uno_catch(g,g->turn);notice();return;}
- uno_bot(g);notice();color_sel=uno_bot_color(g,0);sel=0;
+
+/* back to the table from a pause: the bots wait a little */
+static void resume(void) {
+ ui.screen = V_PLAY;
+ bot_at = now + 600;
+ if (catcher != UNO_NONE && (int32_t)(catch_at - now) < 600) catch_at = now + 600;
}
-int main(void){
- np_app_begin();color_t*old_strip=gfx_buf;gfx_buf=strip;
- sv.prefs=(UnoRules){4,1,0};uint32_t n=0;const uint8_t*b=np_file_read(SAVE_NAME,&n);save_decode(&sv,b,n);
- uint32_t last=(uint32_t)eadk_timing_millis();ui_random=eadk_random()^last;if(!ui_random)ui_random=1;
- screen=S_MENU;sel=sv.active?0:1;selected=0;action=-1;clock_ms=0;redraw=true;dirty=false;
- uint64_t held=eadk_keyboard_scan(),stale=held;bool quit=false;uint32_t last_repeat=0;uint64_t repeat_keys=0;
- while(!quit){
- uint32_t now=(uint32_t)eadk_timing_millis(),dt=now-last;last=now;
- if(screen==S_PLAY){clock_ms+=NP_MIN(dt,100u);}
- uint64_t k=eadk_keyboard_scan();stale&=k;k&=~stale;uint64_t hit=k&~held;held=k;
- uint64_t arrows=(1ull<<eadk_key_left)|(1ull<<eadk_key_right)|(1ull<<eadk_key_up)|(1ull<<eadk_key_down);
- if((k&arrows)!=repeat_keys){repeat_keys=k&arrows;last_repeat=now+330;}
- else if(repeat_keys&&(int32_t)(now-last_repeat)>=0){hit|=repeat_keys;last_repeat=now+110;}
- bool ok=key(hit,eadk_key_ok)||key(hit,eadk_key_exe),back=key(hit,eadk_key_back);
- int dx=key(hit,eadk_key_right)-key(hit,eadk_key_left),dy=key(hit,eadk_key_down)-key(hit,eadk_key_up),before=screen;
- if(hit)redraw=true;
- if(screen!=S_SAVE_ERROR&&(key(k,eadk_key_home)||key(k,eadk_key_on_off))){
- if(save()){quit=true;continue;}exit_after_save=true;screen=S_SAVE_ERROR;sel=0;stale|=k;ok=back=false;dx=dy=0;redraw=true;
- }
- switch(screen){
- case S_MENU:
- if(dy)sel=(sel+dy+4)%4;
- if(ok){if(sel==0&&sv.active){screen=S_PLAY;reported=G->phase>=U_ROUND;bot_at=clock_ms+1300;}
- else if(sel==1){screen=S_SETTINGS;setup_page=0;sel=0;}
- else if(sel==2){return_to=S_MENU;screen=S_HELP;help_page=0;}
- else if(sel==3){screen=S_CREDITS;return_to=S_MENU;}}
- else if(back){screen=S_EXIT;sel=0;}break;
- case S_SETTINGS:
- setup_input(dx,dy,ok,back);break;
- case S_PLAY:
- if(back){screen=S_PAUSE;sel=0;}
- else play_input(dx,dy,ok,key(hit,eadk_key_one),key(hit,eadk_key_two),key(hit,eadk_key_zero));
- cpu_tick();break;
- case S_PAUSE:
- if(dy)sel=(sel+dy+4)%4;
- if(back||(ok&&!sel)){screen=S_PLAY;bot_at=clock_ms+800;}
- else if(ok&&sel==1){screen=S_TABLE_INFO;}
- else if(ok){exit_after_save=sel==3;if(save()){if(exit_after_save)quit=true;else screen=S_MENU,sel=0;}else screen=S_SAVE_ERROR,sel=0;}
+
+int main(void) {
+ plat_begin();
+ memset(&ui, 0, sizeof ui);
+ catcher = open_seen = UNO_NONE;
+ save_load(&sv);
+ ui.setup = sv.setup, ui.has_game = sv.has_game;
+ if (ui.has_game) describe();
+ ui.screen = V_TITLE, ui.sel = 0;
+ uint32_t stale = plat_keys(), prev = stale, rep_at = 0;
+ uint8_t shown = 0xFF;
+ now = plat_millis();
+ bot_at = now + 1000;
+ dirty = true;
+ for (;;) {
+ now = plat_millis();
+ uint32_t keys = plat_keys();
+ stale &= keys; /* keys still down from the screen before don't count */
+ uint32_t live = keys & ~stale, hit = live & ~prev;
+ /* Left or Right held: again after 350 ms, then every 120 ms */
+ uint32_t arrows = live & (K_LEFT | K_RIGHT);
+ if (hit & arrows) rep_at = now + 350;
+ else if (arrows && (int32_t)(now - rep_at) >= 0) hit |= arrows, rep_at = now + 120;
+ prev = live;
+ if (keys & K_HOME) break; /* Home: saved below, then out */
+ if (hit) dirty = true;
+ bool quit = false;
+ switch (ui.screen) {
+ case V_TITLE: {
+ int n = uno_menu_count(&ui);
+ if (hit & K_UP) ui.sel = (uint8_t)((ui.sel + n - 1) % n);
+ if (hit & K_DOWN) ui.sel = (uint8_t)((ui.sel + 1) % n);
+ if (hit & K_BACK) quit = true;
+ else if (hit & K_OK) switch (uno_menu_item(&ui, ui.sel % n)) {
+ case MENU_CONTINUE: ui.screen = V_PLAY, after(1000); break;
+ case MENU_NEW: ui.screen = V_SETUP, ui.under = V_TITLE, ui.sel = ROW_DEAL; break;
+ default: ui.screen = V_HELP, ui.under = V_TITLE, ui.page = 0, ui.first_run = 0; break;
+ }
+ break;
+ }
+ case V_SETUP: {
+ uno_rules *r = &ui.setup;
+ if (hit & K_UP) ui.sel = (uint8_t)((ui.sel + SETUP_ROWS - 1) % SETUP_ROWS);
+ if (hit & K_DOWN) ui.sel = (uint8_t)((ui.sel + 1) % SETUP_ROWS);
+ int d = hit & K_RIGHT ? 1 : hit & K_LEFT ? -1 : 0;
+ if (d && ui.sel == ROW_PLAYERS) r->players = (uint8_t)(2 + (r->players - 2 + d + 3) % 3);
+ if (d && ui.sel == ROW_LEVEL) r->level = (uint8_t)((r->level + d + 3) % 3);
+ if (d && ui.sel == ROW_LENGTH) r->one_hand ^= 1;
+ bool toggle = ui.sel >= ROW_HOUSE && ui.sel < ROW_DEAL && (d || (hit & K_OK));
+ if (toggle) r->house ^= (uint8_t)(1u << (ui.sel - ROW_HOUSE));
+ if (hit & K_BACK) ui.screen = ui.under, ui.sel = ui.under == V_PAUSE ? PAUSE_NEW : (uint8_t)(uno_menu_count(&ui) - 2);
+ else if ((hit & K_OK) && !toggle) deal();
+ break;
+ }
+ case V_HELP:
+ if (ui.first_run && (hit & K_BACK)) {
+ ui.first_run = 0;
+ start();
+ } else if ((hit & K_RIGHT || (ui.first_run && (hit & K_OK))) && ui.page + 1 < UNO_HELP_PAGES) {
+ ui.page++;
+ } else if ((hit & K_LEFT) && ui.page) {
+ ui.page--;
+ } else if (ui.first_run && (hit & K_OK)) {
+ ui.first_run = 0;
+ start();
+ } else if (hit & (K_BACK | K_OK)) {
+ ui.screen = ui.under, ui.sel = ui.under == V_PAUSE ? PAUSE_HELP : (uint8_t)(uno_menu_count(&ui) - 1);
+ }
+ break;
+ case V_PLAY: play_keys(hit); break;
+ case V_REVEAL:
+ if (hit & (K_OK | K_BACK)) resume();
break;
- case S_HELP:
- help_page=(help_page+dx+7)%7;if(back||ok){screen=return_to;sel=return_to==S_PAUSE?1:2;}break;
- case S_CREDITS:if(back||ok){screen=S_MENU;sel=3;}break;
- case S_TABLE_INFO:
- if(back){screen=S_PAUSE;sel=1;}else if(ok){return_to=S_TABLE_INFO;screen=S_HELP;help_page=4;}break;
- case S_REPLACE:
- if(dy)sel^=1;if(back||(ok&&!sel)){screen=replace_to;setup_page=2;sel=0;}else if(ok)new_game();break;
- case S_EXIT:
- if(dy)sel^=1;if(back||(ok&&!sel)){screen=S_MENU;sel=1;}else if(ok){if(save())quit=true;else screen=S_SAVE_ERROR,sel=0,exit_after_save=true;}break;
- case S_SAVE_ERROR:
- if(dy)sel^=1;
- if(ok){if(sel||save()){if(exit_after_save)quit=true;else screen=S_MENU,sel=0;}}break;
- case S_EVIDENCE:
- if(dx&&evidence_count)selected=(selected+dx+evidence_count)%evidence_count;
- if(ok||back){screen=S_PLAY;selected=0;bot_at=clock_ms+1300;}break;
+ case V_PAUSE:
+ if (hit & K_UP) ui.sel = (uint8_t)((ui.sel + PAUSE_COUNT - 1) % PAUSE_COUNT);
+ if (hit & K_DOWN) ui.sel = (uint8_t)((ui.sel + 1) % PAUSE_COUNT);
+ if (hit & K_BACK) resume();
+ else if (hit & K_OK) switch (ui.sel) {
+ case PAUSE_RESUME: resume(); break;
+ case PAUSE_NEW: ui.screen = V_SETUP, ui.under = V_PAUSE, ui.sel = ROW_DEAL; break;
+ case PAUSE_HELP: ui.screen = V_HELP, ui.under = V_PAUSE, ui.page = 0, ui.first_run = 0; break;
+ default: ui.screen = V_QUIT, ui.sel = 0; break;
+ }
+ break;
+ case V_QUIT:
+ if (hit & (K_LEFT | K_RIGHT | K_UP | K_DOWN)) ui.sel ^= 1;
+ if (hit & K_BACK) ui.screen = V_PAUSE, ui.sel = PAUSE_QUIT;
+ else if (hit & K_OK) {
+ if (ui.sel) quit = true;
+ else ui.screen = V_PAUSE, ui.sel = PAUSE_QUIT;
+ }
+ break;
+ }
+ if (quit) break;
+ tick();
+ if (ui.has_game && (int32_t)(now - saved_at) >= 30000) save();
+ if (ui.screen != shown) {
+ stale = keys, prev = 0; /* a new screen starts with all keys up */
+ shown = ui.screen;
+ dirty = true;
+ }
+ if (dirty) {
+ ui.clock = now;
+ uint32_t t0 = plat_millis();
+ uno_render(G, &ui);
+ uint32_t spent = plat_millis() - t0;
+ perf_frames++;
+ if (spent > perf_max) perf_max = spent;
+ if (spent > 33) perf_slow++;
+ dirty = false;
+ } else {
+ plat_sleep(10);
}
- if(screen!=before){stale|=k;redraw=true;repeat_keys=0;last=(uint32_t)eadk_timing_millis();}
- if(redraw){eadk_display_wait_for_vblank();gfx_render(scene,0,0,240);redraw=false;}
- eadk_timing_msleep(8);
}
- gfx_buf=old_strip;return np_app_end();
+ save();
+ return plat_end();
}
diff --git a/games/uno/src/plat.h b/games/uno/src/plat.h
new file mode 100644
index 00000000..45b5fca0
--- /dev/null
+++ b/games/uno/src/plat.h
@@ -0,0 +1,17 @@
+/* What the game needs from the calculator (plat_eadk.c), or from a computer for the tests. */
+#ifndef UNO_PLAT_H
+#define UNO_PLAT_H
+#include <stdbool.h>
+#include <stdint.h>
+
+enum { K_OK = 1, K_SHIFT = 2, K_UP = 4, K_DOWN = 8, K_LEFT = 16, K_RIGHT = 32, K_BACK = 64, K_HOME = 128 };
+uint32_t plat_keys(void);
+uint32_t plat_millis(void);
+void plat_sleep(uint32_t ms);
+void plat_push(int x, int y, int w, int h, const uint16_t *px);
+bool plat_save(const char *name, const void *data, uint32_t len);
+const uint8_t *plat_load(const char *name, uint32_t *len);
+uint32_t plat_random(void);
+void plat_begin(void);
+int plat_end(void);
+#endif
diff --git a/games/uno/src/plat_eadk.c b/games/uno/src/plat_eadk.c
new file mode 100644
index 00000000..1b66fc31
--- /dev/null
+++ b/games/uno/src/plat_eadk.c
@@ -0,0 +1,34 @@
+/* The calculator: keys, time, the screen and files (EADK, and NumPlay's careful file helpers). */
+#include <eadk.h>
+#include "../../common/epsilon_app.h"
+#include "../../common/epsilon_files.h"
+#include "plat.h"
+
+const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "UNO";
+const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;
+
+#define KEY(k) ((uint64_t)1 << (k))
+
+uint32_t plat_keys(void) {
+ uint64_t k = eadk_keyboard_scan();
+ uint32_t r = 0;
+ if (k & (KEY(eadk_key_ok) | KEY(eadk_key_exe) | KEY(eadk_key_five))) r |= K_OK;
+ if (k & KEY(eadk_key_shift)) r |= K_SHIFT;
+ if (k & (KEY(eadk_key_up) | KEY(eadk_key_eight))) r |= K_UP;
+ if (k & (KEY(eadk_key_down) | KEY(eadk_key_two))) r |= K_DOWN;
+ if (k & (KEY(eadk_key_left) | KEY(eadk_key_four))) r |= K_LEFT;
+ if (k & (KEY(eadk_key_right) | KEY(eadk_key_six))) r |= K_RIGHT;
+ if (k & (KEY(eadk_key_back) | KEY(eadk_key_backspace))) r |= K_BACK;
+ if (k & (KEY(eadk_key_home) | KEY(eadk_key_on_off))) r |= K_HOME;
+ return r;
+}
+uint32_t plat_millis(void) { return (uint32_t)eadk_timing_millis(); }
+void plat_sleep(uint32_t ms) { eadk_timing_msleep(ms); }
+void plat_push(int x, int y, int w, int h, const uint16_t *px) {
+ eadk_display_push_rect((eadk_rect_t){(uint16_t)x, (uint16_t)y, (uint16_t)w, (uint16_t)h}, (const eadk_color_t *)px);
+}
+bool plat_save(const char *name, const void *data, uint32_t len) { return ef_write(name, data, len); }
+const uint8_t *plat_load(const char *name, uint32_t *len) { return ef_read(name, len); }
+uint32_t plat_random(void) { return eadk_random(); }
+void plat_begin(void) { np_app_begin(); }
+int plat_end(void) { return np_app_end(); }
diff --git a/games/uno/src/save.c b/games/uno/src/save.c
new file mode 100644
index 00000000..0164974e
--- /dev/null
+++ b/games/uno/src/save.c
@@ -0,0 +1,120 @@
+/* The save (save.h): a bytes file with a magic, a version, its size and a checksum, and the game checked card by
+ * card; anything else (damaged, cut short, from elsewhere) is not read: the copy in the Python script is tried,
+ * then a fresh start. */
+#include <stddef.h>
+#include <string.h>
+#include "plat.h"
+#include "save.h"
+
+void uno_fresh(uno_progress *p) {
+ memset(p, 0, sizeof *p);
+ p->setup.players = 4, p->setup.level = LEVEL_NORMAL;
+}
+
+uint32_t uno_sum(const void *data, uint32_t n) {
+ const uint8_t *p = data;
+ uint32_t h = 2166136261u;
+ for (uint32_t i = 0; i < n; i++) h = (h ^ p[i]) * 16777619u;
+ return h;
+}
+
+bool uno_file_ok(const uno_file *f) {
+ if (f->magic != UNO_MAGIC || f->version != UNO_VERSION || f->size != sizeof *f) return false;
+ if (f->sum != uno_sum(f, offsetof(uno_file, sum))) return false;
+ const uno_progress *p = &f->p;
+ const uno_rules *r = &p->setup;
+ if (r->players < 2 || r->players > 4 || r->level > LEVEL_HARD || r->one_hand > 1 || r->house > H_ALL) return false;
+ if (p->guide > 1 || p->has_game > 1) return false;
+ return !p->has_game || uno_valid(&p->g);
+}
+
+static const char head[] = "# UNO keeps a copy of your game here,\n"
+ "# so that installing it again doesn't erase it.\n";
+static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static uint8_t copy[1 + sizeof head + 2 + sizeof UNO_SAVE_NAME + 1 + (sizeof(uno_file) + 2) / 3 * 4 + 2];
+
+/* the copy: the file in base 64, in a comment line of a script */
+static bool copy_write(const uno_file *f) {
+ const uint8_t *bytes = (const uint8_t *)f;
+ uint32_t len = sizeof *f, nl = sizeof UNO_SAVE_NAME - 1;
+ uint8_t *p = copy;
+ *p++ = 0; /* (a script's first byte: not imported) */
+ memcpy(p, head, sizeof head - 1), p += sizeof head - 1;
+ *p++ = '#', *p++ = '>';
+ memcpy(p, UNO_SAVE_NAME, nl), p += nl;
+ *p++ = ':';
+ for (uint32_t i = 0; i < len; i += 3, p += 4) {
+ uint32_t left = len - i;
+ uint32_t v = (uint32_t)bytes[i] << 16 | (left > 1 ? (uint32_t)bytes[i + 1] << 8 : 0) | (left > 2 ? bytes[i + 2] : 0);
+ p[0] = (uint8_t)b64[v >> 18 & 63];
+ p[1] = (uint8_t)b64[v >> 12 & 63];
+ p[2] = left > 1 ? (uint8_t)b64[v >> 6 & 63] : '=';
+ p[3] = left > 2 ? (uint8_t)b64[v & 63] : '=';
+ }
+ *p++ = '\n';
+ return plat_save(UNO_COPY_NAME, copy, (uint32_t)(p - copy));
+}
+
+static int b64v(uint8_t c) {
+ for (int i = 0; i < 64; i++)
+ if ((uint8_t)b64[i] == c) return i;
+ return -1;
+}
+
+static bool copy_read(uno_file *f) {
+ uint32_t n, nl = sizeof UNO_SAVE_NAME - 1;
+ const uint8_t *c = plat_load(UNO_COPY_NAME, &n);
+ if (!c) return false;
+ for (uint32_t i = 0; i + nl + 3 <= n; i++) {
+ if (c[i] != '#' || c[i + 1] != '>' || memcmp(c + i + 2, UNO_SAVE_NAME, nl) || c[i + 2 + nl] != ':') continue;
+ const uint8_t *l = c + i + 3 + nl;
+ uint32_t m = 0;
+ while (l + m < c + n && l[m] != '\n' && l[m]) m++;
+ if (m != (sizeof *f + 2) / 3 * 4) return false;
+ uint8_t *bytes = (uint8_t *)f;
+ uint32_t o = 0;
+ for (uint32_t k = 0; k < m; k += 4) {
+ int v0 = b64v(l[k]), v1 = b64v(l[k + 1]), v2 = l[k + 2] == '=' ? 0 : b64v(l[k + 2]),
+ v3 = l[k + 3] == '=' ? 0 : b64v(l[k + 3]);
+ if (v0 < 0 || v1 < 0 || v2 < 0 || v3 < 0) return false;
+ uint32_t w = (uint32_t)(v0 << 18 | v1 << 12 | v2 << 6 | v3);
+ if (o < sizeof *f) bytes[o++] = (uint8_t)(w >> 16);
+ if (o < sizeof *f) bytes[o++] = (uint8_t)(w >> 8);
+ if (o < sizeof *f) bytes[o++] = (uint8_t)w;
+ }
+ return true;
+ }
+ return false;
+}
+
+static uno_file file; /* (static: the stack stays small) */
+
+bool save_load(uno_progress *p) {
+ uint32_t n;
+ const uint8_t *d = plat_load(UNO_SAVE_NAME, &n);
+ bool ok = false;
+ if (d && n == sizeof file) {
+ memcpy(&file, d, sizeof file);
+ ok = uno_file_ok(&file);
+ }
+ if (!ok && copy_read(&file) && uno_file_ok(&file)) {
+ ok = true;
+ plat_save(UNO_SAVE_NAME, &file, sizeof file); /* back where it belongs */
+ }
+ if (!ok) {
+ uno_fresh(p);
+ return false;
+ }
+ *p = file.p;
+ return true;
+}
+
+bool save_write(const uno_progress *p) {
+ memset(&file, 0, sizeof file);
+ file.magic = UNO_MAGIC, file.version = UNO_VERSION, file.size = sizeof file;
+ file.p = *p;
+ file.sum = uno_sum(&file, offsetof(uno_file, sum));
+ bool ok = plat_save(UNO_SAVE_NAME, &file, sizeof file);
+ copy_write(&file);
+ return ok;
+}
diff --git a/games/uno/src/save.h b/games/uno/src/save.h
index f18995bc..1d7cedf6 100644
--- a/games/uno/src/save.h
+++ b/games/uno/src/save.h
@@ -1,59 +1,34 @@
+/* What's kept (the new game screen's choices, whether how to play was read, the game going on), in uno.sav,
+ * and a copy of it in a Python script, uno_saves.py (installing apps from the NumWorks website keeps only
+ * scripts, so the save comes back from it). */
#ifndef UNO_SAVE_H
#define UNO_SAVE_H
-#include "uno.h"
-#define UNO_SAVE_BYTES 768
-typedef struct { Uno game; UnoRules prefs; uint16_t played, wins; uint8_t active; } UnoSave;
-static uint32_t save_crc(const uint8_t*p,unsigned n){
- uint32_t c=~0u;while(n--){c^=*p++;for(int j=0;j<8;j++)c=(c>>1)^(0xEDB88320u&-(c&1));}return ~c;
-}
-static void save_encode(const UnoSave*s,uint8_t*b){
- memset(b,0,UNO_SAVE_BYTES);uint8_t*p=b;
- *p++='U';*p++='N';*p++='O';*p++=2;*p++=s->active;
- *p++=s->prefs.players;*p++=s->prefs.difficulty;*p++=s->prefs.flags;p++; /* reserved */
-#define PUT16(v) do {unsigned t=(v);*p++=t;*p++=t>>8;}while(0)
-#define PUT32(v) do {uint32_t t=(v);for(int k=0;k<4;k++)*p++=t>>(k*8);}while(0)
- PUT16(s->played);PUT16(s->wins);
- const Uno*g=&s->game;
- *p++=g->rules.players;*p++=g->rules.difficulty;*p++=g->rules.flags;p++;
- memcpy(p,g->hands,sizeof g->hands);p+=sizeof g->hands;memcpy(p,g->count,4);p+=4;
- memcpy(p,g->deck,108);p+=108;memcpy(p,g->discard,108);p+=108;
- *p++=g->dn;*p++=g->xn;
- p+=8; /* Former v1 point totals: always zero in v2. */
- PUT16(g->round);p+=2;PUT16(g->turns);PUT32(g->rng);
-#define WRITE(f) *p++=g->f
- WRITE(dealer);WRITE(turn);WRITE(color);WRITE(phase);WRITE(pending);WRITE(penalty_kind);WRITE(offender);
- WRITE(guilty);WRITE(old_color);WRITE(drawn);WRITE(candidate);WRITE(winner);WRITE(uno_player);WRITE(uno_armed);
- WRITE(stalls);WRITE(event);WRITE(actor);WRITE(card);WRITE(amount);WRITE(direction);
-#undef WRITE
- p=b+UNO_SAVE_BYTES-4;PUT32(save_crc(b,UNO_SAVE_BYTES-4));
-#undef PUT16
-#undef PUT32
-}
-static bool save_decode(UnoSave*s,const uint8_t*b,unsigned n){
- if(!b||n!=UNO_SAVE_BYTES||b[0]!='U'||b[1]!='N'||b[2]!='O'||(b[3]!=1&&b[3]!=2))return false;
- unsigned at=UNO_SAVE_BYTES-4;uint32_t crc=0;for(int k=0;k<4;k++)crc|=(uint32_t)b[at+k]<<(k*8);
- if(crc!=save_crc(b,at))return false;
- UnoSave t={0};const uint8_t*p=b+4;t.active=*p++;
- t.prefs.players=*p++;t.prefs.difficulty=*p++;t.prefs.flags=*p++;p++;
- if(t.active>1||t.prefs.players<2||t.prefs.players>4||t.prefs.difficulty>2||t.prefs.flags>31)return false;
-#define GET16(v) do{(v)=(uint16_t)(p[0]|p[1]<<8);p+=2;}while(0)
-#define GET32(v) do{(v)=0;for(int k=0;k<4;k++)(v)|=(uint32_t)*p++<<(k*8);}while(0)
- GET16(t.played);GET16(t.wins);Uno*g=&t.game;
- g->rules.players=*p++;g->rules.difficulty=*p++;g->rules.flags=*p++;p++;
- memcpy(g->hands,p,sizeof g->hands);p+=sizeof g->hands;memcpy(g->count,p,4);p+=4;
- memcpy(g->deck,p,108);p+=108;memcpy(g->discard,p,108);p+=108;g->dn=*p++;g->xn=*p++;
- p+=8;GET16(g->round);p+=2;GET16(g->turns);GET32(g->rng);
-#define READ(f) g->f=*p++
- READ(dealer);READ(turn);READ(color);READ(phase);READ(pending);READ(penalty_kind);READ(offender);
- READ(guilty);READ(old_color);READ(drawn);READ(candidate);READ(winner);READ(uno_player);READ(uno_armed);
- READ(stalls);READ(event);READ(actor);READ(card);READ(amount);READ(direction);
-#undef READ
-#undef GET16
-#undef GET32
- /* A won v1 round now ends the game. In-progress cards and rules survive;
- old point totals and target settings are intentionally discarded. */
- if(b[3]==1&&g->phase==U_ROUND&&g->winner!=UNO_NONE){g->phase=U_MATCH;g->event=E_MATCH;}
- if(t.active&&!uno_valid(g))return false;
- *s=t;return true;
-}
+#include "game.h"
+
+#define UNO_SAVE_NAME "uno.sav"
+#define UNO_COPY_NAME "uno_saves.py"
+#define UNO_MAGIC 0x314F4E55u /* "UNO1" */
+#define UNO_VERSION 1
+
+typedef struct {
+ uno_rules setup; /* the new game screen's choices */
+ uint8_t guide; /* how to play shown before the first game */
+ uint8_t has_game; /* a game to go on with */
+ uint8_t spare[2];
+ uno_game g;
+} uno_progress;
+
+typedef struct {
+ uint32_t magic;
+ uint16_t version, size;
+ uno_progress p;
+ uint32_t sum; /* FNV-1a of everything before it */
+} uno_file;
+_Static_assert(sizeof(uno_file) == 728, "uno.sav: 728 bytes");
+
+void uno_fresh(uno_progress *p);
+uint32_t uno_sum(const void *data, uint32_t n);
+bool uno_file_ok(const uno_file *f);
+bool save_load(uno_progress *p); /* the save, its copy, or a fresh start; false: a fresh start */
+bool save_write(const uno_progress *p);
#endif
diff --git a/games/uno/src/uno.c b/games/uno/src/uno.c
deleted file mode 100644
index 6d8849db..00000000
--- a/games/uno/src/uno.c
+++ /dev/null
@@ -1,216 +0,0 @@
-#include "uno.h"
-#include <string.h>
-static uint32_t random32(Uno*g){uint32_t x=g->rng;x^=x<<13;x^=x>>17;x^=x<<5;return g->rng=x?x:1;}
-static int next(const Uno*g,int p){return (p+g->rules.players+g->direction)%g->rules.players;}
-static void event(Uno*g,int e,int p,int c,int n){g->event=e;g->actor=p;g->card=c;g->amount=n;}
-static void shuffle(Uno*g){for(int i=g->dn-1;i>0;i--){int j=random32(g)%(i+1),c=g->deck[i];g->deck[i]=g->deck[j];g->deck[j]=c;}}
-static bool take(Uno*g,int p){
- if(!g->dn&&g->xn>1){int c=g->discard[g->xn-1];g->dn=g->xn-1;memcpy(g->deck,g->discard,g->dn);g->discard[0]=c;g->xn=1;shuffle(g);}
- if(!g->dn||g->count[p]>=UNO_CARDS)return false;
- g->hands[p][g->count[p]++]=g->deck[--g->dn];return true;
-}
-static int take_n(Uno*g,int p,int n){int got=0;while(got<n&&take(g,p))got++;return got;}
-static void begin_action(Uno*g){g->uno_player=UNO_NONE;g->uno_armed=UNO_NONE;g->turns++;}
-static bool matching(const Uno*g,int c){int top=g->discard[g->xn-1];return c>=52||uno_color(c)==g->color||uno_value(c)==uno_value(top);}
-static void finish(Uno*g,int w){
- g->winner=w;g->candidate=UNO_NONE;g->phase=U_MATCH;
- event(g,E_MATCH,w,0,0);
-}
-static void check_out(Uno*g){if(g->candidate!=UNO_NONE&&!g->pending)finish(g,g->candidate);}
-void uno_next_round(Uno*g){
- if(g->round)g->dealer=(g->dealer+1)%g->rules.players;
- g->round++;g->direction=1;g->phase=U_TURN;g->dn=0;g->xn=0;g->pending=0;g->turns=0;g->stalls=0;
- g->winner=g->candidate=g->uno_player=g->uno_armed=g->drawn=UNO_NONE;
- memset(g->count,0,sizeof g->count);
- for(int c=0;c<52;c++){g->deck[g->dn++]=c;if(c%13)g->deck[g->dn++]=c;}
- for(int i=0;i<4;i++){g->deck[g->dn++]=UNO_WILD;g->deck[g->dn++]=UNO_DRAW4;}
- shuffle(g);
- for(int n=0;n<7;n++)for(int p=0;p<g->rules.players;p++)take(g,(g->dealer+1+p)%g->rules.players);
- /* Opening +4 goes back in the deck; no random-retry loop. */
- int at=g->dn-1;while(at>=0&&g->deck[at]==UNO_DRAW4)at--;
- bool rejected=at!=g->dn-1;
- int c=g->deck[at];g->deck[at]=g->deck[g->dn-1];g->dn--;g->discard[g->xn++]=c;
- if(rejected)shuffle(g);
- g->color=uno_color(c);g->turn=next(g,g->dealer);
- int v=uno_value(c);
- if(v==UNO_REVERSE){g->direction=-1;g->turn=g->dealer;}
- else if(v==UNO_SKIP)g->turn=next(g,g->turn);
- else if(v==UNO_DRAW2){take_n(g,g->turn,2);g->turn=next(g,g->turn);}
- else if(c==UNO_WILD)g->phase=U_COLOR;
- event(g,E_START,g->turn,c,0);g->offender=UNO_NONE;
-}
-void uno_new(Uno*g,UnoRules r,uint32_t seed){
- memset(g,0,sizeof *g);g->rules=r;g->rules.players=r.players<2?2:r.players>4?4:r.players;
- g->rules.difficulty=r.difficulty%3;g->rules.flags=r.flags&31;g->rng=seed?seed:1;g->direction=1;
- /* Official dealer selection: each player draws, highest number (actions=0).
- * Ties redraw only among tied players, from the same finite shuffled deck. */
- uint8_t pool[UNO_CARDS];int n=0;
- for(int c=0;c<52;c++){pool[n++]=c;if(c%13)pool[n++]=c;}
- for(int i=0;i<4;i++){pool[n++]=UNO_WILD;pool[n++]=UNO_DRAW4;}
- for(int i=n-1;i>0;i--){int j=random32(g)%(i+1),c=pool[i];pool[i]=pool[j];pool[j]=c;}
- unsigned eligible=(1u<<g->rules.players)-1;int index=0;
- while((eligible&(eligible-1))&&index+g->rules.players<=n){
- int best=-1;unsigned tied=0;
- for(int p=0;p<g->rules.players;p++)if(eligible&(1u<<p)){
- int v=uno_value(pool[index++]);if(v>9)v=0;
- if(v>best){best=v;tied=1u<<p;}else if(v==best)tied|=1u<<p;
- }eligible=tied;
- }
- for(int p=0;p<g->rules.players;p++)if(eligible&(1u<<p)){g->dealer=p;break;}
- uno_next_round(g);
-}
-bool uno_can_play(const Uno*g,int i){
- if(i<0||i>=g->count[g->turn]||g->phase>=U_ROUND||g->phase==U_COLOR)return false;
- if(g->phase==U_DRAWN&&i!=g->drawn)return false;
- int c=g->hands[g->turn][i];
- if(g->pending){
- if(g->candidate!=UNO_NONE)return false;
- return (g->penalty_kind==2&&(g->rules.flags&R_STACK2)&&uno_value(c)==UNO_DRAW2)||
- (g->penalty_kind==4&&(g->rules.flags&R_STACK4)&&c==UNO_DRAW4);
- }
- return g->phase!=U_CHALLENGE&&matching(g,c);
-}
-static void apply(Uno*g,int c){
- int p=g->turn,v=uno_value(c);g->phase=U_TURN;
- if(v==UNO_DRAW2||c==UNO_DRAW4){
- int n=c==UNO_DRAW4?4:2;g->pending+=n;g->penalty_kind=n;g->offender=p;g->turn=next(g,p);
- if(c==UNO_DRAW4&&!(g->rules.flags&R_STACK4))g->phase=U_CHALLENGE;
- /* Last-card penalties cannot be stacked: the round has ended. +4 may
- still be challenged before the penalty and win are settled. */
- else if(g->candidate!=UNO_NONE)uno_accept(g);
- }else{
- if(v==UNO_REVERSE&&g->rules.players>2)g->direction=-g->direction;
- g->turn=next(g,p);
- if(v==UNO_SKIP||(v==UNO_REVERSE&&g->rules.players==2))g->turn=next(g,g->turn);
- check_out(g);
- }
-}
-bool uno_play(Uno*g,int i,bool announce){
- if(!uno_can_play(g,i))return false;
- int p=g->turn,c=g->hands[p][i];bool armed=g->uno_armed==p;
- /* A +4 may be bluffed; only a challenge consults this saved evidence. */
- g->old_color=g->color;g->guilty=0;
- if(c==UNO_DRAW4)for(int j=0;j<g->count[p];j++)if(j!=i&&uno_color(g->hands[p][j])==g->color)g->guilty=1;
- begin_action(g);g->stalls=0;
- memmove(&g->hands[p][i],&g->hands[p][i+1],g->count[p]-i-1);g->count[p]--;
- g->discard[g->xn++]=c;g->drawn=UNO_NONE;
- if(g->count[p]==1){if(!(announce||armed||(g->rules.flags&R_AUTO_UNO)))g->uno_player=p;}
- if(!g->count[p])g->candidate=p;
- event(g,E_PLAY,p,c,0);
- if(c>=52){g->phase=U_COLOR;g->offender=p;}
- else{g->color=uno_color(c);apply(g,c);}
- return true;
-}
-bool uno_choose_color(Uno*g,int color){
- if(g->phase!=U_COLOR||color<0||color>3)return false;
- g->color=color;
- if(g->offender==UNO_NONE){g->phase=U_TURN;event(g,E_COLOR,g->turn,0,color);}
- else {int c=g->discard[g->xn-1];event(g,E_COLOR,g->turn,c,color);apply(g,c);}
- return true;
-}
-bool uno_accept(Uno*g){
- if(!g->pending||g->phase==U_COLOR||g->phase>=U_ROUND)return false;
- int p=g->turn,n=g->pending;begin_action(g);int got=take_n(g,p,n);g->pending=0;g->phase=U_TURN;
- g->turn=next(g,p);event(g,E_PENALTY,p,0,got);check_out(g);return true;
-}
-bool uno_challenge(Uno*g){
- if(g->phase!=U_CHALLENGE)return false;
- int p=g->turn,o=g->offender;begin_action(g);g->phase=U_TURN;g->pending=0;
- if(g->guilty){int n=take_n(g,o,4);if(g->candidate==o)g->candidate=UNO_NONE;event(g,E_CHALLENGE_WON,p,0,n);}
- else{int n=take_n(g,p,6);g->turn=next(g,p);event(g,E_CHALLENGE_LOST,p,0,n);}
- check_out(g);return true;
-}
-bool uno_draw(Uno*g){
- if(g->phase!=U_TURN)return false;
- if(g->pending)return uno_accept(g);
- int p=g->turn;begin_action(g);int n=0;
- do {if(!take(g,p))break;n++;g->drawn=g->count[p]-1;}
- while((g->rules.flags&R_DRAW_UNTIL)&&!matching(g,g->hands[p][g->drawn]));
- event(g,E_DRAW,p,0,n);
- if(n&&matching(g,g->hands[p][g->drawn])){
- g->phase=U_DRAWN;g->stalls=0;
- if((g->rules.flags&R_FORCE)&&g->hands[p][g->drawn]<52)uno_play(g,g->drawn,false);
- /* Wild still needs the player's colour decision. */
- }else{
- g->turn=next(g,p);g->drawn=UNO_NONE;
- if(!n)g->stalls++;else g->stalls=0;
- if(g->stalls>=g->rules.players){g->phase=U_ROUND;g->winner=UNO_NONE;event(g,E_STALEMATE,p,0,0);}
- }
- return true;
-}
-bool uno_keep(Uno*g){
- if(g->phase!=U_DRAWN||(g->rules.flags&R_FORCE))return false;
- int p=g->turn;g->drawn=UNO_NONE;g->phase=U_TURN;g->turn=next(g,p);event(g,E_PASS,p,0,0);return true;
-}
-bool uno_call(Uno*g,int p){
- if(g->phase>=U_ROUND||p<0||p>=g->rules.players)return false;
- if(g->uno_player==p){g->uno_player=UNO_NONE;event(g,E_UNO,p,0,0);return true;}
- if(g->count[p]==2&&p==g->turn&&(g->phase==U_TURN||g->phase==U_DRAWN)){g->uno_armed=p;event(g,E_UNO,p,0,0);return true;}
- return false;
-}
-bool uno_catch(Uno*g,int p){
- int o=g->uno_player;if(o==UNO_NONE||p==o||p<0||p>=g->rules.players||g->phase>=U_ROUND)return false;
- int got=take_n(g,o,2);g->uno_player=UNO_NONE;event(g,E_CAUGHT,o,0,got);return true;
-}
-int uno_bot_color(const Uno*g,int p){
- int counts[4]={0},best=0;for(int i=0;i<g->count[p];i++){int c=g->hands[p][i];if(c<52)counts[c/13]++;}
- for(int c=1;c<4;c++)if(counts[c]>counts[best])best=c;return best;
-}
-int uno_bot_card(const Uno*g){
- int best=-1,rank=-10000,p=g->turn,counts[4]={0};
- for(int i=0;i<g->count[p];i++)if(g->hands[p][i]<52)counts[g->hands[p][i]/13]++;
- for(int i=0;i<g->count[p];i++)if(uno_can_play(g,i)){
- /* Card-selection priorities are private strategy, not a player score. */
- int c=g->hands[p][i],v=uno_value(c),r=c>=52?5:v>=10?20:v;
- if(c<52)r+=counts[c/13]*(g->rules.difficulty==2?7:3);
- else if(c==UNO_DRAW4&&counts[g->color])r-=150;
- if(g->rules.difficulty==2&&g->count[next(g,p)]<=2&&(v>=10&&v<=12))r+=55;
- if(g->rules.difficulty==2&&v==UNO_REVERSE&&g->rules.players>2&&g->count[(p+g->rules.players-g->direction)%g->rules.players]<=2)r-=45;
- if(g->rules.difficulty==0)r=(int)((g->rng^(unsigned)c*2654435761u)%(r< -100?10:100));
- if(r>rank){rank=r;best=i;}
- }return best;
-}
-void uno_bot(Uno*g){
- if(g->phase>=U_ROUND)return;
- int p=g->turn;
- if(g->phase==U_COLOR){uno_choose_color(g,uno_bot_color(g,p));return;}
- if(g->phase==U_CHALLENGE){
- /* Decision uses RNG, difficulty and public hand sizes, never guilty or
- any other player's hidden cards. The engine reveals evidence after. */
- unsigned chance=g->rules.difficulty==0?20:g->rules.difficulty==1?12:8;
- if(random32(g)%100<chance)uno_challenge(g);else uno_accept(g);return;
- }
- int i=uno_bot_card(g);
- if(i>=0){
- if(g->phase==U_DRAWN&&!(g->rules.flags&R_FORCE)&&g->rules.difficulty==0&&random32(g)%12==0){uno_keep(g);return;}
- bool call=random32(g)%100<(g->rules.difficulty==0?85:97);
- uno_play(g,i,call);
- }else if(g->phase==U_DRAWN)uno_keep(g);
- else uno_draw(g);
-}
-bool uno_valid(const Uno*g){
- if(g->rules.players<2||g->rules.players>4||g->rules.difficulty>2||g->rules.flags>31||!g->rng||
- g->turn>=g->rules.players||g->dealer>=g->rules.players||g->phase>U_MATCH||!g->xn||g->xn>108||g->dn>108||
- (g->direction!=1&&g->direction!=-1)||g->color>4||g->pending>104||g->event>E_STALEMATE)return false;
- if(g->color==4&&!(g->phase==U_COLOR&&g->offender==UNO_NONE))return false;
- const uint8_t ids[]={g->offender,g->candidate,g->winner,g->uno_player,g->uno_armed};
- for(unsigned i=0;i<sizeof ids;i++)if(ids[i]!=UNO_NONE&&ids[i]>=g->rules.players)return false;
- if(g->phase==U_DRAWN&&(g->drawn>=g->count[g->turn]||g->pending))return false;
- if(g->phase==U_CHALLENGE&&(!g->pending||g->penalty_kind!=4||g->offender==UNO_NONE))return false;
- if(g->pending&&g->penalty_kind!=2&&g->penalty_kind!=4)return false;
- if(g->phase==U_COLOR&&g->discard[g->xn-1]<52)return false;
- if(g->uno_player!=UNO_NONE&&g->count[g->uno_player]!=1)return false;
- if(g->candidate!=UNO_NONE&&g->count[g->candidate])return false;
- if(g->phase==U_MATCH&&(g->winner==UNO_NONE||g->count[g->winner]))return false;
- if(g->phase==U_ROUND&&g->winner!=UNO_NONE)return false;
- uint8_t hist[54]={0};int total=g->dn+g->xn;
- for(int p=0;p<4;p++){
- if(g->count[p]>108||(p>=g->rules.players&&g->count[p]))return false;
- total+=g->count[p];for(int i=0;i<g->count[p];i++){int c=g->hands[p][i];if(c>53)return false;hist[c]++;}
- }
- if(total!=108)return false;
- for(int i=0;i<g->dn;i++){if(g->deck[i]>53)return false;hist[g->deck[i]]++;}
- for(int i=0;i<g->xn;i++){if(g->discard[i]>53)return false;hist[g->discard[i]]++;}
- for(int c=0;c<54;c++)if(hist[c]!=(c>=52?4:c%13?2:1))return false;
- return true;
-}
diff --git a/games/uno/src/uno.h b/games/uno/src/uno.h
deleted file mode 100644
index 258db660..00000000
--- a/games/uno/src/uno.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Classic 108-card UNO. The rules engine has no graphics, clock or heap. */
-#ifndef UNO_H
-#define UNO_H
-#include <stdint.h>
-#include <stdbool.h>
-#define UNO_CARDS 108
-#define UNO_NONE 255
-enum { UNO_SKIP=10, UNO_REVERSE=11, UNO_DRAW2=12, UNO_WILD=52, UNO_DRAW4=53 };
-enum { U_TURN, U_COLOR, U_CHALLENGE, U_DRAWN, U_ROUND, U_MATCH };
-enum { R_STACK2=1, R_STACK4=2, R_DRAW_UNTIL=4, R_FORCE=8, R_AUTO_UNO=16 };
-enum { E_START, E_PLAY, E_DRAW, E_PASS, E_COLOR, E_PENALTY, E_CHALLENGE_WON,
- E_CHALLENGE_LOST, E_UNO, E_CAUGHT, E_ROUND, E_MATCH, E_STALEMATE };
-typedef struct { uint8_t players, difficulty, flags; } UnoRules;
-typedef struct {
- UnoRules rules;
- uint8_t hands[4][UNO_CARDS], count[4];
- uint8_t deck[UNO_CARDS], discard[UNO_CARDS], dn, xn;
- uint16_t round, turns;
- uint32_t rng;
- uint8_t dealer, turn, color, phase, pending, penalty_kind, offender;
- uint8_t guilty, old_color, drawn, candidate, winner, uno_player, uno_armed;
- uint8_t stalls, event, actor, card, amount;
- int8_t direction;
-} Uno;
-static inline int uno_color(int c) { return c<52?c/13:4; }
-static inline int uno_value(int c) { return c<52?c%13:c; }
-void uno_new(Uno*, UnoRules, uint32_t);
-void uno_next_round(Uno*);
-bool uno_can_play(const Uno*,int);
-bool uno_play(Uno*,int,bool);
-bool uno_choose_color(Uno*,int);
-bool uno_draw(Uno*);
-bool uno_keep(Uno*);
-bool uno_accept(Uno*);
-bool uno_challenge(Uno*);
-bool uno_call(Uno*,int);
-bool uno_catch(Uno*,int);
-int uno_bot_card(const Uno*);
-int uno_bot_color(const Uno*,int);
-void uno_bot(Uno*);
-bool uno_valid(const Uno*);
-#endif
diff --git a/games/uno/tests/eadk.h b/games/uno/tests/eadk.h
deleted file mode 100644
index d24a9127..00000000
--- a/games/uno/tests/eadk.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef UNO_HOST_EADK
-#define UNO_HOST_EADK
-#include <stdint.h>
-enum { eadk_key_left=0,eadk_key_up=1,eadk_key_down=2,eadk_key_right=3,eadk_key_ok=4,
- eadk_key_back=5,eadk_key_home=6,eadk_key_on_off=8,eadk_key_one=42,eadk_key_two=43,
- eadk_key_zero=48,eadk_key_exe=52 };
-uint64_t eadk_timing_millis(void);
-uint32_t eadk_random(void);
-uint64_t eadk_keyboard_scan(void);
-void eadk_display_wait_for_vblank(void);
-void eadk_timing_msleep(uint32_t);
-#endif
diff --git a/games/uno/tests/legacy-save.bin b/games/uno/tests/legacy-save.bin
deleted file mode 100644
index 82ebf21b..00000000
Binary files a/games/uno/tests/legacy-save.bin and /dev/null differ
diff --git a/games/uno/tests/play.c b/games/uno/tests/play.c
new file mode 100644
index 00000000..554d2932
--- /dev/null
+++ b/games/uno/tests/play.c
@@ -0,0 +1,937 @@
+/* UNO on a computer, for tests and pictures (make host, make test).
+ *
+ * play test DIR the rules against Mattel's instruction sheet (every card, two players, the challenge, UNO and
+ * its penalty, going out, scoring to 500, the house rules), the bots playing whole games to 500
+ * at every level (and the same game twice, to the same hash on every computer), a few hundred
+ * sessions of the whole app with random keys, saves written and read back, damaged saves
+ * play shots DIR pictures of the screens (DIR/<name>.ppm)
+ * play film DIR MS SEED MS milliseconds of a game, a bot playing your cards too (DIR/<frame>_<ms>.raw, for
+ * tools/record.py --frames)
+ */
+#define main uno_app_main
+#include "../src/main.c"
+#undef main
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* ---------------------------------------------------------------- the calculator, on a computer */
+static uint16_t fb[240][320];
+static void (*on_frame)(void);
+void plat_push(int x, int y, int w, int h, const uint16_t *px) {
+ for (int j = 0; j < h; j++)
+ for (int i = 0; i < w; i++) fb[y + j][x + i] = px[j * w + i];
+ if (on_frame && y + h == 240) on_frame();
+}
+void *np_alloc(uint32_t n) { (void)n; return 0; }
+static double clock_ms;
+static uint32_t (*script)(uint32_t frame);
+static uint32_t frame_no, quit_at;
+static void (*watch)(void);
+uint32_t plat_keys(void) {
+ clock_ms += 10;
+ frame_no++;
+ if (watch) watch();
+ if (frame_no >= quit_at) return K_HOME;
+ return script ? script(frame_no) : 0;
+}
+uint32_t plat_millis(void) { return (uint32_t)clock_ms; }
+void plat_sleep(uint32_t ms) { clock_ms += ms; }
+uint32_t plat_random(void) { return 0x9E3779B9u ^ frame_no; }
+void plat_begin(void) {}
+int plat_end(void) { return 0; }
+
+static struct { char name[32]; uint8_t data[4096]; uint32_t len; bool on; } files[4];
+static bool storage_full;
+bool plat_save(const char *name, const void *data, uint32_t len) {
+ if (storage_full) return false;
+ int k = -1;
+ for (int i = 0; i < 4; i++)
+ if (files[i].on && !strcmp(files[i].name, name)) k = i;
+ for (int i = 0; i < 4 && k < 0; i++)
+ if (!files[i].on) k = i;
+ if (k < 0 || len > sizeof files[k].data) return false;
+ strcpy(files[k].name, name), memcpy(files[k].data, data, len), files[k].len = len, files[k].on = true;
+ return true;
+}
+const uint8_t *plat_load(const char *name, uint32_t *len) {
+ for (int i = 0; i < 4; i++)
+ if (files[i].on && !strcmp(files[i].name, name)) return *len = files[i].len, files[i].data;
+ return 0;
+}
+static void forget(const char *name) {
+ for (int i = 0; i < 4; i++)
+ if (files[i].on && !strcmp(files[i].name, name)) files[i].on = false;
+}
+static uint8_t *file_data(const char *name, uint32_t *len) {
+ for (int i = 0; i < 4; i++)
+ if (files[i].on && !strcmp(files[i].name, name)) return *len = files[i].len, files[i].data;
+ return 0;
+}
+
+static void shot(const char *dir, const char *name) {
+ char path[512];
+ snprintf(path, sizeof path, "%s/%s.ppm", dir, name);
+ FILE *f = fopen(path, "wb");
+ if (!f) exit(2);
+ fprintf(f, "P6 320 240 255\n");
+ for (int y = 0; y < 240; y++)
+ for (int x = 0; x < 320; x++) {
+ uint16_t c = fb[y][x];
+ fputc((c >> 11) * 255 / 31, f), fputc((c >> 5 & 63) * 255 / 63, f), fputc((c & 31) * 255 / 31, f);
+ }
+ fclose(f);
+}
+
+static int fails;
+#define CHECK(c, ...) do { if (!(c)) { fails++; printf("FAIL %s:%d: ", __FILE__, __LINE__); printf(__VA_ARGS__); printf("\n"); } } while (0)
+
+/* ---------------------------------------------------------------- tables made to order */
+#define R(c, v) ((c) * 13 + (v))
+static uno_game T;
+
+/* n players, the house rules, every card in the draw pile (in order, its top the last), nothing dealt; then
+ top(card) turns a card, give(p, card) hands one over */
+static void blank(uno_game *g, int n, int house) {
+ uno_new_game(g, (uno_rules){(uint8_t)n, LEVEL_NORMAL, 0, (uint8_t)house}, 7);
+ uno_fill_deck(g->deck);
+ g->dn = UNO_DECK, g->pn = 0;
+ memset(g->count, 0, sizeof g->count);
+ memset(g->hand, 0, sizeof g->hand);
+ g->turn = 0, g->dealer = (uint8_t)(n - 1), g->dir = 1, g->phase = P_PLAY, g->pending = 0, g->opening = 0;
+ g->out = g->uno_open = g->uno_said = g->winner = g->offender = g->drawn = UNO_NONE;
+}
+static void pull(uno_game *g, int card) {
+ for (int i = g->dn - 1; i >= 0; i--)
+ if (g->deck[i] == card) {
+ memmove(&g->deck[i], &g->deck[i + 1], (size_t)(g->dn - i - 1));
+ g->dn--;
+ return;
+ }
+ printf("no %d left in the deck\n", card);
+ exit(1);
+}
+static void top(uno_game *g, int card) {
+ pull(g, card);
+ g->pile[g->pn++] = (uint8_t)card;
+ g->color = (uint8_t)uno_color(card);
+}
+static void give(uno_game *g, int p, int card) {
+ pull(g, card);
+ g->hand[p][g->count[p]++] = (uint8_t)card;
+}
+/* the draw pile's next card */
+static void next_draw(uno_game *g, int card) {
+ pull(g, card);
+ g->deck[g->dn++] = (uint8_t)card;
+}
+static int find(const uno_game *g, int p, int card) {
+ for (int i = 0; i < g->count[p]; i++)
+ if (g->hand[p][i] == card) return i;
+ return -1;
+}
+
+/* ---------------------------------------------------------------- the rules */
+static void deck_and_points(void) {
+ uint8_t d[UNO_DECK];
+ uno_fill_deck(d);
+ int per[5] = {0}, zero = 0, skip = 0, rev = 0, d2 = 0, wild = 0, w4 = 0;
+ for (int i = 0; i < UNO_DECK; i++) {
+ int c = d[i], v = uno_value(c);
+ per[uno_color(c)]++;
+ zero += c < 52 && v == 0, skip += c < 52 && v == V_SKIP, rev += c < 52 && v == V_REVERSE, d2 += c < 52 && v == V_DRAW2;
+ wild += c == C_WILD, w4 += c == C_WILD4;
+ }
+ CHECK(per[0] == 25 && per[1] == 25 && per[2] == 25 && per[3] == 25 && per[4] == 8, "25 cards a colour, 8 Wilds");
+ CHECK(zero == 4 && skip == 8 && rev == 8 && d2 == 8 && wild == 4 && w4 == 4, "the action cards");
+ int numbers = 0;
+ for (int i = 0; i < UNO_DECK; i++) numbers += d[i] < 52 && uno_value(d[i]) < 10;
+ CHECK(numbers == 76, "19 number cards a colour");
+ CHECK(uno_points(R(RED, 0)) == 0 && uno_points(R(BLUE, 7)) == 7 && uno_points(R(GREEN, 9)) == 9, "numbers: face value");
+ CHECK(uno_points(R(RED, V_SKIP)) == 20 && uno_points(R(RED, V_REVERSE)) == 20 && uno_points(R(RED, V_DRAW2)) == 20,
+ "Skip, Reverse, Draw Two: 20");
+ CHECK(uno_points(C_WILD) == 50 && uno_points(C_WILD4) == 50, "Wilds: 50");
+}
+
+static void dealing(void) {
+ /* a new game: a dealer, seven cards each, a first card that isn't a Wild Draw Four */
+ int dealers[4] = {0};
+ for (uint32_t s = 1; s <= 400; s++) {
+ uno_new_game(&T, (uno_rules){4, LEVEL_NORMAL, 0, 0}, s);
+ CHECK(uno_valid(&T), "a valid deal (seed %u)", s);
+ CHECK(T.pn == 1 && T.pile[0] != C_WILD4, "no Wild Draw Four first (seed %u)", s);
+ int dealt = 0;
+ for (int p = 0; p < 4; p++) dealt += T.count[p];
+ CHECK(dealt >= 28 && dealt <= 30 && T.dn == UNO_DECK - dealt - 1, "seven cards each (seed %u)", s);
+ dealers[T.dealer]++;
+ }
+ CHECK(dealers[0] > 60 && dealers[1] > 60 && dealers[2] > 60 && dealers[3] > 60, "anyone can deal: %d %d %d %d",
+ dealers[0], dealers[1], dealers[2], dealers[3]);
+ /* the first card: on a deck laid out so that it comes up after the deal */
+ struct { int card, n, turn, dir, phase, victim_cards; } first[] = {
+ {R(RED, 5), 4, 0, 1, P_PLAY, 7}, /* the dealer (3)'s left (0) starts */
+ {R(RED, V_SKIP), 4, 1, 1, P_PLAY, 7}, /* the dealer's left is skipped */
+ {R(RED, V_REVERSE), 4, 3, -1, P_PLAY, 7}, /* the dealer starts, to the right */
+ {R(RED, V_REVERSE), 2, 1, 1, P_PLAY, 7}, /* two players: the dealer starts */
+ {R(RED, V_DRAW2), 4, 1, 1, P_PLAY, 9}, /* the dealer's left draws 2 and is skipped */
+ {C_WILD, 4, 0, 1, P_COLOR, 7}, /* the dealer's left calls the colour, then plays */
+ };
+ for (unsigned k = 0; k < sizeof first / sizeof first[0]; k++) {
+ int n = first[k].n;
+ blank(&T, n, 0);
+ T.dealer = (uint8_t)(n - 1);
+ pull(&T, first[k].card);
+ memmove(&T.deck[UNO_DECK - 7 * n], &T.deck[UNO_DECK - 7 * n - 1], (size_t)(7 * n));
+ T.deck[UNO_DECK - 7 * n - 1] = (uint8_t)first[k].card;
+ T.dn = UNO_DECK;
+ uno_deal(&T);
+ CHECK(T.pile[0] == first[k].card && T.turn == first[k].turn && T.dir == first[k].dir && T.phase == first[k].phase,
+ "first card %d: turn %d dir %d phase %d", first[k].card, T.turn, T.dir, T.phase);
+ CHECK(T.count[0] == first[k].victim_cards, "first card %d: the dealer's left has %d cards", first[k].card, T.count[0]);
+ CHECK(uno_valid(&T), "first card %d: valid", first[k].card);
+ }
+ /* a Wild first: the first player calls the colour, then plays */
+ CHECK(uno_choose(&T, BLUE) && T.phase == P_PLAY && T.turn == 0 && T.color == BLUE, "the first Wild's colour");
+ /* a Wild Draw Four turned first goes back in the deck and another is turned */
+ blank(&T, 3, 0);
+ T.dealer = 2;
+ pull(&T, C_WILD4);
+ memmove(&T.deck[UNO_DECK - 21], &T.deck[UNO_DECK - 22], 21);
+ T.deck[UNO_DECK - 22] = C_WILD4;
+ T.dn = UNO_DECK;
+ uno_deal(&T);
+ CHECK(T.pile[0] != C_WILD4 && T.pn == 1 && uno_valid(&T), "a first Wild Draw Four is turned back");
+ /* the deal goes to the left */
+ uno_new_game(&T, (uno_rules){3, LEVEL_NORMAL, 0, 0}, 99);
+ int d0 = T.dealer;
+ uno_next_hand(&T);
+ CHECK(T.dealer == (d0 + 1) % 3 && T.hands == 2, "the deal passes to the left");
+}
+
+static void action_cards(void) {
+ /* matching */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 2)), give(&T, 0, R(BLUE, 5)), give(&T, 0, R(BLUE, 7)), give(&T, 0, C_WILD), give(&T, 0, C_WILD4);
+ CHECK(uno_can_play(&T, 0) && uno_can_play(&T, 1) && !uno_can_play(&T, 2) && uno_can_play(&T, 3) && uno_can_play(&T, 4),
+ "colour, number, Wilds");
+ CHECK(!uno_play(&T, 2, false) && T.count[0] == 5, "a card that doesn't go");
+ /* a number: the next player */
+ CHECK(uno_play(&T, 0, false) && T.turn == 1 && T.color == RED && T.pile[T.pn - 1] == R(RED, 2), "a number");
+ /* symbols match symbols */
+ blank(&T, 3, 0);
+ top(&T, R(RED, V_SKIP));
+ give(&T, 0, R(GREEN, V_SKIP)), give(&T, 0, R(GREEN, 1));
+ CHECK(uno_can_play(&T, 0) && !uno_can_play(&T, 1), "a Skip on a Skip");
+ /* Skip */
+ CHECK(uno_play(&T, 0, false) && T.turn == 2 && T.color == GREEN, "Skip: player 1 misses a turn");
+ /* Reverse, three and four players */
+ for (int n = 3; n <= 4; n++) {
+ blank(&T, n, 0);
+ top(&T, R(RED, 1));
+ give(&T, 0, R(RED, V_REVERSE)), give(&T, 0, R(RED, 3));
+ CHECK(uno_play(&T, 0, false) && T.dir == -1 && T.turn == n - 1, "Reverse (%d players): to the right", n);
+ }
+ /* Draw Two */
+ blank(&T, 3, 0);
+ top(&T, R(BLUE, 1));
+ give(&T, 0, R(BLUE, V_DRAW2)), give(&T, 0, R(RED, 3));
+ CHECK(uno_play(&T, 0, false) && T.count[1] == 2 && T.turn == 2 && T.phase == P_PLAY, "Draw Two: 2 cards, skipped");
+ CHECK(T.ev_victim == 1 && T.ev_n == 2, "Draw Two: the message");
+ /* Wild */
+ blank(&T, 3, 0);
+ top(&T, R(BLUE, 1));
+ give(&T, 0, C_WILD), give(&T, 0, R(RED, 3));
+ CHECK(uno_play(&T, 0, false) && T.phase == P_COLOR && T.turn == 0 && T.color == NO_COLOR, "Wild: call a colour");
+ CHECK(uno_valid(&T), "valid while calling");
+ CHECK(!uno_choose(&T, 4) && uno_choose(&T, GREEN) && T.color == GREEN && T.turn == 1 && T.phase == P_PLAY, "Wild: green");
+ /* Wild Draw Four, taken */
+ blank(&T, 3, 0);
+ top(&T, R(BLUE, 1));
+ give(&T, 0, C_WILD4), give(&T, 0, R(RED, 3));
+ CHECK(uno_play(&T, 0, false) && T.phase == P_COLOR && uno_choose(&T, RED), "Wild Draw Four: a colour");
+ CHECK(T.phase == P_PENALTY && T.turn == 1 && T.pending == 4 && T.challengeable && !T.guilty, "next player: 4 waiting");
+ CHECK(uno_valid(&T), "valid with a penalty waiting");
+ CHECK(!uno_draw(&T) && uno_take(&T) && T.count[1] == 4 && T.turn == 2 && T.color == RED, "taken: 4 cards, skipped");
+}
+
+static void challenge(void) {
+ /* guilty: it had a card of the colour in play */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, C_WILD4), give(&T, 0, R(RED, 8)), give(&T, 0, R(BLUE, 2));
+ give(&T, 1, R(GREEN, 1));
+ CHECK(!uno_legal_wild4(&T, 0), "a red card: not allowed");
+ CHECK(uno_play(&T, 0, false) && uno_choose(&T, BLUE) && T.guilty && T.prev_color == RED, "a bluff");
+ CHECK(uno_challenge(&T) && T.count[0] == 6 && T.count[1] == 1 && T.turn == 1 && T.phase == P_PLAY,
+ "challenge won: the bluffer draws 4, the challenger plays");
+ CHECK(T.color == BLUE && T.ev == E_CHALLENGE_WON, "the colour called stays");
+ /* not guilty: other numbers and symbols, and Wilds, don't count */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, C_WILD4), give(&T, 0, R(BLUE, 5)), give(&T, 0, C_WILD), give(&T, 0, R(GREEN, V_SKIP));
+ give(&T, 1, R(GREEN, 1));
+ CHECK(uno_legal_wild4(&T, 0), "no red card: allowed");
+ CHECK(uno_play(&T, 0, false) && uno_choose(&T, BLUE) && !T.guilty, "honest");
+ CHECK(uno_challenge(&T) && T.count[1] == 7 && T.turn == 2 && T.count[0] == 3, "challenge lost: 6 cards, skipped");
+ /* only a waiting Wild Draw Four can be challenged */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, V_DRAW2)), give(&T, 0, R(RED, 1));
+ uno_play(&T, 0, false);
+ CHECK(!uno_challenge(&T), "no challenge on a Draw Two");
+ /* two players: after a Wild Draw Four taken, the same player again */
+ blank(&T, 2, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, C_WILD4), give(&T, 0, R(BLUE, 1));
+ uno_play(&T, 0, false), uno_choose(&T, BLUE);
+ CHECK(uno_take(&T) && T.turn == 0 && T.count[1] == 4, "two players: +4 taken, the same player plays");
+}
+
+static void two_players(void) {
+ blank(&T, 2, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, V_REVERSE)), give(&T, 0, R(RED, V_SKIP)), give(&T, 0, R(RED, V_DRAW2)), give(&T, 0, R(RED, 1));
+ CHECK(uno_play(&T, 0, false) && T.turn == 0 && T.dir == 1, "Reverse is a Skip: play again");
+ CHECK(uno_play(&T, 0, false) && T.turn == 0, "Skip: play again");
+ CHECK(uno_play(&T, 0, false) && T.turn == 0 && T.count[1] == 2, "Draw Two: 2 cards, play again");
+}
+
+static void drawing(void) {
+ /* a card that goes: it may be played, and only it */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(BLUE, 1)), give(&T, 0, R(RED, 2));
+ next_draw(&T, R(RED, 9));
+ CHECK(uno_draw(&T) && T.phase == P_DRAWN && T.count[0] == 3 && T.drawn == 2 && T.turn == 0, "drew a card that goes");
+ CHECK(!uno_can_play(&T, 1) && uno_can_play(&T, 2), "only the card drawn");
+ CHECK(uno_play(&T, 2, false) && T.turn == 1 && T.pile[T.pn - 1] == R(RED, 9), "played at once");
+ /* or kept */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(BLUE, 1));
+ next_draw(&T, R(RED, 9));
+ CHECK(uno_draw(&T) && uno_keep(&T) && T.turn == 1 && T.count[0] == 2, "kept");
+ /* one that doesn't go: the turn passes */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(BLUE, 1));
+ next_draw(&T, R(GREEN, 9));
+ CHECK(uno_draw(&T) && T.turn == 1 && T.phase == P_PLAY && T.lacks[0] == 1 << RED, "no luck: next player");
+ /* allowed with a card that goes */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 1));
+ CHECK(uno_draw(&T), "drawing instead of playing");
+ /* the draw pile runs out: the discards but the top one are shuffled into it */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(BLUE, 1));
+ while (T.dn > 1) T.pile[T.pn++] = T.deck[--T.dn];
+ int last = T.deck[0], topc = T.pile[T.pn - 1], before = T.pn;
+ T.color = (uint8_t)(uno_color(topc) < 4 ? uno_color(topc) : RED);
+ T.dn = 0, T.pile[T.pn++] = (uint8_t)last;
+ T.color = (uint8_t)(uno_color(last) < 4 ? uno_color(last) : RED);
+ CHECK(uno_valid(&T), "an empty draw pile: valid");
+ uno_draw(&T);
+ CHECK(T.pn == 1 && T.pile[0] == last && T.dn == before - 1 && uno_valid(&T), "a new draw pile, the top card stays");
+}
+
+static void uno_calls(void) {
+ /* forgot: caught, 2 cards */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 1)), give(&T, 0, R(BLUE, 2));
+ CHECK(uno_play(&T, 0, false) && T.uno_open == 0, "one card left, no UNO");
+ CHECK(!uno_catch(&T, 0), "you can't catch yourself");
+ CHECK(uno_catch(&T, 2) && T.count[0] == 3 && T.uno_open == UNO_NONE && T.ev == E_CAUGHT, "caught: 2 cards");
+ /* said in time, after the card: safe */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 1)), give(&T, 0, R(BLUE, 2));
+ uno_play(&T, 0, false);
+ CHECK(uno_call(&T, 0) && T.uno_open == UNO_NONE && !uno_catch(&T, 1), "said before anyone caught it");
+ /* said with the next-to-last card */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 1)), give(&T, 0, R(BLUE, 2));
+ CHECK(uno_call(&T, 0) && uno_play(&T, 0, false) && T.uno_open == UNO_NONE, "said first");
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 1)), give(&T, 0, R(BLUE, 2));
+ CHECK(uno_play(&T, 0, true) && T.uno_open == UNO_NONE && T.ev_by == 0, "said with the card");
+ /* too late once the next player has started */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 1)), give(&T, 0, R(BLUE, 2));
+ give(&T, 1, R(RED, 3)), give(&T, 1, R(RED, 4));
+ uno_play(&T, 0, false);
+ CHECK(uno_play(&T, 0, true) && !uno_catch(&T, 2) && T.count[0] == 1, "too late after the next card");
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 1)), give(&T, 0, R(BLUE, 2));
+ uno_play(&T, 0, false);
+ CHECK(uno_draw(&T) && !uno_catch(&T, 2), "too late after the next player draws");
+ /* not with more cards */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 1)), give(&T, 0, R(BLUE, 2)), give(&T, 0, R(BLUE, 3));
+ CHECK(!uno_call(&T, 0), "UNO with three cards");
+ /* the window stays open while a Wild's colour is called */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, C_WILD), give(&T, 0, R(BLUE, 2));
+ uno_play(&T, 0, false);
+ CHECK(T.uno_open == 0 && uno_choose(&T, BLUE) && T.uno_open == 0 && uno_catch(&T, 1) && T.count[0] == 3,
+ "caught after the colour");
+ /* house rule: UNO said for everyone */
+ blank(&T, 3, H_AUTO_UNO);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 1)), give(&T, 0, R(BLUE, 2));
+ CHECK(uno_play(&T, 0, false) && T.uno_open == UNO_NONE, "automatic UNO");
+}
+
+static void going_out(void) {
+ /* a number: the hand is over, the others' cards scored */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 1));
+ give(&T, 1, R(BLUE, 7)), give(&T, 1, C_WILD), give(&T, 2, R(GREEN, V_SKIP)), give(&T, 2, R(GREEN, 3));
+ CHECK(uno_play(&T, 0, false) && T.phase == P_HAND_OVER && T.winner == 0 && T.gained == 7 + 50 + 20 + 3 &&
+ T.score[0] == 80, "out: 80 points");
+ CHECK(uno_valid(&T), "valid after the hand");
+ /* a Draw Two last: the next player draws and it counts */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, V_DRAW2));
+ give(&T, 1, R(BLUE, 7)), give(&T, 2, R(GREEN, 3));
+ next_draw(&T, R(YELLOW, 9)), next_draw(&T, R(YELLOW, 8));
+ CHECK(uno_play(&T, 0, false) && T.phase == P_HAND_OVER && T.count[1] == 3 && T.gained == 7 + 8 + 9 + 3,
+ "a last Draw Two counts: %d", T.gained);
+ /* a Wild last: no colour to call */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, C_WILD), give(&T, 1, R(BLUE, 7)), give(&T, 2, R(GREEN, 3));
+ CHECK(uno_play(&T, 0, false) && T.phase == P_HAND_OVER && T.gained == 10, "out on a Wild");
+ /* a Wild Draw Four last, taken: counts */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, C_WILD4), give(&T, 1, R(BLUE, 7)), give(&T, 2, R(GREEN, 3));
+ next_draw(&T, R(YELLOW, 1)), next_draw(&T, R(YELLOW, 2)), next_draw(&T, R(YELLOW, 3)), next_draw(&T, R(YELLOW, 4));
+ CHECK(uno_play(&T, 0, false) && T.phase == P_COLOR && uno_choose(&T, GREEN) && T.phase == P_PENALTY, "a last +4");
+ CHECK(uno_valid(&T), "valid with the last +4 waiting");
+ CHECK(uno_take(&T) && T.phase == P_HAND_OVER && T.gained == 7 + 10 + 3, "a last +4 taken counts: %d", T.gained);
+ /* a Wild Draw Four last is always allowed: challenged, the challenger draws 6 and it counts */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, C_WILD4), give(&T, 1, R(BLUE, 7)), give(&T, 2, R(GREEN, 3));
+ uno_play(&T, 0, false), uno_choose(&T, GREEN);
+ CHECK(!T.guilty && uno_challenge(&T) && T.phase == P_HAND_OVER && T.count[1] == 7, "a last +4 challenged: 6 cards");
+ /* to 500 */
+ blank(&T, 2, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 1)), give(&T, 1, C_WILD);
+ T.score[0] = 460, T.score[1] = 499;
+ CHECK(uno_play(&T, 0, false) && T.phase == P_GAME_OVER && T.winner == 0 && T.score[0] == 510, "500: the game is won");
+ blank(&T, 2, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 1)), give(&T, 1, R(BLUE, 2));
+ T.score[0] = 400;
+ CHECK(uno_play(&T, 0, false) && T.phase == P_HAND_OVER && T.score[0] == 402, "short of 500: another hand");
+ /* a single hand */
+ blank(&T, 2, 0);
+ T.r.one_hand = 1;
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, 1)), give(&T, 1, R(BLUE, 2));
+ CHECK(uno_play(&T, 0, false) && T.phase == P_GAME_OVER && T.winner == 0, "one hand: over");
+}
+
+static void house_rules(void) {
+ /* stacking Draw Twos */
+ blank(&T, 3, H_STACK2);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, V_DRAW2)), give(&T, 0, R(RED, 1));
+ give(&T, 1, R(BLUE, V_DRAW2)), give(&T, 1, R(BLUE, 1));
+ give(&T, 2, R(GREEN, 1));
+ CHECK(uno_play(&T, 0, false) && T.phase == P_PENALTY && T.turn == 1 && T.pending == 2 && !T.challengeable, "+2 waits");
+ CHECK(uno_can_stack(&T) && !uno_can_play(&T, 1) && uno_play(&T, 0, false) && T.turn == 2 && T.pending == 4, "stacked");
+ CHECK(!uno_can_stack(&T) && uno_take(&T) && T.count[2] == 5 && T.turn == 0, "4 taken");
+ /* stacking Wild Draw Fours: a stacked one can't be challenged */
+ blank(&T, 3, H_STACK4);
+ top(&T, R(RED, 5));
+ give(&T, 0, C_WILD4), give(&T, 0, R(GREEN, 1)), give(&T, 1, C_WILD4), give(&T, 1, R(BLUE, 1)), give(&T, 2, R(GREEN, 2));
+ uno_play(&T, 0, false), uno_choose(&T, BLUE);
+ CHECK(T.challengeable && uno_can_stack(&T) && uno_play(&T, 0, false) && uno_choose(&T, GREEN), "+4 on +4");
+ CHECK(T.turn == 2 && T.pending == 8 && !T.challengeable && !uno_challenge(&T) && uno_take(&T) && T.count[2] == 9,
+ "8 taken, no challenge");
+ /* no stacking on a last card */
+ blank(&T, 3, H_STACK2);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(RED, V_DRAW2)), give(&T, 1, R(BLUE, V_DRAW2)), give(&T, 2, R(GREEN, 1));
+ CHECK(uno_play(&T, 0, false) && T.phase == P_HAND_OVER && T.count[1] == 3, "a last Draw Two is taken at once");
+ /* without stacking a Draw Two can't answer a waiting Wild Draw Four */
+ blank(&T, 3, 0);
+ top(&T, R(RED, 5));
+ give(&T, 0, C_WILD4), give(&T, 0, R(GREEN, 1)), give(&T, 1, R(BLUE, V_DRAW2)), give(&T, 1, C_WILD4);
+ uno_play(&T, 0, false), uno_choose(&T, BLUE);
+ CHECK(!uno_can_stack(&T) && !uno_can_play(&T, 0) && !uno_can_play(&T, 1), "official: no stacking");
+ /* draw until you can play */
+ blank(&T, 3, H_DRAW_UNTIL);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(BLUE, 1));
+ next_draw(&T, R(RED, 9)), next_draw(&T, R(GREEN, 2)), next_draw(&T, R(GREEN, 3));
+ CHECK(uno_draw(&T) && T.count[0] == 4 && T.phase == P_DRAWN && T.ev_n == 3, "drew 3 until one goes");
+ /* a playable drawn card must be played */
+ blank(&T, 3, H_MUST_PLAY);
+ top(&T, R(RED, 5));
+ give(&T, 0, R(BLUE, 1));
+ next_draw(&T, R(RED, 9));
+ CHECK(uno_draw(&T) && !uno_keep(&T) && uno_play(&T, 1, false), "must play it");
+}
+
+static void validity(void) {
+ uno_new_game(&T, (uno_rules){4, LEVEL_HARD, 0, H_ALL}, 5);
+ CHECK(uno_valid(&T), "a fresh game");
+ uno_game b = T;
+ b.hand[1][0] = b.hand[2][0];
+ CHECK(!uno_valid(&b), "a card twice");
+ b = T, b.count[0]++;
+ CHECK(!uno_valid(&b), "a card too many");
+ b = T, b.turn = 4;
+ CHECK(!uno_valid(&b), "a turn past the table");
+ b = T, b.phase = 9;
+ CHECK(!uno_valid(&b), "a phase that isn't");
+ b = T, b.color = NO_COLOR;
+ CHECK(!uno_valid(&b), "no colour outside a Wild");
+}
+
+/* ---------------------------------------------------------------- the bots */
+static uint32_t hash_game(const uno_game *g, uint32_t h) {
+ return uno_sum(g, sizeof *g) ^ (h * 16777619u);
+}
+
+/* a whole game, bots in every seat (their levels), catches included; the hash of every step */
+static int bot_game(uno_rules r, uint32_t seed, const int *levels, uint32_t *hash, int *hands_out) {
+ uno_new_game(&T, r, seed);
+ uint32_t h = 0;
+ int steps = 0, gained = 0, hands = 1;
+ while (T.phase != P_GAME_OVER && steps < 400000) {
+ if (T.phase == P_HAND_OVER) {
+ gained += T.gained;
+ uno_next_hand(&T);
+ hands++;
+ CHECK(uno_valid(&T), "a new hand: valid");
+ continue;
+ }
+ int p = T.turn;
+ uno_move m = bot_move(&T, levels[p]);
+ if (!bot_do(&T, m)) {
+ CHECK(0, "seed %u step %d: the bot's move %d (%d) was refused (phase %d)", seed, steps, m.act, m.arg, T.phase);
+ return -1;
+ }
+ if (T.uno_open != UNO_NONE)
+ for (int b = 0; b < r.players; b++) {
+ uint32_t ms;
+ if (b != T.uno_open && bot_catches(&T, b, levels[b], &ms)) {
+ uno_catch(&T, b);
+ break;
+ }
+ }
+ if (!uno_valid(&T)) {
+ CHECK(0, "seed %u step %d: not valid after move %d", seed, steps, m.act);
+ return -1;
+ }
+ h = hash_game(&T, h);
+ steps++;
+ }
+ CHECK(T.phase == P_GAME_OVER, "seed %u: the game ends (%d steps)", seed, steps);
+ gained += T.gained;
+ int total = 0;
+ for (int p = 0; p < r.players; p++) total += T.score[p];
+ CHECK(total == gained, "seed %u: the scores add up (%d, %d)", seed, total, gained);
+ CHECK(r.one_hand || T.score[T.winner] >= UNO_GOAL, "seed %u: 500 reached", seed);
+ if (hash) *hash = h;
+ if (hands_out) *hands_out = hands;
+ return T.winner;
+}
+
+static void bots(void) {
+ int games = 0, hands = 0;
+ for (int n = 2; n <= 4; n++)
+ for (int level = 0; level < 3; level++)
+ for (int house = 0; house < 4; house++) {
+ static const uint8_t mix[4] = {0, H_STACK2 | H_STACK4, H_DRAW_UNTIL | H_MUST_PLAY, H_ALL};
+ int levels[4] = {level, level, level, level};
+ for (uint32_t s = 1; s <= 4; s++) {
+ int k = 0;
+ bot_game((uno_rules){(uint8_t)n, (uint8_t)level, 0, mix[house]}, s * 7919 + (uint32_t)(n * 100 + level * 10 + house),
+ levels, 0, &k);
+ games++, hands += k;
+ }
+ }
+ printf("bots: %d games to 500 (%d hands), every step valid\n", games, hands);
+ /* the levels: who wins, two players to 500 */
+ struct { int a, b, min; } duel[] = {{LEVEL_HARD, LEVEL_EASY, 60}, {LEVEL_NORMAL, LEVEL_EASY, 55}, {LEVEL_HARD, LEVEL_NORMAL, 50}};
+ for (int d = 0; d < 3; d++) {
+ int wins = 0, n = 200;
+ for (int s = 0; s < n; s++) {
+ /* each seat in turn, so the dealer's luck evens out */
+ int levels[4] = {duel[d].a, duel[d].b, 0, 0};
+ if (s & 1) levels[0] = duel[d].b, levels[1] = duel[d].a;
+ int w = bot_game((uno_rules){2, LEVEL_NORMAL, 0, 0}, 1000u + (uint32_t)s, levels, 0, 0);
+ wins += w == (s & 1 ? 1 : 0);
+ }
+ printf("bots: %s beat %s in %d of %d games\n", (const char *[]){"Easy", "Normal", "Hard"}[duel[d].a],
+ (const char *[]){"Easy", "Normal", "Hard"}[duel[d].b], wins, n);
+ CHECK(wins * 100 >= duel[d].min * n, "level %d against %d: %d of %d", duel[d].a, duel[d].b, wins, n);
+ }
+ /* four at the table, every level, many hands: the same game twice, to the same hash on every computer */
+ uint32_t h1, h2;
+ int levels[4] = {LEVEL_HARD, LEVEL_EASY, LEVEL_NORMAL, LEVEL_HARD};
+ bot_game((uno_rules){4, LEVEL_NORMAL, 0, 0}, 2026, levels, &h1, 0);
+ bot_game((uno_rules){4, LEVEL_NORMAL, 0, 0}, 2026, levels, &h2, 0);
+ printf("bots: a game's hash %08X\n", h1);
+ CHECK(h1 == h2 && h1 == 0x6205C6AFu, "the same game twice, and as on every computer: %08X", h1);
+}
+
+/* ---------------------------------------------------------------- saves */
+static void saves(void) {
+ memset(files, 0, sizeof files);
+ uno_progress a, b;
+ uno_fresh(&a);
+ CHECK(!save_load(&b) && b.setup.players == 4 && b.setup.level == LEVEL_NORMAL && !b.has_game, "no save: a fresh start");
+ a.setup = (uno_rules){3, LEVEL_HARD, 1, H_STACK2 | H_AUTO_UNO};
+ a.guide = 1, a.has_game = 1;
+ uno_new_game(&a.g, a.setup, 31337);
+ for (int i = 0; i < 40 && a.g.phase < P_HAND_OVER; i++) bot_do(&a.g, bot_move(&a.g, LEVEL_NORMAL));
+ CHECK(save_write(&a), "written");
+ uint32_t n;
+ uint8_t *d = file_data(UNO_SAVE_NAME, &n);
+ CHECK(d && n == sizeof(uno_file) && n == 728 && !memcmp(d, "UNO1", 4), "uno.sav: %u bytes", n);
+ CHECK(save_load(&b) && !memcmp(&a, &b, sizeof a), "read back exactly");
+ /* damaged: the copy in the script brings it back */
+ d[100] ^= 0x55;
+ CHECK(save_load(&b) && !memcmp(&a, &b, sizeof a), "a damaged save: back from the copy");
+ d = file_data(UNO_SAVE_NAME, &n);
+ CHECK(d && !memcmp(d + 4, (uint8_t[]){1, 0, 216, 2}, 4), "and written again");
+ /* cut short */
+ files[0].len = 300;
+ CHECK(save_load(&b) && !memcmp(&a, &b, sizeof a), "a save cut short: back from the copy");
+ /* both damaged: a clean fresh start */
+ d = file_data(UNO_SAVE_NAME, &n);
+ d[200] ^= 1;
+ uint8_t *c = file_data(UNO_COPY_NAME, &n);
+ c[n - 10] = c[n - 10] == 'A' ? 'B' : 'A';
+ CHECK(!save_load(&b) && !b.has_game && b.setup.players == 4, "both damaged: a fresh start");
+ /* the script gone too */
+ forget(UNO_COPY_NAME);
+ CHECK(!save_load(&b) && !b.has_game, "damaged, no copy: a fresh start");
+ /* the right checksum over a wrong game: refused */
+ save_write(&a);
+ d = file_data(UNO_SAVE_NAME, &n);
+ uno_file f;
+ memcpy(&f, d, sizeof f);
+ f.p.g.hand[0][0] = f.p.g.hand[1][0];
+ f.sum = uno_sum(&f, offsetof(uno_file, sum));
+ memcpy(d, &f, sizeof f);
+ forget(UNO_COPY_NAME);
+ CHECK(!save_load(&b) && !b.has_game, "a card twice, summed right: refused");
+ /* another version: refused */
+ save_write(&a);
+ d = file_data(UNO_SAVE_NAME, &n);
+ memcpy(&f, d, sizeof f);
+ f.version = 2;
+ f.sum = uno_sum(&f, offsetof(uno_file, sum));
+ memcpy(d, &f, sizeof f);
+ forget(UNO_COPY_NAME);
+ CHECK(!save_load(&b), "another version: refused");
+ /* where the emulator test looks: has_game, the players, the score */
+ CHECK(offsetof(uno_file, p.has_game) == 13 && offsetof(uno_file, p.g.r.players) == 16 &&
+ offsetof(uno_file, p.g.score) == 674 && offsetof(uno_file, p.g.hands) == 682,
+ "offsets %zu %zu %zu %zu", offsetof(uno_file, p.has_game), offsetof(uno_file, p.g.r.players),
+ offsetof(uno_file, p.g.score), offsetof(uno_file, p.g.hands));
+}
+
+/* ---------------------------------------------------------------- the whole app, with keys */
+static uint32_t lcg;
+static uint32_t rnd(void) { return lcg = lcg * 1103515245u + 12345u, lcg >> 8; }
+static uint32_t held_keys, held_until;
+static uint32_t random_keys(uint32_t f) {
+ if (f >= held_until) {
+ static const uint32_t pick[] = {K_OK, K_OK, K_OK, K_LEFT, K_RIGHT, K_RIGHT, K_UP, K_UP, K_DOWN, K_SHIFT, K_BACK, 0, 0, 0};
+ held_keys = pick[rnd() % (sizeof pick / sizeof pick[0])];
+ held_until = f + 2 + rnd() % 12;
+ }
+ return held_keys;
+}
+static int bad_frames;
+static void check_state(void) {
+ if (ui.has_game && !uno_valid(G)) bad_frames++;
+ if (ui.screen > V_QUIT || (ui.screen == V_PLAY && !ui.has_game && G->phase != P_GAME_OVER)) bad_frames++;
+}
+
+static void fuzz(void) {
+ memset(files, 0, sizeof files);
+ int quits = 0, games = 0;
+ for (int s = 0; s < 300; s++) {
+ lcg = (uint32_t)s * 2654435761u + 1;
+ if (s % 50 == 0) memset(files, 0, sizeof files);
+ storage_full = s % 37 == 36;
+ script = random_keys, watch = check_state;
+ frame_no = 0, quit_at = 1500 + rnd() % 3000, held_until = 0;
+ uno_app_main();
+ quits++;
+ storage_full = false;
+ uno_progress p;
+ if (save_load(&p)) games += p.has_game;
+ CHECK(!bad_frames, "session %d: %d bad frames", s, bad_frames);
+ bad_frames = 0;
+ }
+ script = 0, watch = 0;
+ printf("keys: %d sessions of random keys, quit with Home each time (%d left a game going)\n", quits, games);
+}
+
+/* a game played through the app's own keys: the menu, how to play, a deal; your turns played by the Normal bot
+ through the keys a player would press */
+static bool game_done;
+static uint32_t key_every = 2; /* (frames from a press to the next) */
+static uint32_t bot_keys(uint32_t f) {
+ if (f % key_every || game_done) return 0; /* keys up between presses */
+ uno_game *g = G;
+ if (ui.screen != V_PLAY) return K_OK;
+ if (g->phase >= P_HAND_OVER) return ui.show_end ? K_OK : 0;
+ if (g->turn != 0) return 0;
+ if (g->uno_open == 0) return K_SHIFT;
+ uno_move m = bot_move(g, LEVEL_NORMAL);
+ switch (m.act) {
+ case M_COLOR: return ui.sel == m.arg ? K_OK : K_RIGHT;
+ case M_DRAW: return K_UP;
+ case M_KEEP: return K_UP;
+ case M_TAKE: return g->challengeable ? (ui.sel == PEN_TAKE ? K_OK : K_UP) : (uno_can_stack(g) ? K_UP : 0);
+ case M_CHALLENGE: return ui.sel == PEN_CHALLENGE ? K_OK : K_DOWN;
+ default:
+ if (g->phase == P_PENALTY && g->challengeable) return ui.sel == PEN_STACK ? K_OK : K_DOWN;
+ if (g->phase == P_DRAWN) return K_OK;
+ if (m.uno && g->uno_said != 0) return K_SHIFT;
+ return ui.pick == m.arg ? K_OK : K_RIGHT;
+ }
+}
+
+static void until_won(void) {
+ check_state();
+ if (!game_done && ui.screen == V_PLAY && G->phase == P_GAME_OVER && ui.show_end) game_done = true, quit_at = frame_no + 2;
+}
+static void through_the_keys(void) {
+ memset(files, 0, sizeof files);
+ script = bot_keys, watch = until_won;
+ frame_no = 0, quit_at = 2000000, game_done = false, clock_ms = 0;
+ uno_app_main();
+ uno_progress p;
+ CHECK(save_load(&p) && p.guide, "how to play shown");
+ CHECK(game_done && G->score[G->winner] >= UNO_GOAL, "a game to 500 through the keys");
+ printf("keys: a game to 500 through the app's keys, %u hands in %.0f minutes, scores %u %u %u %u\n", G->hands,
+ clock_ms / 60000, G->score[0], G->score[1], G->score[2], G->score[3]);
+ CHECK(!bad_frames, "%d bad frames", bad_frames);
+ script = 0, watch = 0;
+}
+
+/* every key line fits */
+static void texts(void) {
+ uno_ui v;
+ memset(&v, 0, sizeof v);
+ uno_new_game(&T, (uno_rules){4, LEVEL_NORMAL, 0, H_ALL}, 3);
+ int widest = 0;
+ for (int screen = 0; screen <= V_QUIT; screen++)
+ for (int phase = 0; phase <= P_GAME_OVER; phase++)
+ for (int sel = 0; sel < SETUP_ROWS; sel++)
+ for (int k = 0; k < 8; k++) {
+ v.screen = (uint8_t)screen, v.sel = (uint8_t)sel, v.first_run = k & 1, v.show_end = k >> 1 & 1;
+ T.phase = (uint8_t)phase, T.turn = (uint8_t)(k >> 2 & 1), T.challengeable = k & 1, T.count[0] = (uint8_t)(1 + (k & 2));
+ T.uno_open = k == 6 ? 1 : UNO_NONE, T.r.house = k & 4 ? H_MUST_PLAY : 0;
+ int w = uno_keyline_width(uno_keys(&T, &v));
+ if (w > widest) widest = w;
+ CHECK(w <= 314, "key line too wide (%d): %s", w, uno_keys(&T, &v));
+ }
+ printf("texts: the widest key line is %d pixels\n", widest);
+ for (int pg = 0; pg < UNO_HELP_PAGES; pg++)
+ CHECK(uno_help_bottom(pg) <= 86 + 4 * 19, "how to play, page %d: more than four lines (%d)", pg + 1, uno_help_bottom(pg));
+ /* the longest messages */
+ static const char *const msgs[] = {"Bot 3 played Wild +4: Yellow, UNO!", "Bot 2 played Yellow +2: Bot 3 draws 2, UNO!",
+ "Bot 1 challenged: Bot 3 bluffed, draws 4", "UNO is for your next-to-last card",
+ "Bot 3 deals: Yellow +2, you draw 2", "Only the new card can be played"};
+ for (unsigned i = 0; i < sizeof msgs / sizeof msgs[0]; i++)
+ CHECK(uno_text_width(msgs[i]) <= 252, "message too wide: %s (%d)", msgs[i], uno_text_width(msgs[i]));
+}
+
+static void test(const char *dir) {
+ (void)dir;
+ deck_and_points();
+ dealing();
+ action_cards();
+ challenge();
+ two_players();
+ drawing();
+ uno_calls();
+ going_out();
+ house_rules();
+ validity();
+ printf("rules: checked\n");
+ bots();
+ saves();
+ texts();
+ through_the_keys();
+ fuzz();
+}
+
+/* ---------------------------------------------------------------- pictures */
+static void picture(const char *dir, const char *name) {
+ uno_render(G, &ui);
+ shot(dir, name);
+}
+
+/* the bots play on until it's your turn in phase `phase` (and `count` cards or fewer in your hand, when not 0) */
+static bool until_mine(int phase, int most) {
+ for (int i = 0; i < 20000; i++) {
+ uno_game *g = G;
+ if (g->phase >= P_HAND_OVER) uno_next_hand(g);
+ if (g->turn == 0 && g->phase == phase && (!most || g->count[0] <= most)) return true;
+ bot_do(g, bot_move(g, g->turn ? g->r.level : LEVEL_NORMAL));
+ describe();
+ }
+ return false;
+}
+
+void uno_render_cards(void);
+void uno_render_icon(uint16_t bg);
+static void shots(const char *dir) {
+ uno_render_cards();
+ shot(dir, "cards");
+ uno_render_icon(0);
+ shot(dir, "icon_black");
+ uno_render_icon(0xFFFF);
+ shot(dir, "icon_white");
+ memset(files, 0, sizeof files);
+ memset(&ui, 0, sizeof ui);
+ sv.guide = 1;
+ ui.setup = (uno_rules){4, LEVEL_NORMAL, 0, 0};
+ ui.has_game = 1;
+ /* the table: your turn */
+ uno_new_game(G, ui.setup, 12);
+ for (int i = 0; i < 9; i++) bot_do(G, bot_move(G, LEVEL_NORMAL)), describe();
+ until_mine(P_PLAY, 0);
+ ui.screen = V_PLAY, ui.pick = 2;
+ for (int i = 0; i < G->count[0]; i++)
+ if (uno_can_play(G, i)) { ui.pick = (uint8_t)i; break; }
+ picture(dir, "shot");
+ /* a Wild: calling the colour */
+ uno_new_game(G, (uno_rules){3, LEVEL_HARD, 0, 0}, 77);
+ for (int k = 0; k < 400; k++) {
+ until_mine(P_PLAY, 0);
+ int w = find(G, 0, C_WILD);
+ if (w >= 0 && uno_can_play(G, w)) { uno_play(G, w, false), describe(); break; }
+ bot_do(G, bot_move(G, LEVEL_NORMAL)), describe();
+ }
+ ui.sel = (uint8_t)bot_best_color(G, 0, LEVEL_NORMAL), ui.pick = 0;
+ picture(dir, "colour");
+ /* a Wild Draw Four played on you */
+ uno_new_game(G, (uno_rules){2, LEVEL_HARD, 0, 0}, 5);
+ for (int k = 0; k < 100000 && !(G->turn == 0 && G->phase == P_PENALTY && G->challengeable); k++) {
+ if (G->phase >= P_HAND_OVER) uno_next_hand(G);
+ bot_do(G, bot_move(G, LEVEL_NORMAL)), describe();
+ }
+ ui.sel = 1;
+ picture(dir, "challenge");
+ /* the hand you were shown */
+ int o = G->offender;
+ memcpy(ui.reveal, G->hand[o], G->count[o]);
+ ui.reveal_n = G->count[o], ui.reveal_who = (uint8_t)o, ui.reveal_color = G->prev_color, ui.reveal_guilty = G->guilty;
+ uno_challenge(G), describe();
+ ui.screen = V_REVEAL;
+ picture(dir, "reveal");
+ /* UNO! */
+ uno_new_game(G, (uno_rules){4, LEVEL_NORMAL, 0, 0}, 41);
+ ui.screen = V_PLAY;
+ for (int k = 0; k < 400000; k++) {
+ if (G->phase >= P_HAND_OVER) uno_next_hand(G);
+ if (G->turn == 0 && G->phase == P_PLAY && G->count[0] == 2 && uno_can_play(G, 0)) break;
+ bot_do(G, bot_move(G, LEVEL_NORMAL)), describe();
+ }
+ ui.pick = 0;
+ picture(dir, "uno");
+ /* the end of a hand */
+ uno_new_game(G, (uno_rules){4, LEVEL_NORMAL, 0, 0}, 8);
+ G->score[1] = 120, G->score[2] = 245, G->score[3] = 60;
+ for (int k = 0; k < 100000 && G->phase < P_HAND_OVER; k++) bot_do(G, bot_move(G, LEVEL_HARD)), describe();
+ ui.show_end = 1, ui.sel = 0;
+ picture(dir, "scores");
+ /* the end of a game */
+ G->phase = P_GAME_OVER, G->winner = 0, G->score[0] = 512, G->gained = 96;
+ picture(dir, "won");
+ /* two players */
+ uno_new_game(G, (uno_rules){2, LEVEL_EASY, 0, 0}, 3);
+ until_mine(P_PLAY, 0);
+ ui.show_end = 0, ui.pick = 1;
+ picture(dir, "duel");
+ /* the menus */
+ ui.screen = V_PAUSE, ui.sel = 0;
+ picture(dir, "pause");
+ ui.screen = V_QUIT, ui.sel = 0;
+ picture(dir, "quit");
+ ui.screen = V_TITLE, ui.sel = 0, ui.has_game = 1;
+ picture(dir, "title");
+ ui.screen = V_SETUP, ui.sel = ROW_DEAL, ui.setup = (uno_rules){4, LEVEL_NORMAL, 0, 0};
+ picture(dir, "setup");
+ ui.sel = ROW_HOUSE, ui.setup.house = H_STACK2;
+ picture(dir, "setup_house");
+ for (int pg = 0; pg < UNO_HELP_PAGES; pg++) {
+ char name[16];
+ snprintf(name, sizeof name, "help%d", pg + 1);
+ ui.screen = V_HELP, ui.page = (uint8_t)pg, ui.first_run = 0;
+ picture(dir, name);
+ }
+}
+
+/* a game, your cards played by a bot, for the GIF: every frame drawn at the table, for ms milliseconds */
+static const char *film_dir;
+static uint32_t film_ms, film_k;
+static double film_t0 = -1;
+static void film_frame(void) {
+ if (ui.screen != V_PLAY) return;
+ if (film_t0 < 0) film_t0 = clock_ms;
+ char path[512];
+ snprintf(path, sizeof path, "%s/%06u_%06u.raw", film_dir, film_k++, (unsigned)(clock_ms - film_t0));
+ FILE *f = fopen(path, "wb");
+ if (!f) exit(2);
+ fwrite(fb, 2, 320 * 240, f);
+ fclose(f);
+ if (clock_ms - film_t0 >= film_ms) quit_at = frame_no + 1;
+}
+
+int main(int argc, char **argv) {
+ if (argc > 2 && !strcmp(argv[1], "test")) {
+ test(argv[2]);
+ if (fails) printf("%d FAILED\n", fails);
+ else printf("all passed\n");
+ return fails ? 1 : 0;
+ }
+ if (argc > 2 && !strcmp(argv[1], "shots")) {
+ shots(argv[2]);
+ return 0;
+ }
+ if (argc > 4 && !strcmp(argv[1], "film")) {
+ /* a table already dealt (how to play read), from seed argv[4] */
+ memset(files, 0, sizeof files);
+ uno_progress p;
+ uno_fresh(&p);
+ p.guide = 1, p.has_game = 1;
+ uno_new_game(&p.g, p.setup, (uint32_t)atoi(argv[4]));
+ save_write(&p);
+ film_dir = argv[2], film_ms = (uint32_t)atoi(argv[3]);
+ script = bot_keys, on_frame = film_frame, key_every = 24;
+ frame_no = 0, quit_at = 10000000;
+ uno_app_main();
+ return 0;
+ }
+ printf("usage: play test DIR | shots DIR | film DIR MS SEED\n");
+ return 2;
+}
diff --git a/games/uno/tests/test_arm.py b/games/uno/tests/test_arm.py
deleted file mode 100644
index 75f109bb..00000000
--- a/games/uno/tests/test_arm.py
+++ /dev/null
@@ -1,132 +0,0 @@
-"""Run the actual Cortex-M7 app with Epsilon/Upsilon storage and exit checks."""
-import argparse,io,json,shlex,struct,tempfile,types
-from pathlib import Path
-ROOT=Path(__file__).resolve().parents[1];REPO=ROOT.parents[1]
-emu_path=REPO/'tools/emu.py';emu=types.ModuleType('uno_emu');emu.__file__=str(emu_path);emu.io=io
-source=emu_path.read_text().replace('ELFFile(open(elf, "rb"))','ELFFile(io.BytesIO(open(elf, "rb").read()))')
-source=source.replace('cmd = [nwlink, "nwa-elf",','cmd = nwlink + ["nwa-elf",')
-source=source.replace('chunk = CPU_HZ // 1000','chunk = CPU_HZ // 10000').replace('self.now_ms += 1\n','self.now_ms += 0.1\n')
-source=source.replace(' next_frame = self.now_ms if frame_ms else None',' self.checkpoint = until_ms\n next_frame = self.now_ms if frame_ms else None')
-source=source.replace(' self.slept_ms += r0\n',' self.slept_ms += r0\n if self.now_ms >= self.checkpoint: uc.emu_stop()\n')
-exec(compile(source,str(emu_path),'exec'),emu.__dict__)
-def storage(path,items):
- data=bytearray(emu.STORAGE_SIZE);at=0
- for name,value in items:
- r=name.encode()+b'\0'+value;n=2+len(r);struct.pack_into('<H',data,at,n);data[at+2:at+n]=r;at+=n
- assert at+2<=len(data);path.write_bytes(data)
-def records(data):
- result={};at=0
- while at+2<=len(data):
- n=struct.unpack_from('<H',data,at)[0]
- if not n:break
- assert n>=3 and at+n<=len(data);name,value=data[at+2:at+n].split(b'\0',1);result[name.decode()]=value;at+=n
- return result
-def uint(c,name):return struct.unpack('<I',bytes(c.uc.mem_read(c.symbols[name],4)))[0]
-def main():
- ap=argparse.ArgumentParser();ap.add_argument('--nwlink',default='nwlink');ap.add_argument('--quick',action='store_true');a=ap.parse_args()
- nw=['node',a.nwlink]if Path(a.nwlink).is_file()and not a.nwlink.endswith(('.exe','.cmd'))else shlex.split(a.nwlink)
- out=ROOT/'output/arm';out.mkdir(parents=True,exist_ok=True);tempfile.tempdir=str(out);app=str(ROOT/'output/uno-debug.nwa');report=[]
- def key(c,k,d=70):
- t=int(c.now_ms)+10;c.keys.append((t,t+d,emu.KEYS[k]));c.run(t+d+120)
- def check(c):assert not c.violations,sorted(set(c.violations));assert not c.firmware_ram_changes()
- def review(c):
- key(c,'up');assert uint(c,'sel')==2;key(c,'ok');assert uint(c,'setup_page')==1
- key(c,'down');key(c,'ok');key(c,'down');key(c,'ok')
- c.save_png(str(out/'rules-custom.png'))
- key(c,'up');key(c,'up');key(c,'ok') # restore classic before starting
- key(c,'up');assert uint(c,'sel')==6;key(c,'ok');assert uint(c,'setup_page')==2
- def exit_check(c,upsilon=False):
- assert c.exited;check(c);assert c.app_ram_clean();assert c.locks==0 and c.max_locks==(0 if upsilon else 1)
- sentinel=b'print(42)\n';saved_reference=None
- profiles=[('n0120','n0120','epsilon',153676),('n0110','n0110','epsilon',148928),('n0115','n0110','epsilon',133652),('upsilon','n0110','upsilon',107674)]
- for profile,model,system,ram in profiles[:1]if a.quick else profiles:
- emu.configure(model,system,ram);emu.CPU_HZ=216_000_000 if model=='n0120'else 86_400_000
- path=out/(profile+'.storage');storage(path,[('keep.py',sentinel)])
- c=emu.Calculator(app,storage_file=str(path),nwlink=nw);c.enable_checks();c.run(250)
- assert uint(c,'screen')==0 and uint(c,'sel')==1
- c.save_png(str(out/(profile+'-menu.png')))
- key(c,'ok');assert uint(c,'screen')==1
- # Players 4 -> 2 -> 3 -> 4; options change without creating a match.
- key(c,'right');key(c,'right');key(c,'right')
- c.save_png(str(out/(profile+'-setup.png')))
- review(c);c.save_png(str(out/(profile+'-review.png')));key(c,'ok');assert uint(c,'screen')==2
- c.run(c.now_ms+4500);check(c);c.save_png(str(out/(profile+'-table.png')))
- for _ in range(5):key(c,'right')
- key(c,'0');key(c,'1');c.run(c.now_ms+2000)
- key(c,'back');assert uint(c,'screen')==3
- frozen=uint(c,'clock_ms');c.run(c.now_ms+1200);assert uint(c,'clock_ms')==frozen
- c.save_png(str(out/(profile+'-pause.png')))
- key(c,'down');key(c,'ok');assert uint(c,'screen')==10
- key(c,'ok');assert uint(c,'screen')==4
- for _ in range(7):key(c,'right')
- key(c,'back');assert uint(c,'screen')==10
- key(c,'back');assert uint(c,'screen')==3
- key(c,'down');key(c,'ok');assert uint(c,'screen')==0
- saved=records(path.read_bytes())['uno.sav'];assert len(saved)==768 and saved[:5]==b'UNO\x02\x01'
- assert not saved[8] and not saved[16] and not any(saved[671:679]) and not any(saved[681:683])
- saved_reference=saved
- # Launch settings then cancel replacement, without changing the saved table.
- key(c,'down');key(c,'ok');assert uint(c,'screen')==1
- review(c);key(c,'ok');assert uint(c,'screen')==6
- for _ in range(4):key(c,'back')
- assert uint(c,'screen')==0
- key(c,'up');key(c,'ok');assert uint(c,'screen')==2
- key(c,'back');key(c,'home',90);c.run(c.now_ms+150);exit_check(c,system=='upsilon')
- assert records(path.read_bytes())['keep.py']==sentinel
- d=emu.Calculator(app,storage_file=str(path),nwlink=nw);d.enable_checks();d.run(250)
- assert uint(d,'screen')==0 and uint(d,'sel')==0
- key(d,'ok');assert uint(d,'screen')==2
- before_resume=records(path.read_bytes())['uno.sav']
- key(d,'back');key(d,'onoff',90);d.run(d.now_ms+150);exit_check(d,system=='upsilon')
- assert records(path.read_bytes())['uno.sav']==before_resume
- frames=c.svc_counts.get(19,0)//15
- r=dict(profile=profile,static_ram=json.loads((ROOT/'output/sizes.json').read_text())['profiles'][0]['static_ram'],peak_stack_bytes=max(c.stack_used(),d.stack_used()),
- average_render_work_ms=round((c.now_ms-c.slept_ms)/max(1,frames),2),
- gameplay=True,pause_freezes=True,save_resume=True,firmware_memory_preserved=True,clean_exit=True)
- report.append(r);print(json.dumps(r),flush=True)
- emu.configure();emu.CPU_HZ=216_000_000
- # Real key paths for play, manual UNO, legal/illegal challenges, draws,
- # wild colour choice and a completed match. Fixtures are engine-validated.
- def start_fixture(name):
- p=out/(name+'.storage');storage(p,[('keep.py',sentinel),('uno.sav',(ROOT/'output'/(name+'.sav')).read_bytes())])
- c=emu.Calculator(app,storage_file=str(p),nwlink=nw);c.enable_checks();c.run(200);key(c,'ok');assert uint(c,'screen')==2;return c,p
- def finish_fixture(c,p):
- key(c,'back');key(c,'home');c.run(c.now_ms+150);exit_check(c);r=records(p.read_bytes());assert r['keep.py']==sentinel;return r['uno.sav']
- c,p=start_fixture('play');key(c,'0');key(c,'ok');saved=finish_fixture(c,p)
- assert saved[449]==1 and saved[701]==255 # human called UNO and played one card
- c,p=start_fixture('draw');key(c,'1');key(c,'left');key(c,'ok');saved=finish_fixture(c,p)
- assert saved[449]==2 and saved[692]==3 # cannot play an old hand card after drawing
- c,p=start_fixture('draw');key(c,'1');key(c,'2');saved=finish_fixture(c,p)
- assert saved[449]==2 and saved[692]==0 and saved[690]==1
- c,p=start_fixture('wild');key(c,'ok');key(c,'right');key(c,'ok');saved=finish_fixture(c,p)
- assert saved[449]==1 and saved[691]==1 and saved[690]==1
- for fixture,guilty in [('challenge-guilty',True),('challenge-legal',False)]:
- c,p=start_fixture(fixture);key(c,'down');key(c,'ok');assert uint(c,'screen')==9
- c.save_png(str(out/(fixture+'.png')));key(c,'ok');saved=finish_fixture(c,p)
- assert saved[449]==(1 if guilty else 7) and saved[450]==(5 if guilty else 1)
- assert saved[690]==(0 if guilty else 1) and saved[693]==0
- c,p=start_fixture('win');key(c,'ok');c.save_png(str(out/'win.png'));saved=finish_fixture(c,p)
- assert saved[692]==5 and saved[700]==0 and not any(saved[671:679]) and struct.unpack_from('<HH',saved,9)==(1,1)
- # Real v1 save with accumulated points: preserve the table and discard totals.
- legacy=(ROOT/'tests/legacy-save.bin').read_bytes();p=out/'legacy.storage';storage(p,[('keep.py',sentinel),('uno.sav',legacy)])
- c=emu.Calculator(app,storage_file=str(p),nwlink=nw);c.enable_checks();c.run(250);key(c,'ok');assert uint(c,'screen')==2
- migrated=finish_fixture(c,p);assert migrated[3]==2 and migrated[17:671]==legacy[17:671]
- assert not migrated[8] and not migrated[16] and not any(migrated[671:679]) and not any(migrated[681:683])
- # From a finished game, OK starts a fresh single game; no extra round target.
- c,p=start_fixture('win');key(c,'ok');key(c,'ok');assert uint(c,'screen')==2
- fresh=finish_fixture(c,p);assert fresh[692]<4 and all(n>=7 for n in fresh[449:451])
- # Full storage: retry fails without damaging the existing record, exit explicit.
- p=out/'full.storage';filler=b'x'*(emu.STORAGE_SIZE-24);storage(p,[('full.py',filler)])
- c=emu.Calculator(app,storage_file=str(p),nwlink=nw);c.enable_checks();c.run(250);key(c,'home');assert uint(c,'screen')==8
- key(c,'ok');assert uint(c,'screen')==8;key(c,'down');key(c,'ok');c.run(c.now_ms+150);exit_check(c)
- assert records(p.read_bytes())=={'full.py':filler}
- # Invalid checksum is ignored and never interpreted as a match.
- bad=bytearray(saved_reference);bad[300]^=1;p=out/'bad.storage';storage(p,[('keep.py',sentinel),('uno.sav',bad)])
- c=emu.Calculator(app,storage_file=str(p),nwlink=nw);c.enable_checks();c.run(250);assert uint(c,'sel')==1
- key(c,'home');c.run(c.now_ms+150);exit_check(c);assert records(p.read_bytes())['keep.py']==sentinel
- # A launch key held by NumPlay cannot accidentally enter New game.
- c=emu.Calculator(app,nwlink=nw);c.enable_checks();c.keys=[(0,400,emu.KEYS['ok'])];c.run(550);assert uint(c,'screen')==0
- key(c,'home');c.run(c.now_ms+150);exit_check(c)
- report.append(dict(full_storage=True,corrupt_save_ignored=True,held_launch_key=True,real_keys_play_and_uno=True,real_keys_challenges=True,real_keys_draw_keep_and_wild=True,real_keys_win=True,legacy_points_removed=True,real_keys_play_again=True))
- (out/'report.json').write_text(json.dumps(report,indent=2)+'\n');print('ARM tests passed',flush=True)
-if __name__=='__main__':main()
diff --git a/games/uno/tests/test_engine.c b/games/uno/tests/test_engine.c
deleted file mode 100644
index 4234b010..00000000
--- a/games/uno/tests/test_engine.c
+++ /dev/null
@@ -1,143 +0,0 @@
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-#include "../src/uno.h"
-#include "../src/save.h"
-static Uno g;
-static void fixture(int players,int flags,int top,int color){
- memset(&g,0,sizeof g);g.rules=(UnoRules){players,1,flags};g.direction=1;g.color=color;g.rng=12345;g.round=1;
- g.candidate=g.winner=g.offender=g.uno_player=g.uno_armed=g.drawn=UNO_NONE;
- for(int c=0;c<52;c++){g.deck[g.dn++]=c;if(c%13)g.deck[g.dn++]=c;}
- for(int i=0;i<4;i++){g.deck[g.dn++]=52;g.deck[g.dn++]=53;}
- for(int i=0;i<g.dn;i++)if(g.deck[i]==top){g.deck[i]=g.deck[--g.dn];break;}
- g.discard[g.xn++]=top;
-}
-static void give(int p,int c){
- int i;for(i=0;i<g.dn;i++)if(g.deck[i]==c)break;assert(i<g.dn);
- g.deck[i]=g.deck[--g.dn];g.hands[p][g.count[p]++]=c;
-}
-static void on_top(int c){int i;for(i=0;i<g.dn;i++)if(g.deck[i]==c)break;assert(i<g.dn);int t=g.deck[g.dn-1];g.deck[g.dn-1]=c;g.deck[i]=t;}
-static void snapshot(const char*name){
- UnoSave s={0};s.prefs=g.rules;s.active=1;s.game=g;assert(uno_valid(&g));
- uint8_t b[UNO_SAVE_BYTES];save_encode(&s,b);FILE*f=fopen(name,"wb");assert(f);fwrite(b,1,sizeof b,f);fclose(f);
-}
-static void basic(void){
- fixture(4,0,3,0);give(0,4);give(0,16);give(0,27);give(0,52);give(0,53);
- assert(uno_can_play(&g,0)&&uno_can_play(&g,1)&&!uno_can_play(&g,2)&&uno_can_play(&g,3)&&uno_can_play(&g,4));
- assert(!uno_play(&g,-1,false)&&!uno_play(&g,9,false));assert(uno_play(&g,1,false));assert(g.turn==1&&g.color==1&&g.count[0]==4);assert(uno_valid(&g));
- for(int n=2;n<=4;n++){
- fixture(n,0,3,0);give(0,UNO_REVERSE);give(0,4);assert(uno_play(&g,0,false));assert(g.turn==(n==2?0:n-1));assert(g.direction==(n==2?1:-1));
- fixture(n,0,3,0);give(0,UNO_SKIP);give(0,4);assert(uno_play(&g,0,false));assert(g.turn==2%n);
- }
- fixture(4,0,3,0);give(0,12);give(0,4);give(1,25);give(2,30);
- assert(uno_play(&g,0,false));assert(g.turn==1&&g.pending==2&&!uno_can_play(&g,0));
- assert(uno_accept(&g));assert(g.count[1]==3&&g.turn==2&&g.pending==0&&uno_valid(&g));
-}
-static void draws(void){
- fixture(2,0,3,0);give(0,4);on_top(5);assert(uno_draw(&g));assert(g.phase==U_DRAWN&&g.drawn==1);
- assert(!uno_can_play(&g,0)&&uno_can_play(&g,1));assert(!uno_play(&g,0,false));assert(uno_keep(&g)&&g.turn==1&&g.count[0]==2);
- fixture(2,0,3,0);give(0,4);on_top(27);assert(uno_draw(&g)&&g.phase==U_TURN&&g.turn==1&&g.count[0]==2);
- fixture(2,R_DRAW_UNTIL,3,0);give(0,4);on_top(27);
- for(int i=0;i<g.dn-1;i++)if(g.deck[i]==5){int c=g.deck[g.dn-2];g.deck[g.dn-2]=5;g.deck[i]=c;break;}
- assert(uno_draw(&g)&&g.phase==U_DRAWN&&g.count[0]==3&&g.drawn==2);assert(uno_play(&g,2,false));assert(g.turn==1);
- fixture(2,R_FORCE,3,0);give(0,4);on_top(5);assert(uno_draw(&g)&&g.turn==1&&g.count[0]==1);assert(!uno_keep(&g));
- fixture(2,R_FORCE,3,0);give(0,4);on_top(52);assert(uno_draw(&g)&&g.phase==U_DRAWN);assert(!uno_keep(&g));assert(uno_play(&g,g.drawn,false));assert(uno_choose_color(&g,2));assert(g.turn==1&&g.color==2);
- /* Every non-top discard gets recycled; the top card and hand never do. */
- fixture(4,0,3,0);while(g.dn>2)give(3,g.deck[0]);
- g.discard[g.xn++]=g.deck[--g.dn];g.discard[g.xn++]=g.deck[--g.dn];g.color=uno_color(g.discard[g.xn-1]);if(g.color==4)g.color=0;
- int top=g.discard[g.xn-1];assert(uno_draw(&g));assert(g.discard[0]==top&&g.xn==1&&uno_valid(&g));
-}
-static void challenge(void){
- fixture(4,0,3,0);give(0,53);give(0,4);give(1,20);
- assert(uno_play(&g,0,false)&&g.phase==U_COLOR&&g.guilty);assert(uno_choose_color(&g,1)&&g.phase==U_CHALLENGE&&g.turn==1);
- assert(uno_challenge(&g));assert(g.count[0]==5&&g.count[1]==1&&g.turn==1&&g.event==E_CHALLENGE_WON&&uno_valid(&g));
- fixture(4,0,3,0);give(0,53);give(0,16);give(1,20);
- assert(uno_play(&g,0,false)&&!g.guilty);assert(uno_choose_color(&g,2));assert(uno_challenge(&g));
- assert(g.count[1]==7&&g.turn==2&&g.event==E_CHALLENGE_LOST&&uno_valid(&g));
- fixture(2,0,3,0);give(0,53);give(0,52);assert(uno_play(&g,0,false)&&!g.guilty);
- assert(uno_choose_color(&g,3));assert(uno_accept(&g)&&g.count[1]==4&&g.turn==0);
- /* A different-colour matching symbol is allowed alongside a legal +4. */
- fixture(2,0,3,0);give(0,53);give(0,16);assert(uno_play(&g,0,false)&&!g.guilty);
-}
-static void variants(void){
- fixture(4,R_STACK2,3,0);give(0,12);give(0,4);give(1,25);give(1,20);give(2,38);give(2,30);
- assert(uno_play(&g,0,true)&&g.pending==2&&uno_can_play(&g,0));assert(uno_play(&g,0,true)&&g.pending==4);
- assert(uno_play(&g,0,true)&&g.pending==6&&g.turn==3);assert(uno_accept(&g)&&g.count[3]==6&&g.turn==0&&uno_valid(&g));
- fixture(4,R_STACK4,3,0);give(0,53);give(0,4);give(1,53);give(1,20);
- assert(uno_play(&g,0,true)&&uno_choose_color(&g,2));assert(g.phase==U_TURN&&g.pending==4&&!uno_challenge(&g));
- assert(uno_play(&g,0,true)&&uno_choose_color(&g,1));assert(g.pending==8);assert(uno_accept(&g)&&g.count[2]==8&&uno_valid(&g));
- fixture(4,R_AUTO_UNO,3,0);give(0,4);give(0,5);assert(uno_play(&g,0,false)&&g.uno_player==UNO_NONE);
-}
-static void uno_calls(void){
- fixture(4,0,3,0);give(0,4);give(0,5);give(1,6);give(1,7);
- give(2,19);give(3,32);snapshot("play.sav");
- assert(uno_play(&g,0,false)&&g.uno_player==0);assert(uno_call(&g,0)&&g.uno_player==UNO_NONE);assert(!uno_catch(&g,1));
- fixture(4,0,3,0);give(0,4);give(0,5);assert(uno_call(&g,0)&&g.uno_armed==0);assert(uno_play(&g,0,false)&&g.uno_player==UNO_NONE);
- fixture(4,0,3,0);give(0,4);give(0,5);assert(uno_play(&g,0,false));assert(uno_catch(&g,1));assert(g.count[0]==3&&!uno_catch(&g,2)&&g.turn==1);
- fixture(4,0,3,0);give(0,4);give(0,5);give(1,6);give(1,7);assert(uno_play(&g,0,false));assert(uno_play(&g,0,true));assert(!uno_catch(&g,1)&&g.count[0]==1);
-}
-static void wins(void){
- fixture(2,0,3,0);give(0,4);give(1,50);give(1,53);snapshot("win.sav");assert(uno_play(&g,0,true));assert(g.phase==U_MATCH&&g.winner==0&&uno_valid(&g));
- fixture(2,0,3,0);give(0,12);give(1,20);
- assert(uno_play(&g,0,true));assert(g.phase==U_MATCH&&g.count[1]==3&&g.winner==0&&uno_valid(&g));
- fixture(2,0,3,0);give(0,53);give(1,20);assert(uno_play(&g,0,true)&&uno_choose_color(&g,2));assert(g.phase==U_CHALLENGE&&g.candidate==0);
- assert(uno_challenge(&g)&&g.phase==U_MATCH&&g.count[1]==7&&g.winner==0&&uno_valid(&g));
- fixture(2,R_STACK2,3,0);give(0,12);give(1,25);assert(uno_play(&g,0,true));assert(g.phase==U_MATCH&&g.count[1]==3);
- fixture(2,0,3,0);give(0,4);give(1,0);assert(uno_play(&g,0,true)&&g.phase==U_MATCH&&g.winner==0); /* Even opponents holding only zero-valued cards. */
- fixture(4,0,3,0);give(0,4);give(1,5);assert(uno_play(&g,0,true)&&g.phase==U_MATCH);g.direction=-1;g.dealer=0;uno_next_round(&g);assert(g.dealer==1&&g.direction==1&&uno_valid(&g));
- fixture(2,0,3,0);give(0,50);give(1,4);g.turn=1;assert(uno_play(&g,0,true)&&g.phase==U_MATCH&&g.winner==1);
-}
-static void arm_fixtures(void){
- fixture(4,0,3,0);give(0,4);give(1,53);give(1,5);give(2,30);give(3,43);
- g.turn=1;assert(uno_play(&g,0,true)&&uno_choose_color(&g,2));g.turn=0;snapshot("challenge-guilty.sav");
- fixture(4,0,3,0);give(0,4);give(1,53);give(1,16);give(2,30);give(3,43);
- g.turn=1;assert(uno_play(&g,0,true)&&uno_choose_color(&g,2));g.turn=0;snapshot("challenge-legal.sav");
- fixture(2,0,3,0);give(0,4);give(1,6);on_top(5);snapshot("draw.sav");
- fixture(2,0,3,0);give(0,52);give(0,4);give(1,6);snapshot("wild.sav");
-}
-static void saves(void){
- UnoSave a={0},b={0};a.prefs=(UnoRules){4,1,0};a.active=1;a.played=19;a.wins=7;uno_new(&a.game,a.prefs,98765);
- uint8_t data[UNO_SAVE_BYTES];save_encode(&a,data);assert(save_decode(&b,data,sizeof data));assert(!memcmp(&a,&b,sizeof a));
- for(unsigned i=0;i<sizeof data;i++)for(int bit=0;bit<8;bit++){
- data[i]^=1u<<bit;UnoSave before=b;assert(!save_decode(&b,data,sizeof data));assert(!memcmp(&before,&b,sizeof b));data[i]^=1u<<bit;
- }
- assert(!save_decode(&b,data,20)&&!save_decode(&b,NULL,0));
- FILE*f=fopen("reference.sav","wb");assert(f);fwrite(data,1,sizeof data,f);fclose(f);
- a.game.turn=9;save_encode(&a,data);assert(!save_decode(&b,data,sizeof data));
- /* Real v1 save from the previous build: preserve cards, drop old scores. */
- f=fopen("../tests/legacy-save.bin","rb");assert(f);assert(fread(data,1,sizeof data,f)==sizeof data);fclose(f);
- assert(data[3]==1&&data[8]==3&&data[16]==3&&data[671]);
- assert(save_decode(&b,data,sizeof data)&&uno_valid(&b.game));
- uint8_t migrated[UNO_SAVE_BYTES];save_encode(&b,migrated);assert(migrated[3]==2&&!migrated[8]&&!migrated[16]);
- assert(!memcmp(data+17,migrated+17,654));for(int i=671;i<679;i++)assert(!migrated[i]);
- for(int i=681;i<683;i++)assert(!migrated[i]);
- f=fopen("migrated.sav","wb");assert(f);fwrite(migrated,1,sizeof migrated,f);fclose(f);
- /* A formerly completed round becomes a finished game, not another deal. */
- fixture(2,0,3,0);give(0,4);give(1,50);assert(uno_play(&g,0,true));a.game=g;a.prefs=g.rules;save_encode(&a,data);
- data[3]=1;data[8]=data[16]=3;data[692]=U_ROUND;data[704]=E_ROUND;
- uint32_t crc=save_crc(data,UNO_SAVE_BYTES-4);for(int i=0;i<4;i++)data[UNO_SAVE_BYTES-4+i]=crc>>(i*8);
- assert(save_decode(&b,data,sizeof data)&&b.game.phase==U_MATCH&&b.game.winner==0&&uno_valid(&b.game));
-}
-static void simulations(void){
- unsigned moves=0,max_hand=0,rounds=0;bool opening[54]={0};
- for(unsigned seed=1;seed<=12000;seed++){
- UnoRules r={(seed%3)+2,seed%3,0};uno_new(&g,r,seed);assert(uno_valid(&g));
- int c=g.discard[0];opening[c]=true;assert(c!=53);
- for(int p=0;p<r.players;p++)assert(g.count[p]==7||g.count[p]==9);
- }
- assert(opening[52]&&opening[12]&&opening[11]&&opening[10]);
- for(int flags=0;flags<32;flags++)for(int players=2;players<=4;players++)for(int difficulty=0;difficulty<3;difficulty++)for(int s=1;s<=4;s++){
- UnoRules r={players,difficulty,flags};uno_new(&g,r,(s*13457u+flags*17+players*13));
- unsigned step=0;
- while(g.phase!=U_MATCH&&step++<150000){
- assert(uno_valid(&g));
- for(int p=0;p<players;p++)if(g.count[p]>max_hand)max_hand=g.count[p];
- if(g.phase==U_ROUND){uno_next_round(&g);rounds++;continue;}
- if(g.uno_player!=UNO_NONE){int p=(g.uno_player+1)%players;if(step%3==0)uno_catch(&g,p);else uno_call(&g,g.uno_player);}
- uno_bot(&g);moves++;
- }
- assert(g.phase==U_MATCH&&uno_valid(&g));
- }
- printf("1,152 complete games, %u actions, %u blocked-table redeals; largest hand %u cards.\n",moves,rounds,max_hand);
-}
-int main(void){basic();draws();challenge();variants();uno_calls();wins();saves();arm_fixtures();simulations();puts("Engine, card rules, variants, direct wins, legacy migration and saves passed.");return 0;}
diff --git a/games/uno/tests/test_integration.py b/games/uno/tests/test_integration.py
deleted file mode 100644
index 168f0101..00000000
--- a/games/uno/tests/test_integration.py
+++ /dev/null
@@ -1,133 +0,0 @@
-"""Build the real NumPlay launcher with only this module for integration testing.
-
-This deliberately small test catalogue is not a release of NumPlay. Production
-builds still read the complete games/games.json and use the UNO ID.
-"""
-import argparse
-import json
-import shlex
-import subprocess
-import sys
-from elftools.elf.elffile import ELFFile
-from pathlib import Path
-import test_arm as arm
-
-ROOT = Path(__file__).resolve().parents[1]
-REPO = ROOT.parents[1]
-
-
-def main():
- ap = argparse.ArgumentParser()
- ap.add_argument('--nwlink', default='nwlink')
- args = ap.parse_args()
- nw = ['node', args.nwlink] if Path(args.nwlink).is_file() and not args.nwlink.endswith(('.exe', '.cmd')) else shlex.split(args.nwlink)
- out = ROOT / 'output/integration'
- out.mkdir(parents=True, exist_ok=True)
- arm.tempfile.tempdir = str(out)
-
- def run(*cmd):
- subprocess.run([str(x) for x in cmd], cwd=REPO, check=True)
-
- def py(tool, *args):
- run(sys.executable, REPO / 'tools' / tool, *args)
-
- device = shlex.split(subprocess.check_output(nw + ['eadk-cflags-device'], text=True))
- cc = ['arm-none-eabi-gcc', *device, '-std=gnu11', '-Os', '-Wall', '-Wextra',
- '-Wno-unused-parameter', '-fno-math-errno', '-ffunction-sections', '-fdata-sections',
- '-fno-tree-loop-distribute-patterns', '-DNP_VERSION="uno-test"',
- '-I' + str(REPO / 'launcher/src')]
- games = json.loads((REPO / 'games/games.json').read_text())
- index = next(i for i, g in enumerate(games, 1) if g['id'] == 'uno')
- game = games[index - 1]
- assert game['app'] == 'UNO.nwa' and game['records'] == ['uno.sav']
- run('arm-none-eabi-ld', '-r', '-d', '-z', 'noexecstack', '--force-group-allocation', '-T', REPO / 'tools/module.ld',
- ROOT / 'output/module.o', '-o', out / 'stage1.o')
- run('arm-none-eabi-objcopy', '--keep-global-symbol=main',
- '--redefine-sym', 'eadk_keyboard_scan=np_keyboard_scan',
- '--redefine-sym', 'eadk_event_get=np_event_get',
- '--redefine-sym', 'eadk_display_draw_string=np_display_draw_string',
- out / 'stage1.o', out / 'stage2.o')
- py('npmodule.py', out / 'stage2.o', out / 'uno.o', '--game', 'uno',
- '--index', index, '--json', out / 'uno.json')
- py('gen_games.py', REPO / 'games/games.json', out, out, '--only', 'uno')
- py('shots.py', '--id', 'uno', '--index', index, '--colors', 16,
- out / 'shots.c', *(ROOT / p for p in game['shots']))
- objects = [out / 'uno.o']
- entry = out / 'entry_uno.c' if (out / 'entry_uno.c').exists() else out / 'gametable.c'
- sources = sorted((REPO / 'launcher/src').glob('*.c')) + [entry, out / 'shots.c']
- for src in sources:
- obj = out / ('launcher-' + src.stem + '.o')
- run(*cc, '-c', src, '-o', obj)
- objects.append(obj)
- marks = 'marks_uno' if (out / 'marks_uno.s').exists() else 'marks'
- for stem in ['arena', marks]:
- obj = out / (stem + '.o')
- run(*cc, '-c', out / (stem + '.s'), '-o', obj)
- objects.append(obj)
- run(*cc, '-DNP_APP_NAME="NumPlay integration test"', '-c', REPO / 'launcher/app_name.c', '-o', out / 'name.o')
- run(*nw, 'png-icon-o', REPO / 'launcher/assets/icon.png', out / 'icon.o')
- app = out / 'NumPlay-test.nwa'
- run(*cc, '-nostartfiles', '--specs=nano.specs', '-Wl,--relocatable', '-Wl,--gc-sections',
- '-Wl,-e,main', '-Wl,-u,eadk_app_name', '-Wl,-u,eadk_app_icon', '-Wl,-u,eadk_api_level',
- '-Wl,-T,' + str(out / 'numplay.ld'), *objects, out / 'name.o', out / 'icon.o', '-lm', '-o', app)
- report = []
- for profile, model, system, ram in [('n0120', 'n0120', 'epsilon', 153676),
- ('upsilon', 'n0110', 'upsilon', 107674)]:
- arm.emu.configure(model, system, ram)
- st = out / (profile + '.storage')
- arm.storage(st, [('keep.py', b'print(42)\n')])
- c = arm.emu.Calculator(str(app), storage_file=str(st), nwlink=nw)
- # npmodule deliberately removes the module's private symbols. Recover
- # their RAM offsets from its input solely for these debugger assertions.
- with (out / 'stage1.o').open('rb') as f:
- elf = ELFFile(f)
- for sym in elf.get_section_by_name('.symtab').iter_symbols():
- if sym.name in ('screen', 'setup_page'):
- section = elf.get_section(sym['st_shndx']).name
- assert section == '.bss'
- c.symbols[sym.name] = c.symbols['np_uno_bss'] + sym['st_value']
- c.enable_checks()
- c.run(1100)
- c.save_png(str(out / (profile + '-launcher.png')))
-
- def key(k, wait=200):
- t = int(c.now_ms) + 20
- c.keys.append((t, t + 70, arm.emu.KEYS[k]))
- c.run(t + wait)
-
- key('ok', 650) # Real carousel -> UNO module.
- assert arm.uint(c, 'screen') == 0
- key('ok'); assert arm.uint(c, 'screen') == 1
- key('up'); key('ok'); assert arm.uint(c, 'setup_page') == 1
- key('up'); key('ok'); assert arm.uint(c, 'setup_page') == 2
- key('ok'); assert arm.uint(c, 'screen') == 2
- c.save_png(str(out / (profile + '-table.png')))
- key('back'); key('down'); key('down'); key('ok') # Save to menu.
- assert arm.uint(c, 'screen') == 0
- key('back'); key('down'); key('ok', 800) # Save and exit -> carousel.
- assert not c.exited
- c.save_png(str(out / (profile + '-returned.png')))
- key('ok', 650) # BSS resets, table restored from shared storage.
- assert arm.uint(c, 'screen') == 0
- key('ok'); assert arm.uint(c, 'screen') == 2
- key('back'); key('home', 700)
- assert c.exited and not c.violations and not c.firmware_ram_changes()
- assert c.app_ram_clean() and c.locks == 0 and c.max_locks == (0 if system == 'upsilon' else 1)
- records = arm.records(st.read_bytes())
- assert len(records['uno.sav']) == 768 and records['uno.sav'][:5] == b'UNO\x02\x01'
- assert records['keep.py'] == b'print(42)\n' and b'uno.sav' in records['numplay_saves.py']
- # Simulate an installer that retains only Python scripts.
- arm.storage(st, [(n, v) for n, v in records.items() if n.endswith('.py')])
- restored = arm.emu.Calculator(str(app), storage_file=str(st), nwlink=nw)
- restored.enable_checks(); restored.run(1100)
- t = int(restored.now_ms) + 20; restored.keys.append((t, t + 90, arm.emu.KEYS['home'])); restored.run(t + 750)
- assert restored.exited and not restored.violations and not restored.firmware_ram_changes() and restored.app_ram_clean()
- assert arm.records(st.read_bytes())['uno.sav'] == records['uno.sav']
- report.append(dict(profile=profile, launch_return_reenter=True, backup_and_reinstall_restore=True,
- stack_bytes=max(c.stack_used(), restored.stack_used())))
- (out / 'report.json').write_text(json.dumps(report, indent=2) + '\n')
- print('PASS: UNO NumPlay module launch, return, re-entry, shared saves and backup.')
-
-
-if __name__ == '__main__':
- main()
diff --git a/games/uno/tests/test_ui.c b/games/uno/tests/test_ui.c
deleted file mode 100644
index 54ae0ae6..00000000
--- a/games/uno/tests/test_ui.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#define NP_MODULE 1
-#define main uno_appmain
-#include "../src/main.c"
-#undef main
-static uint16_t pixels[320*240];
-uint64_t eadk_timing_millis(void){return clock_ms;}
-uint32_t eadk_random(void){return 73;}
-uint64_t eadk_keyboard_scan(void){return 0;}
-void eadk_display_wait_for_vblank(void){}
-void eadk_timing_msleep(uint32_t n){(void)n;}
-void*np_alloc(uint32_t n){return malloc(n);}
-bool np_file_write(const char*n,const void*d,uint32_t z){assert(!strcmp(n,SAVE_NAME)&&z==768);return true;}
-const uint8_t*np_file_read(const char*n,uint32_t*z){*z=0;return NULL;}
-void np_push(int x,int y,int w,int h,const color_t*d){assert(x>=0&&y>=0&&x+w<=320&&y+h<=240);for(int i=0;i<h;i++)memcpy(pixels+(y+i)*320+x,d+i*w,w*2);}
-static void shot(const char*name){
- gfx_render(scene,NULL,0,240);FILE*f=fopen(name,"wb");assert(f);fprintf(f,"P6\n320 240\n255\n");
- for(unsigned i=0;i<320*240;i++){unsigned c=pixels[i];uint8_t rgb[3]={(c>>11)*255/31,((c>>5)&63)*255/63,(c&31)*255/31};fwrite(rgb,1,3,f);}fclose(f);
-}
-static void art(void){
- assert(sizeof(card_palette)/2==31&&sizeof(card_offsets)/2==56);
- for(int i=0;i<55;i++){
- const uint8_t*p=card_pixels+card_offsets[i];
- for(int y=0;y<64;y++){int n=*p++,x=0;assert(n>0&&n<=44);for(int j=0;j<n;j++)x+=(p[j]>>5)+1;assert(x==44);p+=n;}
- assert(p==card_pixels+card_offsets[i+1]);
- }
- for(int i=0;i<7;i++){
- /* Check the wrapped help really fits the panel, using the actual font. */
- const char*p=HELP[i];int lines=1,w=0;
- while(*p){const char*start=p;while(*p&&*p!=' ')p++;char word[80];unsigned n=p-start;assert(n<sizeof word);memcpy(word,start,n);word[n]=0;
- int ww=gfx_text_width(&np_font_body,word),space=gfx_text_width(&np_font_body," ");assert(ww<=266);
- if(w&&w+space+ww>266){lines++;w=ww;}else w+=ww+(w?space:0);if(*p)p++;
- }
- assert(72+(lines-1)*20+4<209);
- }
- for(int i=0;i<5;i++)assert(gfx_text_width(&np_font_small,VARIANT[i])<218);
- for(int i=0;i<6;i++)assert(gfx_text_width(&np_font_small,VARIANT_HELP[i])<296);
- assert(172+gfx_text_width(&np_font_small,"DISCARD")/2+6<=222-gfx_text_width(&np_font_small,"COLOR")/2);
- assert(gfx_text_width(&np_font_small,"1 Draw +16")<=64);
- assert(gfx_text_width(&np_font_small,"Back: pause")<=79);
- for(int c=0;c<54;c++){char s[60];name_card(c,s);assert(gfx_text_width(&np_font_small,s)<126);}
-}
-static void setup_navigation(void){
- screen=S_SETTINGS;setup_page=0;sel=0;Uno before=*G;
- for(int i=0;i<3;i++)setup_input(1,0,false,false);
- assert(sv.prefs.players==4&&setup_page==0&&sel==0);
- setup_input(0,1,false,false);
- for(int i=0;i<3;i++)setup_input(1,0,false,false);
- assert(sv.prefs.difficulty==1);
- setup_input(0,1,true,false);assert(setup_page==1&&sel==0&&screen==S_SETTINGS);
- for(int i=0;i<5;i++){setup_input(0,1,true,false);assert(sv.prefs.flags==(1u<<(i+1))-1);}
- assert(sv.prefs.flags==31&&custom_rules(&sv.prefs));
- setup_input(0,1,true,false);assert(setup_page==2&&screen==S_SETTINGS);
- setup_input(0,0,false,true);assert(setup_page==1&&sel==6);
- setup_input(0,1,true,false);assert(sel==0&&sv.prefs.flags==0);
- setup_input(0,0,false,true);assert(setup_page==0&&sel==2);
- setup_input(0,0,false,true);assert(screen==S_MENU);
- assert(!memcmp(&before,G,sizeof before));
-}
-int main(void){
- gfx_buf=strip;sv.prefs=(UnoRules){4,1,0};ui_random=5123;clock_ms=10000;last_action=0;screen=S_MENU;sel=1;
- art();shot("menu.ppm");
- setup_navigation();screen=S_SETTINGS;setup_page=0;sel=0;shot("settings.ppm");
- sv.prefs.players=2;shot("settings-two.ppm");sv.prefs.players=4;
- setup_page=1;sel=2;sv.prefs.flags=3;shot("variants.ppm");
- setup_page=2;sel=0;shot("review.ppm");sv.prefs.flags=0;shot("review-classic.ppm");
- for(int n=2;n<=4;n++){
- sv.prefs.players=n;new_game();while(G->phase==U_COLOR)uno_choose_color(G,0);G->turn=0;last_action=0;
- char s[40];sprintf(s,"table-%d.ppm",n);shot(s);G->turn=1;selected=3;sprintf(s,"bot-turn-%d.ppm",n);shot(s);
- int old=selected;play_input(1,0,false,false,false,false);assert(selected==(old+1)%G->count[0]);
- }
- for(int i=0;i<7;i++){screen=S_HELP;help_page=i;char s[40];sprintf(s,"help-%d.ppm",i);shot(s);}
- screen=S_CREDITS;shot("credits.ppm");screen=S_PAUSE;sel=0;shot("pause.ppm");screen=S_TABLE_INFO;shot("table-rules.ppm");
- screen=S_PLAY;G->phase=U_COLOR;G->turn=0;color_sel=2;shot("color.ppm");
- G->phase=U_CHALLENGE;G->pending=4;G->old_color=1;sel=1;shot("challenge.ppm");
- evidence_count=G->count[1];memcpy(evidence,G->hands[1],evidence_count);selected=0;screen=S_EVIDENCE;shot("evidence.ppm");
- screen=S_PLAY;G->phase=U_MATCH;G->winner=0;sel=0;shot("result.ppm");
- /* Play again retains the active table, even if future-game prefs differ. */
- UnoRules rules=G->rules;sv.prefs=(UnoRules){2,0,R_AUTO_UNO};
- play_input(0,0,true,false,false,false);assert(screen==S_PLAY&&G->phase<U_ROUND);
- assert(!memcmp(&rules,&G->rules,sizeof rules)&&sv.prefs.flags==R_AUTO_UNO);
- G->phase=U_MATCH;G->winner=1;shot("bot-wins.ppm");
- play_input(0,1,true,false,false,false);assert(screen==S_MENU&&!sv.active);
- screen=S_SAVE_ERROR;sel=0;exit_after_save=true;shot("save-error.ppm");
- /* Navigate every card even when the hand is bigger than one screen. */
- new_game();G->phase=U_TURN;G->turn=0;
- while(G->dn){G->hands[0][G->count[0]++]=G->deck[--G->dn];}
- selected=G->count[0]-1;last_action=0;shot("large-hand.ppm");assert(uno_valid(G));
- for(int j=0;j<G->count[0];j++)play_input(1,0,false,false,false,false);
- assert(selected==G->count[0]-1);
- /* Disabled actions cannot trap focus, and returning to the hand is explicit. */
- G->turn=1;G->uno_player=UNO_NONE;action=-1;play_input(0,-1,false,false,false,false);assert(action==2);
- play_input(1,0,false,false,false,false);assert(action==2);
- play_input(0,1,false,false,false,false);assert(action==-1);
- G->turn=0;G->phase=U_DRAWN;G->rules.flags=R_FORCE;G->drawn=selected;
- play_input(0,-1,false,false,false,false);assert(action==2);
- puts("Asset decoder, visual setup navigation, text layout, card browsing and UI screenshots passed.");return 0;
-}
diff --git a/games/uno/tools/assets.json b/games/uno/tools/assets.json
deleted file mode 100644
index 4ae9c939..00000000
--- a/games/uno/tools/assets.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "source_sha256": "873e5243b3bc15140313becdbfb33c2afc7ed858e49c6f67a6ef5f9706ad9837",
- "cards": 55,
- "width": 44,
- "height": 64,
- "card_rom_bytes": 60895,
- "table_rom_bytes": 1536
-}
diff --git a/games/uno/tools/assets.py b/games/uno/tools/assets.py
deleted file mode 100644
index 360d45de..00000000
--- a/games/uno/tools/assets.py
+++ /dev/null
@@ -1,59 +0,0 @@
-"""Build small, shared-palette sprites from the user-supplied AlexDer ZIP.
-
-python tools/assets.py '/path/to/Uno Game Assets (1).zip'
-No original-size textures, PDF, fonts or executable files are shipped.
-"""
-import argparse, hashlib, io, json, zipfile
-from pathlib import Path
-from PIL import Image, ImageDraw
-
-ROOT = Path(__file__).resolve().parents[1]
-W, H = 44, 64
-
-def array(name, kind, data, columns=24):
- return 'static const '+kind+' '+name+'[] = {\n'+''.join(
- ' '+','.join(str(x) for x in data[i:i+columns])+',\n' for i in range(0,len(data),columns))+'};\n'
-
-def main():
- p=argparse.ArgumentParser(); p.add_argument('zip',type=Path); a=p.parse_args()
- names=[f'{c}_{v}.png' for c in ('Red','Yellow','Green','Blue')
- for v in list(map(str,range(10)))+['Skip','Reverse','Draw']]+['Wild.png','Wild_Draw.png','Deck.png']
- with zipfile.ZipFile(a.zip) as z:
- members={Path(n).name:n for n in z.namelist() if n.startswith('Uno Game Assets/') and n.endswith('.png')}
- def read(n): return Image.open(io.BytesIO(z.read(members[n]))).convert('RGBA')
- images=[read(n).resize((W,H),Image.Resampling.LANCZOS) for n in names]
- sample=Image.new('RGB',(W*len(images),H),'white')
- for i,im in enumerate(images): sample.paste(im,(i*W,0),im)
- pal=sample.quantize(colors=31,method=Image.Quantize.MEDIANCUT)
- colors=pal.getpalette()[:93]
- palette=[((colors[i]&248)<<8)|((colors[i+1]&252)<<3)|(colors[i+2]>>3) for i in range(0,93,3)]
- encoded=bytearray(); offsets=[]
- for im in images:
- offsets.append(len(encoded))
- rgb=Image.new('RGB',im.size,'white');rgb.paste(im,mask=im.getchannel('A'))
- ix=list(rgb.quantize(palette=pal,dither=Image.Dither.NONE).getdata());alpha=list(im.getchannel('A').getdata())
- ix=[v if alpha[i]>=128 else 31 for i,v in enumerate(ix)]
- for y in range(H):
- row=ix[y*W:(y+1)*W]; tokens=[];x=0
- while x<W:
- n=1
- while x+n<W and row[x+n]==row[x] and n<8:n+=1
- tokens.append(((n-1)<<5)|row[x]);x+=n
- encoded.append(len(tokens)); encoded.extend(tokens)
- offsets.append(len(encoded))
- table=read('Table_2.png').convert('RGB').resize((32,24),Image.Resampling.LANCZOS)
- packed=[((r&248)<<8)|((g&252)<<3)|(b>>3) for r,g,b in table.getdata()]
- content='/* Generated by tools/assets.py. AlexDer card art, see ASSETS.md. */\n#define CARD_W 44\n#define CARD_H 64\n'
- content+=array('card_palette','uint16_t',palette)+array('card_offsets','uint16_t',offsets)
- content+=array('card_pixels','uint8_t',list(encoded))+array('table_pixels','uint16_t',packed)
- (ROOT/'src/assets.h').write_text(content,encoding='utf-8')
- icon=Image.new('RGBA',(55,56),(15,47,41,255))
- for name,x,y in [('Red_7.png',3,7),('Wild.png',17,3),('Deck.png',31,7)]:
- im=read(name).resize((23,34),Image.Resampling.LANCZOS);icon.alpha_composite(im,(x,y+6))
- icon.save(ROOT/'src/icon.png')
- report=dict(source_sha256=hashlib.sha256(a.zip.read_bytes()).hexdigest(),cards=55,width=W,height=H,
- card_rom_bytes=len(encoded)+2*len(offsets)+2*len(palette),table_rom_bytes=len(packed)*2)
- (ROOT/'tools/assets.json').write_text(json.dumps(report,indent=2)+'\n')
- print(json.dumps(report,indent=2))
-
-if __name__=='__main__':main()
diff --git a/games/uno/tools/build.py b/games/uno/tools/build.py
deleted file mode 100644
index d9065d5f..00000000
--- a/games/uno/tools/build.py
+++ /dev/null
@@ -1,59 +0,0 @@
-"""Portable NumWorks build. Requires ARM GCC, nwlink 1.0.0 and pyelftools."""
-import argparse, json, os, shlex, shutil, subprocess
-from pathlib import Path
-ROOT=Path(__file__).resolve().parents[1];REPO=ROOT.parents[1]
-def main():
- ap=argparse.ArgumentParser();ap.add_argument('--toolchain',type=Path);ap.add_argument('--nwlink',default='nwlink');a=ap.parse_args()
- out=ROOT/'output';out.mkdir(exist_ok=True)
- # Root make can request the standalone app and module simultaneously.
- # Serialize their shared compiler outputs; OS locks are released on exit.
- with (out/'.build.lock').open('a+b') as lock:
- if os.name=='nt':
- import msvcrt
- if lock.seek(0,2)==0:lock.write(b'\0');lock.flush()
- lock.seek(0);msvcrt.locking(lock.fileno(),msvcrt.LK_LOCK,1)
- else:
- import fcntl
- fcntl.flock(lock.fileno(),fcntl.LOCK_EX)
- try:build(a,out)
- finally:
- if os.name=='nt':lock.seek(0);msvcrt.locking(lock.fileno(),msvcrt.LK_UNLCK,1)
- else:fcntl.flock(lock.fileno(),fcntl.LOCK_UN)
-
-def build(a,out):
- def run(*args,capture=False):
- return subprocess.run(list(map(str,args)),cwd=ROOT,check=True,capture_output=capture,text=capture)
- def tool(n):
- name='arm-none-eabi-'+n+('.exe'if os.name=='nt'else'');return a.toolchain/name if a.toolchain else name
- nw=['node',a.nwlink]if Path(a.nwlink).is_file()and not a.nwlink.endswith(('.exe','.cmd'))else[a.nwlink]
- flags=['-std=c11','-Os','-Wall','-Wextra','-Werror','-Wno-misleading-indentation','-fno-math-errno','-ffunction-sections','-fdata-sections','-flto','-fstack-usage',
- '-fno-tree-loop-distribute-patterns','-fvisibility=internal']
- flags+=shlex.split(run(*nw,'eadk-cflags-device',capture=True).stdout)
- objects=[]
- for src in [ROOT/'src/main.c',ROOT/'src/uno.c',REPO/'launcher/src/gfx.c',REPO/'launcher/src/font_data.c',REPO/'launcher/src/xfont.c']:
- obj=out/(src.stem+'.o');run(tool('gcc'),*flags,'-c',src,'-o',obj);objects.append(obj)
- run(*nw,'png-icon-o',ROOT/'src/icon.png',out/'icon.o')
- link=[tool('gcc'),*flags,'-nostartfiles','--specs=nano.specs','-Wl,--relocatable,--gc-sections,-e,main','-flinker-output=nolto-rel']
- run(*link,*objects,out/'icon.o','-Wl,-u,eadk_app_name,-u,eadk_app_icon,-u,eadk_api_level','-lm','-o',out/'uno-debug.nwa')
- shutil.copyfile(out/'uno-debug.nwa',out/'UNO.nwa');run(tool('strip'),'--strip-unneeded',out/'UNO.nwa')
- # NumPlay's conventional standalone target reads output/<id>.nwa.
- if os.name!='nt':shutil.copyfile(out/'UNO.nwa',out/'uno.nwa')
- # Module build leaves graphics, fonts and storage to the NumPlay launcher.
- mod=[]
- for source in ['main','uno']:
- obj=out/('module-'+source+'.o');run(tool('gcc'),*flags,'-DNP_MODULE=1','-c',ROOT/'src'/(source+'.c'),'-o',obj);mod.append(obj)
- run(*link,*mod,'-nostdlib','-o',out/'module.o')
- from elftools.elf.elffile import ELFFile
- profiles=[]
- for name,base,ram in [('n0120',0x24000000,153676),('n0110',0x20000000,148928),('n0115',0x20000000,133652),('upsilon',0x20000000,107674)]:
- opts=['--ram-start',hex(base+0x37000-ram),'--ram-length',str(ram)];elf=out/(name+'.elf');binary=out/(name+'.bin')
- run(*nw,'nwa-elf',out/'UNO.nwa',elf,*opts);run(*nw,'nwa-bin',out/'UNO.nwa',binary,*opts)
- debug=out/(name+'-debug.bin');run(*nw,'nwa-bin',out/'uno-debug.nwa',debug,*opts)
- assert debug.read_bytes()==binary.read_bytes()
- with elf.open('rb')as f:
- e=ELFFile(f);sym={s.name:s.entry.st_value for s in e.get_section_by_name('.symtab').iter_symbols()};static_ram=sym['_heap_start']-sym['_data_section_start_ram']
- assert static_ram<20*1024,(name,static_ram)
- profiles.append(dict(profile=name,static_ram=static_ram,installed_flash=binary.stat().st_size,available_ram=ram))
- result=dict(nwa_bytes=(out/'UNO.nwa').stat().st_size,save_bytes=768,profiles=profiles)
- (out/'sizes.json').write_text(json.dumps(result,indent=2)+'\n');print(json.dumps(result,indent=2))
-if __name__=='__main__':main()
diff --git a/games/uno/tools/test.py b/games/uno/tools/test.py
deleted file mode 100644
index 11a119ae..00000000
--- a/games/uno/tools/test.py
+++ /dev/null
@@ -1,11 +0,0 @@
-import argparse, subprocess, os
-from pathlib import Path
-ROOT=Path(__file__).resolve().parents[1]
-def main():
- ap=argparse.ArgumentParser();ap.add_argument('--cc',default='cc');a=ap.parse_args();out=ROOT/'output';out.mkdir(exist_ok=True)
- for name,sources in [('engine',['tests/test_engine.c','src/uno.c']),('ui',['tests/test_ui.c','src/uno.c','../../launcher/src/gfx.c','../../launcher/src/font_data.c','../../launcher/src/xfont.c'])]:
- exe=out/('test-'+name+('.exe'if os.name=='nt'else''))
- subprocess.run([a.cc,'-std=c11','-O2','-Wall','-Wextra','-Werror','-Wno-misleading-indentation','-Wno-unused-parameter',
- '-ffunction-sections','-fdata-sections','-Itests',*sources,'-Wl,--gc-sections','-lm','-o',str(exe)],cwd=ROOT,check=True)
- subprocess.run([str(exe)],cwd=out,check=True)
-if __name__=='__main__':main()