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.

circloO: the levels, the physics and the screens, first playable

Mason363fe32ba69301d
diff --git a/games/circloo/.gitignore b/games/circloo/.gitignore
new file mode 100644
index 00000000..342d9dda
--- /dev/null
+++ b/games/circloo/.gitignore
@@ -0,0 +1,2 @@
+output/
+build/
diff --git a/games/circloo/Makefile b/games/circloo/Makefile
new file mode 100644
index 00000000..af6a6277
--- /dev/null
+++ b/games/circloo/Makefile
@@ -0,0 +1,89 @@
+# circloO on the NumWorks calculator (C; the physics are Box2D's, written down for the game: src/phys.c).
+# make output/circloo.nwa
+# make check link it like the calculator does (output/circloo.bin)
+# make host build/play: the game on a computer, for tests and screenshots
+# make test the game played on a computer (tests/check.py, with the sanitizers)
+# make data src/levels.h from the game's web build (REF=its circloO.js) and src/font.h
+# (FONTS=a folder with OpenSans-Regular.ttf and OpenSans-Semibold.ttf, Python + Pillow)
+Q ?= @
+TOOLCHAIN ?=
+BIN = $(if $(TOOLCHAIN),$(TOOLCHAIN)/)
+CC = $(BIN)arm-none-eabi-gcc
+NWLINK ?= npx --yes -- [email protected]
+STRIP ?= $(BIN)arm-none-eabi-strip --strip-unneeded
+SIZE = $(BIN)arm-none-eabi-size
+BUILD_DIR = output
+REF ?=
+FONTS ?=
+
+# the physics and the drawing run every frame at -O2; the rest is small at -Os
+HOT = src/phys.c src/gfx.c src/level.c
+COLD = $(filter-out $(HOT) src/plat_host.c src/plat_eadk.c,$(wildcard src/*.c))
+COLD_OBJ = $(patsubst src/%.c,$(BUILD_DIR)/cold/%.o,$(COLD))
+HEADERS = $(wildcard src/*.h) ../common/epsilon_app.h ../common/epsilon_files.h
+
+CFLAGS = -std=gnu11 $(shell $(NWLINK) eadk-cflags-device) -DEPSILON_XL=1
+CFLAGS += -O2 -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 $(EXTRA)
+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 data
+build: $(BUILD_DIR)/circloo.nwa
+
+# apps get 133652 bytes of RAM on custom builds of Epsilon 25.2 (148928 or more on official ones); installed on its
+# own, the app must fit the calculator's space for apps (0x90200000 to 0x903F0000 in its flash)
+RAM_LENGTH = 133652
+APP_SPACE = 2031616
+check: $(BUILD_DIR)/circloo.nwa
+ $(Q) $(NWLINK) nwa-bin --ram-length $(RAM_LENGTH) $< $(BUILD_DIR)/circloo.bin
+ @n=$$(wc -c < $(BUILD_DIR)/circloo.bin); \
+ echo "BIN $(BUILD_DIR)/circloo.bin: $$n bytes, $$(( $(APP_SPACE) - n )) to spare of the app space"; \
+ [ $$n -le $(APP_SPACE) ] || { echo "circloo.nwa is bigger than the calculator's app space ($(APP_SPACE) bytes)"; exit 1; }
+
+$(BUILD_DIR)/cold/%.o: src/%.c $(HEADERS)
+ @mkdir -p $(@D)
+ $(Q) $(CC) $(CFLAGS) -Os -c $< -o $@
+
+$(BUILD_DIR)/circloo.nwa: $(HOT) src/plat_eadk.c $(COLD_OBJ) $(HEADERS) $(BUILD_DIR)/icon.o
+ @echo "LD $@"
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(HOT) src/plat_eadk.c $(COLD_OBJ) $(BUILD_DIR)/icon.o -lm -o $@
+ $(Q) $(STRIP) $@
+ $(Q) $(SIZE) $@
+
+$(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 plays it with scripted keys and saves screenshots
+HOST_FLAGS = -std=gnu11 -O1 -g -Wall -Wextra -Wno-unused-parameter -Isrc -DHOST
+HOST_SAN = -fsanitize=address,undefined -fno-sanitize-recover=undefined
+HOST_SRC = $(filter-out src/plat_eadk.c src/main.c,$(wildcard src/*.c))
+host: build/play
+build/play: $(HOST_SRC) tests/play.c $(HEADERS)
+ $(Q) mkdir -p $(dir $@)
+ $(Q) cc $(HOST_FLAGS) $(HOST_SAN) $(HOST_SRC) tests/play.c -lm -o $@
+ @echo "HOST $@"
+
+test: build/play
+ python3 tests/check.py build/play
+
+data:
+ @test -n "$(REF)" -a -n "$(FONTS)" || { echo "make data REF=<the web build's circloO.js> FONTS=<Open Sans folder>"; exit 1; }
+ python3 -I tools/levels.py $(REF) src/levels.h
+ python3 tools/font.py $(FONTS) src/font.h
+
+clean:
+ $(Q) rm -rf $(BUILD_DIR) build
+
+# the other targets (platform/port.mk): make port TARGET=sdl
+PORT_ID = circloo
+PORT_NAME = circloO
+PORT_SRC = $(filter-out src/plat_host.c,$(wildcard src/*.c))
+PORT_FLAGS = -Isrc -DEPSILON_XL=1 -fno-math-errno
+include ../../platform/port.mk
diff --git a/games/circloo/src/font.h b/games/circloo/src/font.h
new file mode 100644
index 00000000..60c8975b
--- /dev/null
+++ b/games/circloo/src/font.h
@@ -0,0 +1,1183 @@
+/* Open Sans (c) 2011 Google, Apache License 2.0: made by tools/font.py, do not edit. */
+typedef struct { uint32_t off; uint8_t w, h; int8_t x, y; uint8_t adv; } Glyph;
+typedef struct { const Glyph *g; const uint8_t *bits; uint8_t height, ascent; } Font;
+static const uint8_t font_small_bits[2645] = {
+ 240,3,46,208,1,12,176,0,10,0,0,23,209,3,211,240,32,11,13,160,176,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,177,112,5,0,132,160,2,0,102,192,0,179,206,236,91,0,27,147,0,0,12,117,0,200,190,206,
+ 11,80,7,27,0,128,4,12,0,0,176,0,0,197,206,8,225,177,16,16,30,11,0,96,221,2,0,16,221,7,0,176,
+ 225,16,1,59,13,194,237,59,0,0,11,0,144,91,0,118,0,147,192,0,28,0,117,176,97,6,0,117,176,194,184,7,
+ 147,192,119,11,27,144,123,60,9,56,0,128,53,9,56,0,178,16,11,27,0,73,0,183,8,16,203,44,0,0,150,112,
+ 9,0,112,8,150,0,0,210,213,3,0,16,251,4,0,0,124,215,2,29,180,0,214,152,48,29,16,251,4,112,221,140,
+ 212,4,211,32,11,160,0,0,0,0,0,0,0,0,0,0,32,12,160,5,225,0,180,0,151,0,135,0,151,0,181,0,
+ 225,0,160,5,32,12,165,0,192,3,96,9,48,13,0,15,0,31,0,15,48,13,96,9,192,3,165,0,0,195,0,32,
+ 35,26,5,148,235,154,0,193,121,0,96,24,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,
+ 0,12,0,0,192,0,80,204,207,60,0,192,0,0,0,12,0,0,64,0,0,0,0,0,241,65,10,88,0,215,93,0,
+ 0,0,0,0,0,112,17,61,0,208,2,48,11,0,105,0,208,1,64,10,0,90,0,209,0,80,9,0,75,0,0,48,
+ 220,27,0,77,96,10,195,0,224,81,9,0,60,150,0,176,84,9,0,60,195,0,224,1,77,96,11,48,220,44,0,0,
+ 227,3,0,212,61,0,144,179,3,0,0,60,0,0,192,3,0,0,60,0,0,192,3,0,0,60,0,0,192,3,0,112,
+ 204,43,16,6,112,10,0,0,195,0,0,96,9,0,32,45,0,16,76,0,16,92,0,16,91,0,0,246,238,238,3,145,
+ 204,43,16,5,96,11,0,0,211,0,0,178,7,32,237,43,0,0,64,13,0,0,208,34,1,64,13,196,205,59,0,0,
+ 16,94,0,0,186,5,0,150,88,0,194,145,5,176,4,89,96,8,144,5,218,221,238,8,0,144,5,0,0,89,0,176,
+ 222,141,0,28,0,0,208,0,0,0,205,189,2,0,0,213,0,0,0,45,0,0,224,17,2,96,11,194,221,26,0,0,
+ 199,140,0,167,1,0,208,1,0,48,156,204,4,228,3,210,65,11,0,59,210,0,192,3,107,48,13,32,219,60,0,214,
+ 221,253,4,0,16,13,0,0,135,0,0,208,2,0,80,10,0,0,76,0,0,196,0,0,160,6,0,32,30,0,0,64,
+ 204,60,0,46,64,12,225,0,225,0,154,162,6,32,237,27,16,77,112,12,165,0,192,51,28,32,29,112,204,76,0,64,
+ 220,27,16,45,112,10,164,0,224,81,9,0,60,210,1,244,3,198,124,29,0,0,194,0,0,177,5,160,204,6,0,209,
+ 3,23,0,0,0,112,17,61,225,2,23,0,0,0,0,16,31,180,128,5,0,0,146,3,32,185,4,145,58,0,48,140,
+ 2,0,0,181,58,0,0,48,58,0,0,0,0,196,204,204,2,0,0,0,196,204,204,2,0,0,0,0,0,0,0,0,
+ 0,0,133,1,0,0,197,24,0,0,80,123,1,0,130,44,64,171,4,80,41,0,0,0,0,0,0,215,205,51,1,181,
+ 0,48,11,32,60,16,60,0,132,0,0,0,0,83,0,112,10,0,0,112,187,156,2,0,177,6,0,196,1,144,5,185,
+ 92,148,16,12,119,112,6,12,147,176,2,88,176,65,8,28,144,5,12,163,160,3,108,177,0,29,195,75,187,3,80,43,
+ 0,32,0,0,64,203,204,7,0,0,192,6,0,0,179,12,0,0,88,43,0,0,29,134,0,80,9,209,0,160,221,237,
+ 4,209,0,64,10,135,0,0,29,60,0,0,105,192,221,173,2,192,3,128,10,192,3,64,12,192,3,145,7,192,221,190,
+ 1,192,3,80,13,192,3,0,31,192,3,80,13,192,221,189,3,0,196,238,27,80,77,0,3,208,4,0,0,226,0,0,
+ 0,196,0,0,0,227,0,0,0,224,3,0,0,112,61,0,2,0,214,222,10,192,221,190,3,0,60,0,229,3,192,3,
+ 0,167,0,60,0,32,14,192,3,0,241,0,60,0,48,14,192,3,0,168,0,60,0,230,2,192,221,174,2,0,192,222,
+ 221,0,60,0,0,192,3,0,0,60,0,0,192,221,157,0,60,0,0,192,3,0,0,60,0,0,192,222,221,0,192,222,
+ 221,192,3,0,192,3,0,192,3,0,192,222,173,192,3,0,192,3,0,192,3,0,192,3,0,0,179,238,109,0,212,4,
+ 32,2,208,4,0,0,32,14,0,0,0,196,0,209,222,48,14,0,32,13,224,4,0,210,0,214,4,48,13,0,197,222,
+ 141,0,192,3,0,165,0,60,0,80,10,192,3,0,165,0,60,0,80,10,192,222,221,174,0,60,0,80,10,192,3,0,
+ 165,0,60,0,80,10,192,3,0,165,0,192,3,60,192,3,60,192,3,60,192,3,60,192,3,0,45,0,45,0,45,0,
+ 45,0,45,0,45,0,45,0,45,0,29,32,14,220,5,192,3,96,11,192,3,196,1,192,51,45,0,192,212,3,0,192,
+ 237,3,0,192,84,29,0,192,3,153,0,192,3,209,5,192,3,48,29,192,3,0,192,3,0,192,3,0,192,3,0,192,
+ 3,0,192,3,0,192,3,0,192,3,0,192,238,222,192,13,0,16,174,0,204,3,0,198,10,192,151,0,176,167,0,44,
+ 13,32,92,10,192,161,5,103,165,0,28,165,192,81,10,192,1,77,10,165,0,28,144,94,80,10,192,1,227,0,165,0,
+ 192,9,0,209,0,220,3,16,13,192,197,0,209,0,28,122,16,13,192,33,46,209,0,28,112,27,13,192,1,192,213,0,
+ 28,0,211,13,192,1,0,217,0,0,214,238,25,0,199,2,145,11,224,3,0,192,52,14,0,0,136,196,0,0,112,57,
+ 14,0,0,136,224,3,0,192,4,199,2,129,11,0,214,238,25,0,192,221,125,0,60,32,93,192,3,112,8,60,0,120,
+ 192,19,212,2,220,172,3,192,3,0,0,60,0,0,192,3,0,0,0,214,238,25,0,199,2,145,11,224,3,0,192,52,
+ 14,0,0,136,196,0,0,112,57,14,0,0,120,224,3,0,192,4,199,2,129,11,0,214,254,25,0,0,0,185,0,0,
+ 0,0,171,0,192,221,141,0,192,3,177,6,192,3,112,8,192,3,194,4,192,221,79,0,192,3,107,0,192,3,211,0,
+ 192,3,176,6,192,3,48,30,80,221,125,32,46,16,2,195,0,0,0,141,1,0,16,233,25,0,0,145,11,0,0,241,
+ 32,1,96,12,212,221,42,0,220,254,221,7,48,12,0,0,195,0,0,48,12,0,0,195,0,0,48,12,0,0,195,0,
+ 0,48,12,0,0,195,0,0,224,1,0,165,0,30,0,80,10,224,1,0,165,0,30,0,80,10,224,1,0,165,0,30,
+ 0,80,10,192,3,0,135,0,183,1,210,3,0,215,205,4,0,60,0,32,14,135,0,112,9,210,0,192,4,192,3,226,
+ 0,112,8,151,0,32,13,76,0,0,76,13,0,0,199,8,0,0,242,3,0,91,0,242,3,64,124,9,112,125,0,151,
+ 195,0,107,12,176,5,30,224,208,1,30,176,69,10,89,195,0,135,104,80,122,8,48,203,2,209,74,0,208,12,0,235,
+ 1,0,138,0,112,12,0,167,0,160,5,76,64,11,48,28,44,0,144,124,0,0,244,3,0,192,183,0,112,9,91,16,
+ 29,32,29,106,0,128,9,91,0,144,55,13,32,29,176,5,105,0,211,210,0,0,218,6,0,48,14,0,0,210,0,0,
+ 32,13,0,0,210,0,0,213,221,253,3,0,80,12,0,16,61,0,0,137,0,0,211,1,0,192,5,0,112,10,0,32,
+ 46,0,0,248,238,238,5,240,140,224,0,224,0,224,0,224,0,224,0,224,0,224,0,224,0,224,0,240,141,74,0,80,
+ 9,0,208,1,0,89,0,64,10,0,208,1,0,104,0,48,11,0,208,2,201,15,0,15,0,15,0,15,0,15,0,15,
+ 0,15,0,15,0,15,0,15,217,15,0,166,0,0,176,43,0,64,73,9,0,58,192,1,178,0,134,128,6,0,28,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,204,204,92,0,182,0,0,0,88,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,204,60,0,2,80,9,112,187,188,80,12,80,11,166,
+ 0,186,16,203,108,11,240,0,0,0,15,0,0,224,0,0,0,142,220,8,240,6,176,6,31,0,150,240,1,96,9,111,
+ 0,91,192,200,141,0,48,220,45,209,3,1,180,0,0,180,0,0,225,3,0,64,220,45,0,0,160,5,0,0,90,0,
+ 0,160,5,196,172,91,225,3,226,69,11,0,91,180,0,160,21,46,32,94,64,204,170,5,48,203,76,16,28,32,14,228,
+ 204,204,65,12,0,0,225,5,32,0,179,221,9,16,203,5,120,0,160,5,112,222,11,160,4,0,74,0,160,4,0,74,
+ 0,160,4,0,112,203,191,35,12,144,6,195,0,104,0,201,170,0,192,2,0,0,219,221,8,105,0,208,162,5,32,29,
+ 178,187,75,0,240,0,0,0,15,0,0,240,0,0,0,126,219,9,240,6,192,4,31,0,105,240,0,144,6,15,0,105,
+ 240,0,144,6,48,0,13,0,0,15,240,0,15,240,0,15,240,0,0,3,0,13,0,0,0,15,0,15,0,15,0,15,
+ 0,15,0,15,0,15,16,14,216,7,240,0,0,0,15,0,0,240,0,0,0,15,160,7,240,177,7,0,190,9,0,240,
+ 196,3,0,15,211,1,240,0,182,0,240,0,15,240,0,15,240,0,15,240,0,15,240,0,208,198,109,198,125,0,111,16,
+ 126,16,30,240,1,208,2,192,3,15,0,29,0,60,240,0,208,1,192,3,15,0,29,0,60,208,199,157,0,111,0,76,
+ 240,1,144,6,15,0,105,240,0,144,6,15,0,105,48,203,92,16,61,16,61,180,0,128,71,11,0,120,225,3,209,3,
+ 195,204,5,208,200,141,0,111,16,91,240,1,96,9,31,0,150,240,6,192,5,142,220,8,240,0,0,0,15,0,0,240,
+ 0,0,0,64,204,154,21,62,32,94,180,0,176,69,11,0,91,225,2,226,5,196,172,91,0,0,160,5,0,0,90,0,
+ 0,160,5,208,214,9,158,0,240,1,0,15,0,240,0,0,15,0,161,220,11,165,0,1,177,74,0,0,147,12,0,0,
+ 45,196,204,7,160,1,230,188,208,1,208,1,208,1,208,3,96,189,224,0,160,5,14,0,90,224,0,160,5,14,0,90,
+ 224,2,226,5,213,172,90,76,0,195,96,9,144,6,225,17,30,0,105,150,0,48,187,3,0,176,12,0,75,16,111,0,
+ 30,150,80,186,48,11,210,160,211,129,7,208,210,128,198,2,128,138,48,219,0,64,63,0,157,0,196,0,136,0,136,180,
+ 0,0,219,2,0,193,61,0,144,55,28,96,10,96,10,76,0,211,80,10,144,7,208,1,29,0,120,165,0,32,172,4,
+ 0,160,13,0,0,120,0,0,209,1,0,219,5,0,0,179,203,15,0,144,7,0,165,0,32,28,0,192,3,0,231,187,
+ 43,0,215,2,226,1,48,12,0,195,0,96,10,144,45,0,112,10,0,195,0,48,12,0,226,1,0,215,2,0,178,0,
+ 0,32,11,0,0,178,0,0,32,11,0,0,178,0,0,32,11,0,0,178,0,0,32,11,0,0,178,0,0,32,11,0,
+ 0,178,0,0,32,11,0,183,2,0,151,0,64,11,0,180,0,32,29,0,112,63,32,29,0,180,0,64,11,0,166,0,
+ 199,2,0,194,109,48,67,18,200,27,0,0,0,0,0,0,0,0,0,0,0,
+};
+static const Glyph font_small_glyphs[95] = {
+ {0,0,0,0,0,3},
+ {0,3,9,0,4,3},
+ {14,5,9,0,4,5},
+ {37,8,9,0,4,8},
+ {73,7,10,0,4,7},
+ {108,10,9,0,4,10},
+ {153,9,9,0,4,9},
+ {194,3,9,0,4,3},
+ {208,4,11,0,4,4},
+ {230,4,11,0,4,4},
+ {252,7,9,0,4,7},
+ {284,7,8,0,5,7},
+ {312,3,3,0,12,3},
+ {317,4,4,0,9,4},
+ {325,3,2,0,11,3},
+ {328,5,9,0,4,4},
+ {351,7,9,0,4,7},
+ {383,7,9,0,4,7},
+ {415,7,9,0,4,7},
+ {447,7,9,0,4,7},
+ {479,7,9,0,4,7},
+ {511,7,9,0,4,7},
+ {543,7,9,0,4,7},
+ {575,7,9,0,4,7},
+ {607,7,9,0,4,7},
+ {639,7,9,0,4,7},
+ {671,3,6,0,7,3},
+ {680,3,8,0,7,3},
+ {692,7,7,0,6,7},
+ {717,7,6,0,7,7},
+ {738,7,7,0,6,7},
+ {763,5,9,0,4,5},
+ {786,11,10,0,4,11},
+ {841,8,9,0,4,8},
+ {877,8,9,0,4,8},
+ {913,8,9,0,4,8},
+ {949,9,9,0,4,9},
+ {990,7,9,0,4,7},
+ {1022,6,9,0,4,6},
+ {1049,9,9,0,4,9},
+ {1090,9,9,0,4,9},
+ {1131,3,9,0,4,3},
+ {1145,4,11,-1,4,3},
+ {1167,8,9,0,4,7},
+ {1203,6,9,0,4,6},
+ {1230,11,9,0,4,11},
+ {1280,9,9,0,4,9},
+ {1321,9,9,0,4,9},
+ {1362,7,9,0,4,7},
+ {1394,9,11,0,4,9},
+ {1444,8,9,0,4,7},
+ {1480,7,9,0,4,7},
+ {1512,7,9,0,4,7},
+ {1544,9,9,0,4,9},
+ {1585,8,9,0,4,7},
+ {1621,11,9,0,4,11},
+ {1671,7,9,0,4,7},
+ {1703,7,9,0,4,7},
+ {1735,7,9,0,4,7},
+ {1767,4,11,0,4,4},
+ {1789,5,9,0,4,4},
+ {1812,4,11,0,4,4},
+ {1834,7,9,0,4,7},
+ {1866,7,2,-1,13,5},
+ {1873,7,9,0,4,7},
+ {1905,7,6,0,7,7},
+ {1926,7,9,0,4,7},
+ {1958,6,6,0,7,6},
+ {1976,7,9,0,4,7},
+ {2008,7,6,0,7,7},
+ {2029,5,9,0,4,4},
+ {2052,7,9,0,7,7},
+ {2084,7,9,0,4,7},
+ {2116,3,9,0,4,3},
+ {2130,4,12,-1,4,3},
+ {2154,7,9,0,4,6},
+ {2186,3,9,0,4,3},
+ {2200,11,6,0,7,11},
+ {2233,7,6,0,7,7},
+ {2254,7,6,0,7,7},
+ {2275,7,9,0,7,7},
+ {2307,7,9,0,7,7},
+ {2339,5,6,0,7,5},
+ {2354,6,6,0,7,6},
+ {2372,4,7,0,6,4},
+ {2386,7,6,0,7,7},
+ {2407,7,6,0,7,6},
+ {2428,10,6,0,7,9},
+ {2458,7,6,0,7,6},
+ {2479,7,9,0,7,6},
+ {2511,6,6,0,7,6},
+ {2529,5,11,0,4,5},
+ {2557,7,12,0,4,7},
+ {2599,5,11,0,4,5},
+ {2627,7,5,0,8,7},
+};
+static const Font font_small = {font_small_glyphs, font_small_bits, 17, 13};
+static const uint8_t font_medium_bits[4846] = {
+ 208,79,192,63,176,63,160,47,160,31,144,15,128,15,112,14,0,0,48,5,208,79,160,46,224,12,221,0,189,176,12,176,
+ 10,186,0,154,144,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,48,63,208,8,0,112,14,241,4,0,160,11,244,1,240,255,255,255,239,80,245,88,204,69,0,243,3,141,0,
+ 0,245,1,111,0,249,255,255,255,111,83,204,149,95,37,0,141,128,13,0,0,95,176,10,0,48,63,208,8,0,0,0,
+ 30,0,0,0,224,1,0,16,216,239,140,0,250,251,185,11,240,12,30,0,0,253,230,1,0,64,254,159,2,0,16,247,
+ 255,7,0,0,94,253,2,1,224,145,79,242,139,175,223,17,217,254,157,1,0,0,30,0,0,0,224,1,0,80,237,8,
+ 0,225,8,0,225,123,95,0,231,1,0,244,4,158,16,126,0,0,245,3,172,128,30,0,0,243,4,158,242,7,0,0,
+ 224,123,95,217,178,206,2,64,237,40,111,232,214,11,0,0,160,13,188,112,15,0,0,243,5,173,96,47,0,0,203,0,
+ 188,112,15,0,64,79,0,232,214,11,0,192,11,0,161,206,2,0,178,238,25,0,0,0,237,168,159,0,0,32,159,0,
+ 206,0,0,32,191,32,175,0,0,0,251,215,62,0,0,0,243,223,3,16,1,48,254,238,4,208,31,224,79,227,95,243,
+ 10,243,11,32,254,253,3,243,29,0,243,175,0,192,223,169,254,254,5,16,216,239,75,210,95,224,12,208,11,176,10,160,
+ 9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,245,5,209,11,96,95,0,235,0,240,11,48,143,0,
+ 244,6,80,111,0,244,6,48,143,0,241,11,0,236,0,96,95,0,225,11,0,245,4,244,6,0,234,1,64,127,0,208,
+ 12,0,250,1,112,79,0,245,5,80,111,0,245,6,112,79,0,250,1,208,13,64,127,0,234,1,243,6,0,0,112,63,
+ 0,0,0,245,1,0,195,120,95,201,64,203,254,206,27,0,226,205,0,0,209,45,159,0,32,106,144,8,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,242,4,
+ 0,0,32,79,0,0,0,242,4,0,244,255,255,255,22,102,247,104,38,0,32,79,0,0,0,242,4,0,0,16,40,0,
+ 0,0,0,0,0,192,47,224,12,242,7,246,1,247,255,73,136,88,0,0,0,0,0,0,0,0,48,5,208,79,160,46,
+ 0,0,236,0,0,242,9,0,128,63,0,0,221,0,0,243,8,0,144,47,0,0,206,0,0,244,7,0,160,47,0,16,
+ 190,0,0,245,6,0,176,31,0,0,0,214,223,6,0,245,157,253,6,192,47,16,238,16,191,0,144,63,244,9,0,247,
+ 69,143,0,96,111,244,8,0,246,54,159,0,112,111,241,11,0,249,3,252,2,225,14,64,223,200,127,0,80,252,125,0,
+ 0,48,253,1,0,64,254,31,0,96,207,251,1,0,164,177,31,0,0,0,251,1,0,0,176,31,0,0,0,251,1,0,
+ 0,176,31,0,0,0,251,1,0,0,176,31,0,0,0,251,1,0,0,176,31,0,32,217,223,7,16,254,156,253,8,80,
+ 3,16,238,0,0,0,208,15,0,0,16,207,0,0,0,250,6,0,0,247,10,0,0,245,27,0,0,245,28,0,0,244,
+ 28,0,0,226,175,153,153,68,255,255,255,127,80,235,223,24,16,238,154,253,9,48,1,16,238,0,0,0,224,13,0,0,
+ 146,111,0,144,255,94,0,0,132,217,143,0,0,0,209,63,0,0,0,249,21,0,0,209,63,229,138,217,175,32,218,239,
+ 108,0,0,0,192,95,0,0,112,255,5,0,32,190,95,0,0,203,247,5,0,245,115,95,0,225,9,247,5,160,29,112,
+ 95,64,95,0,247,5,250,255,255,255,93,136,136,251,122,0,0,112,95,0,0,0,247,5,112,255,255,143,0,248,171,170,
+ 5,144,47,0,0,0,250,0,0,0,192,239,223,8,0,167,152,254,10,0,0,16,254,2,0,0,144,95,0,0,0,250,
+ 4,1,0,225,30,241,155,233,127,0,217,238,92,0,0,96,236,159,0,160,223,137,6,96,143,0,0,0,220,0,0,0,
+ 241,121,254,43,48,223,141,250,13,244,29,0,249,53,159,0,80,127,241,11,0,246,7,252,3,176,63,64,239,185,191,0,
+ 64,236,158,1,246,255,255,255,71,153,153,217,111,0,0,0,237,1,0,0,245,9,0,0,176,47,0,0,48,191,0,0,
+ 0,249,5,0,0,225,13,0,0,112,127,0,0,0,253,1,0,0,245,9,0,0,192,63,0,0,0,215,222,24,0,248,
+ 123,250,10,208,14,0,252,0,237,0,192,14,96,175,146,127,0,112,255,127,0,48,237,251,61,0,237,2,211,30,244,8,
+ 0,246,70,159,0,112,95,208,175,151,223,1,146,253,157,2,0,215,207,5,0,248,156,253,6,241,13,16,238,48,143,0,
+ 128,79,244,8,0,247,38,207,0,192,111,176,191,200,254,5,161,238,121,63,0,0,0,235,0,0,0,245,8,80,136,251,
+ 28,0,247,206,23,0,176,46,208,79,48,5,0,0,0,0,0,0,48,5,208,79,160,46,176,46,208,79,48,5,0,0,
+ 0,0,0,0,0,0,192,47,224,12,242,7,246,1,0,0,0,130,5,0,32,249,61,0,146,223,6,16,249,92,0,0,
+ 227,142,2,0,0,113,253,74,0,0,0,181,223,3,0,0,48,89,0,0,0,0,0,0,0,0,0,243,255,255,255,21,
+ 102,102,102,38,0,0,0,0,16,102,102,102,38,243,255,255,255,5,0,0,0,0,0,0,0,0,0,0,0,0,0,147,
+ 2,0,0,32,253,42,0,0,0,197,175,3,0,0,64,251,42,0,0,113,254,5,48,249,142,1,194,207,6,0,64,74,
+ 0,0,0,0,0,0,0,0,0,0,0,0,164,253,125,144,174,201,127,17,0,241,12,0,16,191,0,16,252,4,32,237,
+ 5,0,249,3,0,192,12,0,0,0,0,0,64,4,0,16,255,2,0,192,29,0,0,0,164,253,190,5,0,0,145,175,
+ 70,149,175,0,0,218,3,0,0,227,8,64,79,96,253,190,113,30,176,11,245,56,248,17,95,224,7,188,0,246,0,126,
+ 241,5,127,0,247,0,110,241,5,142,0,250,32,79,224,7,234,100,254,165,13,176,12,161,222,116,206,3,48,143,0,0,
+ 0,0,0,0,246,108,84,166,7,0,0,48,217,239,173,3,0,0,0,253,7,0,0,0,244,222,0,0,0,144,143,63,
+ 0,0,0,190,243,8,0,0,245,7,237,0,0,160,47,128,79,0,16,207,0,243,9,0,246,255,255,239,0,176,159,153,
+ 201,95,32,207,0,0,244,10,247,7,0,0,254,193,47,0,0,144,111,112,255,255,173,2,0,247,139,201,239,1,112,111,
+ 0,192,95,0,247,6,0,250,4,112,111,0,228,30,0,247,255,255,44,0,112,175,136,251,28,0,247,6,0,248,8,112,
+ 111,0,80,175,0,247,6,0,249,9,112,191,153,252,46,0,247,255,223,42,0,0,48,218,223,58,0,246,191,202,79,48,
+ 239,3,0,2,144,127,0,0,0,208,47,0,0,0,240,15,0,0,0,240,14,0,0,0,224,31,0,0,0,176,95,0,
+ 0,0,80,223,2,0,0,0,249,191,185,62,0,96,236,223,26,112,255,239,157,2,0,112,191,152,252,78,0,112,111,0,
+ 80,239,1,112,111,0,0,250,6,112,111,0,0,245,10,112,111,0,0,243,12,112,111,0,0,243,11,112,111,0,0,245,
+ 10,112,111,0,0,250,6,112,111,0,112,223,0,112,191,169,253,62,0,112,255,239,140,1,0,112,255,255,255,0,247,155,
+ 153,8,112,111,0,0,0,247,6,0,0,112,111,0,0,0,247,255,255,10,112,191,136,104,0,247,6,0,0,112,111,0,
+ 0,0,247,6,0,0,112,191,153,153,0,247,255,255,15,112,255,255,239,0,247,155,153,8,112,95,0,0,0,247,5,0,
+ 0,112,95,0,0,0,247,255,255,10,112,191,153,105,0,247,5,0,0,112,95,0,0,0,247,5,0,0,112,95,0,0,
+ 0,247,5,0,0,0,32,217,239,140,1,0,245,207,170,237,0,48,255,5,0,32,0,144,143,0,0,0,0,208,47,0,
+ 0,0,0,240,14,0,0,0,0,240,14,0,252,255,6,224,31,0,151,252,6,160,111,0,0,247,6,64,239,3,0,247,
+ 6,0,248,191,169,253,6,0,80,235,239,157,3,112,111,0,0,245,8,112,111,0,0,245,8,112,111,0,0,245,8,112,
+ 111,0,0,245,8,112,111,0,0,245,8,112,255,255,255,255,8,112,191,153,153,251,8,112,111,0,0,245,8,112,111,0,
+ 0,245,8,112,111,0,0,245,8,112,111,0,0,245,8,112,111,0,0,245,8,112,111,0,247,6,112,111,0,247,6,112,
+ 111,0,247,6,112,111,0,247,6,112,111,0,247,6,112,111,0,247,6,0,128,95,0,0,248,5,0,128,95,0,0,248,
+ 5,0,128,95,0,0,248,5,0,128,95,0,0,248,5,0,128,95,0,0,248,5,0,128,95,0,0,249,4,0,192,47,
+ 32,186,207,0,227,174,2,0,112,111,0,96,175,0,247,6,64,223,1,112,111,32,238,2,0,247,6,252,4,0,112,111,
+ 249,7,0,0,247,252,30,0,0,112,255,252,10,0,0,247,24,253,4,0,112,111,64,223,1,0,247,6,144,159,0,112,
+ 111,0,209,79,0,247,6,0,244,29,112,111,0,0,0,247,6,0,0,112,111,0,0,0,247,6,0,0,112,111,0,0,
+ 0,247,6,0,0,112,111,0,0,0,247,6,0,0,112,111,0,0,0,247,6,0,0,112,191,153,153,2,247,255,255,63,
+ 112,255,5,0,0,248,79,0,247,175,0,0,208,255,4,112,207,14,0,48,207,79,0,247,248,5,0,233,248,4,112,63,
+ 175,0,224,138,79,0,247,179,14,64,95,248,4,112,63,246,4,233,128,79,0,247,19,159,224,10,248,4,112,63,176,94,
+ 79,128,79,0,247,3,246,237,0,248,4,112,63,16,255,9,128,79,0,247,3,176,79,0,248,4,112,239,2,0,160,15,
+ 0,247,175,0,0,250,0,112,223,79,0,160,15,0,247,246,12,0,250,0,112,63,250,6,160,15,0,247,35,238,1,250,
+ 0,112,63,112,159,160,15,0,247,3,208,63,250,0,112,63,0,245,156,15,0,247,3,0,251,254,0,112,63,0,32,255,
+ 15,0,247,3,0,128,255,0,0,80,235,223,41,0,0,128,255,171,252,62,0,64,239,2,0,246,13,0,250,6,0,0,
+ 252,4,224,31,0,0,112,143,0,239,0,0,0,245,9,240,14,0,0,80,159,0,254,1,0,0,247,8,160,95,0,0,
+ 176,79,0,244,45,0,96,223,0,0,248,174,201,239,3,0,0,181,254,157,2,0,112,255,239,108,0,112,191,169,255,7,
+ 112,111,0,243,14,112,111,0,208,31,112,111,0,224,15,112,111,32,250,10,112,255,255,207,2,112,191,120,4,0,112,111,
+ 0,0,0,112,111,0,0,0,112,111,0,0,0,112,111,0,0,0,0,80,235,223,41,0,0,128,255,171,252,62,0,64,
+ 239,2,0,246,13,0,250,6,0,0,252,4,224,31,0,0,112,143,0,239,0,0,0,245,9,240,14,0,0,80,159,0,
+ 254,1,0,0,247,8,160,95,0,0,176,79,0,244,45,0,96,223,0,0,248,174,201,239,2,0,0,181,254,207,1,0,
+ 0,0,0,226,79,0,0,0,0,0,245,46,0,0,0,0,0,249,28,0,112,255,239,108,0,0,247,155,250,127,0,112,
+ 111,0,243,14,0,247,6,0,253,1,112,111,0,224,14,0,247,6,146,159,0,112,255,255,175,1,0,247,139,253,3,0,
+ 112,111,48,207,0,0,247,6,144,127,0,112,111,0,225,46,0,247,6,0,245,11,0,215,238,107,0,249,173,235,9,240,
+ 30,0,16,0,223,0,0,0,176,159,1,0,0,210,239,24,0,0,113,254,78,0,0,0,248,13,0,0,0,252,17,2,
+ 0,225,14,243,172,217,143,16,217,238,108,0,252,255,255,255,124,153,252,156,121,0,96,127,0,0,0,246,7,0,0,96,
+ 127,0,0,0,246,7,0,0,96,127,0,0,0,246,7,0,0,96,127,0,0,0,246,7,0,0,96,127,0,0,0,246,
+ 7,0,144,79,0,0,246,7,144,79,0,0,246,7,144,79,0,0,246,7,144,79,0,0,246,7,144,79,0,0,246,7,
+ 144,79,0,0,246,7,144,79,0,0,246,7,144,79,0,0,246,7,128,111,0,0,248,6,64,207,1,32,254,2,0,250,
+ 174,234,127,0,0,112,253,190,5,0,253,1,0,32,207,248,6,0,112,127,243,11,0,192,47,208,31,0,242,12,128,95,
+ 0,246,7,48,175,0,251,2,0,237,17,207,0,0,248,101,127,0,0,243,169,47,0,0,208,221,12,0,0,128,255,7,
+ 0,0,48,255,2,0,252,2,0,248,9,0,224,14,248,5,0,252,13,0,243,10,244,9,16,239,47,0,247,6,241,12,
+ 80,143,111,0,250,2,192,31,144,47,175,0,238,0,128,79,208,13,235,32,175,0,64,143,242,9,247,99,111,0,16,191,
+ 245,5,243,151,47,0,0,236,249,1,224,202,14,0,0,248,205,0,160,253,10,0,0,244,143,0,96,255,6,0,0,241,
+ 79,0,32,255,3,0,246,10,0,160,95,192,79,0,244,11,48,207,0,252,2,0,249,102,143,0,0,225,238,13,0,0,
+ 96,255,4,0,0,144,255,8,0,0,243,202,47,0,0,252,66,191,0,112,143,0,250,5,226,29,0,242,30,250,5,0,
+ 128,159,251,4,0,192,63,243,12,0,245,10,176,79,0,252,3,48,191,64,175,0,0,250,196,47,0,0,243,253,9,0,
+ 0,160,255,2,0,0,64,191,0,0,0,48,175,0,0,0,48,175,0,0,0,48,175,0,0,0,48,175,0,0,245,255,
+ 255,255,56,153,153,233,111,0,0,64,207,0,0,16,253,2,0,0,248,7,0,0,243,13,0,0,192,63,0,0,112,159,
+ 0,0,32,222,1,0,0,251,5,0,0,245,158,153,153,118,255,255,255,175,192,255,13,236,86,192,13,0,220,0,192,13,
+ 0,220,0,192,13,0,220,0,192,13,0,220,0,192,13,0,220,0,192,13,0,236,86,192,255,13,251,1,0,80,111,0,
+ 0,225,11,0,0,250,2,0,64,127,0,0,224,12,0,0,249,2,0,48,143,0,0,208,13,0,0,248,3,0,32,159,
+ 0,0,192,14,249,255,49,182,31,0,249,1,144,31,0,249,1,144,31,0,249,1,144,31,0,249,1,144,31,0,249,1,
+ 144,31,0,249,49,182,31,249,255,1,0,144,13,0,0,32,255,6,0,0,201,216,1,0,241,21,126,0,128,13,112,30,
+ 16,110,0,209,8,232,1,0,246,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,240,255,255,239,16,17,17,17,0,209,79,0,0,0,226,12,0,0,0,227,6,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,32,217,222,25,0,209,121,250,10,0,0,0,238,0,0,0,192,15,32,217,254,255,16,254,71,
+ 211,15,244,10,16,254,32,239,119,236,15,80,253,109,246,0,160,47,0,0,0,160,47,0,0,0,160,47,0,0,0,160,
+ 47,0,0,0,160,79,251,125,0,160,239,138,254,6,160,143,0,242,13,160,79,0,208,31,160,63,0,176,47,160,79,0,
+ 208,31,160,143,0,243,13,160,239,138,254,6,160,61,252,125,0,0,197,238,60,80,239,153,29,208,63,0,0,242,12,0,
+ 0,243,11,0,0,242,12,0,0,224,63,0,0,96,239,153,61,0,198,239,27,0,0,0,243,10,0,0,0,243,10,0,
+ 0,0,243,10,0,0,0,243,10,0,215,191,245,10,96,239,168,254,10,208,47,0,248,10,241,12,0,243,10,243,11,0,
+ 242,10,241,12,0,243,10,224,47,0,247,10,112,223,168,254,10,0,232,191,226,10,0,197,223,25,0,245,124,248,11,208,
+ 30,0,248,36,239,153,201,111,243,190,187,187,37,207,0,0,0,208,63,0,0,0,245,158,151,13,0,180,254,157,0,0,
+ 195,238,5,208,159,41,48,175,0,0,244,8,0,231,255,175,64,249,107,4,64,143,0,0,244,8,0,64,143,0,0,244,
+ 8,0,64,143,0,0,244,8,0,64,143,0,0,16,217,255,255,9,251,70,252,22,241,10,64,143,32,175,0,244,8,192,
+ 111,180,63,0,226,239,76,0,144,30,0,0,0,246,255,223,7,194,157,152,253,164,30,0,64,127,219,0,0,246,118,175,
+ 85,232,29,112,237,223,24,0,160,47,0,0,0,160,47,0,0,0,160,47,0,0,0,160,47,0,0,0,160,79,235,157,
+ 1,160,239,139,253,8,160,159,0,242,12,160,79,0,224,14,160,63,0,224,14,160,47,0,224,14,160,47,0,224,14,160,
+ 47,0,224,14,160,47,0,224,14,144,46,144,46,0,0,0,0,160,47,160,47,160,47,160,47,160,47,160,47,160,47,160,
+ 47,160,47,0,233,2,144,46,0,0,0,0,0,0,250,2,160,47,0,250,2,160,47,0,250,2,160,47,0,250,2,160,
+ 47,0,250,2,160,47,0,251,130,249,13,253,60,0,160,47,0,0,0,160,47,0,0,0,160,47,0,0,0,160,47,0,
+ 0,0,160,47,0,251,6,160,47,144,143,0,160,47,248,9,0,160,111,191,0,0,160,255,207,0,0,160,159,248,8,0,
+ 160,47,192,79,0,160,47,48,239,1,160,47,0,246,11,160,47,160,47,160,47,160,47,160,47,160,47,160,47,160,47,160,
+ 47,160,47,160,47,160,47,160,47,160,61,252,125,145,238,43,0,250,174,232,223,141,252,11,160,143,0,246,30,0,238,0,
+ 250,4,64,175,0,192,31,160,63,0,244,9,0,252,1,250,2,64,159,0,192,31,160,47,0,244,9,0,252,1,250,2,
+ 64,159,0,192,31,160,47,0,244,9,0,252,1,160,61,235,157,1,160,239,139,253,8,160,159,0,242,12,160,79,0,224,
+ 14,160,63,0,224,14,160,47,0,224,14,160,47,0,224,14,160,47,0,224,14,160,47,0,224,14,0,197,239,59,0,80,
+ 239,153,239,2,208,47,0,246,10,242,12,0,240,13,243,11,0,224,15,241,12,0,240,13,192,47,0,246,10,64,239,153,
+ 239,2,0,180,238,59,0,160,62,251,125,0,160,239,154,254,6,160,143,0,243,13,160,63,0,208,31,160,63,0,176,47,
+ 160,79,0,208,15,160,143,0,243,13,160,239,138,254,6,160,95,252,125,0,160,47,0,0,0,160,47,0,0,0,160,47,
+ 0,0,0,160,47,0,0,0,0,215,191,227,10,96,239,168,254,10,208,47,0,248,10,241,12,0,243,10,243,11,0,242,
+ 10,241,12,0,243,10,224,47,0,247,10,112,223,152,254,10,0,232,191,245,10,0,0,0,243,10,0,0,0,243,10,0,
+ 0,0,243,10,0,0,0,243,10,160,28,234,8,234,235,91,160,207,1,0,250,5,0,160,47,0,0,250,2,0,160,47,
+ 0,0,250,2,0,160,47,0,0,48,235,222,8,225,126,183,9,243,10,0,0,208,191,5,0,16,250,223,3,0,32,249,
+ 14,0,0,176,31,211,120,248,12,178,254,174,2,0,94,0,64,95,0,230,255,207,180,159,86,128,95,0,128,95,0,128,
+ 95,0,128,95,0,112,111,0,64,223,136,0,232,190,192,31,0,240,13,192,31,0,240,13,192,31,0,240,13,192,31,0,
+ 240,13,192,31,0,240,13,176,47,0,241,13,160,79,0,246,13,96,239,152,238,13,0,216,207,164,13,252,2,0,248,118,
+ 127,0,208,30,242,12,48,175,0,251,2,248,4,80,127,208,14,0,225,60,143,0,0,250,248,3,0,64,239,12,0,0,
+ 208,127,0,0,251,2,144,175,0,241,124,111,0,237,14,80,127,243,10,242,248,3,249,3,222,96,47,127,192,14,160,47,
+ 218,192,27,175,0,245,229,9,248,245,6,16,175,79,64,175,47,0,192,255,1,224,223,0,0,248,11,0,251,9,0,245,
+ 11,16,253,2,250,6,248,7,16,238,244,12,0,80,255,63,0,0,224,191,0,0,112,239,79,0,48,223,226,29,0,252,
+ 3,246,9,247,9,0,252,4,252,3,0,249,102,143,0,208,31,241,13,48,175,0,250,3,248,5,64,143,208,14,0,208,
+ 61,159,0,0,247,249,3,0,32,255,13,0,0,176,143,0,0,0,251,2,0,0,243,11,0,96,232,63,0,0,249,76,
+ 0,0,0,243,255,255,15,97,102,249,12,0,0,252,3,0,128,127,0,0,243,12,0,0,237,2,0,128,111,0,0,243,
+ 110,102,22,247,255,255,31,0,112,205,0,246,108,0,248,3,0,248,2,0,249,2,48,237,0,250,60,0,181,143,0,0,
+ 251,1,0,249,2,0,248,2,0,248,2,0,247,3,0,243,109,0,96,204,0,64,47,0,0,0,244,2,0,0,64,47,
+ 0,0,0,244,2,0,0,64,47,0,0,0,244,2,0,0,64,47,0,0,0,244,2,0,0,64,47,0,0,0,244,2,
+ 0,0,64,47,0,0,0,244,2,0,0,64,47,0,0,0,244,2,0,0,64,47,0,0,0,244,2,0,0,64,47,0,
+ 0,217,9,0,196,111,0,32,159,0,16,159,0,16,175,0,0,222,3,0,179,159,0,247,91,0,206,0,16,159,0,16,
+ 159,0,16,159,0,48,159,0,197,95,0,217,7,0,177,238,139,151,69,106,184,254,43,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+};
+static const Glyph font_medium_glyphs[95] = {
+ {0,0,0,0,0,4},
+ {0,4,12,0,6,4},
+ {24,7,12,0,6,7},
+ {66,10,12,0,6,10},
+ {126,9,14,0,5,9},
+ {189,14,12,0,6,14},
+ {273,12,12,0,6,12},
+ {345,4,12,0,6,4},
+ {369,5,15,0,6,5},
+ {407,5,15,0,6,5},
+ {445,9,13,0,5,9},
+ {504,9,10,0,8,9},
+ {549,4,4,0,16,4},
+ {557,5,5,0,13,5},
+ {570,4,3,0,15,4},
+ {576,7,12,0,6,6},
+ {618,9,12,0,6,9},
+ {672,9,12,0,6,9},
+ {726,9,12,0,6,9},
+ {780,9,12,0,6,9},
+ {834,9,12,0,6,9},
+ {888,9,12,0,6,9},
+ {942,9,12,0,6,9},
+ {996,9,12,0,6,9},
+ {1050,9,12,0,6,9},
+ {1104,9,12,0,6,9},
+ {1158,4,9,0,9,4},
+ {1176,4,11,0,9,4},
+ {1198,9,10,0,8,9},
+ {1243,9,8,0,10,9},
+ {1279,9,10,0,8,9},
+ {1324,7,12,0,6,7},
+ {1366,14,13,0,6,14},
+ {1457,11,12,0,6,11},
+ {1523,11,12,0,6,11},
+ {1589,10,12,0,6,10},
+ {1649,12,12,0,6,12},
+ {1721,9,12,0,6,9},
+ {1775,9,12,0,6,9},
+ {1829,12,12,0,6,12},
+ {1901,12,12,0,6,12},
+ {1973,5,12,0,6,5},
+ {2003,7,15,-2,6,5},
+ {2056,11,12,0,6,10},
+ {2122,9,12,0,6,9},
+ {2176,15,12,0,6,15},
+ {2266,13,12,0,6,13},
+ {2344,13,12,0,6,13},
+ {2422,10,12,0,6,10},
+ {2482,13,15,0,6,13},
+ {2580,11,12,0,6,10},
+ {2646,9,12,0,6,9},
+ {2700,9,12,0,6,9},
+ {2754,12,12,0,6,12},
+ {2826,10,12,0,6,10},
+ {2886,16,12,0,6,15},
+ {2982,10,12,0,6,10},
+ {3042,10,12,0,6,9},
+ {3102,9,12,0,6,9},
+ {3156,5,15,0,6,5},
+ {3194,7,12,0,6,6},
+ {3236,5,15,0,6,5},
+ {3274,9,12,0,6,9},
+ {3328,8,3,-1,18,7},
+ {3340,9,13,0,5,9},
+ {3399,9,9,0,9,9},
+ {3440,10,13,0,5,10},
+ {3505,8,9,0,9,8},
+ {3541,10,13,0,5,10},
+ {3606,9,9,0,9,9},
+ {3647,7,13,0,5,6},
+ {3693,9,13,0,9,9},
+ {3752,10,13,0,5,10},
+ {3817,4,13,0,5,4},
+ {3843,5,17,-1,5,4},
+ {3886,10,13,0,5,9},
+ {3951,4,13,0,5,4},
+ {3977,15,9,0,9,15},
+ {4045,10,9,0,9,10},
+ {4090,10,9,0,9,10},
+ {4135,10,13,0,9,10},
+ {4200,10,13,0,9,10},
+ {4265,7,9,0,9,7},
+ {4297,8,9,0,9,8},
+ {4333,6,11,0,7,6},
+ {4366,10,9,0,9,10},
+ {4411,9,9,0,9,9},
+ {4452,13,9,0,9,13},
+ {4511,9,9,0,9,9},
+ {4552,9,13,0,9,9},
+ {4611,8,9,0,9,8},
+ {4647,6,15,0,6,6},
+ {4692,9,17,0,5,9},
+ {4769,6,15,0,6,6},
+ {4814,9,7,0,11,9},
+};
+static const Font font_medium = {font_medium_glyphs, font_medium_bits, 23, 18};
+static const uint8_t font_big_bits[20612] = {
+ 0,249,255,15,0,128,255,239,0,0,247,255,13,0,96,255,207,0,0,245,255,11,0,80,255,191,0,0,244,255,10,0,
+ 48,255,159,0,0,242,255,8,0,16,255,127,0,0,240,255,7,0,0,255,111,0,0,224,255,5,0,0,253,79,0,0,
+ 192,255,3,0,0,251,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,252,94,0,0,249,255,14,0,176,
+ 255,255,1,0,249,255,14,0,16,235,77,0,0,251,255,0,243,255,9,0,160,255,14,32,255,143,0,0,249,223,0,241,
+ 255,6,0,128,255,12,0,255,95,0,0,247,191,0,208,255,4,0,96,255,10,0,252,63,0,0,245,143,0,176,255,2,
+ 0,48,255,7,0,250,31,0,0,242,111,0,144,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,253,47,0,160,255,3,0,0,0,0,16,255,14,0,208,255,0,0,0,0,0,64,255,11,0,241,207,0,
+ 0,0,0,0,96,255,8,0,244,159,0,0,0,0,0,144,255,5,0,247,127,0,0,0,0,0,192,255,3,0,250,79,
+ 0,0,0,0,0,240,255,0,0,252,31,0,0,0,254,255,255,255,255,255,255,255,255,47,0,254,255,255,255,255,255,255,
+ 255,255,47,0,203,204,254,223,204,236,255,205,204,44,0,0,0,251,63,0,160,255,4,0,0,0,0,0,254,14,0,208,
+ 255,1,0,0,0,0,48,255,11,0,242,207,0,0,0,0,0,96,255,8,0,245,159,0,0,0,243,255,255,255,255,255,
+ 255,255,255,255,0,243,255,255,255,255,255,255,255,255,255,0,195,204,252,255,204,204,255,207,204,204,0,0,0,243,191,0,
+ 32,255,12,0,0,0,0,0,245,159,0,80,255,10,0,0,0,0,0,248,111,0,128,255,7,0,0,0,0,0,251,63,
+ 0,160,255,4,0,0,0,0,0,253,31,0,208,255,1,0,0,0,0,16,255,13,0,241,239,0,0,0,0,0,64,255,
+ 10,0,244,191,0,0,0,0,0,0,0,0,246,12,0,0,0,0,0,0,0,96,207,0,0,0,0,0,0,0,0,246,
+ 12,0,0,0,0,0,0,131,236,255,222,123,3,0,0,16,250,255,255,255,255,255,29,0,16,253,255,255,255,255,255,191,
+ 0,0,249,255,142,249,77,151,254,5,0,224,255,63,96,207,0,0,4,0,0,255,239,0,246,12,0,0,0,0,224,255,
+ 47,96,207,0,0,0,0,0,250,255,93,246,12,0,0,0,0,48,255,255,239,207,0,0,0,0,0,80,255,255,255,191,
+ 5,0,0,0,0,32,251,255,255,255,110,0,0,0,0,0,147,254,255,255,207,1,0,0,0,0,96,255,255,255,207,0,
+ 0,0,0,0,246,28,248,255,95,0,0,0,0,96,207,0,248,255,9,0,0,0,0,246,12,80,255,159,0,130,2,0,
+ 96,207,0,250,255,7,32,255,140,53,247,109,252,255,46,0,242,255,255,255,255,255,255,111,0,32,254,255,255,255,255,255,
+ 77,0,0,16,149,219,254,255,156,5,0,0,0,0,0,0,246,12,0,0,0,0,0,0,0,96,207,0,0,0,0,0,
+ 0,0,0,246,12,0,0,0,0,0,0,0,96,207,0,0,0,0,0,16,216,239,58,0,0,0,0,128,255,11,0,0,
+ 0,16,253,255,255,95,0,0,0,32,255,47,0,0,0,0,250,255,236,255,30,0,0,0,250,159,0,0,0,0,241,255,
+ 6,209,255,7,0,0,243,239,1,0,0,0,80,255,14,0,247,207,0,0,192,255,7,0,0,0,0,247,191,0,64,255,
+ 14,0,80,255,13,0,0,0,0,144,255,10,0,242,255,1,0,253,95,0,0,0,0,0,249,159,0,32,255,31,0,247,
+ 207,0,0,0,0,0,128,255,10,0,242,255,1,225,255,3,0,0,0,0,0,247,191,0,64,255,15,144,255,10,146,253,
+ 157,2,0,64,255,14,0,247,207,32,255,47,227,255,255,239,2,0,225,255,5,209,255,8,251,143,192,255,190,254,207,0,
+ 0,248,255,236,255,46,244,239,65,255,63,32,255,79,0,16,252,255,255,111,192,255,6,248,191,0,160,255,9,0,0,215,
+ 239,75,96,255,12,160,255,8,0,247,191,0,0,0,0,0,16,253,79,0,251,127,0,80,255,13,0,0,0,0,0,248,
+ 191,0,192,255,7,0,245,223,0,0,0,0,0,226,255,3,0,251,127,0,80,255,13,0,0,0,0,144,255,9,0,160,
+ 255,8,0,247,207,0,0,0,0,48,255,30,0,0,247,191,0,160,255,9,0,0,0,0,251,127,0,0,48,255,63,32,
+ 255,95,0,0,0,0,245,223,0,0,0,176,255,190,254,223,0,0,0,0,208,255,5,0,0,0,210,255,255,239,3,0,
+ 0,0,96,255,12,0,0,0,0,145,253,174,2,0,0,0,0,147,236,239,124,1,0,0,0,0,0,0,0,128,255,255,
+ 255,255,62,0,0,0,0,0,0,0,247,255,255,255,255,239,1,0,0,0,0,0,0,254,255,57,82,253,255,7,0,0,
+ 0,0,0,48,255,191,0,0,244,255,10,0,0,0,0,0,48,255,143,0,0,241,255,10,0,0,0,0,0,16,255,191,
+ 0,0,245,255,7,0,0,0,0,0,0,251,255,3,32,254,239,2,0,0,0,0,0,0,243,255,46,230,255,111,0,0,
+ 0,0,0,0,0,112,255,255,255,255,6,0,0,0,0,0,0,0,0,252,255,255,60,0,0,0,0,0,0,0,0,178,
+ 255,255,255,3,0,0,16,51,35,0,0,48,254,255,255,255,62,0,0,96,255,159,0,0,226,255,239,181,255,239,3,0,
+ 176,255,95,0,0,251,255,45,0,251,255,62,0,242,255,14,0,32,255,255,4,0,176,255,239,3,249,255,8,0,80,255,
+ 223,0,0,0,250,255,110,255,239,1,0,96,255,191,0,0,0,160,255,255,255,127,0,0,80,255,223,0,0,0,0,250,
+ 255,255,11,0,0,16,255,255,8,0,0,0,245,255,255,6,0,0,0,250,255,223,104,118,234,255,255,255,111,0,0,0,
+ 209,255,255,255,255,255,255,223,255,255,7,0,0,32,251,255,255,255,255,207,5,247,255,143,0,0,0,48,201,254,222,139,
+ 3,0,112,255,255,9,0,251,255,0,0,250,239,0,0,249,223,0,0,248,207,0,0,247,191,0,0,246,175,0,0,245,
+ 143,0,0,243,127,0,0,242,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,32,254,111,0,0,0,252,191,0,0,0,246,255,2,0,0,225,255,9,0,0,128,255,47,
+ 0,0,0,254,191,0,0,0,245,255,5,0,0,160,255,31,0,0,0,254,191,0,0,0,242,255,8,0,0,80,255,95,
+ 0,0,0,247,255,3,0,0,128,255,31,0,0,0,249,255,1,0,0,144,255,15,0,0,0,249,255,0,0,0,144,255,
+ 31,0,0,0,247,255,3,0,0,80,255,95,0,0,0,242,255,8,0,0,0,254,191,0,0,0,160,255,14,0,0,0,
+ 246,255,5,0,0,16,254,175,0,0,0,128,255,47,0,0,0,225,255,8,0,0,0,247,255,2,0,0,0,252,175,0,
+ 0,0,32,254,111,0,160,255,12,0,0,0,225,255,8,0,0,0,246,255,3,0,0,0,252,207,0,0,0,80,255,79,
+ 0,0,0,224,255,10,0,0,0,249,255,1,0,0,64,255,111,0,0,0,224,255,10,0,0,0,251,223,0,0,0,144,
+ 255,31,0,0,0,246,255,3,0,0,80,255,95,0,0,0,244,255,5,0,0,48,255,111,0,0,0,244,255,6,0,0,
+ 80,255,95,0,0,0,246,255,3,0,0,128,255,47,0,0,0,251,239,0,0,0,224,255,11,0,0,48,255,127,0,0,
+ 0,248,255,2,0,0,208,255,11,0,0,80,255,95,0,0,0,252,207,0,0,0,245,255,4,0,0,209,255,9,0,0,
+ 144,255,12,0,0,0,0,0,0,144,255,31,0,0,0,0,0,0,0,247,255,0,0,0,0,0,0,0,96,255,13,0,
+ 0,0,0,0,0,0,244,207,0,0,0,0,16,2,0,32,255,10,0,0,3,0,245,140,4,241,159,16,165,238,0,112,
+ 255,255,174,255,204,255,255,31,0,250,255,255,255,255,255,255,255,3,80,151,186,252,255,239,172,137,39,0,0,0,64,255,
+ 255,12,0,0,0,0,0,16,254,191,255,8,0,0,0,0,0,251,175,243,255,5,0,0,0,0,247,255,4,251,239,2,
+ 0,0,0,243,255,12,48,255,207,0,0,0,48,252,111,0,176,255,25,0,0,0,0,197,1,0,180,3,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,201,44,0,0,0,0,0,0,0,192,255,3,0,0,0,0,0,0,0,252,63,0,0,0,0,0,0,0,192,255,3,
+ 0,0,0,0,0,0,0,252,63,0,0,0,0,0,0,0,192,255,3,0,0,0,0,0,0,0,252,63,0,0,0,0,
+ 246,255,255,255,255,255,255,255,12,96,255,255,255,255,255,255,255,207,0,230,238,238,254,255,238,238,238,12,0,0,0,0,
+ 252,63,0,0,0,0,0,0,0,192,255,3,0,0,0,0,0,0,0,252,63,0,0,0,0,0,0,0,192,255,3,0,
+ 0,0,0,0,0,0,252,63,0,0,0,0,0,0,0,192,255,3,0,0,0,0,0,0,0,184,43,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,245,255,11,0,
+ 128,255,127,0,0,251,255,2,0,208,255,12,0,32,255,111,0,0,245,239,1,0,144,255,9,0,0,253,47,0,0,192,
+ 255,255,255,191,0,252,255,255,255,11,192,255,255,255,191,0,84,85,85,85,4,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,32,252,94,0,0,249,255,14,0,176,255,255,1,0,249,255,14,0,16,235,77,0,0,0,0,0,208,255,12,0,0,
+ 0,64,255,111,0,0,0,0,250,255,1,0,0,0,225,255,10,0,0,0,96,255,79,0,0,0,0,251,239,0,0,0,
+ 0,242,255,8,0,0,0,128,255,47,0,0,0,0,253,207,0,0,0,0,244,255,6,0,0,0,160,255,31,0,0,0,
+ 16,254,175,0,0,0,0,246,255,4,0,0,0,192,255,13,0,0,0,32,255,143,0,0,0,0,248,255,2,0,0,0,
+ 208,255,12,0,0,0,64,255,111,0,0,0,0,250,239,1,0,0,0,241,255,10,0,0,0,96,255,79,0,0,0,0,
+ 252,223,0,0,0,0,243,255,8,0,0,0,128,255,47,0,0,0,0,0,0,16,182,253,206,40,0,0,0,0,48,253,
+ 255,255,255,110,0,0,0,48,254,255,255,255,255,111,0,0,0,252,255,126,101,251,255,47,0,0,245,255,45,0,0,249,
+ 255,9,0,160,255,95,0,0,16,254,239,1,0,254,239,0,0,0,144,255,95,0,242,255,11,0,0,0,246,255,8,80,
+ 255,159,0,0,0,48,255,175,0,246,255,8,0,0,0,241,255,12,112,255,127,0,0,0,16,255,223,0,248,255,6,0,
+ 0,0,240,255,14,128,255,111,0,0,0,0,255,239,0,247,255,7,0,0,0,240,255,13,96,255,143,0,0,0,16,255,
+ 223,0,244,255,9,0,0,0,243,255,11,32,255,191,0,0,0,80,255,159,0,224,255,14,0,0,0,249,255,6,0,249,
+ 255,5,0,0,225,255,31,0,48,255,223,1,0,144,255,191,0,0,160,255,223,71,181,255,255,3,0,0,209,255,255,255,
+ 255,255,8,0,0,0,194,255,255,255,255,8,0,0,0,0,80,219,239,140,2,0,0,0,0,0,0,194,255,14,0,0,
+ 0,0,0,0,228,255,239,0,0,0,0,0,0,248,255,255,14,0,0,0,0,16,251,255,255,239,0,0,0,0,48,253,
+ 255,219,255,14,0,0,0,48,255,255,9,254,239,0,0,0,0,160,255,6,224,255,14,0,0,0,0,177,3,0,254,239,
+ 0,0,0,0,0,0,0,224,255,14,0,0,0,0,0,0,0,254,239,0,0,0,0,0,0,0,224,255,14,0,0,0,
+ 0,0,0,0,254,239,0,0,0,0,0,0,0,224,255,14,0,0,0,0,0,0,0,254,239,0,0,0,0,0,0,0,
+ 224,255,14,0,0,0,0,0,0,0,254,239,0,0,0,0,0,0,0,224,255,14,0,0,0,0,0,0,0,254,239,0,
+ 0,0,0,0,0,0,224,255,14,0,0,0,0,0,0,0,254,239,0,0,0,0,0,0,0,224,255,14,0,0,0,0,
+ 0,0,0,254,239,0,0,0,0,0,0,0,224,255,14,0,0,0,0,0,0,0,254,239,0,0,0,0,0,48,200,254,
+ 206,57,0,0,0,0,179,255,255,255,255,175,1,0,0,247,255,255,255,255,255,191,0,0,226,255,239,122,134,253,255,111,
+ 0,0,244,143,1,0,0,250,255,12,0,0,54,0,0,0,16,255,255,0,0,0,0,0,0,0,208,255,31,0,0,0,
+ 0,0,0,0,254,255,0,0,0,0,0,0,0,242,255,11,0,0,0,0,0,0,128,255,111,0,0,0,0,0,0,48,
+ 255,223,0,0,0,0,0,0,16,253,255,4,0,0,0,0,0,16,252,255,8,0,0,0,0,0,16,251,255,10,0,0,
+ 0,0,0,0,251,255,10,0,0,0,0,0,16,251,255,9,0,0,0,0,0,16,251,255,9,0,0,0,0,0,16,252,
+ 255,8,0,0,0,0,0,16,252,255,7,0,0,0,0,0,16,252,255,6,0,0,0,0,0,16,253,255,123,119,119,119,
+ 119,103,0,247,255,255,255,255,255,255,255,14,128,255,255,255,255,255,255,255,239,0,248,255,255,255,255,255,255,255,14,0,
+ 0,114,219,254,206,73,0,0,0,48,251,255,255,255,255,191,2,0,64,255,255,255,255,255,255,223,1,0,176,255,175,86,
+ 101,252,255,159,0,0,226,24,0,0,0,248,255,13,0,0,1,0,0,0,16,255,255,0,0,0,0,0,0,0,224,255,
+ 14,0,0,0,0,0,0,32,255,191,0,0,0,0,0,0,0,251,255,4,0,0,0,0,16,115,253,255,7,0,0,0,
+ 208,255,255,255,207,4,0,0,0,0,253,255,255,159,4,0,0,0,0,208,255,255,255,255,110,0,0,0,0,50,51,117,
+ 252,255,143,0,0,0,0,0,0,0,246,255,63,0,0,0,0,0,0,0,249,255,8,0,0,0,0,0,0,96,255,191,
+ 0,0,0,0,0,0,0,247,255,10,0,0,0,0,0,0,176,255,159,0,86,0,0,0,0,112,255,255,4,144,239,122,
+ 52,67,199,255,255,11,0,249,255,255,255,255,255,255,45,0,112,255,255,255,255,255,255,25,0,0,32,166,236,255,222,122,
+ 2,0,0,0,0,0,0,0,144,255,143,0,0,0,0,0,0,64,255,255,8,0,0,0,0,0,16,254,255,143,0,0,
+ 0,0,0,0,250,255,255,8,0,0,0,0,0,245,223,255,143,0,0,0,0,0,225,255,246,255,8,0,0,0,0,176,
+ 255,58,255,143,0,0,0,0,96,255,46,244,255,8,0,0,0,32,254,95,64,255,143,0,0,0,0,251,175,0,244,255,
+ 8,0,0,0,247,239,1,64,255,143,0,0,0,242,255,5,0,244,255,8,0,0,192,255,10,0,64,255,143,0,0,112,
+ 255,30,0,0,244,255,8,0,48,255,79,0,0,64,255,143,0,0,252,159,0,0,0,244,255,8,0,245,255,255,255,255,
+ 255,255,255,255,92,255,255,255,255,255,255,255,255,207,245,255,255,255,255,255,255,255,255,28,68,68,68,68,68,247,255,74,
+ 52,0,0,0,0,0,64,255,143,0,0,0,0,0,0,0,244,255,8,0,0,0,0,0,0,64,255,143,0,0,0,0,
+ 0,0,0,244,255,8,0,0,160,255,255,255,255,255,255,0,0,0,251,255,255,255,255,255,15,0,0,192,255,255,255,255,
+ 255,255,0,0,0,254,223,119,119,119,119,7,0,0,240,255,11,0,0,0,0,0,0,16,255,159,0,0,0,0,0,0,
+ 0,242,255,8,0,0,0,0,0,0,48,255,127,0,0,0,0,0,0,0,245,255,5,0,0,0,0,0,0,96,255,207,
+ 236,239,173,5,0,0,0,247,255,255,255,255,255,60,0,0,112,255,255,255,255,255,255,62,0,0,80,138,70,84,216,255,
+ 255,12,0,0,0,0,0,0,128,255,255,4,0,0,0,0,0,0,176,255,143,0,0,0,0,0,0,0,247,255,10,0,
+ 0,0,0,0,0,96,255,175,0,0,0,0,0,0,0,247,255,8,0,0,0,0,0,0,192,255,95,0,145,2,0,0,
+ 0,144,255,239,1,16,255,156,70,84,216,255,255,6,0,241,255,255,255,255,255,255,9,0,16,254,255,255,255,255,239,6,
+ 0,0,0,149,236,255,222,106,1,0,0,0,0,0,0,132,220,254,206,3,0,0,0,64,252,255,255,255,79,0,0,0,
+ 128,255,255,255,255,255,4,0,0,128,255,255,141,53,67,38,0,0,64,255,255,6,0,0,0,0,0,0,253,255,4,0,
+ 0,0,0,0,0,244,255,8,0,0,0,0,0,0,144,255,47,0,0,0,0,0,0,0,253,207,0,0,0,0,0,0,
+ 0,241,255,9,130,237,222,74,0,0,64,255,127,246,255,255,255,175,0,0,245,255,250,255,255,255,255,175,0,96,255,255,
+ 207,37,66,250,255,79,0,246,255,143,0,0,0,249,255,10,96,255,207,0,0,0,16,255,223,0,245,255,8,0,0,0,
+ 208,255,15,48,255,159,0,0,0,0,252,255,0,240,255,12,0,0,0,224,255,14,0,250,255,4,0,0,48,255,191,0,
+ 64,255,223,2,0,16,252,255,7,0,176,255,239,72,116,253,255,30,0,0,209,255,255,255,255,255,79,0,0,0,177,255,
+ 255,255,255,77,0,0,0,0,64,218,255,189,6,0,0,192,255,255,255,255,255,255,255,255,0,252,255,255,255,255,255,255,
+ 255,15,192,255,255,255,255,255,255,255,255,0,117,119,119,119,119,119,249,255,10,0,0,0,0,0,0,160,255,63,0,0,
+ 0,0,0,0,32,255,191,0,0,0,0,0,0,0,249,255,5,0,0,0,0,0,0,241,255,13,0,0,0,0,0,0,
+ 128,255,111,0,0,0,0,0,0,16,254,239,1,0,0,0,0,0,0,247,255,8,0,0,0,0,0,0,208,255,31,0,
+ 0,0,0,0,0,96,255,159,0,0,0,0,0,0,0,253,255,3,0,0,0,0,0,0,245,255,11,0,0,0,0,0,
+ 0,192,255,79,0,0,0,0,0,0,64,255,207,0,0,0,0,0,0,0,251,255,6,0,0,0,0,0,0,243,255,14,
+ 0,0,0,0,0,0,160,255,127,0,0,0,0,0,0,32,255,239,1,0,0,0,0,0,0,249,255,9,0,0,0,0,
+ 0,0,225,255,47,0,0,0,0,0,0,128,255,175,0,0,0,0,0,0,0,32,200,254,222,90,0,0,0,0,144,255,
+ 255,255,255,207,3,0,0,160,255,255,255,255,255,239,2,0,80,255,255,40,33,214,255,175,0,0,250,255,7,0,0,226,
+ 255,31,0,192,255,31,0,0,0,250,255,2,0,250,255,1,0,0,176,255,31,0,112,255,111,0,0,16,254,223,0,0,
+ 241,255,78,0,16,251,255,6,0,0,246,255,175,82,253,255,9,0,0,0,246,255,255,255,255,8,0,0,0,0,227,255,
+ 255,239,3,0,0,0,0,212,255,255,255,239,6,0,0,0,247,255,191,215,255,255,27,0,0,246,255,77,0,80,253,255,
+ 11,0,225,255,46,0,0,16,252,255,6,80,255,127,0,0,0,32,255,207,0,248,255,4,0,0,0,192,255,14,112,255,
+ 95,0,0,0,0,254,223,0,245,255,12,0,0,0,246,255,10,0,254,255,92,2,49,249,255,79,0,64,255,255,255,255,
+ 255,255,143,0,0,64,253,255,255,255,255,110,0,0,0,0,165,236,239,189,23,0,0,0,0,48,201,254,190,23,0,0,
+ 0,0,144,255,255,255,255,94,0,0,0,176,255,255,255,255,255,111,0,0,112,255,255,90,100,252,255,63,0,16,254,255,
+ 5,0,0,248,255,11,0,244,255,11,0,0,0,252,255,2,112,255,111,0,0,0,80,255,127,0,248,255,4,0,0,0,
+ 242,255,10,128,255,95,0,0,0,16,255,207,0,247,255,8,0,0,0,245,255,13,48,255,239,2,0,0,210,255,223,0,
+ 192,255,223,54,66,232,255,255,13,0,243,255,255,255,255,207,254,207,0,0,228,255,255,255,207,241,255,11,0,0,129,236,
+ 223,107,16,255,143,0,0,0,0,0,0,0,245,255,5,0,0,0,0,0,0,144,255,47,0,0,0,0,0,0,32,255,
+ 191,0,0,0,0,0,0,0,251,255,5,0,0,0,0,0,32,251,255,11,0,0,96,36,50,166,255,255,46,0,0,0,
+ 253,255,255,255,255,45,0,0,0,208,255,255,255,255,24,0,0,0,0,234,255,222,106,1,0,0,0,0,178,222,4,0,
+ 144,255,239,0,0,251,255,47,0,144,255,239,0,0,194,239,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,194,239,5,0,144,
+ 255,239,0,0,251,255,31,0,144,255,239,0,0,177,222,4,0,0,178,222,4,0,160,255,239,0,0,252,255,31,0,160,
+ 255,239,0,0,194,223,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,255,191,0,0,248,255,7,0,176,255,
+ 47,0,0,253,207,0,0,242,255,6,0,80,255,30,0,0,249,159,0,0,208,255,2,0,0,0,0,0,0,0,0,0,
+ 0,165,0,0,0,0,0,0,0,96,253,12,0,0,0,0,0,0,214,255,207,0,0,0,0,0,96,253,255,207,5,0,
+ 0,0,0,214,255,255,75,0,0,0,0,96,253,255,175,3,0,0,0,16,231,255,239,41,0,0,0,0,113,254,255,126,
+ 1,0,0,0,0,96,255,239,22,0,0,0,0,0,0,246,255,223,22,0,0,0,0,0,0,197,255,255,158,3,0,0,
+ 0,0,0,48,250,255,255,108,1,0,0,0,0,0,130,254,255,239,41,0,0,0,0,0,16,198,255,255,191,5,0,0,
+ 0,0,0,64,250,255,207,0,0,0,0,0,0,0,130,254,12,0,0,0,0,0,0,0,16,166,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,80,255,255,255,255,255,255,255,175,0,245,255,255,255,255,255,255,255,10,80,255,255,255,255,255,255,255,175,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,228,238,238,238,238,238,238,238,10,80,255,255,255,255,255,255,255,175,0,245,255,255,255,255,255,255,255,10,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,80,24,0,0,0,0,0,0,0,0,246,159,2,0,0,0,0,0,0,96,255,255,41,0,0,0,0,0,0,
+ 146,255,255,159,2,0,0,0,0,0,16,232,255,255,41,0,0,0,0,0,0,113,253,255,159,2,0,0,0,0,0,0,
+ 214,255,255,42,0,0,0,0,0,0,80,252,255,175,3,0,0,0,0,0,0,179,255,207,0,0,0,0,0,0,164,255,
+ 255,12,0,0,0,0,113,253,255,239,40,0,0,0,48,249,255,255,109,1,0,0,16,198,255,255,191,4,0,0,0,146,
+ 254,255,239,41,0,0,0,0,96,255,255,125,1,0,0,0,0,0,246,191,5,0,0,0,0,0,0,96,57,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,114,218,254,206,57,0,48,251,255,255,255,255,159,0,247,255,255,255,255,255,
+ 159,16,254,175,86,101,251,255,47,96,23,0,0,0,250,255,7,0,0,0,0,64,255,143,0,0,0,0,0,245,255,7,
+ 0,0,0,0,176,255,63,0,0,0,0,161,255,191,0,0,0,0,194,255,207,1,0,0,0,228,255,191,1,0,0,0,
+ 227,255,127,0,0,0,0,192,255,78,0,0,0,0,32,255,111,0,0,0,0,0,244,255,1,0,0,0,0,64,255,14,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,253,61,0,0,
+ 0,0,0,252,255,11,0,0,0,0,224,255,223,0,0,0,0,0,252,255,11,0,0,0,0,48,236,44,0,0,0,0,
+ 0,0,0,0,64,184,237,239,173,22,0,0,0,0,0,0,0,0,16,232,255,255,255,255,255,175,2,0,0,0,0,0,
+ 0,80,254,255,239,172,186,253,255,239,6,0,0,0,0,0,128,255,239,56,0,0,0,97,253,255,7,0,0,0,0,128,
+ 255,143,1,0,0,0,0,16,250,255,5,0,0,0,96,255,95,0,0,0,0,0,0,0,248,239,1,0,0,16,254,95,
+ 0,0,164,237,239,172,39,0,251,143,0,0,0,249,175,0,16,251,255,255,255,255,7,48,255,14,0,0,225,255,2,16,
+ 252,255,140,152,254,127,0,192,255,4,0,96,255,10,0,248,239,4,0,176,255,6,0,247,127,0,0,250,95,0,241,255,
+ 6,0,0,251,95,0,80,255,9,0,208,255,2,80,255,14,0,0,192,255,4,0,244,175,0,16,255,14,0,248,175,0,
+ 0,0,253,79,0,80,255,9,0,242,223,0,144,255,9,0,0,224,255,3,0,246,143,0,32,255,13,0,248,175,0,0,
+ 32,255,47,0,144,255,5,0,241,239,0,96,255,13,0,0,247,255,3,0,254,31,0,0,255,15,0,242,255,7,0,227,
+ 255,127,0,247,159,0,0,208,255,3,0,249,255,155,250,207,253,159,250,239,2,0,0,250,127,0,16,251,255,255,223,82,
+ 255,255,239,4,0,0,80,255,13,0,0,198,238,141,1,80,236,174,2,0,0,0,225,255,6,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,246,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,251,239,5,0,0,0,0,0,0,1,
+ 0,0,0,0,0,16,252,255,92,1,0,0,16,132,125,0,0,0,0,0,0,16,250,255,255,189,170,219,255,255,7,0,
+ 0,0,0,0,0,0,197,255,255,255,255,255,255,78,0,0,0,0,0,0,0,0,48,167,237,255,206,122,4,0,0,0,
+ 0,0,0,0,0,0,242,255,159,0,0,0,0,0,0,0,0,112,255,255,14,0,0,0,0,0,0,0,0,253,255,255,
+ 5,0,0,0,0,0,0,0,244,255,254,191,0,0,0,0,0,0,0,144,255,126,255,47,0,0,0,0,0,0,16,254,
+ 175,242,255,7,0,0,0,0,0,0,246,255,5,253,223,0,0,0,0,0,0,176,255,30,112,255,63,0,0,0,0,0,
+ 32,255,175,0,242,255,9,0,0,0,0,0,248,255,5,0,252,239,1,0,0,0,0,208,255,14,0,112,255,95,0,0,
+ 0,0,64,255,159,0,0,241,255,11,0,0,0,0,250,255,4,0,0,251,255,2,0,0,0,241,255,13,0,0,96,255,
+ 143,0,0,0,96,255,255,255,255,255,255,255,13,0,0,0,252,255,255,255,255,255,255,255,4,0,0,242,255,255,255,255,
+ 255,255,255,175,0,0,128,255,175,102,102,102,102,247,255,30,0,0,254,255,3,0,0,0,0,251,255,6,0,244,255,12,
+ 0,0,0,0,96,255,207,0,160,255,127,0,0,0,0,0,241,255,47,16,255,255,1,0,0,0,0,0,250,255,8,247,
+ 255,11,0,0,0,0,0,64,255,239,192,255,111,0,0,0,0,0,0,224,255,79,0,192,255,255,255,239,206,106,2,0,
+ 0,0,192,255,255,255,255,255,255,159,0,0,0,192,255,255,255,255,255,255,255,11,0,0,192,255,127,85,85,167,255,255,
+ 95,0,0,192,255,63,0,0,0,210,255,175,0,0,192,255,63,0,0,0,96,255,223,0,0,192,255,63,0,0,0,64,
+ 255,223,0,0,192,255,63,0,0,0,80,255,191,0,0,192,255,63,0,0,0,176,255,111,0,0,192,255,63,0,0,81,
+ 251,255,12,0,0,192,255,255,255,255,255,255,175,1,0,0,192,255,255,255,255,255,239,6,0,0,0,192,255,255,255,255,
+ 255,255,223,5,0,0,192,255,95,51,67,116,252,255,127,0,0,192,255,63,0,0,0,112,255,255,1,0,192,255,63,0,
+ 0,0,0,252,255,6,0,192,255,63,0,0,0,0,249,255,8,0,192,255,63,0,0,0,0,250,255,9,0,192,255,63,
+ 0,0,0,0,253,255,7,0,192,255,63,0,0,0,144,255,255,3,0,192,255,127,85,85,150,253,255,191,0,0,192,255,
+ 255,255,255,255,255,255,45,0,0,192,255,255,255,255,255,255,191,2,0,0,192,255,255,255,255,239,140,3,0,0,0,0,
+ 0,0,97,218,254,222,139,3,0,0,0,0,145,255,255,255,255,255,207,3,0,0,48,253,255,255,255,255,255,239,1,0,
+ 0,227,255,255,174,104,151,253,159,0,0,16,253,255,143,1,0,0,64,58,0,0,128,255,255,6,0,0,0,0,0,0,
+ 0,225,255,159,0,0,0,0,0,0,0,0,245,255,31,0,0,0,0,0,0,0,0,249,255,10,0,0,0,0,0,0,
+ 0,0,252,255,7,0,0,0,0,0,0,0,0,254,255,4,0,0,0,0,0,0,0,0,254,255,3,0,0,0,0,0,
+ 0,0,0,254,255,3,0,0,0,0,0,0,0,0,253,255,4,0,0,0,0,0,0,0,0,252,255,6,0,0,0,0,
+ 0,0,0,0,250,255,9,0,0,0,0,0,0,0,0,246,255,14,0,0,0,0,0,0,0,0,242,255,127,0,0,0,
+ 0,0,0,0,0,160,255,239,3,0,0,0,0,0,0,0,48,255,255,110,0,0,0,0,51,0,0,0,246,255,255,158,
+ 103,135,234,143,0,0,0,96,255,255,255,255,255,255,143,0,0,0,0,196,255,255,255,255,255,143,0,0,0,0,0,132,
+ 220,254,222,139,4,0,0,192,255,255,255,239,205,88,0,0,0,0,0,0,252,255,255,255,255,255,239,7,0,0,0,0,
+ 192,255,255,255,255,255,255,255,44,0,0,0,0,252,255,87,85,118,235,255,255,46,0,0,0,192,255,63,0,0,0,129,
+ 255,255,28,0,0,0,252,255,3,0,0,0,80,255,255,7,0,0,192,255,63,0,0,0,0,128,255,239,1,0,0,252,
+ 255,3,0,0,0,0,225,255,95,0,0,192,255,63,0,0,0,0,0,250,255,9,0,0,252,255,3,0,0,0,0,112,
+ 255,191,0,0,192,255,63,0,0,0,0,0,245,255,13,0,0,252,255,3,0,0,0,0,64,255,239,0,0,192,255,63,
+ 0,0,0,0,0,244,255,13,0,0,252,255,3,0,0,0,0,80,255,207,0,0,192,255,63,0,0,0,0,0,248,255,
+ 11,0,0,252,255,3,0,0,0,0,176,255,127,0,0,192,255,63,0,0,0,0,32,255,255,3,0,0,252,255,3,0,
+ 0,0,0,250,255,13,0,0,192,255,63,0,0,0,0,248,255,95,0,0,0,252,255,3,0,0,48,251,255,191,0,0,
+ 0,192,255,127,85,118,201,255,255,207,1,0,0,0,252,255,255,255,255,255,255,175,1,0,0,0,192,255,255,255,255,255,
+ 255,92,0,0,0,0,0,252,255,255,255,222,122,3,0,0,0,0,0,192,255,255,255,255,255,255,14,0,0,252,255,255,
+ 255,255,255,239,0,0,192,255,255,255,255,255,255,14,0,0,252,255,87,85,85,85,85,0,0,192,255,63,0,0,0,0,
+ 0,0,0,252,255,3,0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,0,252,255,3,0,0,0,0,0,0,192,
+ 255,63,0,0,0,0,0,0,0,252,255,3,0,0,0,0,0,0,192,255,255,255,255,255,255,5,0,0,252,255,255,255,
+ 255,255,95,0,0,192,255,255,255,255,255,255,5,0,0,252,255,87,85,85,85,37,0,0,192,255,63,0,0,0,0,0,
+ 0,0,252,255,3,0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,0,252,255,3,0,0,0,0,0,0,192,255,
+ 63,0,0,0,0,0,0,0,252,255,3,0,0,0,0,0,0,192,255,127,102,102,102,102,5,0,0,252,255,255,255,255,
+ 255,239,0,0,192,255,255,255,255,255,255,14,0,0,252,255,255,255,255,255,239,0,0,192,255,255,255,255,255,255,14,0,
+ 192,255,255,255,255,255,255,14,0,192,255,255,255,255,255,255,14,0,192,255,127,85,85,85,85,5,0,192,255,47,0,0,
+ 0,0,0,0,192,255,47,0,0,0,0,0,0,192,255,47,0,0,0,0,0,0,192,255,47,0,0,0,0,0,0,192,
+ 255,47,0,0,0,0,0,0,192,255,47,0,0,0,0,0,0,192,255,47,0,0,0,0,0,0,192,255,255,255,255,255,
+ 255,4,0,192,255,255,255,255,255,255,4,0,192,255,255,255,255,255,255,4,0,192,255,127,102,102,102,102,2,0,192,255,
+ 47,0,0,0,0,0,0,192,255,47,0,0,0,0,0,0,192,255,47,0,0,0,0,0,0,192,255,47,0,0,0,0,
+ 0,0,192,255,47,0,0,0,0,0,0,192,255,47,0,0,0,0,0,0,192,255,47,0,0,0,0,0,0,192,255,47,
+ 0,0,0,0,0,0,192,255,47,0,0,0,0,0,0,0,0,0,48,183,237,239,189,89,1,0,0,0,0,0,197,255,
+ 255,255,255,255,255,8,0,0,0,16,250,255,255,255,255,255,255,111,0,0,0,16,252,255,255,157,103,151,251,239,1,0,
+ 0,0,251,255,207,4,0,0,0,97,7,0,0,0,246,255,175,0,0,0,0,0,0,0,0,0,208,255,207,0,0,0,
+ 0,0,0,0,0,0,64,255,255,3,0,0,0,0,0,0,0,0,0,248,255,11,0,0,0,0,0,0,0,0,0,192,
+ 255,127,0,0,0,0,0,0,0,0,0,0,253,255,4,0,0,0,0,0,0,0,0,0,224,255,63,0,0,0,253,255,
+ 255,255,31,0,0,254,255,3,0,0,208,255,255,255,255,1,0,208,255,79,0,0,0,253,255,255,255,31,0,0,252,255,
+ 6,0,0,80,102,102,254,255,1,0,144,255,159,0,0,0,0,0,208,255,31,0,0,246,255,30,0,0,0,0,0,253,
+ 255,1,0,16,255,255,8,0,0,0,0,208,255,31,0,0,144,255,255,5,0,0,0,0,253,255,1,0,0,226,255,255,
+ 24,0,0,0,208,255,31,0,0,0,244,255,255,174,103,118,168,255,255,1,0,0,0,228,255,255,255,255,255,255,255,31,
+ 0,0,0,0,162,255,255,255,255,255,255,223,1,0,0,0,0,32,183,237,255,222,155,38,0,0,0,192,255,63,0,0,
+ 0,0,0,250,255,5,0,0,192,255,63,0,0,0,0,0,250,255,5,0,0,192,255,63,0,0,0,0,0,250,255,5,
+ 0,0,192,255,63,0,0,0,0,0,250,255,5,0,0,192,255,63,0,0,0,0,0,250,255,5,0,0,192,255,63,0,
+ 0,0,0,0,250,255,5,0,0,192,255,63,0,0,0,0,0,250,255,5,0,0,192,255,63,0,0,0,0,0,250,255,
+ 5,0,0,192,255,63,0,0,0,0,0,250,255,5,0,0,192,255,63,0,0,0,0,0,250,255,5,0,0,192,255,255,
+ 255,255,255,255,255,255,255,5,0,0,192,255,255,255,255,255,255,255,255,255,5,0,0,192,255,255,255,255,255,255,255,255,
+ 255,5,0,0,192,255,143,102,102,102,102,102,252,255,5,0,0,192,255,63,0,0,0,0,0,250,255,5,0,0,192,255,
+ 63,0,0,0,0,0,250,255,5,0,0,192,255,63,0,0,0,0,0,250,255,5,0,0,192,255,63,0,0,0,0,0,
+ 250,255,5,0,0,192,255,63,0,0,0,0,0,250,255,5,0,0,192,255,63,0,0,0,0,0,250,255,5,0,0,192,
+ 255,63,0,0,0,0,0,250,255,5,0,0,192,255,63,0,0,0,0,0,250,255,5,0,0,192,255,63,0,0,0,0,
+ 0,250,255,5,0,0,192,255,63,0,0,0,0,0,250,255,5,0,0,192,255,63,0,0,192,255,63,0,0,192,255,63,
+ 0,0,192,255,63,0,0,192,255,63,0,0,192,255,63,0,0,192,255,63,0,0,192,255,63,0,0,192,255,63,0,0,
+ 192,255,63,0,0,192,255,63,0,0,192,255,63,0,0,192,255,63,0,0,192,255,63,0,0,192,255,63,0,0,192,255,
+ 63,0,0,192,255,63,0,0,192,255,63,0,0,192,255,63,0,0,192,255,63,0,0,192,255,63,0,0,192,255,63,0,
+ 0,192,255,63,0,0,192,255,63,0,0,0,0,254,255,1,0,0,0,224,255,31,0,0,0,0,254,255,1,0,0,0,
+ 224,255,31,0,0,0,0,254,255,1,0,0,0,224,255,31,0,0,0,0,254,255,1,0,0,0,224,255,31,0,0,0,
+ 0,254,255,1,0,0,0,224,255,31,0,0,0,0,254,255,1,0,0,0,224,255,31,0,0,0,0,254,255,1,0,0,
+ 0,224,255,31,0,0,0,0,254,255,1,0,0,0,224,255,31,0,0,0,0,254,255,1,0,0,0,224,255,31,0,0,
+ 0,0,254,255,1,0,0,0,224,255,31,0,0,0,0,254,255,1,0,0,0,224,255,31,0,0,0,0,254,255,1,0,
+ 0,0,240,255,15,0,0,0,48,255,239,0,0,0,0,251,255,10,0,134,135,252,255,95,0,144,255,255,255,191,0,0,
+ 249,255,255,191,1,0,96,237,223,90,0,0,0,0,192,255,63,0,0,0,0,247,255,46,0,192,255,63,0,0,0,80,
+ 255,255,3,0,192,255,63,0,0,0,227,255,95,0,0,192,255,63,0,0,32,254,255,7,0,0,192,255,63,0,0,193,
+ 255,159,0,0,0,192,255,63,0,0,251,255,11,0,0,0,192,255,63,0,144,255,207,1,0,0,0,192,255,63,0,247,
+ 255,45,0,0,0,0,192,255,63,80,255,239,3,0,0,0,0,192,255,63,227,255,79,0,0,0,0,0,192,255,79,254,
+ 255,9,0,0,0,0,0,192,255,239,255,255,46,0,0,0,0,0,192,255,255,255,255,191,0,0,0,0,0,192,255,255,
+ 109,255,255,7,0,0,0,0,192,255,191,1,248,255,63,0,0,0,0,192,255,63,0,192,255,207,0,0,0,0,192,255,
+ 63,0,32,254,255,8,0,0,0,192,255,63,0,0,246,255,63,0,0,0,192,255,63,0,0,176,255,223,1,0,0,192,
+ 255,63,0,0,16,254,255,9,0,0,192,255,63,0,0,0,245,255,95,0,0,192,255,63,0,0,0,144,255,239,1,0,
+ 192,255,63,0,0,0,16,253,255,10,0,192,255,63,0,0,0,0,243,255,111,0,192,255,63,0,0,0,0,0,0,192,
+ 255,63,0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,192,255,63,0,0,0,
+ 0,0,0,192,255,63,0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,192,255,
+ 63,0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,192,255,63,0,0,0,0,
+ 0,0,192,255,63,0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,192,255,63,
+ 0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,192,255,63,0,0,0,0,0,
+ 0,192,255,63,0,0,0,0,0,0,192,255,143,102,102,102,102,54,0,192,255,255,255,255,255,255,127,0,192,255,255,255,
+ 255,255,255,127,0,192,255,255,255,255,255,255,127,0,192,255,255,14,0,0,0,0,0,0,249,255,255,3,0,0,252,255,
+ 255,5,0,0,0,0,0,224,255,255,63,0,0,192,255,255,175,0,0,0,0,0,80,255,255,255,3,0,0,252,255,255,
+ 31,0,0,0,0,0,250,255,255,63,0,0,192,255,250,255,6,0,0,0,0,241,255,251,255,3,0,0,252,159,252,191,
+ 0,0,0,0,96,255,126,255,63,0,0,192,255,122,255,47,0,0,0,0,252,159,248,255,3,0,0,252,191,241,255,7,
+ 0,0,0,242,255,131,255,63,0,0,192,255,11,251,207,0,0,0,128,255,13,248,255,3,0,0,252,191,96,255,47,0,
+ 0,0,253,127,144,255,63,0,0,192,255,12,241,255,8,0,0,244,255,2,249,255,3,0,0,252,207,0,250,223,0,0,
+ 144,255,11,144,255,63,0,0,192,255,12,80,255,63,0,0,254,111,0,249,255,3,0,0,252,207,0,224,255,9,0,245,
+ 255,1,144,255,63,0,0,192,255,12,0,249,239,0,160,255,10,0,249,255,3,0,0,252,207,0,64,255,79,16,255,79,
+ 0,144,255,63,0,0,192,255,12,0,224,255,9,246,239,0,0,249,255,3,0,0,252,207,0,0,249,239,193,255,8,0,
+ 144,255,63,0,0,192,255,12,0,48,255,127,255,63,0,0,249,255,3,0,0,252,207,0,0,208,255,255,223,0,0,144,
+ 255,63,0,0,192,255,12,0,0,248,255,255,7,0,0,249,255,3,0,0,252,207,0,0,48,255,255,47,0,0,144,255,
+ 63,0,0,192,255,12,0,0,192,255,191,0,0,0,249,255,3,0,0,252,207,0,0,0,247,255,6,0,0,144,255,63,
+ 0,0,192,255,255,5,0,0,0,0,48,255,111,0,0,0,252,255,223,1,0,0,0,0,243,255,6,0,0,192,255,255,
+ 159,0,0,0,0,48,255,111,0,0,0,252,255,255,63,0,0,0,0,243,255,6,0,0,192,255,255,255,12,0,0,0,
+ 48,255,111,0,0,0,252,159,254,255,7,0,0,0,243,255,6,0,0,192,255,89,255,239,2,0,0,48,255,111,0,0,
+ 0,252,175,176,255,191,0,0,0,243,255,6,0,0,192,255,11,242,255,95,0,0,48,255,111,0,0,0,252,207,0,247,
+ 255,30,0,0,243,255,6,0,0,192,255,12,0,253,255,9,0,48,255,111,0,0,0,252,207,0,64,255,255,3,0,243,
+ 255,6,0,0,192,255,12,0,144,255,207,0,48,255,111,0,0,0,252,207,0,0,225,255,127,0,243,255,6,0,0,192,
+ 255,12,0,0,246,255,46,48,255,111,0,0,0,252,207,0,0,0,251,255,11,242,255,6,0,0,192,255,12,0,0,32,
+ 255,255,21,255,111,0,0,0,252,207,0,0,0,112,255,239,242,255,6,0,0,192,255,12,0,0,0,208,255,159,255,111,
+ 0,0,0,252,207,0,0,0,0,244,255,255,255,6,0,0,192,255,12,0,0,0,0,249,255,255,111,0,0,0,252,207,
+ 0,0,0,0,16,254,255,255,6,0,0,192,255,12,0,0,0,0,96,255,255,111,0,0,0,252,207,0,0,0,0,0,
+ 176,255,255,6,0,0,0,0,0,115,219,254,222,106,2,0,0,0,0,0,0,48,250,255,255,255,255,255,25,0,0,0,
+ 0,0,80,254,255,255,255,255,255,255,45,0,0,0,0,80,255,255,223,121,118,234,255,255,46,0,0,0,32,254,255,110,
+ 0,0,0,129,255,255,12,0,0,0,250,255,62,0,0,0,0,96,255,255,6,0,0,242,255,127,0,0,0,0,0,160,
+ 255,207,0,0,96,255,239,1,0,0,0,0,0,243,255,47,0,0,249,255,10,0,0,0,0,0,0,253,255,6,0,192,
+ 255,111,0,0,0,0,0,0,160,255,159,0,0,253,255,5,0,0,0,0,0,0,248,255,10,0,224,255,79,0,0,0,
+ 0,0,0,112,255,191,0,0,254,255,4,0,0,0,0,0,0,248,255,11,0,208,255,95,0,0,0,0,0,0,128,255,
+ 175,0,0,252,255,6,0,0,0,0,0,0,250,255,8,0,144,255,175,0,0,0,0,0,0,208,255,111,0,0,246,255,
+ 14,0,0,0,0,0,48,255,255,2,0,16,255,255,7,0,0,0,0,0,250,255,12,0,0,144,255,239,3,0,0,0,
+ 0,246,255,95,0,0,0,226,255,239,6,0,0,16,248,255,207,0,0,0,0,245,255,255,157,103,167,254,255,239,2,0,
+ 0,0,0,229,255,255,255,255,255,255,223,2,0,0,0,0,0,179,255,255,255,255,255,143,1,0,0,0,0,0,0,48,
+ 183,237,239,173,22,0,0,0,0,0,192,255,255,255,239,173,22,0,0,0,0,252,255,255,255,255,255,126,0,0,0,192,
+ 255,255,255,255,255,255,159,0,0,0,252,255,87,85,167,255,255,95,0,0,192,255,63,0,0,32,253,255,12,0,0,252,
+ 255,3,0,0,64,255,255,1,0,192,255,63,0,0,0,224,255,63,0,0,252,255,3,0,0,0,253,255,4,0,192,255,
+ 63,0,0,0,224,255,63,0,0,252,255,3,0,0,48,255,255,1,0,192,255,63,0,0,16,252,255,11,0,0,252,255,
+ 3,16,115,253,255,79,0,0,192,255,255,255,255,255,255,143,0,0,0,252,255,255,255,255,255,127,0,0,0,192,255,255,
+ 255,255,223,40,0,0,0,0,252,255,87,69,20,0,0,0,0,0,192,255,63,0,0,0,0,0,0,0,0,252,255,3,
+ 0,0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,0,0,252,255,3,0,0,0,0,0,0,0,192,255,63,0,
+ 0,0,0,0,0,0,0,252,255,3,0,0,0,0,0,0,0,192,255,63,0,0,0,0,0,0,0,0,252,255,3,0,
+ 0,0,0,0,0,0,0,0,0,115,219,254,222,106,2,0,0,0,0,0,0,48,250,255,255,255,255,255,25,0,0,0,
+ 0,0,80,254,255,255,255,255,255,255,45,0,0,0,0,80,255,255,223,121,118,234,255,255,46,0,0,0,32,254,255,110,
+ 0,0,0,129,255,255,12,0,0,0,250,255,62,0,0,0,0,96,255,255,6,0,0,242,255,127,0,0,0,0,0,160,
+ 255,207,0,0,96,255,239,1,0,0,0,0,0,243,255,47,0,0,249,255,10,0,0,0,0,0,0,253,255,6,0,192,
+ 255,111,0,0,0,0,0,0,160,255,159,0,0,253,255,5,0,0,0,0,0,0,248,255,10,0,224,255,79,0,0,0,
+ 0,0,0,112,255,191,0,0,254,255,4,0,0,0,0,0,0,248,255,11,0,208,255,95,0,0,0,0,0,0,128,255,
+ 175,0,0,252,255,6,0,0,0,0,0,0,250,255,8,0,144,255,175,0,0,0,0,0,0,208,255,111,0,0,246,255,
+ 14,0,0,0,0,0,48,255,255,2,0,16,255,255,7,0,0,0,0,0,250,255,12,0,0,144,255,239,3,0,0,0,
+ 0,246,255,95,0,0,0,226,255,239,6,0,0,16,248,255,207,0,0,0,0,245,255,255,157,103,167,254,255,239,2,0,
+ 0,0,0,229,255,255,255,255,255,255,223,3,0,0,0,0,0,179,255,255,255,255,255,142,1,0,0,0,0,0,0,48,
+ 183,237,255,255,143,0,0,0,0,0,0,0,0,0,0,0,247,255,127,0,0,0,0,0,0,0,0,0,0,0,249,255,
+ 127,0,0,0,0,0,0,0,0,0,0,0,250,255,127,0,0,0,0,0,0,0,0,0,0,0,251,255,127,0,0,0,
+ 0,0,0,0,0,0,0,16,252,255,127,0,0,0,192,255,255,255,239,173,39,0,0,0,0,192,255,255,255,255,255,255,
+ 25,0,0,0,192,255,255,255,255,255,255,191,0,0,0,192,255,127,85,118,234,255,255,7,0,0,192,255,63,0,0,16,
+ 252,255,13,0,0,192,255,63,0,0,0,242,255,47,0,0,192,255,63,0,0,0,208,255,79,0,0,192,255,63,0,0,
+ 0,208,255,79,0,0,192,255,63,0,0,0,241,255,31,0,0,192,255,63,0,0,0,249,255,12,0,0,192,255,63,0,
+ 32,181,255,255,4,0,0,192,255,255,255,255,255,255,111,0,0,0,192,255,255,255,255,255,207,3,0,0,0,192,255,255,
+ 255,255,255,12,0,0,0,0,192,255,111,68,196,255,95,0,0,0,0,192,255,63,0,48,255,239,1,0,0,0,192,255,
+ 63,0,0,249,255,10,0,0,0,192,255,63,0,0,225,255,79,0,0,0,192,255,63,0,0,96,255,223,1,0,0,192,
+ 255,63,0,0,0,252,255,8,0,0,192,255,63,0,0,0,243,255,63,0,0,192,255,63,0,0,0,144,255,207,0,0,
+ 192,255,63,0,0,0,16,254,255,7,0,192,255,63,0,0,0,0,246,255,46,0,0,32,184,254,239,155,21,0,0,0,
+ 144,255,255,255,255,255,126,0,0,176,255,255,255,255,255,255,7,0,96,255,255,141,119,184,255,31,0,0,252,255,9,0,
+ 0,16,118,0,0,240,255,31,0,0,0,0,0,0,16,255,239,0,0,0,0,0,0,0,224,255,47,0,0,0,0,0,
+ 0,0,250,255,44,0,0,0,0,0,0,48,255,255,142,1,0,0,0,0,0,112,255,255,255,58,0,0,0,0,0,80,
+ 254,255,255,207,4,0,0,0,0,16,232,255,255,255,26,0,0,0,0,0,97,253,255,255,12,0,0,0,0,0,0,213,
+ 255,255,8,0,0,0,0,0,0,160,255,239,0,0,0,0,0,0,0,225,255,47,0,0,0,0,0,0,0,251,255,3,
+ 0,0,0,0,0,0,208,255,31,0,181,21,0,0,0,128,255,207,0,80,255,191,120,102,216,255,255,6,0,245,255,255,
+ 255,255,255,255,9,0,64,255,255,255,255,255,239,7,0,0,16,166,236,255,222,106,1,0,0,248,255,255,255,255,255,255,
+ 255,255,139,255,255,255,255,255,255,255,255,191,248,255,255,255,255,255,255,255,255,59,102,102,102,249,255,107,102,102,70,0,
+ 0,0,96,255,159,0,0,0,0,0,0,0,246,255,9,0,0,0,0,0,0,96,255,159,0,0,0,0,0,0,0,246,
+ 255,9,0,0,0,0,0,0,96,255,159,0,0,0,0,0,0,0,246,255,9,0,0,0,0,0,0,96,255,159,0,0,
+ 0,0,0,0,0,246,255,9,0,0,0,0,0,0,96,255,159,0,0,0,0,0,0,0,246,255,9,0,0,0,0,0,
+ 0,96,255,159,0,0,0,0,0,0,0,246,255,9,0,0,0,0,0,0,96,255,159,0,0,0,0,0,0,0,246,255,
+ 9,0,0,0,0,0,0,96,255,159,0,0,0,0,0,0,0,246,255,9,0,0,0,0,0,0,96,255,159,0,0,0,
+ 0,0,0,0,246,255,9,0,0,0,0,0,0,96,255,159,0,0,0,0,0,0,0,246,255,9,0,0,0,0,240,255,
+ 15,0,0,0,0,0,251,255,4,0,0,255,255,0,0,0,0,0,176,255,79,0,0,240,255,15,0,0,0,0,0,251,
+ 255,4,0,0,255,255,0,0,0,0,0,176,255,79,0,0,240,255,15,0,0,0,0,0,251,255,4,0,0,255,255,0,
+ 0,0,0,0,176,255,79,0,0,240,255,15,0,0,0,0,0,251,255,4,0,0,255,255,0,0,0,0,0,176,255,79,
+ 0,0,240,255,15,0,0,0,0,0,251,255,4,0,0,255,255,0,0,0,0,0,176,255,79,0,0,240,255,15,0,0,
+ 0,0,0,251,255,4,0,0,255,255,0,0,0,0,0,176,255,79,0,0,240,255,15,0,0,0,0,0,251,255,4,0,
+ 0,255,255,0,0,0,0,0,176,255,79,0,0,240,255,15,0,0,0,0,0,251,255,4,0,0,255,255,0,0,0,0,
+ 0,192,255,63,0,0,224,255,47,0,0,0,0,0,253,255,2,0,0,252,255,5,0,0,0,0,242,255,15,0,0,128,
+ 255,207,0,0,0,0,160,255,191,0,0,0,242,255,175,1,0,0,128,255,255,4,0,0,0,247,255,239,122,118,233,255,
+ 255,10,0,0,0,0,249,255,255,255,255,255,255,27,0,0,0,0,0,230,255,255,255,255,239,7,0,0,0,0,0,0,
+ 97,218,254,222,106,1,0,0,0,252,255,4,0,0,0,0,0,242,255,14,247,255,9,0,0,0,0,0,247,255,9,242,
+ 255,14,0,0,0,0,0,252,255,4,192,255,79,0,0,0,0,32,255,239,0,96,255,159,0,0,0,0,128,255,143,0,
+ 16,255,239,0,0,0,0,208,255,63,0,0,251,255,4,0,0,0,243,255,13,0,0,245,255,9,0,0,0,248,255,7,
+ 0,0,225,255,14,0,0,0,253,255,2,0,0,160,255,79,0,0,48,255,207,0,0,0,64,255,175,0,0,128,255,127,
+ 0,0,0,0,254,239,0,0,208,255,31,0,0,0,0,249,255,5,0,243,255,11,0,0,0,0,244,255,10,0,249,255,
+ 6,0,0,0,0,208,255,30,0,254,255,1,0,0,0,0,128,255,95,64,255,175,0,0,0,0,0,48,255,175,128,255,
+ 95,0,0,0,0,0,0,252,239,192,255,14,0,0,0,0,0,0,247,255,244,255,9,0,0,0,0,0,0,242,255,251,
+ 255,4,0,0,0,0,0,0,192,255,255,223,0,0,0,0,0,0,0,96,255,255,143,0,0,0,0,0,0,0,16,255,
+ 255,63,0,0,0,0,0,0,0,0,251,255,13,0,0,0,0,250,255,6,0,0,0,16,255,255,2,0,0,0,48,255,
+ 207,246,255,9,0,0,0,96,255,255,6,0,0,0,112,255,143,242,255,13,0,0,0,160,255,255,11,0,0,0,176,255,
+ 79,208,255,47,0,0,0,224,255,255,14,0,0,0,224,255,15,144,255,95,0,0,0,243,255,255,79,0,0,0,243,255,
+ 11,80,255,159,0,0,0,248,223,252,143,0,0,0,247,255,7,16,255,223,0,0,0,252,159,249,223,0,0,0,251,255,
+ 3,0,252,255,2,0,16,255,111,246,255,2,0,0,254,239,0,0,248,255,5,0,80,255,63,242,255,6,0,48,255,175,
+ 0,0,244,255,9,0,160,255,14,208,255,11,0,112,255,111,0,0,241,255,13,0,224,255,10,144,255,30,0,160,255,47,
+ 0,0,176,255,31,0,243,255,5,80,255,79,0,224,255,13,0,0,112,255,95,0,247,255,1,16,255,159,0,243,255,9,
+ 0,0,48,255,159,0,251,207,0,0,251,223,0,247,255,5,0,0,0,254,207,16,255,143,0,0,247,255,2,250,255,1,
+ 0,0,0,250,255,65,255,79,0,0,243,255,6,254,223,0,0,0,0,246,255,132,255,14,0,0,208,255,41,255,159,0,
+ 0,0,0,243,255,183,255,10,0,0,144,255,92,255,95,0,0,0,0,224,255,234,255,6,0,0,80,255,143,255,31,0,
+ 0,0,0,160,255,253,255,2,0,0,16,255,223,255,12,0,0,0,0,96,255,255,207,0,0,0,0,251,255,255,8,0,
+ 0,0,0,32,255,255,143,0,0,0,0,247,255,255,4,0,0,0,0,0,253,255,79,0,0,0,0,242,255,239,0,0,
+ 0,0,0,0,249,255,14,0,0,0,0,208,255,191,0,0,0,226,255,95,0,0,0,0,32,254,255,3,112,255,223,1,
+ 0,0,0,176,255,143,0,0,252,255,8,0,0,0,245,255,13,0,0,242,255,63,0,0,16,253,255,3,0,0,112,255,
+ 207,0,0,128,255,143,0,0,0,0,252,255,6,0,243,255,29,0,0,0,0,243,255,30,0,252,255,4,0,0,0,0,
+ 128,255,175,96,255,159,0,0,0,0,0,0,253,255,229,255,29,0,0,0,0,0,0,243,255,255,255,5,0,0,0,0,
+ 0,0,144,255,255,175,0,0,0,0,0,0,0,16,255,255,47,0,0,0,0,0,0,0,112,255,255,127,0,0,0,0,
+ 0,0,0,242,255,255,255,3,0,0,0,0,0,0,252,255,249,255,12,0,0,0,0,0,96,255,159,176,255,127,0,0,
+ 0,0,0,226,255,30,32,255,255,2,0,0,0,0,251,255,6,0,248,255,12,0,0,0,96,255,191,0,0,208,255,127,
+ 0,0,0,225,255,47,0,0,64,255,239,2,0,0,250,255,7,0,0,0,250,255,11,0,80,255,223,0,0,0,0,225,
+ 255,111,0,225,255,79,0,0,0,0,96,255,239,2,249,255,9,0,0,0,0,0,252,255,11,251,255,9,0,0,0,0,
+ 112,255,223,48,255,255,2,0,0,0,16,254,255,4,160,255,159,0,0,0,0,248,255,11,0,242,255,47,0,0,0,225,
+ 255,63,0,0,248,255,10,0,0,128,255,175,0,0,16,254,255,3,0,32,255,255,2,0,0,112,255,191,0,0,249,255,
+ 8,0,0,0,209,255,79,0,242,255,30,0,0,0,0,246,255,12,160,255,127,0,0,0,0,0,253,255,52,255,223,0,
+ 0,0,0,0,80,255,207,251,255,5,0,0,0,0,0,176,255,255,255,12,0,0,0,0,0,0,243,255,255,79,0,0,
+ 0,0,0,0,0,250,255,175,0,0,0,0,0,0,0,32,255,255,2,0,0,0,0,0,0,0,224,255,15,0,0,0,
+ 0,0,0,0,0,254,255,0,0,0,0,0,0,0,0,224,255,15,0,0,0,0,0,0,0,0,254,255,0,0,0,0,
+ 0,0,0,0,224,255,15,0,0,0,0,0,0,0,0,254,255,0,0,0,0,0,0,0,0,224,255,15,0,0,0,0,
+ 0,0,0,0,254,255,0,0,0,0,0,0,0,0,224,255,15,0,0,0,0,144,255,255,255,255,255,255,255,255,2,144,
+ 255,255,255,255,255,255,255,255,2,144,255,255,255,255,255,255,255,255,2,64,102,102,102,102,102,230,255,175,0,0,0,0,
+ 0,0,0,246,255,29,0,0,0,0,0,0,32,254,255,4,0,0,0,0,0,0,192,255,159,0,0,0,0,0,0,0,
+ 247,255,29,0,0,0,0,0,0,48,255,255,3,0,0,0,0,0,0,192,255,127,0,0,0,0,0,0,0,248,255,12,
+ 0,0,0,0,0,0,64,255,239,2,0,0,0,0,0,0,209,255,111,0,0,0,0,0,0,0,249,255,11,0,0,0,
+ 0,0,0,64,255,239,2,0,0,0,0,0,0,225,255,95,0,0,0,0,0,0,0,250,255,10,0,0,0,0,0,0,
+ 80,255,239,1,0,0,0,0,0,0,226,255,79,0,0,0,0,0,0,0,251,255,9,0,0,0,0,0,0,96,255,255,
+ 103,102,102,102,102,102,3,208,255,255,255,255,255,255,255,255,7,224,255,255,255,255,255,255,255,255,7,224,255,255,255,255,
+ 255,255,255,255,7,0,247,255,255,255,6,112,255,255,255,111,0,247,255,238,238,5,112,255,47,0,0,0,247,255,2,0,
+ 0,112,255,47,0,0,0,247,255,2,0,0,112,255,47,0,0,0,247,255,2,0,0,112,255,47,0,0,0,247,255,2,
+ 0,0,112,255,47,0,0,0,247,255,2,0,0,112,255,47,0,0,0,247,255,2,0,0,112,255,47,0,0,0,247,255,
+ 2,0,0,112,255,47,0,0,0,247,255,2,0,0,112,255,47,0,0,0,247,255,2,0,0,112,255,47,0,0,0,247,
+ 255,2,0,0,112,255,47,0,0,0,247,255,2,0,0,112,255,47,0,0,0,247,255,238,238,5,112,255,255,255,111,0,
+ 247,255,255,255,6,248,255,2,0,0,0,48,255,143,0,0,0,0,192,255,13,0,0,0,0,246,255,4,0,0,0,16,
+ 255,175,0,0,0,0,160,255,30,0,0,0,0,244,255,6,0,0,0,0,253,207,0,0,0,0,128,255,47,0,0,0,
+ 0,242,255,8,0,0,0,0,252,223,0,0,0,0,96,255,79,0,0,0,0,225,255,10,0,0,0,0,250,255,1,0,
+ 0,0,64,255,111,0,0,0,0,208,255,12,0,0,0,0,248,255,2,0,0,0,32,255,143,0,0,0,0,176,255,14,
+ 0,0,0,0,246,255,4,0,0,0,16,254,175,0,0,0,0,160,255,31,0,0,0,0,244,255,6,0,0,0,0,253,
+ 207,242,255,255,255,10,32,255,255,255,175,0,226,238,254,255,10,0,0,0,254,175,0,0,0,224,255,10,0,0,0,254,
+ 175,0,0,0,224,255,10,0,0,0,254,175,0,0,0,224,255,10,0,0,0,254,175,0,0,0,224,255,10,0,0,0,
+ 254,175,0,0,0,224,255,10,0,0,0,254,175,0,0,0,224,255,10,0,0,0,254,175,0,0,0,224,255,10,0,0,
+ 0,254,175,0,0,0,224,255,10,0,0,0,254,175,0,0,0,224,255,10,0,0,0,254,175,0,0,0,224,255,10,0,
+ 0,0,254,175,0,0,0,224,255,10,0,0,0,254,175,0,226,238,254,255,10,32,255,255,255,175,0,242,255,255,255,10,
+ 0,0,0,0,128,239,1,0,0,0,0,0,0,225,255,7,0,0,0,0,0,0,246,255,30,0,0,0,0,0,0,253,
+ 255,127,0,0,0,0,0,80,255,234,239,1,0,0,0,0,192,255,131,255,7,0,0,0,0,243,191,32,255,30,0,0,
+ 0,0,250,95,0,249,143,0,0,0,32,255,13,0,242,239,1,0,0,144,255,7,0,144,255,8,0,0,225,239,1,0,
+ 32,255,30,0,0,247,159,0,0,0,250,143,0,0,254,63,0,0,0,242,239,1,96,255,11,0,0,0,160,255,8,208,
+ 255,5,0,0,0,48,255,30,244,223,0,0,0,0,0,250,143,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,241,255,255,255,255,255,255,175,241,255,255,255,255,255,255,
+ 175,64,68,68,68,68,68,68,36,0,0,0,251,255,13,0,0,0,0,0,0,0,177,255,143,0,0,0,0,0,0,0,
+ 0,250,255,4,0,0,0,0,0,0,0,112,255,46,0,0,0,0,0,0,0,0,228,223,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,184,253,239,123,1,0,0,0,80,253,255,255,255,255,62,0,
+ 0,0,48,255,255,255,255,255,239,2,0,0,0,251,90,2,65,253,255,8,0,0,0,18,0,0,0,243,255,13,0,0,
+ 0,0,0,0,0,208,255,15,0,0,0,0,0,0,0,192,255,31,0,0,0,32,167,220,238,255,255,31,0,0,48,251,
+ 255,255,255,255,255,31,0,0,228,255,255,173,137,231,255,31,0,0,253,255,60,0,0,192,255,31,0,64,255,239,1,0,
+ 0,208,255,31,0,112,255,175,0,0,0,224,255,31,0,112,255,159,0,0,0,244,255,31,0,96,255,207,0,0,16,253,
+ 255,31,0,32,255,255,41,16,214,255,255,31,0,0,251,255,255,255,255,142,255,31,0,0,193,255,255,255,223,34,255,31,
+ 0,0,16,199,254,190,23,0,253,31,0,0,243,255,10,0,0,0,0,0,0,0,48,255,175,0,0,0,0,0,0,0,
+ 0,243,255,10,0,0,0,0,0,0,0,48,255,175,0,0,0,0,0,0,0,0,243,255,10,0,0,0,0,0,0,0,
+ 48,255,175,0,0,0,0,0,0,0,0,243,255,10,0,0,0,0,0,0,0,48,255,175,16,199,238,157,3,0,0,0,
+ 243,255,57,254,255,255,255,8,0,0,48,255,191,254,255,255,255,255,7,0,0,243,255,255,125,52,214,255,255,2,0,48,
+ 255,255,28,0,0,193,255,159,0,0,243,255,79,0,0,0,244,255,14,0,48,255,239,0,0,0,0,254,255,2,0,243,
+ 255,12,0,0,0,176,255,95,0,48,255,191,0,0,0,0,249,255,6,0,243,255,10,0,0,0,144,255,111,0,48,255,
+ 191,0,0,0,0,249,255,6,0,243,255,12,0,0,0,176,255,95,0,48,255,255,1,0,0,0,254,255,2,0,243,255,
+ 95,0,0,0,245,255,14,0,48,255,255,29,0,0,209,255,143,0,0,243,255,255,125,52,214,255,239,2,0,48,255,191,
+ 255,255,255,255,255,6,0,0,243,255,82,254,255,255,255,7,0,0,48,255,13,32,200,238,157,3,0,0,0,0,0,148,
+ 236,239,173,22,0,0,32,251,255,255,255,255,8,0,32,253,255,255,255,255,63,0,0,251,255,175,69,134,205,0,0,245,
+ 255,79,0,0,0,1,0,176,255,143,0,0,0,0,0,0,254,255,2,0,0,0,0,0,242,255,13,0,0,0,0,0,
+ 64,255,207,0,0,0,0,0,0,244,255,11,0,0,0,0,0,64,255,191,0,0,0,0,0,0,243,255,13,0,0,0,
+ 0,0,16,255,255,2,0,0,0,0,0,192,255,127,0,0,0,0,0,0,246,255,78,0,0,0,34,0,16,253,255,159,
+ 69,117,252,5,0,48,254,255,255,255,255,95,0,0,48,253,255,255,255,255,4,0,0,0,165,237,239,156,4,0,0,0,
+ 0,0,0,0,0,248,255,6,0,0,0,0,0,0,0,128,255,111,0,0,0,0,0,0,0,0,248,255,6,0,0,0,
+ 0,0,0,0,128,255,111,0,0,0,0,0,0,0,0,248,255,6,0,0,0,0,0,0,0,128,255,111,0,0,0,0,
+ 0,0,0,0,248,255,6,0,0,0,130,236,222,57,112,255,111,0,0,0,229,255,255,255,127,246,255,6,0,0,245,255,
+ 255,255,255,175,255,111,0,0,225,255,239,71,99,252,255,255,6,0,112,255,239,3,0,0,250,255,111,0,0,252,255,7,
+ 0,0,16,254,255,6,0,240,255,47,0,0,0,160,255,111,0,48,255,223,0,0,0,0,247,255,6,0,244,255,12,0,
+ 0,0,96,255,111,0,64,255,191,0,0,0,0,245,255,6,0,244,255,11,0,0,0,96,255,111,0,48,255,223,0,0,
+ 0,0,247,255,6,0,241,255,31,0,0,0,144,255,111,0,0,252,255,6,0,0,0,254,255,6,0,112,255,239,2,0,
+ 0,248,255,111,0,0,225,255,239,55,83,251,255,255,6,0,0,245,255,255,255,255,159,255,111,0,0,0,246,255,255,255,
+ 94,241,255,6,0,0,0,146,237,222,40,0,252,111,0,0,0,0,148,237,222,90,0,0,0,0,0,177,255,255,255,255,
+ 44,0,0,0,16,253,255,255,255,255,223,1,0,0,176,255,223,4,48,251,255,10,0,0,244,255,29,0,0,192,255,63,
+ 0,0,250,255,6,0,0,80,255,143,0,0,254,255,1,0,0,16,255,191,0,32,255,223,0,0,0,0,254,223,0,64,
+ 255,255,255,255,255,255,255,239,0,64,255,255,255,255,255,255,255,239,0,64,255,239,204,204,204,204,204,204,0,48,255,207,
+ 0,0,0,0,0,0,0,0,254,239,0,0,0,0,0,0,0,0,251,255,6,0,0,0,0,0,0,0,244,255,62,0,
+ 0,0,0,3,0,0,160,255,239,72,34,83,216,15,0,0,16,252,255,255,255,255,255,15,0,0,0,145,255,255,255,255,
+ 255,14,0,0,0,0,130,236,255,206,89,1,0,0,0,0,182,254,222,90,0,0,193,255,255,255,143,0,0,250,255,255,
+ 255,63,0,16,255,255,73,83,8,0,64,255,207,0,0,0,0,96,255,159,0,0,0,0,96,255,143,0,0,0,64,233,
+ 255,255,255,255,0,246,255,255,255,255,255,0,230,254,255,255,238,238,0,0,96,255,143,0,0,0,0,96,255,143,0,0,
+ 0,0,96,255,143,0,0,0,0,96,255,143,0,0,0,0,96,255,143,0,0,0,0,96,255,143,0,0,0,0,96,255,
+ 143,0,0,0,0,96,255,143,0,0,0,0,96,255,143,0,0,0,0,96,255,143,0,0,0,0,96,255,143,0,0,0,
+ 0,96,255,143,0,0,0,0,96,255,143,0,0,0,0,96,255,143,0,0,0,0,96,255,143,0,0,0,0,96,255,143,
+ 0,0,0,0,0,97,219,255,255,255,255,255,4,0,228,255,255,255,255,255,255,79,0,227,255,207,153,252,255,191,71,1,
+ 176,255,127,0,0,248,255,9,0,16,255,207,0,0,0,253,239,0,0,243,255,9,0,0,176,255,47,0,48,255,159,0,
+ 0,0,250,255,2,0,241,255,12,0,0,208,255,14,0,0,250,255,6,0,112,255,159,0,0,32,254,255,156,201,255,223,
+ 1,0,0,48,253,255,255,255,207,2,0,0,0,128,255,254,222,90,0,0,0,0,160,255,7,0,0,0,0,0,0,48,
+ 255,15,0,0,0,0,0,0,0,245,255,22,0,0,0,0,0,0,16,254,255,255,255,239,173,4,0,0,64,254,255,255,
+ 255,255,255,9,0,48,250,255,255,255,255,255,255,6,80,255,207,87,68,85,199,255,223,32,255,159,0,0,0,0,192,255,
+ 15,247,255,1,0,0,0,0,248,255,145,255,14,0,0,0,0,144,255,14,248,255,2,0,0,0,48,254,175,64,255,207,
+ 3,0,0,113,254,255,3,176,255,255,189,187,253,255,255,6,0,161,255,255,255,255,255,207,4,0,0,48,200,254,239,189,
+ 56,0,0,0,0,243,255,10,0,0,0,0,0,0,0,0,243,255,10,0,0,0,0,0,0,0,0,243,255,10,0,0,
+ 0,0,0,0,0,0,243,255,10,0,0,0,0,0,0,0,0,243,255,10,0,0,0,0,0,0,0,0,243,255,10,0,
+ 0,0,0,0,0,0,0,243,255,10,0,0,0,0,0,0,0,0,243,255,9,113,236,239,107,1,0,0,0,243,255,56,
+ 253,255,255,255,45,0,0,0,243,255,234,255,255,255,255,207,0,0,0,243,255,255,142,52,181,255,255,5,0,0,243,255,
+ 239,2,0,0,250,255,10,0,0,243,255,111,0,0,0,244,255,13,0,0,243,255,31,0,0,0,241,255,14,0,0,243,
+ 255,13,0,0,0,240,255,14,0,0,243,255,11,0,0,0,240,255,14,0,0,243,255,10,0,0,0,240,255,14,0,0,
+ 243,255,10,0,0,0,240,255,14,0,0,243,255,10,0,0,0,240,255,14,0,0,243,255,10,0,0,0,240,255,14,0,
+ 0,243,255,10,0,0,0,240,255,14,0,0,243,255,10,0,0,0,240,255,14,0,0,243,255,10,0,0,0,240,255,14,
+ 0,0,243,255,10,0,0,0,240,255,14,0,0,243,255,10,0,0,0,240,255,14,0,0,243,255,10,0,0,0,240,255,
+ 14,0,0,160,222,4,0,80,255,223,0,0,245,255,13,0,0,234,77,0,0,0,0,0,0,0,0,0,0,0,243,255,
+ 10,0,48,255,175,0,0,243,255,10,0,48,255,175,0,0,243,255,10,0,48,255,175,0,0,243,255,10,0,48,255,175,
+ 0,0,243,255,10,0,48,255,175,0,0,243,255,10,0,48,255,175,0,0,243,255,10,0,48,255,175,0,0,243,255,10,
+ 0,48,255,175,0,0,243,255,10,0,48,255,175,0,0,243,255,10,0,0,0,0,234,77,0,0,0,80,255,223,0,0,
+ 0,80,255,223,0,0,0,0,234,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,255,175,0,0,0,48,
+ 255,175,0,0,0,48,255,175,0,0,0,48,255,175,0,0,0,48,255,175,0,0,0,48,255,175,0,0,0,48,255,175,
+ 0,0,0,48,255,175,0,0,0,48,255,175,0,0,0,48,255,175,0,0,0,48,255,175,0,0,0,48,255,175,0,0,
+ 0,48,255,175,0,0,0,48,255,175,0,0,0,48,255,175,0,0,0,48,255,175,0,0,0,48,255,175,0,0,0,48,
+ 255,175,0,0,0,48,255,175,0,0,0,48,255,175,0,0,0,48,255,175,0,0,0,64,255,175,0,0,0,128,255,159,
+ 0,96,68,247,255,95,0,240,255,255,255,13,0,240,255,255,239,3,0,176,254,222,40,0,0,0,243,255,10,0,0,0,
+ 0,0,0,0,243,255,10,0,0,0,0,0,0,0,243,255,10,0,0,0,0,0,0,0,243,255,10,0,0,0,0,0,
+ 0,0,243,255,10,0,0,0,0,0,0,0,243,255,10,0,0,0,0,0,0,0,243,255,10,0,0,0,0,0,0,0,
+ 243,255,10,0,0,48,254,255,5,0,243,255,10,0,0,226,255,127,0,0,243,255,10,0,16,253,255,8,0,0,243,255,
+ 10,0,193,255,175,0,0,0,243,255,10,0,251,255,11,0,0,0,243,255,10,160,255,207,1,0,0,0,243,255,9,248,
+ 255,29,0,0,0,0,243,255,88,255,223,2,0,0,0,0,243,255,233,255,175,0,0,0,0,0,243,255,255,255,255,6,
+ 0,0,0,0,243,255,255,254,255,46,0,0,0,0,243,255,191,145,255,207,0,0,0,0,243,255,12,16,253,255,9,0,
+ 0,0,243,255,10,0,243,255,79,0,0,0,243,255,10,0,112,255,239,1,0,0,243,255,10,0,0,252,255,11,0,0,
+ 243,255,10,0,0,226,255,127,0,0,243,255,10,0,0,96,255,255,3,0,243,255,10,0,0,0,250,255,29,0,243,255,
+ 10,0,48,255,175,0,0,243,255,10,0,48,255,175,0,0,243,255,10,0,48,255,175,0,0,243,255,10,0,48,255,175,
+ 0,0,243,255,10,0,48,255,175,0,0,243,255,10,0,48,255,175,0,0,243,255,10,0,48,255,175,0,0,243,255,10,
+ 0,48,255,175,0,0,243,255,10,0,48,255,175,0,0,243,255,10,0,48,255,175,0,0,243,255,10,0,48,255,175,0,
+ 0,243,255,10,0,48,255,175,0,0,243,255,10,0,48,255,175,0,0,243,239,0,130,236,222,57,0,0,181,253,206,24,
+ 0,0,0,48,255,47,229,255,255,255,143,16,251,255,255,255,62,0,0,0,243,255,248,255,255,255,255,95,251,255,255,255,
+ 255,13,0,0,48,255,255,223,71,115,254,255,255,175,53,164,255,255,5,0,0,243,255,223,1,0,80,255,255,127,0,0,
+ 176,255,159,0,0,48,255,255,5,0,0,208,255,223,0,0,0,244,255,11,0,0,243,255,31,0,0,0,251,255,8,0,
+ 0,32,255,207,0,0,48,255,207,0,0,0,160,255,95,0,0,0,241,255,13,0,0,243,255,11,0,0,0,250,255,4,
+ 0,0,16,255,223,0,0,48,255,175,0,0,0,160,255,79,0,0,0,241,255,13,0,0,243,255,10,0,0,0,250,255,
+ 4,0,0,16,255,223,0,0,48,255,175,0,0,0,160,255,79,0,0,0,241,255,13,0,0,243,255,10,0,0,0,250,
+ 255,4,0,0,16,255,223,0,0,48,255,175,0,0,0,160,255,79,0,0,0,241,255,13,0,0,243,255,10,0,0,0,
+ 250,255,4,0,0,16,255,223,0,0,48,255,175,0,0,0,160,255,79,0,0,0,241,255,13,0,0,243,255,10,0,0,
+ 0,250,255,4,0,0,16,255,223,0,0,48,255,175,0,0,0,160,255,79,0,0,0,241,255,13,0,0,243,255,10,0,
+ 0,0,250,255,4,0,0,16,255,223,0,0,0,243,239,0,113,236,239,107,1,0,0,0,243,255,66,254,255,255,255,45,
+ 0,0,0,243,255,232,255,255,255,255,223,0,0,0,243,255,255,142,52,181,255,255,6,0,0,243,255,239,2,0,0,250,
+ 255,10,0,0,243,255,111,0,0,0,244,255,13,0,0,243,255,31,0,0,0,241,255,14,0,0,243,255,13,0,0,0,
+ 240,255,14,0,0,243,255,11,0,0,0,240,255,14,0,0,243,255,10,0,0,0,240,255,14,0,0,243,255,10,0,0,
+ 0,240,255,14,0,0,243,255,10,0,0,0,240,255,14,0,0,243,255,10,0,0,0,240,255,14,0,0,243,255,10,0,
+ 0,0,240,255,14,0,0,243,255,10,0,0,0,240,255,14,0,0,243,255,10,0,0,0,240,255,14,0,0,243,255,10,
+ 0,0,0,240,255,14,0,0,243,255,10,0,0,0,240,255,14,0,0,243,255,10,0,0,0,240,255,14,0,0,0,0,
+ 148,236,239,140,2,0,0,0,0,16,251,255,255,255,255,8,0,0,0,32,253,255,255,255,255,255,10,0,0,0,251,255,
+ 142,52,165,255,255,6,0,0,245,255,46,0,0,96,255,239,1,0,176,255,127,0,0,0,160,255,127,0,0,254,255,1,
+ 0,0,0,245,255,11,0,243,255,13,0,0,0,16,255,239,0,64,255,191,0,0,0,0,240,255,15,0,244,255,11,0,
+ 0,0,0,254,255,1,64,255,207,0,0,0,0,240,255,15,0,242,255,13,0,0,0,32,255,239,0,0,254,255,2,0,
+ 0,0,245,255,11,0,160,255,127,0,0,0,176,255,127,0,0,243,255,62,0,0,96,255,239,1,0,0,249,255,143,52,
+ 165,255,255,7,0,0,16,252,255,255,255,255,255,10,0,0,0,0,249,255,255,255,255,8,0,0,0,0,0,147,236,239,
+ 140,2,0,0,0,0,243,255,1,113,236,222,57,0,0,0,48,255,79,227,255,255,255,143,0,0,0,243,255,233,255,255,
+ 255,255,127,0,0,48,255,255,223,70,99,253,255,47,0,0,243,255,207,1,0,16,253,255,9,0,48,255,255,4,0,0,
+ 64,255,239,0,0,243,255,14,0,0,0,224,255,47,0,48,255,207,0,0,0,0,251,255,5,0,243,255,11,0,0,0,
+ 144,255,111,0,48,255,175,0,0,0,0,249,255,6,0,243,255,11,0,0,0,144,255,111,0,48,255,207,0,0,0,0,
+ 251,255,5,0,243,255,31,0,0,0,224,255,47,0,48,255,255,5,0,0,80,255,239,0,0,243,255,223,1,0,16,253,
+ 255,8,0,48,255,255,223,71,99,253,255,46,0,0,243,255,252,255,255,255,255,111,0,0,48,255,143,229,255,255,255,127,
+ 0,0,0,243,255,10,130,236,222,57,0,0,0,48,255,175,0,0,0,0,0,0,0,0,243,255,10,0,0,0,0,0,
+ 0,0,48,255,175,0,0,0,0,0,0,0,0,243,255,10,0,0,0,0,0,0,0,48,255,175,0,0,0,0,0,0,
+ 0,0,243,255,10,0,0,0,0,0,0,0,48,255,175,0,0,0,0,0,0,0,0,243,255,10,0,0,0,0,0,0,
+ 0,0,0,32,200,238,141,2,224,255,6,0,0,80,254,255,255,255,22,255,111,0,0,80,255,255,255,255,255,249,255,6,
+ 0,16,254,255,126,52,198,255,255,111,0,0,247,255,46,0,0,160,255,255,6,0,192,255,127,0,0,0,225,255,111,0,
+ 0,255,255,2,0,0,0,250,255,6,0,243,255,13,0,0,0,112,255,111,0,64,255,207,0,0,0,0,246,255,6,0,
+ 244,255,11,0,0,0,80,255,111,0,64,255,191,0,0,0,0,245,255,6,0,243,255,13,0,0,0,96,255,111,0,16,
+ 255,255,1,0,0,0,249,255,6,0,192,255,111,0,0,0,208,255,111,0,0,247,255,29,0,0,112,255,255,6,0,16,
+ 254,255,109,35,164,255,255,111,0,0,80,255,255,255,255,255,250,255,6,0,0,96,255,255,255,239,117,255,111,0,0,0,
+ 32,217,238,141,2,247,255,6,0,0,0,0,0,0,0,128,255,111,0,0,0,0,0,0,0,0,248,255,6,0,0,0,
+ 0,0,0,0,128,255,111,0,0,0,0,0,0,0,0,248,255,6,0,0,0,0,0,0,0,128,255,111,0,0,0,0,
+ 0,0,0,0,248,255,6,0,0,0,0,0,0,0,128,255,111,0,0,0,0,0,0,0,0,248,255,6,0,0,243,239,
+ 0,64,235,239,0,48,255,31,160,255,255,14,0,243,255,163,255,255,207,0,48,255,191,255,207,169,8,0,243,255,255,60,
+ 0,0,0,48,255,255,29,0,0,0,0,243,255,79,0,0,0,0,48,255,239,0,0,0,0,0,243,255,11,0,0,0,
+ 0,48,255,175,0,0,0,0,0,243,255,10,0,0,0,0,48,255,175,0,0,0,0,0,243,255,10,0,0,0,0,48,
+ 255,175,0,0,0,0,0,243,255,10,0,0,0,0,48,255,175,0,0,0,0,0,243,255,10,0,0,0,0,48,255,175,
+ 0,0,0,0,0,243,255,10,0,0,0,0,0,0,147,236,239,189,55,0,0,0,250,255,255,255,255,159,0,0,250,255,
+ 255,255,255,255,5,0,242,255,110,18,65,216,13,0,80,255,143,0,0,0,16,0,0,245,255,11,0,0,0,0,0,32,
+ 255,255,42,0,0,0,0,0,160,255,255,175,4,0,0,0,0,177,255,255,255,108,0,0,0,0,96,254,255,255,223,3,
+ 0,0,0,0,198,255,255,239,3,0,0,0,0,48,250,255,191,0,0,0,0,0,0,245,255,15,0,0,0,0,0,0,
+ 252,255,1,32,2,0,0,0,208,255,15,0,245,123,19,16,163,255,191,0,80,255,255,255,255,255,255,3,0,245,255,255,
+ 255,255,239,4,0,0,131,219,254,222,106,1,0,0,0,0,248,31,0,0,0,0,208,255,1,0,0,0,48,255,31,0,
+ 0,0,0,249,255,1,0,0,64,251,255,255,255,255,84,255,255,255,255,255,79,229,254,255,239,238,238,4,0,253,255,1,
+ 0,0,0,208,255,31,0,0,0,0,253,255,1,0,0,0,208,255,31,0,0,0,0,253,255,1,0,0,0,208,255,31,
+ 0,0,0,0,253,255,1,0,0,0,208,255,31,0,0,0,0,253,255,1,0,0,0,208,255,31,0,0,0,0,252,255,
+ 2,0,0,0,176,255,111,0,0,0,0,248,255,110,51,69,0,32,255,255,255,255,7,0,96,255,255,255,127,0,0,64,
+ 234,239,173,3,0,246,255,8,0,0,0,242,255,12,0,0,246,255,8,0,0,0,242,255,12,0,0,246,255,8,0,0,
+ 0,242,255,12,0,0,246,255,8,0,0,0,242,255,12,0,0,246,255,8,0,0,0,242,255,12,0,0,246,255,8,0,
+ 0,0,242,255,12,0,0,246,255,8,0,0,0,242,255,12,0,0,246,255,8,0,0,0,242,255,12,0,0,246,255,8,
+ 0,0,0,242,255,12,0,0,246,255,8,0,0,0,242,255,12,0,0,246,255,8,0,0,0,242,255,12,0,0,246,255,
+ 9,0,0,0,244,255,12,0,0,245,255,9,0,0,0,247,255,12,0,0,244,255,12,0,0,0,252,255,12,0,0,242,
+ 255,79,0,0,112,255,255,12,0,0,192,255,239,55,83,250,255,255,12,0,0,80,255,255,255,255,255,203,255,12,0,0,
+ 0,247,255,255,255,191,129,255,12,0,0,0,48,217,254,173,5,80,255,12,0,252,255,4,0,0,0,32,255,239,113,255,
+ 159,0,0,0,0,247,255,10,241,255,14,0,0,0,192,255,79,0,251,255,4,0,0,32,255,223,0,80,255,175,0,0,
+ 0,247,255,8,0,225,255,14,0,0,192,255,63,0,0,249,255,5,0,32,255,207,0,0,64,255,175,0,0,247,255,6,
+ 0,0,208,255,14,0,192,255,31,0,0,0,248,255,5,32,255,175,0,0,0,32,255,175,0,247,255,5,0,0,0,192,
+ 255,14,192,255,14,0,0,0,0,246,255,36,255,159,0,0,0,0,16,255,159,246,255,3,0,0,0,0,160,255,156,255,
+ 13,0,0,0,0,0,245,255,253,127,0,0,0,0,0,0,254,255,255,2,0,0,0,0,0,144,255,255,11,0,0,0,
+ 0,0,0,243,255,111,0,0,0,0,248,255,7,0,0,96,255,255,3,0,0,160,255,79,244,255,10,0,0,160,255,255,
+ 7,0,0,208,255,14,224,255,14,0,0,224,255,255,11,0,0,242,255,11,176,255,63,0,0,243,223,255,14,0,0,246,
+ 255,7,112,255,111,0,0,247,143,253,79,0,0,250,255,3,48,255,175,0,0,251,95,250,143,0,0,253,239,0,0,254,
+ 239,0,16,255,47,246,207,0,32,255,175,0,0,250,255,3,80,255,13,243,255,1,96,255,95,0,0,246,255,6,144,255,
+ 10,224,255,5,160,255,31,0,0,241,255,10,208,255,6,160,255,9,208,255,12,0,0,192,255,13,242,255,2,96,255,13,
+ 242,255,8,0,0,128,255,31,246,223,0,32,255,47,245,255,4,0,0,64,255,79,249,159,0,0,253,95,248,255,1,0,
+ 0,16,255,127,252,95,0,0,249,143,251,191,0,0,0,0,251,175,254,31,0,0,245,191,254,127,0,0,0,0,247,239,
+ 255,11,0,0,241,239,255,63,0,0,0,0,243,255,255,7,0,0,192,255,255,14,0,0,0,0,224,255,255,3,0,0,
+ 128,255,255,10,0,0,0,0,160,255,239,0,0,0,64,255,255,6,0,0,209,255,127,0,0,0,176,255,175,0,244,255,
+ 46,0,0,96,255,239,1,0,249,255,11,0,16,254,255,5,0,16,253,255,5,0,250,255,10,0,0,80,255,239,1,244,
+ 255,30,0,0,0,160,255,159,209,255,95,0,0,0,0,225,255,191,255,175,0,0,0,0,0,245,255,255,239,1,0,0,
+ 0,0,0,250,255,255,5,0,0,0,0,0,80,255,255,30,0,0,0,0,0,16,253,255,255,9,0,0,0,0,0,249,
+ 255,255,255,4,0,0,0,0,244,255,93,255,223,1,0,0,0,209,255,95,144,255,159,0,0,0,144,255,175,0,225,255,
+ 79,0,0,64,255,239,2,0,245,255,29,0,16,253,255,6,0,0,251,255,9,0,249,255,12,0,0,32,254,255,4,244,
+ 255,63,0,0,0,112,255,223,1,252,255,6,0,0,0,32,255,255,97,255,207,0,0,0,0,247,255,10,241,255,47,0,
+ 0,0,192,255,95,0,250,255,7,0,0,32,255,239,0,64,255,207,0,0,0,247,255,8,0,208,255,47,0,0,192,255,
+ 63,0,0,247,255,7,0,32,255,207,0,0,32,255,207,0,0,247,255,7,0,0,176,255,63,0,192,255,31,0,0,0,
+ 245,255,8,32,255,191,0,0,0,0,254,223,0,247,255,5,0,0,0,128,255,63,192,255,14,0,0,0,0,242,255,23,
+ 255,159,0,0,0,0,0,251,191,246,255,3,0,0,0,0,96,255,158,255,13,0,0,0,0,0,225,255,254,127,0,0,
+ 0,0,0,0,249,255,255,2,0,0,0,0,0,48,255,255,11,0,0,0,0,0,0,192,255,95,0,0,0,0,0,0,
+ 0,252,239,1,0,0,0,0,0,0,244,255,9,0,0,0,0,0,0,176,255,63,0,0,0,0,0,0,96,255,207,0,
+ 0,0,0,16,52,148,255,255,4,0,0,0,0,244,255,255,255,8,0,0,0,0,64,255,255,255,8,0,0,0,0,0,
+ 211,254,157,3,0,0,0,0,0,0,80,255,255,255,255,255,255,12,80,255,255,255,255,255,255,12,80,255,255,255,255,255,
+ 255,12,0,0,0,0,16,253,255,4,0,0,0,0,144,255,159,0,0,0,0,0,245,255,29,0,0,0,0,16,254,255,
+ 3,0,0,0,0,160,255,143,0,0,0,0,0,245,255,12,0,0,0,0,32,254,255,3,0,0,0,0,176,255,127,0,
+ 0,0,0,0,246,255,12,0,0,0,0,32,254,239,2,0,0,0,0,176,255,127,0,0,0,0,0,247,255,11,0,0,
+ 0,0,32,255,239,2,0,0,0,0,176,255,255,255,255,255,255,31,208,255,255,255,255,255,255,31,208,255,255,255,255,255,
+ 255,31,0,0,0,32,183,237,6,0,0,96,255,255,111,0,0,64,255,255,255,6,0,0,250,255,93,2,0,0,192,255,
+ 47,0,0,0,0,253,207,0,0,0,0,208,255,12,0,0,0,0,253,207,0,0,0,0,208,255,12,0,0,0,0,253,
+ 207,0,0,0,0,224,255,11,0,0,0,64,255,159,0,0,0,114,254,255,4,0,64,255,255,239,6,0,0,244,255,143,
+ 1,0,0,64,255,255,223,4,0,0,49,165,255,255,3,0,0,0,96,255,159,0,0,0,0,224,255,11,0,0,0,0,
+ 253,207,0,0,0,0,208,255,12,0,0,0,0,253,207,0,0,0,0,208,255,12,0,0,0,0,253,207,0,0,0,0,
+ 192,255,47,0,0,0,0,249,255,92,1,0,0,48,255,255,255,6,0,0,96,255,255,111,0,0,0,32,183,237,6,0,
+ 0,0,32,255,13,0,0,0,0,0,0,0,242,223,0,0,0,0,0,0,0,32,255,13,0,0,0,0,0,0,0,242,
+ 223,0,0,0,0,0,0,0,32,255,13,0,0,0,0,0,0,0,242,223,0,0,0,0,0,0,0,32,255,13,0,0,
+ 0,0,0,0,0,242,223,0,0,0,0,0,0,0,32,255,13,0,0,0,0,0,0,0,242,223,0,0,0,0,0,0,
+ 0,32,255,13,0,0,0,0,0,0,0,242,223,0,0,0,0,0,0,0,32,255,13,0,0,0,0,0,0,0,242,223,
+ 0,0,0,0,0,0,0,32,255,13,0,0,0,0,0,0,0,242,223,0,0,0,0,0,0,0,32,255,13,0,0,0,
+ 0,0,0,0,242,223,0,0,0,0,0,0,0,32,255,13,0,0,0,0,0,0,0,242,223,0,0,0,0,0,0,0,
+ 32,255,13,0,0,0,0,0,0,0,242,223,0,0,0,0,0,0,0,32,255,13,0,0,0,0,0,0,0,242,223,0,
+ 0,0,0,0,0,0,32,255,13,0,0,0,0,0,0,0,242,223,0,0,0,0,0,0,0,32,255,13,0,0,0,0,
+ 0,0,0,242,223,0,0,0,0,0,0,0,32,255,13,0,0,0,0,0,0,0,242,223,0,0,0,0,0,0,0,32,
+ 255,13,0,0,0,0,0,0,0,242,223,0,0,0,0,0,0,0,32,255,13,0,0,0,0,0,0,0,242,223,0,0,
+ 0,0,244,190,40,0,0,0,64,255,255,94,0,0,0,244,255,255,46,0,0,0,81,253,255,7,0,0,0,48,255,159,
+ 0,0,0,0,224,255,10,0,0,0,0,254,175,0,0,0,0,224,255,10,0,0,0,0,254,175,0,0,0,0,224,255,
+ 10,0,0,0,0,254,191,0,0,0,0,192,255,30,0,0,0,0,246,255,93,2,0,0,0,248,255,255,13,0,0,0,
+ 146,255,223,0,0,0,230,255,255,13,0,0,244,255,158,53,0,0,176,255,63,0,0,0,0,253,191,0,0,0,0,224,
+ 255,10,0,0,0,0,254,175,0,0,0,0,224,255,10,0,0,0,0,254,175,0,0,0,0,224,255,10,0,0,0,48,
+ 255,175,0,0,0,82,253,255,8,0,0,244,255,255,47,0,0,64,255,255,95,0,0,0,228,189,39,0,0,0,0,0,
+ 129,253,206,57,0,0,0,129,0,210,255,255,255,223,56,17,214,12,96,255,255,255,255,255,255,255,207,0,246,40,16,165,
+ 255,255,255,255,6,80,4,0,0,16,182,254,174,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,
+};
+static const Glyph font_big_glyphs[95] = {
+ {0,0,0,0,0,9},
+ {0,9,24,0,13,9},
+ {108,15,24,0,13,15},
+ {288,22,24,0,13,22},
+ {552,19,28,0,11,19},
+ {818,29,24,0,13,29},
+ {1166,26,24,0,13,25},
+ {1478,8,24,0,13,8},
+ {1574,11,29,0,13,11},
+ {1734,11,29,0,13,11},
+ {1894,19,26,0,11,19},
+ {2141,19,20,0,17,19},
+ {2331,9,8,0,33,9},
+ {2367,11,11,0,26,11},
+ {2428,9,6,0,31,9},
+ {2455,13,24,0,13,13},
+ {2611,19,24,0,13,19},
+ {2839,19,24,0,13,19},
+ {3067,19,24,0,13,19},
+ {3295,19,24,0,13,19},
+ {3523,19,24,0,13,19},
+ {3751,19,24,0,13,19},
+ {3979,19,24,0,13,19},
+ {4207,19,24,0,13,19},
+ {4435,19,24,0,13,19},
+ {4663,19,24,0,13,19},
+ {4891,9,19,0,18,9},
+ {4977,9,23,0,18,9},
+ {5081,19,21,0,16,19},
+ {5281,19,17,0,20,19},
+ {5443,19,21,0,16,19},
+ {5643,15,24,0,13,15},
+ {5823,31,27,0,13,31},
+ {6242,23,24,0,13,22},
+ {6518,22,24,0,13,22},
+ {6782,22,24,0,13,22},
+ {7046,25,24,0,13,25},
+ {7346,19,24,0,13,19},
+ {7574,18,24,0,13,18},
+ {7790,25,24,0,13,25},
+ {8090,26,24,0,13,26},
+ {8402,10,24,0,13,10},
+ {8522,13,30,-3,13,10},
+ {8717,22,24,0,13,22},
+ {8981,18,24,0,13,18},
+ {9197,31,24,0,13,31},
+ {9569,27,24,0,13,27},
+ {9893,27,24,0,13,27},
+ {10217,21,24,0,13,21},
+ {10469,27,29,0,13,27},
+ {10861,22,24,0,13,22},
+ {11125,19,24,0,13,19},
+ {11353,19,24,0,13,19},
+ {11581,25,24,0,13,25},
+ {11881,22,24,0,13,21},
+ {12145,32,24,0,13,32},
+ {12529,22,24,0,13,21},
+ {12793,21,24,0,13,20},
+ {13045,20,24,0,13,20},
+ {13285,11,29,0,13,11},
+ {13445,13,24,0,13,13},
+ {13601,11,29,0,13,11},
+ {13761,18,24,0,13,18},
+ {13977,16,6,-1,37,15},
+ {14025,20,26,0,11,20},
+ {14285,20,19,0,18,20},
+ {14475,21,26,0,11,21},
+ {14748,17,19,0,18,17},
+ {14910,21,26,0,11,21},
+ {15183,20,19,0,18,20},
+ {15373,14,26,0,11,12},
+ {15555,19,27,0,18,19},
+ {15812,22,26,0,11,22},
+ {16098,9,25,0,12,9},
+ {16211,12,33,-3,12,9},
+ {16409,20,26,0,11,19},
+ {16669,9,26,0,11,9},
+ {16786,33,19,0,18,33},
+ {17100,22,19,0,18,22},
+ {17309,21,19,0,18,21},
+ {17509,21,27,0,18,21},
+ {17793,21,27,0,18,21},
+ {18077,15,19,0,18,15},
+ {18220,17,19,0,18,17},
+ {18382,13,23,0,14,13},
+ {18532,22,19,0,18,22},
+ {18741,19,19,0,18,18},
+ {18922,28,19,0,18,28},
+ {19188,19,19,0,18,19},
+ {19369,19,27,0,18,18},
+ {19626,16,19,0,18,16},
+ {19778,13,29,0,13,13},
+ {19967,19,34,0,11,19},
+ {20290,13,29,0,13,13},
+ {20479,19,14,0,23,19},
+};
+static const Font font_big = {font_big_glyphs, font_big_bits, 47, 37};
diff --git a/games/circloo/src/game.c b/games/circloo/src/game.c
new file mode 100644
index 00000000..8e2a03c5
--- /dev/null
+++ b/games/circloo/src/game.c
@@ -0,0 +1,390 @@
+/* circloO: the screens around the levels (a row of circles to pick from, as the game's obj_menu draws them),
+ * the unlocking of levels and the saves. */
+#include <math.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include "game.h"
+#include "gfx.h"
+#include "phys.h"
+#include "plat.h"
+
+Game g;
+Save save;
+
+/* ---- saves: "COOS", a version, then Save ---- */
+
+#define SAVE_NAME "circloo.sav"
+#define SAVE_MAGIC 0x534F4F43u
+#define SAVE_VERSION 1
+
+typedef struct {
+ uint32_t magic;
+ uint16_t version, size;
+ Save s;
+} SaveFile;
+_Static_assert(sizeof(SaveFile) == 112 && offsetof(SaveFile, s.done) == 12 && offsetof(SaveFile, s.best) == 44,
+ "the save's layout (tests/check.py and NumPlay's tests/test_games.py read it)");
+
+static void save_defaults(void) {
+ memset(&save, 0, sizeof save);
+ save.unlocked[0] = save.unlocked[1] = 2;
+}
+
+/* a copy in a Python script, "#>circloo.sav:base64": installing apps from the NumWorks website keeps only Python
+ * scripts, so the save comes back from it when the file itself is gone (as NumPlay's big games keep theirs) */
+#define COPY_NAME "circloo_saves.py"
+static const char copy_head[] = "# circloO's saves: keep this file\n";
+static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+#define COPY_BYTES (1 + sizeof copy_head - 1 + 2 + sizeof SAVE_NAME - 1 + 1 + (sizeof(SaveFile) + 2) / 3 * 4 + 2)
+
+static bool copy_write(const SaveFile *f) {
+ uint8_t o[COPY_BYTES], *p = o;
+ const uint8_t *d = (const uint8_t *)f;
+ uint32_t len = sizeof *f;
+ *p++ = 0; /* (the script's status byte: not imported) */
+ memcpy(p, copy_head, sizeof copy_head - 1), p += sizeof copy_head - 1;
+ *p++ = '#', *p++ = '>';
+ memcpy(p, SAVE_NAME, sizeof SAVE_NAME - 1), p += sizeof SAVE_NAME - 1;
+ *p++ = ':';
+ for (uint32_t i = 0; i < len; i += 3, p += 4) {
+ /* (written out: GCC 15.2 for the calculator got a loop over the four wrong, see launcher/src/storage.c) */
+ uint32_t left = len - i, v = (uint32_t)d[i] << 16 | (left > 1 ? d[i + 1] << 8 : 0) | (left > 2 ? d[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';
+ *p++ = 0;
+ return plat_save(COPY_NAME, o, (uint32_t)(p - o));
+}
+
+static int b64_value(uint8_t c) {
+ for (int i = 0; i < 64; i++)
+ if ((uint8_t)b64[i] == c) return i;
+ return -1;
+}
+
+static bool copy_read(SaveFile *f) {
+ uint32_t n, nl = sizeof SAVE_NAME - 1;
+ const uint8_t *c = plat_load(COPY_NAME, &n), *l = NULL;
+ if (!c) return false;
+ for (uint32_t i = 0; i + nl + 3 <= n && !l; i++)
+ if (c[i] == '#' && c[i + 1] == '>' && !memcmp(c + i + 2, SAVE_NAME, nl) && c[i + 2 + nl] == ':') l = c + i + 3 + nl;
+ if (!l) return false;
+ uint32_t len = 0;
+ while (l + len < c + n && l[len] != '\n' && l[len]) len++;
+ if (len != (sizeof *f + 2) / 3 * 4) return false;
+ uint8_t *out = (uint8_t *)f;
+ uint32_t o = 0;
+ for (uint32_t i = 0; i < len; i += 4) {
+ int v0 = b64_value(l[i]), v1 = b64_value(l[i + 1]);
+ int v2 = l[i + 2] == '=' ? 0 : b64_value(l[i + 2]), v3 = l[i + 3] == '=' ? 0 : b64_value(l[i + 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) out[o++] = (uint8_t)(w >> 16);
+ if (o < sizeof *f) out[o++] = (uint8_t)(w >> 8);
+ if (o < sizeof *f) out[o++] = (uint8_t)w;
+ }
+ return true;
+}
+
+void save_read(void) {
+ save_defaults();
+ uint32_t len;
+ const uint8_t *d = plat_load(SAVE_NAME, &len);
+ SaveFile f;
+ if (d && len >= sizeof f) memcpy(&f, d, sizeof f);
+ else if (d || !copy_read(&f)) return;
+ if (f.magic != SAVE_MAGIC || f.version != SAVE_VERSION || f.size != sizeof(Save)) return;
+ for (int m = 0; m < 2; m++) {
+ if (f.s.unlocked[m] < 2 || f.s.unlocked[m] > 40 || f.s.bonus[m] > 5) return;
+ for (int i = 0; i < 16; i++)
+ if (f.s.done[m][i] > 1) return;
+ }
+ save = f.s;
+ save.hard = save.hard && save.unlocked[0] > 10;
+}
+
+bool save_write(void) {
+ SaveFile f = {SAVE_MAGIC, SAVE_VERSION, sizeof(Save), save};
+ bool ok = plat_save(SAVE_NAME, &f, sizeof f);
+ return copy_write(&f) && ok;
+}
+
+/* ---- the menus ---- */
+
+enum { IT_MODE, IT_LEVEL, IT_CREDITS, IT_CONTINUE, IT_RETRY, IT_MAIN, IT_NEXT };
+#define SLIDE 8
+
+static int levels_in(int m) { return m ? NHARD : NBASE; }
+static int playable(int m) {
+ int n = save.unlocked[m];
+ return n < levels_in(m) ? n : levels_in(m);
+}
+
+/* the level the main menu shows first: the first one not done yet */
+static int first_pick(int m) {
+ for (int i = 1; i <= playable(m); i++)
+ if (!save.done[m][i]) return i;
+ return playable(m);
+}
+
+static void menu(int state, int sel) {
+ g.state = state;
+ g.nitems = 0;
+ if (state == S_MENU) {
+ if (save.unlocked[0] > 10) g.items[g.nitems++] = IT_MODE;
+ g.items[g.nitems++] = IT_LEVEL;
+ g.items[g.nitems++] = IT_CREDITS;
+ } else if (state == S_PAUSE) {
+ g.items[g.nitems++] = IT_CONTINUE, g.items[g.nitems++] = IT_RETRY, g.items[g.nitems++] = IT_MAIN;
+ } else if (state == S_DONE) {
+ g.items[g.nitems++] = IT_NEXT, g.items[g.nitems++] = IT_RETRY, g.items[g.nitems++] = IT_MAIN;
+ }
+ g.sel = g.from = sel;
+ g.anim = 0;
+}
+
+static int sel_of(int item) {
+ for (int i = 0; i < g.nitems; i++)
+ if (g.items[i] == item) return i;
+ return 0;
+}
+
+static void start(int level, bool hard) {
+ save.hard = hard;
+ level_load(level, hard);
+ g.state = S_PLAY;
+ g.zoom = 0;
+}
+
+static void main_menu(void) {
+ menu(S_MENU, 0);
+ g.sel = g.from = sel_of(IT_LEVEL);
+ colours_for((float)g.pick[save.hard]);
+}
+
+static void complete(void) {
+ int m = L.hard, d = L.level;
+ bool before = save.unlocked[0] > 10;
+ if (!save.done[m][d]) save.done[m][d] = 1, save.unlocked[m]++;
+ if (save.bonus[m] < d / 5) save.bonus[m]++, save.unlocked[m]++;
+ g.last_time = L.frames;
+ g.new_best = !save.best[m][d] || L.frames < save.best[m][d];
+ if (g.new_best) save.best[m][d] = (uint16_t)(L.frames > 65535 ? 65535 : L.frames);
+ g.msg = !before && save.unlocked[0] > 10;
+ g.msg_t = 0;
+ save_write();
+ menu(S_DONE, 0);
+}
+
+void game_init(void) {
+ save_read();
+ g.running = true;
+ g.pick[0] = first_pick(0), g.pick[1] = first_pick(1);
+ main_menu();
+}
+
+static void act(int item) {
+ int m = save.hard;
+ switch (item) {
+ case IT_MODE:
+ save.hard = !save.hard;
+ colours_for((float)g.pick[save.hard]);
+ break;
+ case IT_LEVEL: g.zoom = 1; break;
+ case IT_CREDITS: g.state = S_CREDITS; break;
+ case IT_CONTINUE: g.state = S_PLAY; break;
+ case IT_RETRY: start(L.level, L.hard); break;
+ case IT_MAIN:
+ save_write();
+ g.pick[L.hard] = L.level;
+ main_menu();
+ break;
+ case IT_NEXT:
+ m = L.hard;
+ if (L.level < levels_in(m)) {
+ g.pick[m] = L.level + 1;
+ start(L.level + 1, m);
+ } else if (!m) {
+ g.pick[1] = first_pick(1);
+ start(g.pick[1], true); /* "Hard Mode" */
+ } else {
+ g.pick[1] = L.level;
+ save.hard = 1;
+ main_menu();
+ g.state = S_CREDITS;
+ }
+ break;
+ }
+}
+
+void game_tick(uint32_t keys) {
+ uint32_t press = keys & ~g.prev;
+ g.prev = keys;
+ if (g.msg) g.msg_t++;
+ if (g.anim > 0) g.anim--;
+ switch (g.state) {
+ case S_PLAY:
+ if (press & K_BACK) {
+ menu(S_PAUSE, 0);
+ return;
+ }
+ level_tick(keys);
+ if (L.complete) complete();
+ return;
+ case S_CREDITS:
+ if (press & (K_BACK | K_OK)) main_menu();
+ return;
+ case S_DONE:
+ level_tick(0); /* (the level goes on moving behind) */
+ break;
+ default: break;
+ }
+ if (g.zoom) {
+ if (++g.zoom > 12) start(g.pick[save.hard], save.hard);
+ return;
+ }
+ int item = g.items[g.sel];
+ if (press & (K_LEFT | K_RIGHT)) {
+ int to = g.sel + (press & K_RIGHT ? 1 : -1);
+ if (to >= 0 && to < g.nitems) g.from = g.sel, g.sel = to, g.anim = SLIDE;
+ } else if (item == IT_LEVEL && press & (K_UP | K_DOWN)) {
+ int m = save.hard, p = g.pick[m] + (press & K_UP ? 1 : -1);
+ if (p >= 1 && p <= playable(m)) g.pick[m] = p, colours_for((float)p);
+ } else if (press & K_OK) {
+ act(item);
+ } else if (press & K_BACK) {
+ if (g.state == S_PAUSE) g.state = S_PLAY;
+ else if (g.state == S_DONE) act(IT_MAIN);
+ else g.running = false;
+ }
+}
+
+/* ---- drawing ---- */
+
+static const char *label(int item, char *buf) {
+ switch (item) {
+ case IT_MODE: return save.hard ? "Hard mode" : "Normal#mode";
+ case IT_LEVEL: snprintf(buf, 8, "%d", g.pick[save.hard]); return buf;
+ case IT_CREDITS: return "Credits";
+ case IT_CONTINUE: return "Continue";
+ case IT_RETRY: return "Retry level";
+ case IT_MAIN: return "Main menu";
+ default: return L.level < levels_in(L.hard) ? "Next level" : L.hard ? "Credits" : "Hard Mode";
+ }
+}
+
+static void time_text(char *buf, int frames) {
+ int cs = frames * 100 / 60;
+ snprintf(buf, 24, "%d.%02d s", cs / 100, cs % 100);
+}
+
+static const char *title(int item) {
+ if (g.state == S_PAUSE) return "Game paused";
+ if (g.state == S_DONE) return "Level complete!";
+ return item == IT_MODE ? "Choose a game mode" : item == IT_LEVEL ? "Choose a level to play" : "circloO";
+}
+
+static const char *hint(int item) {
+ if (item == IT_LEVEL)
+ return "Use the up and down arrow keys to choose a level, or the left and right arrow keys to select another option. "
+ "OK to confirm.";
+ if (item == IT_MODE) return "Use the left and right arrow keys to select an option. Press OK to change game mode.";
+ return "Use the left and right arrow keys to select an option. Press OK to confirm.";
+}
+
+static void draw_menu(void) {
+ uint16_t A = g.hue_a, B = g.hue_b;
+ if (g.state == S_MENU) gfx_fill(A);
+ else gfx_rect(0, 0, SCREEN_W, SCREEN_H, A, 205);
+ float t = g.anim ? (float)g.anim / SLIDE : 0;
+ t = t * t * (3 - 2 * t);
+ float pos = g.sel + (g.from - g.sel) * t;
+ char buf[32];
+ for (int i = 0; i < g.nitems; i++) {
+ float d = fabsf(i - pos), id = d < 1 ? 1 - d : 0;
+ float x = SCREEN_W / 2 + (i - pos) * 160, y = SCREEN_H / 2, r = 20 + 60 * id;
+ if (x + r < 0 || x - r > SCREEN_W) continue;
+ gfx_disc(x, y, r, B, 256);
+ int font = id > 0.7f ? F_BIG : id > 0.3f ? F_MEDIUM : F_SMALL;
+ const char *s = label(g.items[i], buf);
+ int w = (int)(r * 1.8f), n = gfx_wrap(font, 0, 0, s, w, 0, 0, AL_CENTER, 0), h = gfx_font_h(font);
+ char sub[48] = "";
+ if (id > 0.7f) {
+ int item = g.items[i], m = save.hard;
+ if (item == IT_LEVEL && save.done[m][g.pick[m]]) {
+ char tb[24];
+ time_text(tb, save.best[m][g.pick[m]]);
+ snprintf(sub, sizeof sub, save.best[m][g.pick[m]] ? "Level complete#Best %s" : "Level complete", tb);
+ } else if (item == IT_CONTINUE) {
+ snprintf(sub, sizeof sub, "%d/7 circles collected", L.taken);
+ }
+ }
+ int sn = sub[0] ? gfx_wrap(F_SMALL, 0, 0, sub, (int)(r * 1.6f), 0, 0, AL_CENTER, 0) : 0;
+ float top = y - (n * h + sn * gfx_font_h(F_SMALL)) / 2.0f - 2;
+ gfx_wrap(font, x, top, s, w, A, 256, AL_CENTER, 1);
+ if (sn) gfx_wrap(F_SMALL, x, top + n * h, sub, (int)(r * 1.6f), A, 256, AL_CENTER, 1);
+ if (g.items[i] == IT_LEVEL && id > 0.7f) { /* (up and down change it) */
+ int m = save.hard;
+ float ax = x, ay = y - r + 7;
+ if (g.pick[m] < playable(m)) {
+ float px[3] = {ax - 5, ax + 5, ax}, py[3] = {ay + 3, ay + 3, ay - 3};
+ gfx_poly(px, py, 3, A, 256);
+ }
+ ay = y + r - 7;
+ if (g.pick[m] > 1) {
+ float px[3] = {ax - 5, ax + 5, ax}, py[3] = {ay - 3, ay - 3, ay + 3};
+ gfx_poly(px, py, 3, A, 256);
+ }
+ }
+ }
+ int item = g.items[g.sel];
+ gfx_text(F_MEDIUM, SCREEN_W / 2, 3, title(item), 99, B, 256, AL_CENTER);
+ if (g.state == S_DONE) {
+ char tb[24], line[64];
+ time_text(tb, g.last_time);
+ if (g.new_best) snprintf(line, sizeof line, "%s, a new best", tb);
+ else {
+ char bb[24];
+ time_text(bb, save.best[L.hard][L.level]);
+ snprintf(line, sizeof line, "%s (best %s)", tb, bb);
+ }
+ gfx_text(F_SMALL, SCREEN_W / 2, 24, line, 99, B, 256, AL_CENTER);
+ if (g.msg && g.msg_t < 60 * 6)
+ gfx_wrap(F_SMALL, SCREEN_W / 2, 40, "You unlocked hard mode! Activate it from the main menu.", 300, B, 256, AL_CENTER, 1);
+ }
+ const char *h = hint(item);
+ int n = gfx_wrap(F_SMALL, 0, 0, h, SCREEN_W - 12, 0, 0, AL_CENTER, 0);
+ gfx_wrap(F_SMALL, SCREEN_W / 2, SCREEN_H - 3 - n * gfx_font_h(F_SMALL), h, SCREEN_W - 12, mix(B, 0xFFFF, 64), 256, AL_CENTER, 1);
+ if (g.zoom) gfx_disc(SCREEN_W / 2, SCREEN_H / 2, 80 + g.zoom * 14, B, 256);
+}
+
+static void draw_credits(void) {
+ uint16_t A = g.hue_a, B = g.hue_b;
+ gfx_fill(A);
+ gfx_disc(SCREEN_W / 2, 112, 92, B, 256);
+ gfx_text(F_BIG, SCREEN_W / 2, 40, "circloO", 99, A, 256, AL_CENTER);
+ gfx_wrap(F_SMALL, SCREEN_W / 2, 86,
+ "A game by Florian van Strien#"
+ "#This version by Mason Chen#as part of NumPlay.#Not affiliated with#Florian van Strien.",
+ 170, A, 256, AL_CENTER, 1);
+ gfx_wrap(F_SMALL, SCREEN_W / 2, SCREEN_H - 18, "OK or Back to go back", 300, mix(B, 0xFFFF, 64), 256, AL_CENTER, 1);
+}
+
+void game_draw(void) {
+ if (g.state != S_MENU && g.state != S_CREDITS && L.ball >= 0) {
+ g.camx = W.b[L.ball].x / PX_M, g.camy = W.b[L.ball].y / PX_M;
+ }
+ for (int y = 0; y < SCREEN_H; y += BAND) {
+ gfx_band(y);
+ if (g.state == S_CREDITS) draw_credits();
+ else {
+ if (g.state != S_MENU) level_draw();
+ if (g.state != S_PLAY) draw_menu();
+ }
+ gfx_push();
+ }
+}
diff --git a/games/circloo/src/game.h b/games/circloo/src/game.h
new file mode 100644
index 00000000..df112a41
--- /dev/null
+++ b/games/circloo/src/game.h
@@ -0,0 +1,87 @@
+/* circloO: the game's state, its levels and its screens. */
+#ifndef CO_GAME_H
+#define CO_GAME_H
+#include <stdbool.h>
+#include <stdint.h>
+
+#define NBASE 14
+#define NHARD 6
+#define MAX_OBJ 320 /* a level's bodies, in its script's order */
+#define MAX_MC 96
+#define MAX_TMC 4
+#define MAX_TIMED 16
+#define MAX_PJ 40
+
+/* the save: what the game keeps (levelsunlocked, unlockedaddtimes, the levels done), and the best times */
+typedef struct {
+ uint8_t unlocked[2], bonus[2]; /* [0] normal, [1] hard */
+ uint8_t done[2][16]; /* level 1.. */
+ uint16_t best[2][16]; /* frames (1/60 s), 0: none */
+ uint8_t hard; /* the mode chosen on the main menu */
+ uint8_t pad[3];
+} Save;
+
+typedef struct { float x, y; uint8_t io, taken; } Coll;
+typedef struct { float x, y, r, dens, dist; int16_t body, obj; } Mc;
+typedef struct { float x, y, r, dens, dist; int16_t life, period, alarm; } Tmc;
+typedef struct { int16_t body, life, age; } Timed;
+typedef struct {
+ uint8_t type, fade; /* fade: 0..5, the joint's line appearing */
+ int16_t oa, ob, joint;
+ float ax, ay, bx, by, len, f, t;
+} PJoint;
+
+typedef struct {
+ int level; /* 1.. */
+ bool hard;
+ const int16_t *data; /* the level's records (levels.h) */
+ float R; /* the level's radius, pixels */
+ int grow; /* frames before it grows (0: not growing) */
+ int frames; /* time played, 1/60 s */
+ int ball;
+ Coll coll[8];
+ int ncoll, taken;
+ Mc mc[MAX_MC];
+ int nmc;
+ Tmc tmc[MAX_TMC];
+ int ntmc;
+ Timed timed[MAX_TIMED];
+ PJoint pj[MAX_PJ];
+ int npj;
+ int16_t objbody[MAX_OBJ]; /* each body object: its body (0: the ground, -1: not made yet) */
+ int nobj;
+ int8_t info[8]; /* the text shown at each ring */
+ bool complete;
+} Level;
+
+enum { S_MENU, S_PLAY, S_PAUSE, S_DONE, S_CREDITS };
+
+typedef struct {
+ bool running;
+ int state;
+ uint32_t keys, prev; /* held now, held last tick */
+ /* the menu (a row of circles) */
+ int items[6], nitems, sel, from, anim; /* anim: frames left of the slide from `from` */
+ int pick[2]; /* the level picked on the main menu, each mode */
+ int zoom; /* the circle growing over the screen into a level */
+ int msg, msg_t; /* a notification ("You unlocked hard mode!") */
+ int last_time; /* the level just done: its time, and whether it is the best */
+ bool new_best;
+ uint16_t hue_a, hue_b, hue_c; /* the colours (A outside and things, B inside, C ropes) */
+ float camx, camy;
+} Game;
+
+extern Game g;
+extern Save save;
+extern Level L;
+
+void level_load(int level, bool hard);
+void level_tick(uint32_t keys);
+void level_draw(void);
+void colours_for(float level);
+void game_init(void);
+void game_tick(uint32_t keys);
+void game_draw(void);
+void save_read(void);
+bool save_write(void);
+#endif
diff --git a/games/circloo/src/gfx.c b/games/circloo/src/gfx.c
new file mode 100644
index 00000000..e9cc7c8d
--- /dev/null
+++ b/games/circloo/src/gfx.c
@@ -0,0 +1,189 @@
+/* circloO: drawing into a band of the screen (see gfx.h). Shapes are filled a row at a time from two sub-rows,
+ * with their edges' coverage blended, which smooths circles about as the game's own drawing does. */
+#include <math.h>
+#include <stdbool.h>
+#include <string.h>
+#include <stdint.h>
+#include "font.h"
+#include "gfx.h"
+#include "plat.h"
+
+static uint16_t *fb;
+static int by0;
+static const Font *const fonts[3] = {&font_small, &font_medium, &font_big};
+
+void gfx_init(uint16_t *band) { fb = band; }
+void gfx_band(int y0) { by0 = y0; }
+void gfx_push(void) {
+ int h = SCREEN_H - by0 < BAND ? SCREEN_H - by0 : BAND;
+ plat_push(0, by0, SCREEN_W, h, fb);
+}
+
+uint16_t rgb(int r, int g, int b) {
+ r = r < 0 ? 0 : r > 255 ? 255 : r, g = g < 0 ? 0 : g > 255 ? 255 : g, b = b < 0 ? 0 : b > 255 ? 255 : b;
+ return (uint16_t)((r >> 3) << 11 | (g >> 2) << 5 | b >> 3);
+}
+
+uint16_t mix(uint16_t a, uint16_t b, int t) {
+ if (t <= 0) return a;
+ if (t >= 256) return b;
+ int r = ((a >> 11) * (256 - t) + (b >> 11) * t) >> 8;
+ int g = (((a >> 5) & 63) * (256 - t) + ((b >> 5) & 63) * t) >> 8;
+ int bl = ((a & 31) * (256 - t) + (b & 31) * t) >> 8;
+ return (uint16_t)(r << 11 | g << 5 | bl);
+}
+
+void gfx_fill(uint16_t c) {
+ int n = SCREEN_W * BAND;
+ for (int i = 0; i < n; i++) fb[i] = c;
+}
+
+static inline float clampf(float v, float a, float b) { return v < a ? a : v > b ? b : v; }
+
+/* one row from its two sub-rows' spans (a > b: empty) */
+static void row(int y, float a0, float b0, float a1, float b1, uint16_t c, int alpha) {
+ bool e0 = a0 >= b0, e1 = a1 >= b1;
+ if (e0 && e1) return;
+ float lo = e0 ? a1 : e1 ? a0 : fminf(a0, a1), hi = e0 ? b1 : e1 ? b0 : fmaxf(b0, b1);
+ float in_lo = e0 || e1 ? 1e9f : fmaxf(a0, a1), in_hi = e0 || e1 ? -1e9f : fminf(b0, b1);
+ int x0 = (int)floorf(lo), x1 = (int)ceilf(hi);
+ if (x0 < 0) x0 = 0;
+ if (x1 > SCREEN_W) x1 = SCREEN_W;
+ uint16_t *p = fb + (y - by0) * SCREEN_W;
+ int f0 = (int)ceilf(in_lo), f1 = (int)floorf(in_hi); /* fully covered pixels: [f0, f1) */
+ for (int x = x0; x < x1; x++) {
+ int cov;
+ if (x >= f0 && x < f1) cov = 256;
+ else {
+ float c0 = e0 ? 0 : clampf(fminf(b0, x + 1.0f) - fmaxf(a0, (float)x), 0, 1);
+ float c1 = e1 ? 0 : clampf(fminf(b1, x + 1.0f) - fmaxf(a1, (float)x), 0, 1);
+ cov = (int)((c0 + c1) * 128);
+ }
+ if (alpha < 256) cov = cov * alpha >> 8;
+ if (cov >= 256) p[x] = c;
+ else if (cov > 0) p[x] = mix(p[x], c, cov);
+ }
+}
+
+static bool rows(float top, float bot, int *y0, int *y1) {
+ *y0 = (int)floorf(top), *y1 = (int)ceilf(bot);
+ if (*y0 < by0) *y0 = by0;
+ if (*y1 > by0 + BAND) *y1 = by0 + BAND;
+ if (*y1 > SCREEN_H) *y1 = SCREEN_H;
+ return *y0 < *y1;
+}
+
+void gfx_disc(float cx, float cy, float r, uint16_t c, int alpha) {
+ int y0, y1;
+ if (r <= 0 || alpha <= 0 || cx + r < 0 || cx - r > SCREEN_W || !rows(cy - r, cy + r, &y0, &y1)) return;
+ float r2 = r * r;
+ for (int y = y0; y < y1; y++) {
+ float s[4];
+ for (int k = 0; k < 2; k++) {
+ float dy = y + 0.25f + 0.5f * k - cy, h2 = r2 - dy * dy;
+ if (h2 <= 0) s[2 * k] = 1, s[2 * k + 1] = 0;
+ else {
+ float h = sqrtf(h2);
+ s[2 * k] = cx - h, s[2 * k + 1] = cx + h;
+ }
+ }
+ row(y, s[0], s[1], s[2], s[3], c, alpha);
+ }
+}
+
+void gfx_poly(const float *x, const float *y, int n, uint16_t c, int alpha) {
+ float top = y[0], bot = y[0], l = x[0], r = x[0];
+ for (int i = 1; i < n; i++) top = fminf(top, y[i]), bot = fmaxf(bot, y[i]), l = fminf(l, x[i]), r = fmaxf(r, x[i]);
+ int y0, y1;
+ if (alpha <= 0 || r < 0 || l > SCREEN_W || !rows(top, bot, &y0, &y1)) return;
+ for (int yy = y0; yy < y1; yy++) {
+ float s[4];
+ for (int k = 0; k < 2; k++) {
+ float sy = yy + 0.25f + 0.5f * k, a = 1e9f, b = -1e9f;
+ for (int i = 0; i < n; i++) {
+ int j = (i + 1) % n;
+ float ya = y[i], yb = y[j];
+ if ((sy >= ya && sy < yb) || (sy >= yb && sy < ya)) {
+ float t = (sy - ya) / (yb - ya), xx = x[i] + t * (x[j] - x[i]);
+ a = fminf(a, xx), b = fmaxf(b, xx);
+ }
+ }
+ s[2 * k] = a, s[2 * k + 1] = b;
+ }
+ row(yy, s[0], s[1], s[2], s[3], c, alpha);
+ }
+}
+
+void gfx_rect(float x0, float y0, float x1, float y1, uint16_t c, int alpha) {
+ float x[4] = {x0, x1, x1, x0}, y[4] = {y0, y0, y1, y1};
+ gfx_poly(x, y, 4, c, alpha);
+}
+
+void gfx_line(float x1, float y1, float x2, float y2, float w, uint16_t c, int alpha) {
+ float dx = x2 - x1, dy = y2 - y1, l = sqrtf(dx * dx + dy * dy);
+ if (l < 1e-6f) return;
+ float nx = -dy / l * w * 0.5f, ny = dx / l * w * 0.5f;
+ float x[4] = {x1 + nx, x2 + nx, x2 - nx, x1 - nx}, y[4] = {y1 + ny, y2 + ny, y2 - ny, y1 - ny};
+ gfx_poly(x, y, 4, c, alpha);
+}
+
+/* ---- text ---- */
+
+int gfx_font_h(int font) { return fonts[font]->height; }
+
+int gfx_text_w(int font, const char *s, int n) {
+ const Font *f = fonts[font];
+ int w = 0;
+ for (int i = 0; i < n && s[i]; i++) {
+ unsigned ch = (unsigned char)s[i];
+ if (ch >= 32 && ch <= 126) w += f->g[ch - 32].adv;
+ }
+ return w;
+}
+
+void gfx_text(int font, float x, float y, const char *s, int n, uint16_t c, int alpha, int align) {
+ const Font *f = fonts[font];
+ int px = (int)lroundf(x), py = (int)lroundf(y);
+ if (py > by0 + BAND || py + f->height < by0 || alpha <= 0) return;
+ if (align == AL_CENTER) px -= gfx_text_w(font, s, n) / 2;
+ else if (align == AL_RIGHT) px -= gfx_text_w(font, s, n);
+ for (int i = 0; i < n && s[i]; i++) {
+ unsigned ch = (unsigned char)s[i];
+ if (ch < 32 || ch > 126) continue;
+ const Glyph *g = &f->g[ch - 32];
+ for (int gy = 0; gy < g->h; gy++) {
+ int yy = py + g->y + gy;
+ if (yy < by0 || yy >= by0 + BAND || yy >= SCREEN_H) continue;
+ uint16_t *p = fb + (yy - by0) * SCREEN_W;
+ for (int gx = 0; gx < g->w; gx++) {
+ int xx = px + g->x + gx;
+ if (xx < 0 || xx >= SCREEN_W) continue;
+ int k = gy * g->w + gx, v = f->bits[g->off + (k >> 1)];
+ v = k & 1 ? v >> 4 : v & 15;
+ if (!v) continue;
+ int a = v * 17 + (v >> 1);
+ if (alpha < 256) a = a * alpha >> 8;
+ p[xx] = mix(p[xx], c, a);
+ }
+ }
+ px += g->adv;
+ }
+}
+
+int gfx_wrap(int font, float x, float y, const char *s, int w, uint16_t c, int alpha, int align, int draw) {
+ int lines = 0, h = fonts[font]->height;
+ while (*s) {
+ int n = 0, last = -1;
+ while (s[n] && s[n] != '#') {
+ if (s[n] == ' ') last = n;
+ if (gfx_text_w(font, s, n + 1) > w && last > 0) break;
+ n++;
+ }
+ int len = s[n] && s[n] != '#' ? last : n;
+ if (draw) gfx_text(font, x, y + lines * h, s, len, c, alpha, align);
+ lines++;
+ s += len;
+ if (*s == ' ' || *s == '#') s++;
+ }
+ return lines;
+}
diff --git a/games/circloo/src/gfx.h b/games/circloo/src/gfx.h
new file mode 100644
index 00000000..f3cb1eab
--- /dev/null
+++ b/games/circloo/src/gfx.h
@@ -0,0 +1,28 @@
+/* circloO: drawing into a band of the screen (the screen does not fit the app's RAM), anti-aliased. */
+#ifndef CO_GFX_H
+#define CO_GFX_H
+#include <stdint.h>
+
+#define SCREEN_W 320
+#define SCREEN_H 240
+#define BAND 24
+
+enum { F_SMALL, F_MEDIUM, F_BIG };
+enum { AL_LEFT, AL_CENTER, AL_RIGHT };
+
+void gfx_init(uint16_t *band);
+void gfx_band(int y0); /* drawing goes to rows y0..y0+BAND-1 */
+void gfx_push(void); /* the band to the screen */
+uint16_t rgb(int r, int g, int b);
+uint16_t mix(uint16_t a, uint16_t b, int t); /* a to b, t of 256 */
+void gfx_fill(uint16_t c);
+void gfx_rect(float x0, float y0, float x1, float y1, uint16_t c, int alpha);
+void gfx_disc(float cx, float cy, float r, uint16_t c, int alpha);
+void gfx_poly(const float *x, const float *y, int n, uint16_t c, int alpha); /* convex */
+void gfx_line(float x1, float y1, float x2, float y2, float w, uint16_t c, int alpha);
+int gfx_text_w(int font, const char *s, int n);
+int gfx_font_h(int font);
+void gfx_text(int font, float x, float y, const char *s, int n, uint16_t c, int alpha, int align);
+/* text broken into lines of at most w pixels (and at '#'); returns the lines' count. y: the top of the first */
+int gfx_wrap(int font, float x, float y, const char *s, int w, uint16_t c, int alpha, int align, int draw);
+#endif
diff --git a/games/circloo/src/level.c b/games/circloo/src/level.c
new file mode 100644
index 00000000..5a243121
--- /dev/null
+++ b/games/circloo/src/level.c
@@ -0,0 +1,375 @@
+/* circloO: a level being played. Its objects come from its script (levels.h, read the way the game's level
+ * creator reads it); this runs what the game's objects do each frame: the ball, the circles to collect, the
+ * level growing a ring at a time, the balls that appear and go, the joints. */
+#include <math.h>
+#include <string.h>
+#include "game.h"
+#include "gfx.h"
+#include "phys.h"
+#include "plat.h"
+
+#include "levels.h"
+
+Level L;
+
+enum { T_END, T_Y, T_C, T_I, T_IO, T_MC, T_TMC, T_B, T_T, T_RR, T_LINE, T_CHAIN, T_ROPE, T_DIST, T_FRIC, T_INFO };
+
+#define CX 1500.0f
+#define CY 1500.0f
+#define RMAX 1400.0f
+#define BALL_R 32.0f
+#define PUSH 0.53f /* px a frame, each frame an arrow is held (0.52 + HTML5's 0.01) */
+#define M(v) ((v) * PX_M)
+#define P8(v) ((v) / 8.0f)
+
+/* ---- the colours (the game's _y1/_z1: a hue a level) ---- */
+
+static void hsv(float h, float s, float v, float *r, float *g, float *b) {
+ h = h / 255 * 6, s /= 255, v /= 255;
+ int i = (int)floorf(h) % 6;
+ float f = h - floorf(h), p = v * (1 - s), q = v * (1 - s * f), t = v * (1 - s * (1 - f));
+ float rr[6] = {v, q, p, p, t, v}, gg[6] = {t, v, v, q, p, p}, bb[6] = {p, p, t, v, v, q};
+ *r = rr[i] * 255, *g = gg[i] * 255, *b = bb[i] * 255;
+}
+
+static void hue_of(int n, float *r, float *g, float *b) {
+ if (n <= 11) hsv(255.0f * n / 11, 210, 255, r, g, b);
+ else hsv(fmodf(255.0f * (n - 11.5f) / 11 + 255, 255), 180, 255, r, g, b);
+}
+
+void colours_for(float level) {
+ float r, gr, b;
+ int lo = (int)floorf(level);
+ hue_of(lo, &r, &gr, &b);
+ if (level != lo) {
+ float r2, g2, b2, t = level - lo;
+ hue_of(lo + 1, &r2, &g2, &b2);
+ r += (r2 - r) * t, gr += (g2 - gr) * t, b += (b2 - b) * t;
+ }
+ /* B: merged 30% with grey; A: B at 40%; C: B at 80% */
+ r = r * 0.7f + 128 * 0.3f, gr = gr * 0.7f + 128 * 0.3f, b = b * 0.7f + 128 * 0.3f;
+ g.hue_b = rgb((int)r, (int)gr, (int)b);
+ g.hue_a = rgb((int)(r * 0.4f), (int)(gr * 0.4f), (int)(b * 0.4f));
+ g.hue_c = rgb((int)(r * 0.8f), (int)(gr * 0.8f), (int)(b * 0.8f));
+}
+
+/* ---- building ---- */
+
+static void boundary(void) {
+ ph_drop_statics();
+ int n = L.R > 200 ? 200 : 100;
+ static float xy[400];
+ for (int k = 0; k < n; k++) {
+ float a = 6.28318530717959f * k / n + 3.14159265358979f;
+ xy[2 * k] = M(sinf(a) * L.R + CX), xy[2 * k + 1] = M(cosf(a) * L.R + CY);
+ }
+ ph_static_chain(xy, n, true);
+ ph_build_grid();
+}
+
+static void make_mc(Mc *m) {
+ m->body = (int16_t)ph_add_circle(M(m->x), M(m->y), M(m->r), m->dens, 0.2f);
+ if (m->body >= 0) W.b[m->body].user = 1;
+ L.objbody[m->obj] = m->body;
+}
+
+static void spawn_timed(const Tmc *t, int life) {
+ for (int k = 0; k < MAX_TIMED; k++)
+ if (L.timed[k].body <= 0) {
+ int b = ph_add_circle(M(t->x), M(t->y), M(t->r), t->dens, 0.2f);
+ if (b < 0) return;
+ W.b[b].user = 2;
+ L.timed[k] = (Timed){(int16_t)b, (int16_t)life, 0};
+ return;
+ }
+}
+
+/* the two edges either side of a line, 2 pixels off it (obj_linemanager) */
+static void line_edges(float x1, float y1, float x2, float y2) {
+ float dx = x2 - x1, dy = y2 - y1, l = sqrtf(dx * dx + dy * dy);
+ if (l < 1e-6f) return;
+ float nx = -dy / l * 2, ny = dx / l * 2;
+ ph_static_edge(M(x1 + nx), M(y1 + ny), M(x2 + nx), M(y2 + ny));
+ ph_static_edge(M(x1 - nx), M(y1 - ny), M(x2 - nx), M(y2 - ny));
+}
+
+/* the two chains either side of a path (obj_chainmanager) */
+static void chain_edges(const int16_t *p, int n) {
+ static float xy[2][2 * 300];
+ if (n > 300) n = 300;
+ for (int k = 0; k < n; k++) {
+ int a = k == n - 1 ? k - 1 : k, b = a + 1;
+ float dx = P8(p[2 * b] - p[2 * a]), dy = P8(p[2 * b + 1] - p[2 * a + 1]), l = sqrtf(dx * dx + dy * dy);
+ float nx = l > 0 ? -dy / l * 2 : 0, ny = l > 0 ? dx / l * 2 : 0;
+ float x = P8(p[2 * k]), y = P8(p[2 * k + 1]);
+ xy[0][2 * k] = M(x + nx), xy[0][2 * k + 1] = M(y + ny);
+ xy[1][2 * k] = M(x - nx), xy[1][2 * k + 1] = M(y - ny);
+ }
+ ph_static_chain(xy[0], n, false);
+ ph_static_chain(xy[1], n, false);
+}
+
+void level_load(int level, bool hard) {
+ memset(&L, 0, sizeof L);
+ ph_reset();
+ L.level = level, L.hard = hard;
+ L.data = level_data + level_start[(hard ? NBASE : 0) + level - 1];
+ L.R = 200;
+ L.ball = -1;
+ memset(L.info, -1, sizeof L.info);
+ for (const int16_t *r = L.data; *r != T_END; r += 2 + r[1]) {
+ const int16_t *v = r + 2;
+ switch (r[0]) {
+ case T_Y:
+ if (L.ball < 0) {
+ L.ball = ph_add_circle(M(P8(v[0])), M(P8(v[1])), M(BALL_R), 1, 0.02f);
+ W.b[L.ball].ld = 0.5f, W.b[L.ball].ad = 0.1f;
+ }
+ break;
+ case T_C:
+ ph_static_circle(M(P8(v[0])), M(P8(v[1])), M(P8(v[2])));
+ if (L.nobj < MAX_OBJ) L.objbody[L.nobj++] = 0;
+ break;
+ case T_B: {
+ float x = P8(v[0]), y = P8(v[1]), hx = P8(v[2]), hy = P8(v[3]);
+ float xy[8] = {M(x - hx), M(y - hy), M(x + hx), M(y - hy), M(x + hx), M(y + hy), M(x - hx), M(y + hy)};
+ ph_static_poly(xy, 4);
+ if (L.nobj < MAX_OBJ) L.objbody[L.nobj++] = 0;
+ break;
+ }
+ case T_T: {
+ float xy[6];
+ for (int k = 0; k < 6; k++) xy[k] = M(P8(v[2 + k]));
+ ph_static_poly(xy, 3);
+ if (L.nobj < MAX_OBJ) L.objbody[L.nobj++] = 0;
+ break;
+ }
+ case T_MC:
+ if (L.nmc < MAX_MC && L.nobj < MAX_OBJ) {
+ Mc *m = &L.mc[L.nmc++];
+ m->x = P8(v[0]), m->y = P8(v[1]), m->r = P8(v[2]), m->dens = v[3] / 100.0f;
+ m->dist = sqrtf((m->x - CX) * (m->x - CX) + (m->y - CY) * (m->y - CY));
+ m->obj = (int16_t)L.nobj, m->body = -1;
+ L.objbody[L.nobj++] = -1;
+ }
+ break;
+ case T_RR: {
+ float dens = v[5] / 100.0f, damp = v[6] < 0 ? 0 : v[6] / 100.0f;
+ int b = ph_add_rotor(M(P8(v[0])), M(P8(v[1])), M(P8(v[2]) / 2), M(P8(v[3]) / 2), v[4] / 100.0f * 3.14159265f / 180, dens, damp);
+ if (b >= 0) W.b[b].user = 3;
+ if (L.nobj < MAX_OBJ) L.objbody[L.nobj++] = (int16_t)b;
+ break;
+ }
+ case T_TMC:
+ if (L.ntmc < MAX_TMC) {
+ Tmc *t = &L.tmc[L.ntmc++];
+ t->x = P8(v[0]), t->y = P8(v[1]), t->r = P8(v[2]), t->dens = v[3] / 100.0f;
+ t->life = v[4], t->period = v[5], t->alarm = (int16_t)(v[5] + v[6]);
+ t->dist = sqrtf((t->x - CX) * (t->x - CX) + (t->y - CY) * (t->y - CY));
+ }
+ break;
+ case T_I:
+ case T_IO:
+ if (L.ncoll < 8) L.coll[L.ncoll++] = (Coll){P8(v[0]), P8(v[1]), (uint8_t)(r[0] == T_IO), 0};
+ break;
+ case T_LINE: line_edges(P8(v[0]), P8(v[1]), P8(v[2]), P8(v[3])); break;
+ case T_CHAIN: chain_edges(v + 1, v[0]); break;
+ case T_ROPE:
+ case T_DIST:
+ case T_FRIC:
+ if (L.npj < MAX_PJ) {
+ PJoint *j = &L.pj[L.npj++];
+ j->type = (uint8_t)r[0], j->oa = v[0], j->ob = v[1], j->joint = -1;
+ if (r[0] == T_FRIC) j->f = v[2] / 100.0f, j->t = v[3] / 100.0f;
+ else j->ax = P8(v[2]), j->ay = P8(v[3]), j->bx = P8(v[4]), j->by = P8(v[5]);
+ if (r[0] == T_ROPE) j->len = P8(v[6]);
+ }
+ break;
+ case T_INFO:
+ if (v[0] >= 1 && v[0] <= 7) L.info[v[0]] = (int8_t)v[1];
+ break;
+ }
+ }
+ ph_keep_statics();
+ for (int k = 0; k < L.nmc; k++)
+ if (L.R >= L.mc[k].dist) make_mc(&L.mc[k]);
+ boundary();
+ colours_for((float)level);
+}
+
+/* ---- each frame ---- */
+
+static int body_of(int obj) { return obj >= 0 && obj < L.nobj ? L.objbody[obj] : -1; }
+
+static void joints_tick(void) {
+ for (int k = 0; k < L.npj; k++) {
+ PJoint *j = &L.pj[k];
+ if (j->joint < 0) {
+ int a = body_of(j->oa), b = body_of(j->ob);
+ if (a < 0 || b < 0 || (a == 0 && b == 0)) continue;
+ if (j->type == T_ROPE) j->joint = (int16_t)ph_rope(a, b, M(j->ax), M(j->ay), M(j->bx), M(j->by), M(j->len));
+ else if (j->type == T_DIST) j->joint = (int16_t)ph_dist(a, b, M(j->ax), M(j->ay), M(j->bx), M(j->by));
+ else j->joint = (int16_t)ph_fric(a, b, W.b[a].x, W.b[a].y, j->f, j->t);
+ if (j->joint < 0) j->joint = 999;
+ } else if (j->fade < 5) j->fade++;
+ }
+}
+
+static void grow(void) {
+ float old = L.R;
+ L.R += 200;
+ for (int k = 0; k < L.nmc; k++)
+ if (L.mc[k].body < 0 && L.R >= L.mc[k].dist) make_mc(&L.mc[k]);
+ for (int k = 0; k < L.ntmc; k++) {
+ Tmc *t = &L.tmc[k];
+ float d = t->dist + t->r;
+ if (L.R >= d && old < d && t->alarm > t->period + 1 && t->alarm - t->period > 2) spawn_timed(t, t->alarm - t->period);
+ }
+ boundary();
+}
+
+static void take(Coll *c) {
+ c->taken = 1;
+ L.taken++;
+ if (L.R < RMAX) L.grow = 10;
+ else L.complete = true;
+}
+
+void level_tick(uint32_t keys) {
+ Body *ball = L.ball >= 0 ? &W.b[L.ball] : NULL;
+ if (ball && !L.complete) {
+ float dv = PUSH * 60 * PX_M; /* (px a frame, in m/s) */
+ if (keys & K_LEFT) ball->vx -= dv;
+ if (keys & K_RIGHT) ball->vx += dv;
+ }
+ /* the timed balls' makers and lives (alarms) */
+ for (int k = 0; k < L.ntmc; k++) {
+ Tmc *t = &L.tmc[k];
+ if (--t->alarm <= 0) {
+ if (L.R >= t->dist + t->r) spawn_timed(t, t->life);
+ t->alarm += t->life + t->period;
+ }
+ }
+ for (int k = 0; k < MAX_TIMED; k++) {
+ Timed *t = &L.timed[k];
+ if (t->body <= 0) continue;
+ if (t->age < 10) t->age++;
+ if (--t->life <= 0) ph_kill(t->body), t->body = 0;
+ }
+ if (L.grow > 0 && --L.grow == 0) grow();
+ joints_tick();
+ ph_step();
+ if (!L.complete) L.frames++;
+ /* the circles: the ball takes the plain ones, the other balls and the bars the others */
+ for (int k = 0; k < L.ncoll; k++) {
+ Coll *c = &L.coll[k];
+ if (c->taken || L.complete) continue;
+ if (!c->io) {
+ if (ball) {
+ float dx = M(c->x) - ball->x, dy = M(c->y) - ball->y, r = M(24 + 32.5f);
+ if (dx * dx + dy * dy < r * r) take(c);
+ }
+ } else {
+ for (int b = 1; b < W.nb; b++)
+ if (W.b[b].alive && W.b[b].user && ph_overlaps(b, M(c->x), M(c->y), M(24))) {
+ take(c);
+ break;
+ }
+ }
+ }
+}
+
+/* ---- drawing ---- */
+
+#define SCALE 0.32f
+static float sx(float x) { return (x - g.camx) * SCALE + SCREEN_W / 2; }
+static float sy(float y) { return (y - g.camy) * SCALE + SCREEN_H / 2; }
+
+static void ring(float x, float y, int alpha, bool io) {
+ gfx_disc(sx(x), sy(y), 20 * SCALE, g.hue_a, 256);
+ gfx_disc(sx(x), sy(y), 16 * SCALE, g.hue_b, alpha);
+ if (io) gfx_disc(sx(x), sy(y), 10 * SCALE, g.hue_a, 256);
+}
+
+void level_draw(void) {
+ uint16_t A = g.hue_a, B = g.hue_b;
+ gfx_fill(A);
+ float cx = sx(CX), cy = sy(CY);
+ if (L.grow > 0) gfx_disc(cx, cy, (L.R + 200) * SCALE, B, (10 - L.grow) * 256 / 10);
+ gfx_disc(cx, cy, L.R * SCALE, B, 256);
+ /* the circles to collect (only drawn inside the level, and in the ring that is appearing) */
+ for (int k = 0; k < L.ncoll; k++) {
+ const Coll *c = &L.coll[k];
+ if (c->taken) continue;
+ float d = sqrtf((c->x - CX) * (c->x - CX) + (c->y - CY) * (c->y - CY));
+ if (d < L.R) ring(c->x, c->y, 256, c->io);
+ else if (L.grow > 0 && d < L.R + 200) ring(c->x, c->y, (10 - L.grow) * 256 / 10, c->io);
+ }
+ /* the joints' lines */
+ for (int k = 0; k < L.npj; k++) {
+ const PJoint *j = &L.pj[k];
+ if (j->joint < 0 || j->joint >= W.nj || j->type == T_FRIC) continue;
+ const Joint *pj = &W.j[j->joint];
+ if (!pj->alive) continue;
+ float ax, ay, bx, by;
+ ph_joint_anchors(pj, &ax, &ay, &bx, &by);
+ gfx_line(sx(ax / PX_M), sy(ay / PX_M), sx(bx / PX_M), sy(by / PX_M), 5 * SCALE, g.hue_c, j->fade * 256 / 5);
+ }
+ /* the level's script: lines, chains, boxes, triangles */
+ for (const int16_t *r = L.data; *r != T_END; r += 2 + r[1]) {
+ const int16_t *v = r + 2;
+ if (r[0] == T_LINE) gfx_line(sx(P8(v[0])), sy(P8(v[1])), sx(P8(v[2])), sy(P8(v[3])), 6 * SCALE, A, 256);
+ else if (r[0] == T_CHAIN)
+ for (int k = 0; k + 1 < v[0]; k++)
+ gfx_line(sx(P8(v[1 + 2 * k])), sy(P8(v[2 + 2 * k])), sx(P8(v[3 + 2 * k])), sy(P8(v[4 + 2 * k])), 6 * SCALE, A, 256);
+ else if (r[0] == T_B) gfx_rect(sx(P8(v[0] - v[2])), sy(P8(v[1] - v[3])), sx(P8(v[0] + v[2])), sy(P8(v[1] + v[3])), A, 256);
+ else if (r[0] == T_T) {
+ float x[3], y[3];
+ for (int k = 0; k < 3; k++) x[k] = sx(P8(v[2 + 2 * k])), y[k] = sy(P8(v[3 + 2 * k]));
+ gfx_poly(x, y, 3, A, 256);
+ }
+ }
+ /* the moving things */
+ for (int i = 1; i < W.nb; i++) {
+ const Body *b = &W.b[i];
+ if (!b->alive || i == L.ball) continue;
+ float x = sx(b->x / PX_M), y = sy(b->y / PX_M);
+ if (b->shape == SH_BOX) {
+ float hx = b->hx / PX_M * SCALE, hy = b->hy / PX_M * SCALE, px[4], py[4];
+ static const float ux[4] = {-1, 1, 1, -1}, uy[4] = {-1, -1, 1, 1};
+ for (int k = 0; k < 4; k++) px[k] = x + b->c * ux[k] * hx - b->s * uy[k] * hy, py[k] = y + b->s * ux[k] * hx + b->c * uy[k] * hy;
+ gfx_poly(px, py, 4, A, 256);
+ continue;
+ }
+ int alpha = 256;
+ if (b->user == 2)
+ for (int k = 0; k < MAX_TIMED; k++)
+ if (L.timed[k].body == i) {
+ const Timed *t = &L.timed[k];
+ alpha = t->life < 10 ? t->life * 256 / 10 : t->age < 10 ? t->age * 256 / 10 : 256;
+ }
+ gfx_disc(x, y, (b->r / PX_M + 0.5f) * SCALE, A, alpha);
+ }
+ if (L.ball >= 0) {
+ const Body *b = &W.b[L.ball];
+ gfx_disc(sx(b->x / PX_M), sy(b->y / PX_M), 32.5f * SCALE, mix(A, 0, 51), 256);
+ }
+ for (int k = 0; k < W.nsc; k++) gfx_disc(sx(W.sc[k].x / PX_M), sy(W.sc[k].y / PX_M), (W.sc[k].r / PX_M + 0.5f) * SCALE, A, 256);
+ /* the text of this ring, at the bottom (obj_levelguihandler) */
+ int ringno = (int)lroundf(L.R / 200), alpha = 256;
+ int text = ringno >= 1 && ringno <= 7 ? L.info[ringno] : -1;
+ if (L.grow > 0) {
+ if (L.grow >= 5) alpha = (L.grow - 5) * 256 / 5;
+ else {
+ alpha = (5 - L.grow) * 256 / 5;
+ text = ringno + 1 <= 7 ? L.info[ringno + 1] : -1;
+ }
+ }
+ if (text >= 0 && !L.complete) {
+ const char *s = level_texts[text];
+ int n = gfx_wrap(F_SMALL, 0, 0, s, SCREEN_W - 16, 0, 0, AL_CENTER, 0), h = gfx_font_h(F_SMALL);
+ float top = SCREEN_H - n * h - 8;
+ gfx_rect(0, top, SCREEN_W, SCREEN_H, A, alpha * 205 / 256);
+ gfx_wrap(F_SMALL, SCREEN_W / 2, top + 4, s, SCREEN_W - 16, B, alpha, AL_CENTER, 1);
+ }
+}
diff --git a/games/circloo/src/levels.h b/games/circloo/src/levels.h
new file mode 100644
index 00000000..48a891df
--- /dev/null
+++ b/games/circloo/src/levels.h
@@ -0,0 +1,617 @@
+/* circloO's levels, made by tools/levels.py from the game's web build: do not edit.
+ * Records: type, count, values (places and sizes in 1/8 pixel, densities in 1/100). */
+#define NLEVELS_BASE 14
+#define NLEVELS_HARD 6
+static const int16_t level_data[9650] = {
+ 1,2,12000,13360,3,2,12680,13178,3,2,14915,11486,2,3,7667,12764,
+ 400,2,3,8241,13368,800,2,3,8936,14571,800,3,2,9256,15642,2,
+ 3,7710,15600,800,2,3,10903,18224,80,2,3,11470,18057,320,2,3,
+ 14177,17982,34,2,3,14448,17766,136,3,2,16719,15960,2,3,13250,19091,
+ 640,2,3,17091,18067,80,2,3,16679,17989,80,2,3,16279,17890,80,
+ 2,3,15892,17770,80,2,3,15519,17631,80,2,3,15240,17612,80,2,
+ 3,15042,17722,80,2,3,14841,17824,80,2,3,14216,18089,80,2,3,
+ 13786,18229,80,2,3,13352,18362,80,3,2,5620,14975,2,3,12000,21200,
+ 400,2,3,10347,21375,80,3,2,19170,18016,3,2,1040,12000,15,2,
+ 1,0,15,2,2,1,0,2,3,12000,12640,400,3,2,10822,12680,
+ 2,3,13180,14317,320,2,3,10556,13917,240,2,3,11887,14157,240,2,
+ 3,12209,14391,240,2,3,12522,14261,240,3,2,14267,13903,3,2,7867,
+ 13927,2,3,8764,14351,800,2,3,15308,13204,240,2,3,12000,18320,80,
+ 2,3,13070,18066,240,3,2,16719,15960,2,3,17869,13247,400,2,3,
+ 17086,13081,400,2,3,19520,12000,480,2,3,5840,16313,480,2,3,18626,
+ 13530,560,3,2,5280,15880,2,3,12000,20800,800,2,3,8771,20871,80,
+ 2,3,9132,20826,80,2,3,9486,20767,80,2,3,9832,20694,80,2,
+ 3,10170,20608,80,2,3,10500,20509,80,2,3,10820,20397,80,2,3,
+ 11130,20274,80,2,3,11431,20140,80,3,2,14846,19818,2,3,16760,20245,
+ 80,2,3,8104,21643,800,2,3,19863,19863,80,3,2,18376,19599,1,
+ 2,12000,12000,0,3,2,12000,12400,2,3,11040,12000,80,2,3,12960,
+ 12000,80,10,4,11040,12000,12960,12000,2,3,10550,12676,80,2,3,13450,
+ 12676,80,10,4,10550,12676,13450,12676,2,3,14841,13640,40,10,4,13450,
+ 12676,14841,13640,3,2,14267,13903,2,3,12000,15056,144,2,3,12000,16720,
+ 80,10,4,12000,15056,12000,16720,2,3,16727,12834,24,10,4,12000,16720,
+ 16727,12834,2,3,15924,13428,40,3,2,11722,16551,2,3,9120,16988,640,
+ 2,3,16790,12931,40,2,3,17537,13588,40,10,4,16790,12931,17537,13588,
+ 3,2,8040,16719,2,3,9154,19818,320,2,3,14846,19818,320,10,4,
+ 9154,19818,14846,19818,2,3,8040,18859,80,10,4,9120,16988,8040,18859,2,
+ 3,7880,18857,96,3,2,8197,17637,2,3,7835,16964,80,10,4,9120,
+ 16988,7835,16964,3,2,8518,19468,2,3,7680,19482,40,10,4,9154,19818,
+ 7680,19482,10,4,7680,19482,7880,18857,2,3,13945,23030,80,2,3,22818,
+ 14899,80,10,4,13945,23030,22818,14899,2,3,21322,15393,80,2,3,18560,
+ 13881,32,10,4,21322,15393,18560,13881,2,3,5804,19385,24,2,3,4801,
+ 20580,0,10,4,5804,19385,4801,20580,3,2,4250,19750,1,2,12000,11760,
+ 0,1,2,12000,13360,5,4,12465,13278,240,70,3,2,13339,12236,5,
+ 4,9164,12500,320,70,3,2,9040,12000,2,3,12000,16160,120,2,3,
+ 9938,16423,80,5,4,7640,13587,160,70,2,3,9620,16122,40,3,2,
+ 14280,15949,2,3,8824,17501,48,2,3,15176,17501,48,10,4,8824,17501,
+ 15176,17501,3,2,6211,14107,5,4,13367,19752,128,100,3,2,14463,18766,
+ 2,3,20245,16760,80,2,3,18190,17194,80,10,4,20245,16760,18190,17194,
+ 2,3,4306,16623,24,2,3,5267,16408,24,10,4,4306,16623,5267,16408,
+ 3,2,20796,15201,2,3,16760,20245,80,3,2,2508,17480,0,2,3,
+ 23120,12000,80,2,3,4320,12000,40,10,4,23120,12000,4320,12000,2,3,
+ 1849,13931,80,10,4,4320,12000,1849,13931,1,2,12000,13360,3,2,10958,
+ 12874,2,3,9257,12735,360,2,3,9426,13200,360,2,3,9674,13629,360,
+ 2,3,9992,14008,360,2,3,10371,14326,360,2,3,10800,14574,360,2,
+ 3,11265,14743,360,2,3,11752,14829,360,2,3,12248,14829,360,2,3,
+ 12735,14743,360,2,3,13200,14574,360,5,4,12700,13924,360,100,2,3,
+ 14326,13629,360,3,2,14781,13012,2,3,14314,14758,400,5,4,12000,16512,
+ 288,100,2,3,10427,16323,200,2,3,10768,16598,40,2,3,9408,15992,
+ 40,3,2,7867,13927,2,3,12000,15600,400,2,3,13970,17413,160,2,
+ 3,14134,17864,160,10,4,13970,17413,14134,17864,2,3,10459,18179,32,2,
+ 3,10914,18161,144,2,3,13097,18224,80,2,3,11334,18333,32,3,2,
+ 15080,17335,2,3,9362,18871,640,3,2,9992,19496,2,3,13843,18877,80,
+ 2,3,14512,18901,40,10,4,13843,18877,14512,18901,2,3,16222,18757,32,
+ 2,3,16400,19621,800,2,3,12000,21560,40,2,3,6189,18925,24,2,
+ 3,6989,18925,24,10,4,6189,18925,6989,18925,3,2,6489,18340,2,3,
+ 1360,12000,400,2,3,1760,11911,160,2,3,2083,11740,160,2,3,3057,
+ 11453,32,10,4,2083,11740,3057,11453,2,3,4503,11410,48,2,3,12503,
+ 10610,64,10,4,4503,11410,12503,10610,2,3,16000,12000,240,2,3,16000,
+ 10400,240,10,4,16000,12000,16000,10400,3,2,22956,11713,0,1,2,12000,
+ 12000,5,4,12000,13520,40,50,5,4,12000,13280,40,50,5,4,12000,
+ 13040,40,50,5,4,12212,13505,40,50,5,4,12178,13268,40,50,5,
+ 4,12145,13030,40,50,5,4,12419,13461,40,50,5,4,12353,13230,40,
+ 50,5,4,12287,13000,40,50,5,4,12618,13389,40,50,5,4,12521,
+ 13169,40,50,5,4,12423,12950,40,50,5,4,12805,13289,40,50,5,
+ 4,12678,13086,40,50,5,4,12551,12882,40,50,5,4,12977,13164,40,
+ 50,5,4,12823,12981,40,50,5,4,12668,12797,40,50,5,4,13130,
+ 13017,40,50,5,4,12951,12856,40,50,5,4,12773,12696,40,50,5,
+ 4,13260,12850,40,50,5,4,13061,12716,40,50,5,4,12862,12582,40,
+ 50,5,4,13366,12666,40,50,5,4,13150,12561,40,50,5,4,12935,
+ 12456,40,50,5,4,13446,12470,40,50,5,4,13217,12396,40,50,5,
+ 4,12989,12321,40,50,5,4,13497,12264,40,50,5,4,13261,12222,40,
+ 50,5,4,13024,12181,40,50,5,4,13519,12053,40,50,5,4,13279,
+ 12045,40,50,5,4,13039,12036,40,50,5,4,13512,11841,40,50,5,
+ 4,13273,11866,40,50,5,4,13034,11891,40,50,5,4,13475,11632,40,
+ 50,5,4,13242,11690,40,50,5,4,13009,11748,40,50,5,4,13409,
+ 11431,40,50,5,4,13187,11521,40,50,5,4,12964,11610,40,50,5,
+ 4,13316,11240,40,50,5,4,13109,11360,40,50,5,4,12901,11480,40,
+ 50,5,4,13198,11064,40,50,5,4,13009,11212,40,50,5,4,12820,
+ 11360,40,50,5,4,13056,10907,40,50,5,4,12889,11079,40,50,5,
+ 4,12722,11252,40,50,5,4,12893,10770,40,50,5,4,12752,10964,40,
+ 50,5,4,12611,11159,40,50,5,4,12714,10658,40,50,5,4,12601,
+ 10870,40,50,5,4,12488,11082,40,50,3,2,13360,12000,2,3,14340,
+ 14182,80,2,3,13200,14078,240,10,4,14340,14182,13200,14078,2,3,10800,
+ 14078,240,10,4,13200,14078,10800,14078,2,3,10800,14078,800,2,3,9575,
+ 13400,144,10,4,10800,14078,9575,13400,2,3,9298,13560,80,10,4,9575,
+ 13400,9298,13560,3,2,9275,13157,5,4,7565,13614,80,50,5,4,7912,
+ 14360,80,50,5,4,8384,15034,80,50,5,4,8966,15616,80,50,5,
+ 4,9640,16088,80,50,2,3,8000,12000,800,2,3,14571,15064,800,2,
+ 3,15386,14552,560,2,3,15824,14484,240,2,3,14931,15493,240,2,3,
+ 14280,15949,640,2,3,13180,16405,480,3,2,13648,15379,2,3,12332,16748,
+ 40,2,3,9678,17584,40,2,3,9358,17584,60,2,3,21612,17563,48,
+ 10,4,9358,17584,21612,17563,2,3,3984,17650,32,2,3,8840,17513,88,
+ 10,4,3984,17650,8840,17513,3,2,5848,11718,2,3,18308,14981,320,3,
+ 2,18308,14381,2,3,4881,17173,800,3,2,3894,16680,2,3,12948,22839,
+ 320,3,2,17480,21492,5,4,12000,23120,80,100,5,4,12000,23040,80,
+ 100,5,4,12000,22960,80,100,5,4,12000,22880,80,100,5,4,12000,
+ 22800,80,100,5,4,12000,22720,80,100,5,4,11612,23113,80,100,5,
+ 4,11615,23033,80,100,5,4,11618,22953,80,100,5,4,11620,22873,80,
+ 100,5,4,11623,22793,80,100,5,4,11626,22713,80,100,0,1,2,
+ 12000,13344,2,3,10480,12000,80,5,4,10800,12680,80,100,5,4,10800,
+ 12000,80,100,12,7,1,2,10800,12680,10800,12000,680,12,7,2,0,
+ 10800,12000,10480,12000,320,5,4,11120,12680,80,100,5,4,11120,12000,80,
+ 100,12,7,3,4,11120,12680,11120,12000,680,12,7,4,2,11120,12000,
+ 10800,12000,320,5,4,11440,12680,80,100,5,4,11440,12000,80,100,12,
+ 7,5,6,11440,12680,11440,12000,680,12,7,6,4,11440,12000,11120,12000,
+ 320,5,4,11760,12680,80,100,5,4,11760,12000,80,100,12,7,7,
+ 8,11760,12680,11760,12000,680,12,7,8,6,11760,12000,11440,12000,320,5,
+ 4,12080,12680,80,100,5,4,12080,12000,80,100,12,7,9,10,12080,
+ 12680,12080,12000,680,12,7,10,8,12080,12000,11760,12000,320,2,3,12400,
+ 12000,80,12,7,10,11,12080,12000,12400,12000,320,3,2,10675,11694,2,
+ 3,13455,12840,80,2,3,15120,12000,80,10,4,13455,12840,15120,12000,5,
+ 4,9922,13200,800,80,12,7,0,14,10480,12000,9922,12720,911,3,2,
+ 9219,13012,5,4,13360,9644,480,60,2,3,11585,16742,40,2,3,12415,
+ 16742,40,2,3,10768,16598,40,2,3,13232,16598,40,3,2,12000,15600,
+ 2,3,10747,16675,40,2,3,9955,16387,40,2,3,9224,15965,40,2,
+ 3,8578,15422,40,2,3,8035,14776,40,2,3,7613,14045,40,2,3,
+ 7325,13253,40,2,3,7178,12422,40,2,3,7178,11578,40,2,3,7325,
+ 10747,40,2,3,13253,16675,40,2,3,14045,16387,40,2,3,14776,15965,
+ 40,2,3,15422,15422,40,2,3,15965,14776,40,2,3,16387,14045,40,
+ 2,3,16675,13253,40,2,3,16822,12422,40,2,3,15961,12557,800,2,
+ 3,17579,12488,800,2,3,16800,12000,160,3,2,18137,11463,2,3,15960,
+ 18859,80,2,3,8040,18859,80,2,3,8651,18572,80,10,4,8040,18859,
+ 8651,18572,2,3,15349,18572,80,10,4,8651,18572,15349,18572,2,3,14728,
+ 19495,24,2,3,14488,19463,24,10,4,14728,19495,14488,19463,2,3,13200,
+ 18745,24,5,4,13390,19637,160,200,12,7,47,48,13200,18745,13390,19637,
+ 912,3,2,11760,18928,5,4,15980,20614,80,100,12,7,41,49,15960,
+ 18859,15980,20614,1755,2,3,17605,19715,64,2,3,19048,17914,400,2,3,
+ 19439,17812,160,3,2,19620,17435,2,3,18685,19967,800,2,3,19769,19502,
+ 400,2,3,20332,19243,160,3,2,4955,20396,0,1,2,12000,13360,2,
+ 3,12400,12693,80,2,3,11370,11889,24,10,4,12400,12693,11370,11889,2,
+ 3,10426,11918,24,10,4,11370,11889,10426,11918,2,3,12480,12000,24,2,
+ 3,13481,11461,24,10,4,12480,12000,13481,11461,3,2,13178,11320,2,3,
+ 9610,9995,80,5,4,9360,12046,480,100,12,7,5,6,9610,9995,9360,
+ 12046,2067,2,3,9031,13081,40,3,2,12174,13992,2,3,7540,13279,160,
+ 3,2,7457,11603,2,3,10231,18068,80,5,4,10464,18048,80,100,12,
+ 7,9,10,10231,18068,10464,18048,233,5,4,10693,18020,80,100,12,7,
+ 10,11,10464,18048,10693,18020,231,5,4,10918,17983,80,100,12,7,11,
+ 12,10693,18020,10918,17983,228,5,4,11139,17938,80,100,12,7,12,13,
+ 10918,17983,11139,17938,225,5,4,11356,17885,80,100,12,7,13,14,11139,
+ 17938,11356,17885,223,5,4,11567,17824,80,100,12,7,14,15,11356,17885,
+ 11567,17824,220,5,4,11774,17756,80,100,12,7,15,16,11567,17824,11774,
+ 17756,218,5,4,11975,17680,80,100,12,7,16,17,11774,17756,11975,17680,
+ 215,5,4,12171,17597,80,100,12,7,17,18,11975,17680,12171,17597,212,
+ 2,3,12364,17548,80,12,7,18,19,12171,17597,12364,17548,199,5,4,
+ 12553,17492,80,100,12,7,19,20,12364,17548,12553,17492,197,5,4,12755,
+ 17549,80,100,12,7,20,21,12553,17492,12755,17549,210,5,4,12962,17598,
+ 80,100,12,7,21,22,12755,17549,12962,17598,212,5,4,13173,17639,80,
+ 100,12,7,22,23,12962,17598,13173,17639,215,5,4,13388,17673,80,100,
+ 12,7,23,24,13173,17639,13388,17673,218,5,4,13607,17698,80,100,12,
+ 7,24,25,13388,17673,13607,17698,220,5,4,13829,17714,80,100,12,7,
+ 25,26,13607,17698,13829,17714,223,5,4,14055,17722,80,100,12,7,26,
+ 27,13829,17714,14055,17722,225,5,4,14283,17721,80,100,12,7,27,28,
+ 14055,17722,14283,17721,228,5,4,14513,17712,80,100,12,7,28,29,14283,
+ 17721,14513,17712,231,2,3,14746,17692,80,12,7,29,30,14513,17712,14746,
+ 17692,233,3,2,17583,14603,2,3,9895,18885,800,2,3,9030,18996,400,
+ 2,3,8563,19047,160,3,2,10969,18511,2,3,12508,19262,80,5,4,
+ 12508,18942,240,100,2,3,13714,19732,72,2,3,13102,19843,80,2,3,
+ 17277,19536,400,3,2,18016,19170,2,3,6440,21630,80,3,2,7740,21136,
+ 0,1,2,12000,12880,2,3,12772,13337,56,2,3,11212,13365,24,10,
+ 4,12772,13337,11212,13365,2,3,10534,12534,40,2,3,12826,12534,40,10,
+ 4,10534,12534,12826,12534,2,3,11292,12520,80,2,3,10440,12000,40,10,
+ 4,11292,12520,10440,12000,3,2,10822,11320,2,3,8882,12109,80,10,4,
+ 10440,12000,8882,12109,2,3,11609,11917,80,2,3,12647,11530,40,10,4,
+ 11609,11917,12647,11530,2,3,13559,11100,80,3,2,14425,10302,2,3,7283,
+ 11835,80,10,4,8882,12109,7283,11835,2,3,15759,10632,160,2,3,15383,
+ 10769,160,3,2,16099,10001,2,3,17638,14052,400,3,2,17950,10406,2,
+ 3,6718,15698,40,2,3,6850,15881,40,10,4,6718,15698,6850,15881,2,
+ 3,6989,16058,40,10,4,6850,15881,6989,16058,2,3,7134,16230,40,10,
+ 4,6989,16058,7134,16230,2,3,7284,16398,40,10,4,7134,16230,7284,16398,
+ 2,3,7441,16559,40,10,4,7284,16398,7441,16559,2,3,7602,16716,40,
+ 10,4,7441,16559,7602,16716,2,3,7770,16866,40,10,4,7602,16716,7770,
+ 16866,2,3,7942,17011,40,10,4,7770,16866,7942,17011,2,3,8119,17150,
+ 40,10,4,7942,17011,8119,17150,2,3,8302,17282,40,10,4,8119,17150,
+ 8302,17282,2,3,8488,17408,40,10,4,8302,17282,8488,17408,2,3,8679,
+ 17527,40,10,4,8488,17408,8679,17527,2,3,8874,17640,40,10,4,8679,
+ 17527,8874,17640,2,3,9073,17745,40,10,4,8874,17640,9073,17745,2,3,
+ 9275,17844,40,10,4,9073,17745,9275,17844,2,3,9481,17935,40,10,4,
+ 9275,17844,9481,17935,2,3,9689,18020,40,10,4,9481,17935,9689,18020,2,
+ 3,9901,18097,40,10,4,9689,18020,9901,18097,2,3,10115,18166,40,10,
+ 4,9901,18097,10115,18166,2,3,10331,18228,40,10,4,10115,18166,10331,18228,
+ 2,3,10550,18283,40,10,4,10331,18228,10550,18283,2,3,10770,18330,40,
+ 10,4,10550,18283,10770,18330,2,3,10991,18369,40,10,4,10770,18330,10991,
+ 18369,2,3,11214,18400,40,10,4,10991,18369,11214,18400,2,3,11438,18423,
+ 40,10,4,11214,18400,11438,18423,2,3,11663,18439,40,10,4,11438,18423,
+ 11663,18439,2,3,11887,18447,40,10,4,11663,18439,11887,18447,2,3,12113,
+ 18447,40,10,4,11887,18447,12113,18447,2,3,12337,18439,40,10,4,12113,
+ 18447,12337,18439,2,3,12562,18423,40,10,4,12337,18439,12562,18423,2,3,
+ 12786,18400,40,10,4,12562,18423,12786,18400,2,3,13009,18369,40,10,4,
+ 12786,18400,13009,18369,2,3,13230,18330,40,10,4,13009,18369,13230,18330,2,
+ 3,13450,18283,40,10,4,13230,18330,13450,18283,2,3,13669,18228,40,10,
+ 4,13450,18283,13669,18228,2,3,13885,18166,40,10,4,13669,18228,13885,18166,
+ 2,3,14099,18097,40,10,4,13885,18166,14099,18097,2,3,14311,18020,40,
+ 10,4,14099,18097,14311,18020,2,3,14519,17935,40,10,4,14311,18020,14519,
+ 17935,2,3,14725,17844,40,10,4,14519,17935,14725,17844,2,3,14942,17774,
+ 72,10,4,14725,17844,14942,17774,2,3,15142,17668,72,10,4,14942,17774,
+ 15142,17668,2,3,15337,17554,72,10,4,15142,17668,15337,17554,2,3,15529,
+ 17435,72,10,4,15337,17554,15529,17435,2,3,15717,17308,72,10,4,15529,
+ 17435,15717,17308,2,3,15900,17175,72,10,4,15717,17308,15900,17175,2,3,
+ 16078,17036,72,10,4,15900,17175,16078,17036,2,3,16251,16891,72,10,4,
+ 16078,17036,16251,16891,2,3,16419,16739,72,10,4,16251,16891,16419,16739,2,
+ 3,16582,16582,72,10,4,16419,16739,16582,16582,2,3,16739,16419,72,10,
+ 4,16582,16582,16739,16419,2,3,16891,16251,72,10,4,16739,16419,16891,16251,
+ 2,3,17036,16078,72,10,4,16891,16251,17036,16078,2,3,17175,15900,72,
+ 10,4,17036,16078,17175,15900,2,3,17308,15717,72,10,4,17175,15900,17308,
+ 15717,2,3,17435,15529,72,10,4,17308,15717,17435,15529,2,3,17554,15337,
+ 72,10,4,17435,15529,17554,15337,2,3,17668,15142,72,10,4,17554,15337,
+ 17668,15142,2,3,17774,14942,72,10,4,17668,15142,17774,14942,2,3,17873,
+ 14739,72,10,4,17774,14942,17873,14739,2,3,17965,14532,72,10,4,17873,
+ 14739,17965,14532,2,3,18050,14322,72,10,4,17965,14532,18050,14322,2,3,
+ 18127,14110,72,10,4,18050,14322,18127,14110,2,3,18197,13895,72,10,4,
+ 18127,14110,18197,13895,2,3,18259,13677,72,10,4,18197,13895,18259,13677,2,
+ 3,18314,13458,72,10,4,18259,13677,18314,13458,2,3,18361,13236,72,10,
+ 4,18314,13458,18361,13236,2,3,18400,13014,72,10,4,18361,13236,18400,13014,
+ 2,3,18432,12790,72,10,4,18400,13014,18432,12790,2,3,18455,12565,72,
+ 10,4,18432,12790,18455,12565,2,3,18471,12339,72,10,4,18455,12565,18471,
+ 12339,2,3,18479,12113,72,10,4,18471,12339,18479,12113,2,3,18479,11887,
+ 72,10,4,18479,12113,18479,11887,2,3,18471,11661,72,10,4,18479,11887,
+ 18471,11661,2,3,18455,11435,72,10,4,18471,11661,18455,11435,2,3,18432,
+ 11210,72,10,4,18455,11435,18432,11210,2,3,18400,10986,72,10,4,18432,
+ 11210,18400,10986,2,3,18361,10764,72,10,4,18400,10986,18361,10764,2,3,
+ 18314,10542,72,10,4,18361,10764,18314,10542,2,3,18259,10323,72,10,4,
+ 18314,10542,18259,10323,2,3,18166,10115,40,10,4,18259,10323,18166,10115,2,
+ 3,18097,9901,40,10,4,18166,10115,18097,9901,2,3,18020,9689,40,10,
+ 4,18097,9901,18020,9689,2,3,17935,9481,40,10,4,18020,9689,17935,9481,
+ 2,3,17844,9275,40,10,4,17935,9481,17844,9275,2,3,17745,9073,40,
+ 10,4,17844,9275,17745,9073,2,3,17640,8874,40,10,4,17745,9073,17640,
+ 8874,2,3,17527,8679,40,10,4,17640,8874,17527,8679,2,3,17408,8488,
+ 40,10,4,17527,8679,17408,8488,2,3,17282,8302,40,10,4,17408,8488,
+ 17282,8302,2,3,17150,8119,40,10,4,17282,8302,17150,8119,2,3,17011,
+ 7942,40,10,4,17150,8119,17011,7942,2,3,16866,7770,40,10,4,17011,
+ 7942,16866,7770,2,3,16716,7602,40,10,4,16866,7770,16716,7602,2,3,
+ 16559,7441,40,10,4,16716,7602,16559,7441,2,3,16398,7284,40,10,4,
+ 16559,7441,16398,7284,2,3,16230,7134,40,10,4,16398,7284,16230,7134,2,
+ 3,16058,6989,40,10,4,16230,7134,16058,6989,2,3,15881,6850,40,10,
+ 4,16058,6989,15881,6850,2,3,15698,6718,40,10,4,15881,6850,15698,6718,
+ 2,3,15512,6592,40,10,4,15698,6718,15512,6592,2,3,15321,6473,40,
+ 10,4,15512,6592,15321,6473,2,3,15126,6360,40,10,4,15321,6473,15126,
+ 6360,2,3,14927,6255,40,10,4,15126,6360,14927,6255,2,3,14725,6156,
+ 40,10,4,14927,6255,14725,6156,2,3,14519,6065,40,10,4,14725,6156,
+ 14519,6065,2,3,14311,5980,40,10,4,14519,6065,14311,5980,2,3,14099,
+ 5903,40,10,4,14311,5980,14099,5903,2,3,13885,5834,40,10,4,14099,
+ 5903,13885,5834,2,3,13669,5772,40,10,4,13885,5834,13669,5772,2,3,
+ 13450,5717,40,10,4,13669,5772,13450,5717,2,3,13230,5670,40,10,4,
+ 13450,5717,13230,5670,2,3,13009,5631,40,10,4,13230,5670,13009,5631,2,
+ 3,12786,5600,40,10,4,13009,5631,12786,5600,2,3,12562,5577,40,10,
+ 4,12786,5600,12562,5577,2,3,12337,5561,40,10,4,12562,5577,12337,5561,
+ 2,3,12113,5553,40,10,4,12337,5561,12113,5553,2,3,11887,5553,40,
+ 10,4,12113,5553,11887,5553,2,3,11663,5561,40,10,4,11887,5553,11663,
+ 5561,2,3,11438,5577,40,10,4,11663,5561,11438,5577,2,3,11214,5600,
+ 40,10,4,11438,5577,11214,5600,2,3,10991,5631,40,10,4,11214,5600,
+ 10991,5631,2,3,10770,5670,40,10,4,10991,5631,10770,5670,2,3,10550,
+ 5717,40,10,4,10770,5670,10550,5717,2,3,10331,5772,40,10,4,10550,
+ 5717,10331,5772,2,3,10115,5834,40,10,4,10331,5772,10115,5834,2,3,
+ 9901,5903,40,10,4,10115,5834,9901,5903,2,3,9689,5980,40,10,4,
+ 9901,5903,9689,5980,2,3,9481,6065,40,10,4,9689,5980,9481,6065,2,
+ 3,9275,6156,40,10,4,9481,6065,9275,6156,2,3,9073,6255,40,10,
+ 4,9275,6156,9073,6255,2,3,8874,6360,40,10,4,9073,6255,8874,6360,
+ 2,3,8679,6473,40,10,4,8874,6360,8679,6473,2,3,8488,6592,40,
+ 10,4,8679,6473,8488,6592,2,3,8302,6718,40,10,4,8488,6592,8302,
+ 6718,2,3,8119,6850,40,10,4,8302,6718,8119,6850,2,3,7942,6989,
+ 40,10,4,8119,6850,7942,6989,2,3,7770,7134,40,10,4,7942,6989,
+ 7770,7134,2,3,7602,7284,40,10,4,7770,7134,7602,7284,2,3,7441,
+ 7441,40,10,4,7602,7284,7441,7441,2,3,7284,7602,40,10,4,7441,
+ 7441,7284,7602,2,3,7134,7770,40,10,4,7284,7602,7134,7770,2,3,
+ 6989,7942,40,10,4,7134,7770,6989,7942,2,3,6850,8119,40,10,4,
+ 6989,7942,6850,8119,2,3,6718,8302,40,10,4,6850,8119,6718,8302,2,
+ 3,6592,8488,40,10,4,6718,8302,6592,8488,2,3,6473,8679,40,10,
+ 4,6592,8488,6473,8679,2,3,6360,8874,40,10,4,6473,8679,6360,8874,
+ 2,3,6255,9073,40,10,4,6360,8874,6255,9073,2,3,6156,9275,40,
+ 10,4,6255,9073,6156,9275,2,3,6065,9481,40,10,4,6156,9275,6065,
+ 9481,2,3,5980,9689,40,10,4,6065,9481,5980,9689,2,3,5903,9901,
+ 40,10,4,5980,9689,5903,9901,2,3,5834,10115,40,10,4,5903,9901,
+ 5834,10115,2,3,5772,10331,40,10,4,5834,10115,5772,10331,2,3,5717,
+ 10550,40,10,4,5772,10331,5717,10550,2,3,5670,10770,40,10,4,5717,
+ 10550,5670,10770,2,3,5631,10991,40,10,4,5670,10770,5631,10991,2,3,
+ 5600,11214,40,10,4,5631,10991,5600,11214,2,3,5577,11438,40,10,4,
+ 5600,11214,5577,11438,3,2,19760,12000,2,3,12000,20080,80,5,4,12000,
+ 21600,80,200,12,7,175,176,12000,20080,12000,21600,1520,2,3,11436,20060,
+ 80,5,4,11436,21580,80,200,12,7,177,178,11436,20060,11436,21580,1520,
+ 2,3,10875,20001,80,5,4,10875,21521,80,200,12,7,179,180,10875,
+ 20001,10875,21521,1520,2,3,10320,19903,80,5,4,10320,21423,80,200,12,
+ 7,181,182,10320,19903,10320,21423,1520,2,3,9773,19767,80,5,4,9773,
+ 21287,80,200,12,7,183,184,9773,19767,9773,21287,1520,2,3,9236,19593,
+ 80,5,4,9236,21113,80,200,12,7,185,186,9236,19593,9236,21113,1520,
+ 2,3,8714,19381,80,5,4,8714,20901,80,200,12,7,187,188,8714,
+ 19381,8714,20901,1520,2,3,8207,19134,80,5,4,8207,20654,80,200,12,
+ 7,189,190,8207,19134,8207,20654,1520,2,3,7718,18852,80,5,4,7718,
+ 20372,80,200,12,7,191,192,7718,18852,7718,20372,1520,2,3,7251,18537,
+ 80,5,4,7251,20057,80,200,12,7,193,194,7251,18537,7251,20057,1520,
+ 2,3,6806,18190,80,5,4,6806,19710,80,200,12,7,195,196,6806,
+ 18190,6806,19710,1520,2,3,6387,17812,80,5,4,6387,19332,80,200,12,
+ 7,197,198,6387,17812,6387,19332,1520,2,3,5995,17407,80,5,4,5995,
+ 18927,80,200,12,7,199,200,5995,17407,5995,18927,1520,2,3,5633,16975,
+ 80,5,4,5633,18495,80,200,12,7,201,202,5633,16975,5633,18495,1520,
+ 2,3,5301,16518,80,5,4,5301,18038,80,200,12,7,203,204,5301,
+ 16518,5301,18038,1520,3,2,4830,18016,2,3,14429,22523,400,3,2,15749,
+ 22299,0,1,2,12000,13344,4,2,13360,12000,5,4,12560,12970,480,100,
+ 4,2,9219,13012,5,4,7595,13180,240,50,4,2,7457,12397,3,2,
+ 17789,14107,2,3,8643,18098,40,2,3,21891,18067,80,10,4,8643,18098,
+ 21891,18067,4,2,15402,18975,2,3,16760,20245,80,2,3,5688,17297,240,
+ 2,3,17582,17914,80,2,3,18302,17674,320,2,3,18702,17674,120,3,
+ 2,19475,17633,3,2,21677,17145,15,2,1,2,0,1,2,12000,13344,
+ 3,2,12000,10640,2,3,11212,11861,160,2,3,12788,11861,160,11,181,
+ 90,10240,12000,10241,12061,10244,12123,10250,12184,10257,12245,10267,12306,10278,12366,10292,
+ 12426,10308,12485,10326,12544,10346,12602,10368,12659,10392,12716,10418,12772,10446,12826,10476,
+ 12880,10507,12933,10541,12984,10576,13035,10613,13084,10652,13131,10692,13178,10734,13223,10777,
+ 13266,10822,13308,10869,13348,10916,13387,10965,13424,11016,13459,11067,13493,11120,13524,11174,
+ 13554,11228,13582,11284,13608,11341,13632,11398,13654,11456,13674,11515,13692,11574,13708,11634,
+ 13722,11694,13733,11755,13743,11816,13750,11877,13756,11939,13759,12000,13760,12061,13759,12123,
+ 13756,12184,13750,12245,13743,12306,13733,12366,13722,12426,13708,12485,13692,12544,13674,12602,
+ 13654,12659,13632,12716,13608,12772,13582,12826,13554,12880,13524,12933,13493,12984,13459,13035,
+ 13424,13084,13387,13131,13348,13178,13308,13223,13266,13266,13223,13308,13178,13348,13131,13387,
+ 13084,13424,13035,13459,12984,13493,12933,13524,12880,13554,12826,13582,12772,13608,12716,13632,
+ 12659,13654,12602,13674,12544,13692,12485,13708,12426,13722,12366,13733,12306,13743,12245,13750,
+ 12184,13756,12123,13759,12061,5,4,12000,13680,80,100,4,2,14960,12000,11,
+ 241,120,8691,12583,8713,12699,8740,12813,8770,12926,8804,13038,8843,13149,8885,13259,
+ 8930,13367,8980,13473,9033,13577,9090,13680,9151,13781,9214,13879,9282,13975,9352,14069,
+ 9426,14160,9503,14248,9583,14334,9666,14417,9752,14497,9840,14574,9931,14648,10025,14718,
+ 10121,14786,10219,14849,10320,14910,10423,14967,10527,15020,10633,15070,10741,15115,10851,15157,
+ 10962,15196,11074,15230,11187,15260,11301,15287,11417,15309,11532,15327,11649,15342,11766,15352,
+ 11883,15358,12000,15360,12117,15358,12234,15352,12351,15342,12468,15327,12583,15309,12699,15287,
+ 12813,15260,12926,15230,13038,15196,13149,15157,13259,15115,13367,15070,13473,15020,13577,14967,
+ 13680,14910,13781,14849,13879,14786,13975,14718,14069,14648,14160,14574,14248,14497,14334,14417,
+ 14417,14334,14497,14248,14574,14160,14648,14069,14718,13975,14786,13879,14849,13781,14910,13680,
+ 14967,13577,15020,13473,15070,13367,15115,13259,15157,13149,15196,13038,15230,12926,15260,12813,
+ 15287,12699,15309,12583,15327,12468,15342,12351,15352,12234,15358,12117,15360,12000,15358,11883,
+ 15352,11766,15342,11649,15327,11532,15309,11417,15287,11301,15260,11187,15230,11074,15196,10962,
+ 15157,10851,15115,10741,15070,10633,15020,10527,14967,10423,14910,10320,14849,10219,14786,10121,
+ 14718,10025,14648,9931,14574,9840,14497,9752,14417,9666,14334,9583,14248,9503,14160,9426,
+ 14069,9352,13975,9282,13879,9214,13781,9151,13680,9090,13577,9033,13473,8980,13367,8930,
+ 13259,8885,4,2,15949,14280,2,3,9948,17638,400,2,3,12547,18256,120,
+ 3,2,6954,15533,5,4,13256,19122,768,100,5,4,15880,18720,240,100,
+ 4,2,17945,16988,3,2,4379,16400,4,2,21933,16632,0,1,2,12000,
+ 13344,2,3,11040,12000,80,2,3,12960,12000,80,10,4,11040,12000,12960,
+ 12000,6,7,12000,11200,160,100,180,10,0,4,2,10640,12000,2,3,
+ 9085,12514,240,4,2,9040,12000,2,3,10778,16559,80,2,3,11426,16362,
+ 400,6,7,11426,15882,96,100,120,30,0,2,3,12370,16224,360,2,
+ 3,12918,16319,160,2,3,13279,16460,80,6,7,12000,16704,96,25,240,
+ 60,0,4,2,12485,16615,5,4,12000,18000,400,150,4,2,18160,12000,
+ 11,181,90,5440,12000,5444,12229,5456,12458,5476,12686,5504,12913,5540,13139,5583,
+ 13364,5635,13587,5694,13808,5761,14027,5836,14244,5918,14457,6007,14668,6104,14876,6208,
+ 15080,6319,15280,6437,15476,6562,15668,6693,15856,6831,16039,6975,16217,7125,16389,7281,
+ 16557,7443,16719,7611,16875,7783,17025,7961,17169,8144,17307,8332,17438,8524,17563,8720,
+ 17681,8920,17792,9124,17896,9332,17993,9543,18082,9756,18164,9973,18239,10192,18306,10413,
+ 18365,10636,18417,10861,18460,11087,18496,11314,18524,11542,18544,11771,18556,12000,18560,12229,
+ 18556,12458,18544,12686,18524,12913,18496,13139,18460,13364,18417,13587,18365,13808,18306,14027,
+ 18239,14244,18164,14457,18082,14668,17993,14876,17896,15080,17792,15280,17681,15476,17563,15668,
+ 17438,15856,17307,16039,17169,16217,17025,16389,16875,16557,16719,16719,16557,16875,16389,17025,
+ 16217,17169,16039,17307,15856,17438,15668,17563,15476,17681,15280,17792,15080,17896,14876,17993,
+ 14668,18082,14457,18164,14244,18239,14027,18306,13808,18365,13587,18417,13364,18460,13139,18496,
+ 12913,18524,12686,18544,12458,18556,12229,4,2,14654,19292,11,107,53,4332,9209,
+ 4239,9478,4156,9751,4082,10026,4018,10303,3964,10583,3919,10864,3885,11147,3860,11431,
+ 3845,11715,3840,12000,3845,12285,3860,12569,3885,12853,3919,13136,3964,13417,4018,13697,
+ 4082,13974,4156,14249,4239,14522,4332,14791,4434,15057,4545,15319,4666,15577,4795,15831,
+ 4933,16080,5080,16324,5235,16563,5398,16796,5570,17024,5749,17245,5936,17460,6130,17668,
+ 6332,17870,6540,18064,6755,18251,6976,18430,7204,18602,7437,18765,7676,18920,7920,19067,
+ 8169,19205,8423,19334,8681,19455,8943,19566,9209,19668,9478,19761,9751,19844,10026,19918,
+ 10303,19982,10583,20036,10864,20081,11147,20115,11,107,53,13136,20081,13417,20036,13697,
+ 19982,13974,19918,14249,19844,14522,19761,14791,19668,15057,19566,15319,19455,15577,19334,15831,
+ 19205,16080,19067,16324,18920,16563,18765,16796,18602,17024,18430,17245,18251,17460,18064,17668,
+ 17870,17870,17668,18064,17460,18251,17245,18430,17024,18602,16796,18765,16563,18920,16324,19067,
+ 16080,19205,15831,19334,15577,19455,15319,19566,15057,19668,14791,19761,14522,19844,14249,19918,
+ 13974,19982,13697,20036,13417,20081,13136,20115,12853,20140,12569,20155,12285,20160,12000,20155,
+ 11715,20140,11431,20115,11147,20081,10864,20036,10583,19982,10303,19918,10026,19844,9751,19761,
+ 9478,19668,9209,19566,8943,6,7,12000,21200,400,50,90,60,0,3,2,
+ 21360,12000,3,2,1040,12000,0,1,2,12000,13344,9,7,12000,12000,1440,
+ 160,9000,300,20,2,3,10722,12465,240,3,2,10661,11764,2,3,14781,
+ 13012,240,3,2,14960,12000,2,3,15759,13368,800,2,3,16555,12885,160,
+ 9,7,9496,14985,800,80,9000,300,40,11,89,44,8918,13122,8959,13229,
+ 9004,13334,9052,13438,9104,13540,9159,13640,9218,13738,9281,13834,9346,13928,9415,14019,
+ 9487,14108,9562,14195,9641,14278,9722,14359,9805,14438,9892,14513,9981,14585,10072,14654,
+ 10166,14719,10262,14782,10360,14841,10460,14896,10562,14948,10666,14996,10771,15041,10878,15082,
+ 10986,15119,11096,15153,11206,15183,11318,15208,11430,15230,11544,15248,11657,15262,11771,15272,
+ 11886,15278,12000,15280,12114,15278,12229,15272,12343,15262,12456,15248,12570,15230,12682,15208,
+ 12794,15183,12904,15153,11,45,22,13334,14996,13438,14948,13540,14896,13640,14841,13738,
+ 14782,13834,14719,13928,14654,14019,14585,14108,14513,14195,14438,14278,14359,14359,14278,14438,
+ 14195,14513,14108,14585,14019,14654,13928,14719,13834,14782,13738,14841,13640,14896,13540,14948,
+ 13438,14996,13334,9,7,10888,15424,240,80,0,400,50,5,4,10888,15264,
+ 80,100,8,8,7364,13242,7364,13242,7518,13201,7410,13403,4,2,13204,15308,
+ 11,153,76,5635,12669,7147,12510,7167,12679,7194,12847,7227,13015,7265,13181,7309,
+ 13345,7359,13508,7414,13669,7475,13828,7542,13985,7614,14139,7691,14291,7774,14440,7862,
+ 14586,7954,14729,8052,14868,8155,15004,8262,15137,8373,15265,8490,15390,8610,15510,8735,
+ 15627,8863,15738,8996,15845,9132,15948,9271,16046,9414,16138,9560,16226,9709,16309,9861,
+ 16386,10015,16458,10172,16525,10331,16586,10492,16641,10655,16691,10819,16735,10985,16773,11153,
+ 16806,11321,16833,11490,16853,11660,16868,11830,16877,12000,16880,12170,16877,12340,16868,12510,
+ 16853,12679,16833,12847,16806,13015,16773,13181,16735,13345,16691,13508,16641,13669,16586,13828,
+ 16525,13985,16458,14139,16386,14291,16309,14440,16226,14586,16138,14729,16046,14868,15948,15004,
+ 15845,15137,15738,15265,15627,15390,15510,15510,15390,15627,15265,15738,15137,15845,15004,15948,
+ 14868,16046,14729,16138,14586,16226,14440,16309,14291,16386,14139,9,7,17104,14380,1440,
+ 80,0,100,10,9,7,16850,14800,720,80,0,100,10,9,7,16629,
+ 15006,720,80,0,100,10,4,2,16530,15292,9,7,9537,18766,960,80,
+ 0,300,30,5,4,12000,19760,240,120,12,7,12,13,9985,18766,12000,
+ 19760,2247,9,7,14463,18766,960,80,0,300,30,12,7,13,14,12000,
+ 19760,14015,18766,2247,4,2,12000,18600,11,161,80,4043,10597,3999,10875,3964,
+ 11155,3940,11436,3925,11718,3920,12000,3925,12282,3940,12564,3964,12845,3999,13125,4043,
+ 13403,4097,13680,4160,13955,4233,14227,4315,14497,4407,14764,4508,15027,4619,15286,4738,
+ 15542,4866,15793,5003,16040,5148,16282,5301,16518,5463,16749,5633,16975,5810,17194,5995,
+ 17407,6188,17613,6387,17812,6593,18005,6806,18190,7025,18367,7251,18537,7482,18699,7718,
+ 18852,7960,18997,8207,19134,8458,19262,8714,19381,8973,19492,9236,19593,9503,19685,9773,
+ 19767,10045,19840,10320,19903,10597,19957,10875,20001,11155,20036,11436,20060,11718,20075,12000,
+ 20080,12282,20075,12564,20060,12845,20036,13125,20001,13403,19957,13680,19903,13955,19840,14227,
+ 19767,14497,19685,14764,19593,15027,19492,15286,19381,15542,19262,15793,19134,16040,18997,16282,
+ 18852,16518,18699,16749,18537,16975,18367,17194,18190,17407,18005,17613,17812,17812,17613,18005,
+ 17407,18190,17194,18367,16975,18537,16749,18699,16518,18852,16282,9,7,14996,20232,80,
+ 1200,0,200,100,9,7,13821,20569,80,1200,0,200,100,9,7,12611,
+ 20739,80,1200,0,200,100,9,7,11389,20739,80,1200,0,200,100,9,
+ 7,10179,20569,80,1200,0,200,100,9,7,9004,20232,80,1200,0,200,
+ 100,3,2,2782,13625,9,7,15666,22074,80,1360,0,100,30,4,2,
+ 16360,21793,0,9,7,12000,12000,2800,160,0,30,30,3,2,12000,11680,
+ 1,2,12000,13360,11,261,130,9376,12463,9394,12554,9415,12644,9439,12734,9466,
+ 12823,9497,12911,9530,12998,9566,13084,9606,13168,9648,13251,9693,13332,9741,13412,9791,
+ 13490,9845,13566,9901,13640,9959,13712,10020,13783,10084,13851,10149,13916,10217,13980,10288,
+ 14041,10360,14099,10434,14155,10510,14209,10588,14259,10668,14307,10749,14352,10832,14394,10916,
+ 14434,11002,14470,11089,14503,11177,14534,11266,14561,11356,14585,11446,14606,11537,14624,11629,
+ 14638,11722,14649,11814,14658,11907,14662,12000,14664,12093,14662,12186,14658,12278,14649,12371,
+ 14638,12463,14624,12554,14606,12644,14585,12734,14561,12823,14534,12911,14503,12998,14470,13084,
+ 14434,13168,14394,13251,14352,13332,14307,13412,14259,13490,14209,13566,14155,13640,14099,13712,
+ 14041,13783,13980,13851,13916,13916,13851,13980,13783,14041,13712,14099,13640,14155,13566,14209,
+ 13490,14259,13412,14307,13332,14352,13251,14394,13168,14434,13084,14470,12998,14503,12911,14534,
+ 12823,14561,12734,14585,12644,14606,12554,14624,12463,14638,12371,14649,12278,14658,12186,14662,
+ 12093,14664,12000,14662,11907,14658,11814,14649,11722,14638,11629,14624,11537,14606,11446,14585,
+ 11356,14561,11266,14534,11177,14503,11089,14470,11002,14434,10916,14394,10832,14352,10749,14307,
+ 10668,14259,10588,14209,10510,14155,10434,14099,10360,14041,10288,13980,10217,13916,10149,13851,
+ 10084,13783,10020,13712,9959,13640,9901,13566,9845,13490,9791,13412,9741,13332,9693,13251,
+ 9648,13168,9606,13084,9566,12998,9530,12911,9497,12823,9466,12734,9439,12644,9415,12554,
+ 9394,12463,9376,12371,9362,12278,9351,12186,9342,12093,9338,5,4,12000,14960,240,
+ 75,5,4,12000,14376,240,75,12,7,1,2,12000,14960,12000,14376,584,
+ 3,2,9219,10988,4,2,16285,13560,11,271,135,12000,7120,11830,7123,11660,
+ 7132,11490,7147,11321,7167,11153,7194,10985,7227,10819,7265,10655,7309,10492,7359,10331,
+ 7414,10172,7475,10015,7542,9861,7614,9709,7691,9560,7774,9414,7862,9271,7954,9132,
+ 8052,8996,8155,8863,8262,8735,8373,8610,8490,8490,8610,8373,8735,8262,8863,8155,
+ 8996,8052,9132,7954,9271,7862,9414,7774,9560,7691,9709,7614,9861,7542,10015,7475,
+ 10172,7414,10331,7359,10492,7309,10655,7265,10819,7227,10985,7194,11153,7167,11321,7147,
+ 11490,7132,11660,7123,11830,7120,12000,7123,12170,7132,12340,7147,12510,7167,12679,7194,
+ 12847,7227,13015,7265,13181,7309,13345,7359,13508,7414,13669,7475,13828,7542,13985,7614,
+ 14139,7691,14291,7774,14440,7862,14586,7954,14729,8052,14868,8155,15004,8262,15137,8373,
+ 15265,8490,15390,8610,15510,8735,15627,8863,15738,8996,15845,9132,15948,9271,16046,9414,
+ 16138,9560,16226,9709,16309,9861,16386,10015,16458,10172,16525,10331,16586,10492,16641,10655,
+ 16691,10819,16735,10985,16773,11153,16806,11321,16833,11490,16853,11660,16868,11830,16877,12000,
+ 16880,12170,16877,12340,16868,12510,16853,12679,16833,12847,16806,13015,16773,13181,16735,13345,
+ 16691,13508,16641,13669,16586,13828,16525,13985,16458,14139,16386,14291,16309,14440,16226,14586,
+ 16138,14729,16046,14868,15948,15004,15845,15137,15738,15265,15627,15390,15510,15510,15390,15627,
+ 15265,15738,15137,15845,15004,15948,14868,16046,14729,16138,14586,16226,14440,16309,14291,16386,
+ 14139,16458,13985,16525,13828,16586,13669,16641,13508,16691,13345,16735,13181,16773,13015,16806,
+ 12847,16833,12679,16853,12510,16868,12340,16877,12170,8,8,11779,18316,11779,18316,12000,
+ 17440,12221,18316,7,4,12000,18360,56,56,7,4,10896,18263,56,56,7,
+ 4,13104,18263,56,56,3,2,6141,13904,7,4,13375,19800,80,80,7,
+ 4,13571,19722,120,120,7,4,13821,19584,200,200,7,4,14008,19496,240,
+ 240,7,4,14257,19383,280,280,7,4,14488,19435,160,160,7,4,14644,
+ 19466,80,80,7,4,14782,19441,56,56,3,2,17945,16988,7,4,12000,
+ 21200,4000,400,3,2,2640,12000,5,4,12000,22720,480,100,3,2,22587,
+ 14837,0,2,3,12268,13521,56,1,2,12000,13296,2,3,12936,13115,144,
+ 5,4,11260,13282,120,200,3,2,13178,12680,3,2,14859,12766,2,3,
+ 14286,13320,560,8,8,9607,13116,9607,13116,10550,12676,10590,13183,2,3,7667,
+ 12764,400,2,3,8241,13368,800,2,3,8813,14674,640,8,8,15043,12989,
+ 15043,12989,15933,13354,14080,15603,3,2,9596,14404,2,3,7710,15600,800,6,
+ 7,8884,17397,160,50,120,30,0,2,3,8884,18357,160,2,3,13967,
+ 18054,34,2,3,14463,17803,96,4,2,17950,13594,4,2,14008,19496,2,
+ 3,17091,18067,80,2,3,16679,17989,80,2,3,16279,17890,80,2,3,
+ 15892,17770,80,2,3,15519,17631,80,2,3,15240,17612,80,2,3,15042,
+ 17722,80,2,3,14841,17824,80,2,3,14216,18089,80,2,3,13786,18229,
+ 80,2,3,13352,18362,80,2,3,7210,18357,40,2,3,17514,18124,80,
+ 2,3,17946,18158,80,2,3,18388,18169,80,2,3,12473,21028,400,2,
+ 3,13166,21497,32,5,4,13655,21383,72,100,2,3,10339,21423,32,4,
+ 2,7320,20106,3,2,1050,11522,15,2,1,3,0,2,3,12000,12560,
+ 320,1,2,12000,13344,2,3,10958,12874,240,3,2,10722,12465,2,3,
+ 13307,14566,320,2,3,11879,14317,240,3,2,14267,13903,3,2,7867,13927,
+ 2,3,8764,14351,800,2,3,10903,18224,80,2,3,12000,17680,80,2,
+ 3,12972,17515,800,3,2,16719,15960,2,3,17869,13247,400,2,3,17086,
+ 13081,400,2,3,19520,12000,480,2,3,5840,16313,480,2,3,18626,13530,
+ 560,3,2,5280,15880,2,3,4461,17681,160,5,4,12000,20800,800,100,
+ 2,3,5881,19293,80,2,3,9832,20694,80,2,3,10170,20608,80,2,
+ 3,10500,20509,80,2,3,10820,20397,80,2,3,11130,20274,80,2,3,
+ 11431,20140,80,3,2,14846,19818,2,3,16760,20245,80,2,3,8104,21643,
+ 800,2,3,16700,22078,80,3,2,9163,22587,2,3,6090,21457,48,0,
+ 2,3,10496,12547,80,3,2,11680,12554,2,3,11040,12000,328,2,3,
+ 12480,12000,400,10,4,11040,12000,12480,12000,2,3,13450,12676,80,2,3,
+ 14841,13640,40,10,4,13450,12676,14841,13640,3,2,11486,14915,11,121,60,
+ 9920,12000,9921,12073,9925,12145,9931,12217,9940,12289,9952,12361,9965,12432,9982,12503,
+ 10001,12573,10022,12643,10045,12711,10071,12779,10100,12846,10131,12912,10163,12977,10199,13040,
+ 10236,13102,10276,13163,10317,13223,10361,13281,10407,13337,10454,13392,10504,13445,10555,13496,
+ 10608,13546,10663,13593,10719,13639,10777,13683,10837,13724,10898,13764,10960,13801,11023,13837,
+ 11088,13869,11154,13900,11221,13929,11289,13955,11357,13978,11427,13999,11497,14018,11568,14035,
+ 11639,14048,11711,14060,11783,14069,11855,14075,11927,14079,12000,14080,12073,14079,12145,14075,
+ 12217,14069,12289,14060,12361,14048,12432,14035,12503,14018,12573,13999,12643,13978,12711,13955,
+ 12779,13929,12846,13900,12912,13869,12977,13837,2,3,14021,14408,56,2,3,12000,
+ 15080,120,2,3,12000,16720,80,2,3,16727,12834,24,10,4,12000,16720,
+ 16727,12834,2,3,15954,13439,40,4,2,9069,15493,11,127,63,8776,12000,
+ 8778,12113,8784,12225,8794,12337,8807,12449,8825,12560,8846,12670,8872,12780,8901,12889,
+ 8934,12996,8970,13103,9011,13208,9055,13311,9102,13413,9153,13514,9208,13612,9266,13708,
+ 9327,13803,9392,13895,9459,13985,9530,14072,9604,14157,9681,14240,9760,14319,9843,14396,
+ 9928,14470,10015,14541,10105,14608,10197,14673,10292,14734,10388,14792,10486,14847,10587,14898,
+ 10689,14945,10792,14989,10897,15030,11004,15066,11111,15099,11220,15128,11330,15154,11440,15175,
+ 11551,15193,11663,15206,11775,15216,11887,15222,12000,15224,12113,15222,12225,15216,12337,15206,
+ 12449,15193,12560,15175,12670,15154,12780,15128,12889,15099,12996,15066,13103,15030,13208,14989,
+ 13311,14945,13413,14898,13514,14847,13612,14792,13708,14734,13803,14673,6,7,12000,14000,
+ 80,20,240,30,0,2,3,9169,17108,560,2,3,12000,18344,56,2,
+ 3,10183,17592,520,2,3,16790,12931,40,2,3,17537,13588,40,10,4,
+ 16790,12931,17537,13588,3,2,8040,16719,2,3,9154,19818,320,2,3,14846,
+ 19818,320,10,4,9154,19818,14846,19818,2,3,7797,18994,96,3,2,12000,
+ 18640,2,3,7835,16964,80,10,4,9169,17108,7835,16964,3,2,19136,16120,
+ 2,3,7680,19482,40,10,4,9154,19818,7680,19482,10,4,7680,19482,7797,
+ 18994,2,3,13945,23030,80,2,3,22818,14899,80,10,4,13945,23030,22818,
+ 14899,2,3,21322,15393,80,2,3,18560,13881,32,10,4,21322,15393,18560,
+ 13881,2,3,5804,19385,24,2,3,4801,20580,0,10,4,5804,19385,4801,
+ 20580,3,2,4250,19750,1,2,12000,11760,0,1,2,12000,13304,5,4,
+ 12479,13316,200,120,2,3,12000,13552,48,3,2,13278,11535,2,3,9535,
+ 13150,480,2,3,11080,13593,160,2,3,13839,13543,160,2,3,12716,13608,
+ 160,2,3,12000,15152,48,2,3,10480,9367,160,5,4,10621,13157,160,
+ 100,12,7,7,8,10480,9367,10621,13157,3792,3,2,9085,12514,2,3,
+ 12000,16160,120,2,3,9938,16423,80,5,4,7640,13587,160,70,2,3,
+ 16247,13546,280,3,2,16491,12792,2,3,8824,17501,48,2,3,15176,17501,
+ 48,10,4,8824,17501,15176,17501,2,3,13552,17459,96,5,4,12000,17320,
+ 160,150,5,4,12000,18240,160,100,12,7,16,17,12000,17320,12000,18240,
+ 920,4,2,14308,17711,2,3,12000,19920,80,5,4,16433,18330,272,40,
+ 12,7,18,19,12000,19920,16433,18330,6400,5,4,17465,17465,272,40,12,
+ 7,19,20,16433,18330,17465,17465,4000,2,3,3599,19207,48,2,3,11783,
+ 18909,64,10,4,3599,19207,11783,18909,2,3,12295,19034,64,2,3,20401,
+ 19207,48,10,4,12295,19034,20401,19207,4,2,19033,15280,2,3,20245,16760,
+ 80,2,3,18190,17194,80,10,4,20245,16760,18190,17194,2,3,4306,16623,
+ 24,2,3,5267,16408,24,10,4,4306,16623,5267,16408,3,2,21138,14026,
+ 2,3,16760,20245,80,5,4,2578,17440,320,100,5,4,4194,19806,160,
+ 100,12,7,30,31,2578,17440,4194,19806,2866,4,2,19045,20396,0,2,
+ 3,23120,12000,80,2,3,4320,12000,80,10,4,23120,12000,4320,12000,2,
+ 3,1849,13931,80,10,4,4320,12000,1849,13931,1,2,12000,13360,8,8,
+ 11613,13552,11613,13552,10774,13028,11459,13160,5,4,11750,13418,160,150,11,93,
+ 46,11942,13655,12000,13656,12058,13655,12116,13652,12173,13647,12230,13640,12288,13631,12344,
+ 13620,12401,13607,12456,13592,12512,13575,12566,13556,12620,13535,12674,13513,12726,13488,12777,
+ 13462,12828,13434,12878,13404,12926,13373,12973,13340,13020,13305,13064,13269,13108,13231,13150,
+ 13191,13191,13150,13231,13108,13269,13064,13305,13020,13340,12973,13373,12926,13404,12878,13434,
+ 12828,13462,12777,13488,12726,13513,12674,13535,12620,13556,12566,13575,12512,13592,12456,13607,
+ 12401,13620,12344,13631,12288,13640,12230,13647,12173,13652,12116,13655,12058,2,3,12143,
+ 13634,40,3,2,10958,12874,2,3,9257,12735,360,2,3,9426,13200,360,
+ 2,3,9674,13629,360,2,3,9992,14008,360,2,3,10371,14326,360,2,
+ 3,10800,14574,360,2,3,11265,14743,360,2,3,11752,14829,360,2,3,
+ 12248,14829,360,2,3,12735,14743,360,2,3,13200,14574,360,5,4,12700,
+ 13924,360,100,2,3,14326,13629,360,3,2,14781,13012,2,3,14314,14758,
+ 400,5,4,12000,16512,288,200,2,3,10427,16323,200,2,3,10768,16598,
+ 40,2,3,9408,15992,40,3,2,8265,14616,2,3,12000,15600,400,2,
+ 3,9353,14556,160,2,3,8832,15168,80,2,3,10459,18179,32,2,3,
+ 10914,18161,144,2,3,13106,18271,32,2,3,11334,18333,32,3,2,12000,
+ 17040,11,99,49,10208,16924,10381,16984,10556,17037,10732,17084,10911,17125,11090,17160,
+ 11271,17189,11452,17211,11634,17227,11817,17237,12000,17240,12183,17237,12366,17227,12548,17211,
+ 12729,17189,12910,17160,13089,17125,13268,17084,13444,17037,13619,16984,13792,16924,13963,16858,
+ 14131,16787,14297,16710,14460,16627,14620,16538,14777,16444,14930,16344,15080,16239,15226,16129,
+ 15368,16014,15506,15894,15640,15769,15769,15640,15894,15506,16014,15368,16129,15226,16239,15080,
+ 16344,14930,16444,14777,16538,14620,16627,14460,16710,14297,16787,14131,16858,13963,16924,13792,
+ 17517,13173,17633,12993,17744,12807,2,3,8200,18582,400,3,2,6513,17487,2,
+ 3,13843,18877,80,2,3,14512,18901,40,10,4,13843,18877,14512,18901,2,
+ 3,16222,18757,32,2,3,9305,19405,120,2,3,10105,18197,80,2,3,
+ 16400,19621,800,2,3,12000,21560,40,2,3,6189,18925,24,2,3,6989,
+ 18925,24,10,4,6189,18925,6989,18925,3,2,12000,20240,2,3,1200,12000,
+ 400,2,3,1760,11911,160,2,3,2764,11532,40,10,4,1760,11911,2764,
+ 11532,2,3,3646,11122,48,2,3,4506,11371,48,2,3,12503,10610,64,
+ 10,4,4506,11371,12503,10610,2,3,16000,12000,240,2,3,16000,10400,240,
+ 10,4,16000,12000,16000,10400,3,2,22956,11713,0,1,2,12000,12000,5,
+ 4,12000,13520,40,50,5,4,12000,13280,40,50,5,4,12000,13040,40,
+ 50,5,4,12212,13505,40,50,5,4,12178,13268,40,50,5,4,12145,
+ 13030,40,50,5,4,12419,13461,40,50,5,4,12353,13230,40,50,5,
+ 4,12287,13000,40,50,5,4,12618,13389,40,50,5,4,12521,13169,40,
+ 50,5,4,12423,12950,40,50,5,4,12805,13289,40,50,5,4,12678,
+ 13086,40,50,5,4,12551,12882,40,50,5,4,12977,13164,40,50,5,
+ 4,12823,12981,40,50,5,4,12668,12797,40,50,5,4,13130,13017,40,
+ 50,5,4,12951,12856,40,50,5,4,12773,12696,40,50,5,4,13260,
+ 12850,40,50,5,4,13061,12716,40,50,5,4,12862,12582,40,50,5,
+ 4,13366,12666,40,50,5,4,13150,12561,40,50,5,4,12935,12456,40,
+ 50,5,4,13446,12470,40,50,5,4,13217,12396,40,50,5,4,12989,
+ 12321,40,50,5,4,13497,12264,40,50,5,4,13261,12222,40,50,5,
+ 4,13024,12181,40,50,5,4,13519,12053,40,50,5,4,13279,12045,40,
+ 50,5,4,13039,12036,40,50,5,4,13512,11841,40,50,5,4,13273,
+ 11866,40,50,5,4,13034,11891,40,50,5,4,13475,11632,40,50,5,
+ 4,13242,11690,40,50,5,4,13009,11748,40,50,5,4,13409,11431,40,
+ 50,5,4,13187,11521,40,50,5,4,12964,11610,40,50,5,4,13316,
+ 11240,40,50,5,4,13109,11360,40,50,5,4,12901,11480,40,50,5,
+ 4,13198,11064,40,50,5,4,13009,11212,40,50,5,4,12820,11360,40,
+ 50,5,4,13056,10907,40,50,5,4,12889,11079,40,50,5,4,12722,
+ 11252,40,50,5,4,12893,10770,40,50,5,4,12752,10964,40,50,5,
+ 4,12611,11159,40,50,5,4,12714,10658,40,50,5,4,12601,10870,40,
+ 50,5,4,12488,11082,40,50,5,4,12520,10572,40,50,5,4,12438,
+ 10797,40,50,5,4,12356,11023,40,50,5,4,12316,10513,40,50,5,
+ 4,12266,10748,40,50,5,4,12216,10983,40,50,5,4,12106,10484,40,
+ 50,5,4,12089,10723,40,50,5,4,12073,10963,40,50,3,2,13212,
+ 11383,2,3,14340,14182,80,2,3,13200,14078,240,10,4,14340,14182,13200,
+ 14078,2,3,10680,14286,240,10,4,13200,14078,10680,14286,2,3,10800,14078,
+ 800,2,3,9644,13360,144,10,4,10800,14078,9644,13360,2,3,9298,13560,
+ 80,10,4,9644,13360,9298,13560,3,2,9275,13157,5,4,7565,13614,80,
+ 50,5,4,7912,14360,80,50,5,4,8384,15034,80,50,5,4,8966,
+ 15616,80,50,5,4,9640,16088,80,50,2,3,8000,12000,800,2,3,
+ 14571,15064,800,2,3,15386,14552,560,2,3,15824,14484,240,2,3,14931,
+ 15493,240,2,3,14280,15949,640,2,3,13180,16405,480,2,3,9640,16088,
+ 80,2,3,11180,16648,80,3,2,13648,15379,2,3,12332,16748,40,2,
+ 3,9678,17584,40,2,3,9358,17584,60,2,3,21612,17563,48,10,4,
+ 9358,17584,21612,17563,2,3,3984,17650,32,2,3,8840,17513,88,10,4,
+ 3984,17650,8840,17513,3,2,5840,12040,5,4,15040,17305,320,70,2,3,
+ 18308,14981,320,3,2,18308,14381,2,3,4881,17173,800,3,2,3894,16680,
+ 2,3,12962,22998,160,3,2,22299,15749,5,4,12000,23120,80,100,5,
+ 4,12000,23040,80,100,5,4,12000,22960,80,100,5,4,12000,22880,80,
+ 100,5,4,12000,22800,80,100,5,4,12000,22720,80,100,5,4,11612,
+ 23113,80,100,5,4,11615,23033,80,100,5,4,11618,22953,80,100,5,
+ 4,11620,22873,80,100,5,4,11623,22793,80,100,5,4,11626,22713,80,
+ 100,0,
+};
+static const uint16_t level_start[20] = {0,151,324,561,686,989,1630,2107,2577,4786,4876,5373,5895,6579,7266,7484,7648,8138,8415,8939};
+static const char *const level_texts[4] = {
+ "Use the left and right arrow keys to move. Collect seven circles to complete the level.",
+ "Press Back to pause.",
+ "You cannot take this circle yourself. Use another ball instead.",
+ "This is hard mode. Good luck!",
+};
diff --git a/games/circloo/src/main.c b/games/circloo/src/main.c
new file mode 100644
index 00000000..e6b471df
--- /dev/null
+++ b/games/circloo/src/main.c
@@ -0,0 +1,50 @@
+/* circloO for the NumWorks calculator.
+ *
+ * Inspired by circloO by Florian van Strien, not affiliated with him.
+ * Made by Mason Chen as part of NumPlay. */
+#include "game.h"
+#include "gfx.h"
+#include "plat.h"
+
+#ifndef HOST
+#ifndef NP_PORT /* (another target: platform/port.mk names the app) */
+const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "circloO";
+const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;
+#endif
+
+uint32_t perf_frames __attribute__((used)); /* read by tools/emu.py */
+uint32_t perf_max __attribute__((used));
+
+int main(void) {
+ uint16_t band[SCREEN_W * BAND]; /* (on main's stack: the app's RAM goes to the physics) */
+ gfx_init(band);
+ plat_begin();
+ game_init();
+ /* the game's 60 steps a second, at most 4 a drawing */
+ uint32_t next = plat_millis() * 3; /* in thirds of a millisecond: 50 a step */
+ while (g.running) {
+ int n = 0;
+ uint32_t keys = plat_keys();
+ if (keys & K_HOME) break;
+ uint32_t now = plat_millis() * 3;
+ while ((int32_t)(now - next) >= 0 && n < 4 && g.running) {
+ game_tick(keys);
+ next += 50;
+ n++;
+ }
+ if (!g.running) break;
+ if ((int32_t)(now - next) > 200) next = now; /* far behind: do not rush */
+ if (n) {
+ uint32_t t0 = plat_millis();
+ game_draw();
+ uint32_t dt = plat_millis() - t0;
+ if (dt > perf_max && perf_frames > 30) perf_max = dt;
+ perf_frames++;
+ } else {
+ plat_sleep(1);
+ }
+ }
+ save_write();
+ return plat_end();
+}
+#endif
diff --git a/games/circloo/src/phys.c b/games/circloo/src/phys.c
new file mode 100644
index 00000000..bc9b982c
--- /dev/null
+++ b/games/circloo/src/phys.c
@@ -0,0 +1,871 @@
+/* circloO's physics (see phys.h): Box2D 2.3's contact and joint solvers, written down for the few shapes
+ * the game has. Box2D (c) Erin Catto, zlib licence. */
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include "phys.h"
+
+World W;
+
+/* Box2D's settings */
+#define DT (1.0f / 60)
+#define ITER_V 10
+#define ITER_P 10
+#define SLOP 0.005f
+#define SKIN (2 * SLOP) /* b2_polygonRadius: the skin of edges and polygons */
+#define MAX_CORR 0.2f
+#define BAUM 0.2f
+#define MAX_TRANS 2.0f
+#define MAX_ROT (0.5f * 3.14159265f)
+#define CELL 2.0f
+#define GRID 30
+
+typedef struct {
+ int n;
+ float nx, ny; /* from A to B */
+ float px[2], py[2], sep[2];
+ uint8_t id[2];
+} Man;
+
+static inline float cross(float ax, float ay, float bx, float by) { return ax * by - ay * bx; }
+
+void ph_reset(void) {
+ memset(&W, 0, sizeof W);
+ W.nb = 1; /* the ground */
+ W.b[0].alive = 1;
+ W.b[0].c = 1;
+ W.gx = 0, W.gy = 35; /* the room's gravity, m/s^2 */
+}
+
+static int new_body(void) {
+ for (int i = 1; i < W.nb; i++)
+ if (!W.b[i].alive) {
+ memset(&W.b[i], 0, sizeof W.b[i]);
+ return i;
+ }
+ if (W.nb >= MAX_BODIES) return -1;
+ memset(&W.b[W.nb], 0, sizeof W.b[0]);
+ return W.nb++;
+}
+
+int ph_add_circle(float x, float y, float r, float density, float friction) {
+ int i = new_body();
+ if (i < 0) return -1;
+ Body *b = &W.b[i];
+ b->x = x, b->y = y, b->c = 1, b->r = r;
+ b->shape = SH_CIRCLE, b->alive = 1, b->fr = friction;
+ if (density > 0) {
+ float m = density * 3.14159265f * r * r;
+ b->im = 1 / m;
+ b->ii = 1 / (m * 0.5f * r * r);
+ }
+ return i;
+}
+
+int ph_add_rotor(float x, float y, float hx, float hy, float angle, float density, float adamp) {
+ int i = new_body();
+ if (i < 0) return -1;
+ Body *b = &W.b[i];
+ b->x = x, b->y = y, b->a = angle, b->c = cosf(angle), b->s = sinf(angle);
+ b->hx = hx, b->hy = hy, b->shape = SH_BOX, b->alive = 1, b->pinned = 1, b->fr = 0.2f;
+ b->ad = adamp;
+ if (density > 0) {
+ float m = density * 4 * hx * hy;
+ b->ii = 1 / (m * (hx * hx + hy * hy) / 3);
+ }
+ return i;
+}
+
+void ph_kill(int i) {
+ W.b[i].alive = 0;
+ for (int k = 0; k < W.nj; k++)
+ if (W.j[k].a == i || W.j[k].b == i) W.j[k].alive = 0;
+}
+
+void ph_static_circle(float x, float y, float r) {
+ if (W.nsc >= MAX_SCIRCLES) return;
+ W.sc[W.nsc++] = (SCircle){x, y, r};
+}
+
+void ph_static_edge(float x1, float y1, float x2, float y2) {
+ if (W.nse >= MAX_SEDGES) return;
+ W.se[W.nse++] = (SEdge){x1, y1, x2, y2, -1, -1};
+}
+
+void ph_static_chain(const float *xy, int n, bool loop) {
+ int first = W.nse, segs = loop ? n : n - 1;
+ if (n < 2 || W.nse + segs > MAX_SEDGES) return;
+ for (int k = 0; k < segs; k++) {
+ int k2 = (k + 1) % n;
+ SEdge *e = &W.se[W.nse++];
+ *e = (SEdge){xy[2 * k], xy[2 * k + 1], xy[2 * k2], xy[2 * k2 + 1], -1, -1};
+ if (k > 0 || loop) e->prev = (int16_t)(first + (k + segs - 1) % segs);
+ if (k < segs - 1 || loop) e->next = (int16_t)(first + (k + 1) % segs);
+ }
+}
+
+static void poly_normals(SPoly *p) {
+ for (int k = 0; k < p->n; k++) {
+ int k2 = (k + 1) % p->n;
+ float ex = p->x[k2] - p->x[k], ey = p->y[k2] - p->y[k], l = sqrtf(ex * ex + ey * ey);
+ if (l < 1e-9f) l = 1;
+ p->nx[k] = ey / l, p->ny[k] = -ex / l;
+ }
+}
+
+void ph_static_poly(const float *xy, int n) {
+ if (W.nsp >= MAX_SPOLYS || n < 2 || n > 4) return;
+ SPoly *p = &W.sp[W.nsp++];
+ p->n = (uint8_t)n;
+ float area = 0;
+ for (int k = 0; k < n; k++) area += cross(xy[2 * k], xy[2 * k + 1], xy[2 * ((k + 1) % n)], xy[2 * ((k + 1) % n) + 1]);
+ for (int k = 0; k < n; k++) {
+ int s = area >= 0 ? k : n - 1 - k; /* counter-clockwise in Box2D's sense */
+ p->x[k] = xy[2 * s], p->y[k] = xy[2 * s + 1];
+ }
+ poly_normals(p);
+}
+
+void ph_keep_statics(void) { W.keep_se = W.nse; }
+void ph_drop_statics(void) { W.nse = W.keep_se; }
+
+/* ---- the grid of static shapes ---- */
+
+static void static_box(int s, float *x0, float *y0, float *x1, float *y1) {
+ if (s < MAX_SCIRCLES) {
+ const SCircle *c = &W.sc[s];
+ *x0 = c->x - c->r, *y0 = c->y - c->r, *x1 = c->x + c->r, *y1 = c->y + c->r;
+ } else if (s < MAX_SCIRCLES + MAX_SEDGES) {
+ const SEdge *e = &W.se[s - MAX_SCIRCLES];
+ *x0 = fminf(e->x1, e->x2), *x1 = fmaxf(e->x1, e->x2), *y0 = fminf(e->y1, e->y2), *y1 = fmaxf(e->y1, e->y2);
+ } else {
+ const SPoly *p = &W.sp[s - MAX_SCIRCLES - MAX_SEDGES];
+ *x0 = *x1 = p->x[0], *y0 = *y1 = p->y[0];
+ for (int k = 1; k < p->n; k++) *x0 = fminf(*x0, p->x[k]), *x1 = fmaxf(*x1, p->x[k]), *y0 = fminf(*y0, p->y[k]), *y1 = fmaxf(*y1, p->y[k]);
+ }
+}
+
+static int cell_of(float v) {
+ int c = (int)floorf(v / CELL);
+ return c < 0 ? 0 : c >= GRID ? GRID - 1 : c;
+}
+
+#define FOR_STATICS(s) \
+ for (int _g = 0; _g < 3; _g++) \
+ for (int _i = 0, _n = _g == 0 ? W.nsc : _g == 1 ? W.nse : W.nsp; _i < _n; _i++) \
+ for (int s = _i + (_g == 0 ? 0 : _g == 1 ? MAX_SCIRCLES : MAX_SCIRCLES + MAX_SEDGES), _once = 1; _once; _once = 0)
+
+void ph_build_grid(void) {
+ static uint16_t count[GRID * GRID];
+ memset(count, 0, sizeof count);
+ for (int pass = 0; pass < 2; pass++) {
+ FOR_STATICS(s) {
+ float x0, y0, x1, y1;
+ static_box(s, &x0, &y0, &x1, &y1);
+ for (int cy = cell_of(y0 - SKIN); cy <= cell_of(y1 + SKIN); cy++)
+ for (int cx = cell_of(x0 - SKIN); cx <= cell_of(x1 + SKIN); cx++) {
+ int c = cy * GRID + cx;
+ if (pass == 0) count[c]++;
+ else if (W.cell_start[c] + count[c] < (int)(sizeof W.cell_items / 2)) W.cell_items[W.cell_start[c] + count[c]++] = (uint16_t)s;
+ }
+ }
+ if (pass == 0) {
+ int t = 0;
+ for (int c = 0; c < GRID * GRID; c++) W.cell_start[c] = (uint16_t)t, t += count[c], count[c] = 0;
+ W.cell_start[GRID * GRID] = (uint16_t)t;
+ }
+ }
+}
+
+/* ---- shapes in the world ---- */
+
+static void body_poly(const Body *b, SPoly *p) {
+ static const float sx[4] = {-1, 1, 1, -1}, sy[4] = {-1, -1, 1, 1};
+ p->n = 4;
+ for (int k = 0; k < 4; k++) {
+ float lx = sx[k] * b->hx, ly = sy[k] * b->hy;
+ p->x[k] = b->x + b->c * lx - b->s * ly;
+ p->y[k] = b->y + b->s * lx + b->c * ly;
+ }
+ p->nx[0] = b->s, p->ny[0] = -b->c; /* (0,-1) turned */
+ p->nx[1] = b->c, p->ny[1] = b->s; /* (1,0) */
+ p->nx[2] = -b->s, p->ny[2] = b->c; /* (0,1) */
+ p->nx[3] = -b->c, p->ny[3] = -b->s; /* (-1,0) */
+}
+
+static void edge_poly(const SEdge *e, SPoly *p) {
+ p->n = 2;
+ p->x[0] = e->x1, p->y[0] = e->y1, p->x[1] = e->x2, p->y[1] = e->y2;
+ poly_normals(p);
+ p->nx[1] = -p->nx[0], p->ny[1] = -p->ny[0];
+}
+
+/* ---- contacts (Box2D's b2Collide* functions) ---- */
+
+static void coll_cc(float ax, float ay, float ar, float bx, float by, float br, Man *m) {
+ float dx = bx - ax, dy = by - ay, d2 = dx * dx + dy * dy, R = ar + br;
+ m->n = 0;
+ if (d2 > R * R) return;
+ float d = sqrtf(d2), nx = 1, ny = 0;
+ if (d > 1e-9f) nx = dx / d, ny = dy / d;
+ m->n = 1, m->nx = nx, m->ny = ny, m->id[0] = 0;
+ m->sep[0] = d - R;
+ m->px[0] = 0.5f * (ax + nx * ar + bx - nx * br);
+ m->py[0] = 0.5f * (ay + ny * ar + by - ny * br);
+}
+
+/* a circle (A) on an edge (B), with Box2D's handling of a chain's corners */
+static void coll_ce(float cx, float cy, float r, const SEdge *e, Man *m) {
+ m->n = 0;
+ float R = r + SKIN;
+ float ex = e->x2 - e->x1, ey = e->y2 - e->y1;
+ float u = ex * (e->x2 - cx) + ey * (e->y2 - cy);
+ float v = ex * (cx - e->x1) + ey * (cy - e->y1);
+ float px, py;
+ if (v <= 0) {
+ px = e->x1, py = e->y1;
+ float dx = cx - px, dy = cy - py;
+ if (dx * dx + dy * dy > R * R) return;
+ if (e->prev >= 0) {
+ const SEdge *p = &W.se[e->prev];
+ if ((e->x1 - p->x1) * (e->x1 - cx) + (e->y1 - p->y1) * (e->y1 - cy) > 0) return;
+ }
+ } else if (u <= 0) {
+ px = e->x2, py = e->y2;
+ float dx = cx - px, dy = cy - py;
+ if (dx * dx + dy * dy > R * R) return;
+ if (e->next >= 0) {
+ const SEdge *n = &W.se[e->next];
+ if ((n->x2 - e->x2) * (cx - e->x2) + (n->y2 - e->y2) * (cy - e->y2) > 0) return;
+ }
+ } else {
+ float den = ex * ex + ey * ey;
+ px = (u * e->x1 + v * e->x2) / den, py = (u * e->y1 + v * e->y2) / den;
+ float dx = cx - px, dy = cy - py;
+ if (dx * dx + dy * dy > R * R) return;
+ }
+ float dx = px - cx, dy = py - cy, d = sqrtf(dx * dx + dy * dy);
+ float nx, ny;
+ if (d > 1e-9f) nx = dx / d, ny = dy / d;
+ else {
+ float l = sqrtf(ex * ex + ey * ey);
+ nx = ey / l, ny = -ex / l;
+ }
+ m->n = 1, m->nx = nx, m->ny = ny, m->id[0] = 0;
+ m->sep[0] = d - R;
+ m->px[0] = 0.5f * (cx + nx * r + px - nx * SKIN);
+ m->py[0] = 0.5f * (cy + ny * r + py - ny * SKIN);
+}
+
+/* a polygon (A) on a circle (B) */
+static void coll_pc(const SPoly *p, float cx, float cy, float r, Man *m) {
+ m->n = 0;
+ float R = r + SKIN, sep = -1e30f;
+ int ni = 0;
+ for (int k = 0; k < p->n; k++) {
+ float s = p->nx[k] * (cx - p->x[k]) + p->ny[k] * (cy - p->y[k]);
+ if (s > R) return;
+ if (s > sep) sep = s, ni = k;
+ }
+ int n2 = (ni + 1) % p->n;
+ float x1 = p->x[ni], y1 = p->y[ni], x2 = p->x[n2], y2 = p->y[n2];
+ float nx = p->nx[ni], ny = p->ny[ni], qx, qy;
+ if (sep < 1e-6f) {
+ qx = cx - nx * sep, qy = cy - ny * sep;
+ } else {
+ float u1 = (cx - x1) * (x2 - x1) + (cy - y1) * (y2 - y1);
+ float u2 = (cx - x2) * (x1 - x2) + (cy - y2) * (y1 - y2);
+ if (u1 <= 0 || u2 <= 0) {
+ qx = u1 <= 0 ? x1 : x2, qy = u1 <= 0 ? y1 : y2;
+ float dx = cx - qx, dy = cy - qy, d2 = dx * dx + dy * dy;
+ if (d2 > R * R) return;
+ float d = sqrtf(d2);
+ if (d < 1e-9f) return;
+ nx = dx / d, ny = dy / d;
+ sep = d;
+ } else {
+ qx = cx - nx * sep, qy = cy - ny * sep;
+ }
+ }
+ m->n = 1, m->nx = nx, m->ny = ny, m->id[0] = 0;
+ m->sep[0] = sep - R;
+ m->px[0] = 0.5f * (qx + nx * SKIN + cx - nx * r);
+ m->py[0] = 0.5f * (qy + ny * SKIN + cy - ny * r);
+}
+
+static float max_sep(int *edge, const SPoly *a, const SPoly *b) {
+ float best = -1e30f;
+ int bi = 0;
+ for (int i = 0; i < a->n; i++) {
+ float si = 1e30f;
+ for (int j = 0; j < b->n; j++) {
+ float s = a->nx[i] * (b->x[j] - a->x[i]) + a->ny[i] * (b->y[j] - a->y[i]);
+ if (s < si) si = s;
+ }
+ if (si > best) best = si, bi = i;
+ }
+ *edge = bi;
+ return best;
+}
+
+static int clip(float *ox, float *oy, uint8_t *oid, const float *ix, const float *iy, const uint8_t *iid, float nx,
+ float ny, float off) {
+ int n = 0;
+ float d0 = nx * ix[0] + ny * iy[0] - off, d1 = nx * ix[1] + ny * iy[1] - off;
+ if (d0 <= 0) ox[n] = ix[0], oy[n] = iy[0], oid[n++] = iid[0];
+ if (d1 <= 0) ox[n] = ix[1], oy[n] = iy[1], oid[n++] = iid[1];
+ if (d0 * d1 < 0) {
+ float t = d0 / (d0 - d1);
+ ox[n] = ix[0] + t * (ix[1] - ix[0]), oy[n] = iy[0] + t * (iy[1] - iy[0]), oid[n++] = iid[0];
+ }
+ return n;
+}
+
+/* two polygons (an edge is a polygon of two sides) */
+static void coll_pp(const SPoly *a, const SPoly *b, Man *m) {
+ m->n = 0;
+ float R = 2 * SKIN;
+ int ea, eb;
+ float sa = max_sep(&ea, a, b);
+ if (sa > R) return;
+ float sb = max_sep(&eb, b, a);
+ if (sb > R) return;
+ const SPoly *p1 = a, *p2 = b;
+ int e1 = ea, flip = 0;
+ if (sb > sa + 0.1f * SLOP) p1 = b, p2 = a, e1 = eb, flip = 1;
+ float n1x = p1->nx[e1], n1y = p1->ny[e1];
+ int idx = 0;
+ float mind = 1e30f;
+ for (int i = 0; i < p2->n; i++) {
+ float d = n1x * p2->nx[i] + n1y * p2->ny[i];
+ if (d < mind) mind = d, idx = i;
+ }
+ int i2 = (idx + 1) % p2->n;
+ float ix[2] = {p2->x[idx], p2->x[i2]}, iy[2] = {p2->y[idx], p2->y[i2]};
+ uint8_t iid[2] = {(uint8_t)idx, (uint8_t)i2};
+ int e2 = (e1 + 1) % p1->n;
+ float v1x = p1->x[e1], v1y = p1->y[e1], v2x = p1->x[e2], v2y = p1->y[e2];
+ float tx = v2x - v1x, ty = v2y - v1y, tl = sqrtf(tx * tx + ty * ty);
+ if (tl < 1e-9f) return;
+ tx /= tl, ty /= tl;
+ float nx = ty, ny = -tx;
+ float front = nx * v1x + ny * v1y;
+ float side1 = -(tx * v1x + ty * v1y) + R, side2 = tx * v2x + ty * v2y + R;
+ float c1x[3], c1y[3], c2x[3], c2y[3];
+ uint8_t c1i[3], c2i[3];
+ if (clip(c1x, c1y, c1i, ix, iy, iid, -tx, -ty, side1) < 2) return;
+ if (clip(c2x, c2y, c2i, c1x, c1y, c1i, tx, ty, side2) < 2) return;
+ m->nx = flip ? -nx : nx, m->ny = flip ? -ny : ny;
+ for (int k = 0; k < 2; k++) {
+ float s = nx * c2x[k] + ny * c2y[k] - front;
+ if (s <= R) {
+ m->px[m->n] = c2x[k] - 0.5f * s * nx;
+ m->py[m->n] = c2y[k] - 0.5f * s * ny;
+ m->sep[m->n] = s - R;
+ m->id[m->n] = (uint8_t)(c2i[k] | flip << 4);
+ m->n++;
+ }
+ }
+}
+
+static void collide_bodies(const Body *A, const Body *B, Man *m) {
+ if (A->shape == SH_CIRCLE && B->shape == SH_CIRCLE) coll_cc(A->x, A->y, A->r, B->x, B->y, B->r, m);
+ else if (A->shape == SH_BOX && B->shape == SH_CIRCLE) {
+ SPoly p;
+ body_poly(A, &p);
+ coll_pc(&p, B->x, B->y, B->r, m);
+ } else if (A->shape == SH_CIRCLE) {
+ SPoly p;
+ body_poly(B, &p);
+ coll_pc(&p, A->x, A->y, A->r, m);
+ m->nx = -m->nx, m->ny = -m->ny;
+ } else {
+ SPoly p, q;
+ body_poly(A, &p);
+ body_poly(B, &q);
+ coll_pp(&p, &q, m);
+ }
+}
+
+static void collide_static(const Body *A, int s, Man *m) {
+ m->n = 0;
+ if (s < MAX_SCIRCLES) {
+ const SCircle *c = &W.sc[s];
+ if (A->shape == SH_CIRCLE) coll_cc(A->x, A->y, A->r, c->x, c->y, c->r, m);
+ else {
+ SPoly p;
+ body_poly(A, &p);
+ coll_pc(&p, c->x, c->y, c->r, m);
+ }
+ } else if (s < MAX_SCIRCLES + MAX_SEDGES) {
+ const SEdge *e = &W.se[s - MAX_SCIRCLES];
+ if (A->shape == SH_CIRCLE) coll_ce(A->x, A->y, A->r, e, m);
+ else {
+ SPoly p, q;
+ body_poly(A, &p);
+ edge_poly(e, &q);
+ coll_pp(&p, &q, m);
+ }
+ } else {
+ const SPoly *q = &W.sp[s - MAX_SCIRCLES - MAX_SEDGES];
+ if (A->shape == SH_CIRCLE) {
+ coll_pc(q, A->x, A->y, A->r, m);
+ m->nx = -m->nx, m->ny = -m->ny;
+ } else {
+ SPoly p;
+ body_poly(A, &p);
+ coll_pp(&p, q, m);
+ }
+ }
+}
+
+static void body_box(const Body *b, float *x0, float *y0, float *x1, float *y1) {
+ float e = b->shape == SH_CIRCLE ? b->r : sqrtf(b->hx * b->hx + b->hy * b->hy);
+ *x0 = b->x - e, *x1 = b->x + e, *y0 = b->y - e, *y1 = b->y + e;
+}
+
+static const Warm *warm_find(uint32_t key) {
+ int lo = 0, hi = W.nwarm - 1;
+ while (lo <= hi) {
+ int mid = (lo + hi) >> 1;
+ if (W.warm[mid].key == key) return &W.warm[mid];
+ if (W.warm[mid].key < key) lo = mid + 1;
+ else hi = mid - 1;
+ }
+ return NULL;
+}
+
+static void add_contact(int a, int b, int sid, const Man *m) {
+ if (W.nc >= MAX_CONTACTS || !m->n) return;
+ Contact *c = &W.c[W.nc++];
+ const Body *A = &W.b[a];
+ float frb = b ? W.b[b].fr : 0.2f; /* (a static fixture: Box2D's default friction) */
+ c->key = (uint32_t)a << 24 | (uint32_t)(b ? b : 256 + sid);
+ c->a = (uint8_t)a, c->b = (uint8_t)b, c->sid = (uint16_t)sid, c->n = (uint8_t)m->n;
+ c->nx = m->nx, c->ny = m->ny, c->fr = sqrtf(A->fr * frb);
+ const Warm *w = warm_find(c->key);
+ for (int k = 0; k < m->n; k++) {
+ CPoint *p = &c->p[k];
+ p->ni = w && k < 2 ? w->ni[k] : 0;
+ p->ti = w && k < 2 ? w->ti[k] : 0;
+ p->rax = m->px[k] - A->x, p->ray = m->py[k] - A->y;
+ p->rbx = m->px[k] - W.b[b].x, p->rby = m->py[k] - W.b[b].y;
+ }
+}
+
+static int cmp_warm(const void *x, const void *y) {
+ uint32_t a = ((const Warm *)x)->key, b = ((const Warm *)y)->key;
+ return a < b ? -1 : a > b;
+}
+
+static void find_contacts(void) {
+ /* last step's impulses, to start from (warm starting) */
+ W.nwarm = W.nc;
+ for (int i = 0; i < W.nc; i++) {
+ W.warm[i].key = W.c[i].key;
+ for (int k = 0; k < 2; k++) W.warm[i].ni[k] = W.c[i].p[k].ni, W.warm[i].ti[k] = W.c[i].p[k].ti;
+ }
+ qsort(W.warm, (size_t)W.nwarm, sizeof W.warm[0], cmp_warm);
+ W.nc = 0;
+ /* moving bodies against each other: sorted by their left edge */
+ int n = 0;
+ for (int i = 1; i < W.nb; i++)
+ if (W.b[i].alive) {
+ float x0, y0, x1, y1;
+ body_box(&W.b[i], &x0, &y0, &x1, &y1);
+ W.minx[i] = x0;
+ int k = n++;
+ while (k > 0 && W.minx[W.order[k - 1]] > x0) W.order[k] = W.order[k - 1], k--;
+ W.order[k] = (uint8_t)i;
+ }
+ for (int p = 0; p < n; p++) {
+ int i = W.order[p];
+ const Body *A = &W.b[i];
+ float ax0, ay0, ax1, ay1;
+ body_box(A, &ax0, &ay0, &ax1, &ay1);
+ for (int q = p + 1; q < n; q++) {
+ int j = W.order[q];
+ const Body *B = &W.b[j];
+ if (W.minx[j] > ax1) break;
+ if (A->pinned && B->pinned && A->ii == 0 && B->ii == 0) continue;
+ float bx0, by0, bx1, by1;
+ body_box(B, &bx0, &by0, &bx1, &by1);
+ if (by0 > ay1 || by1 < ay0) continue;
+ int a = i < j ? i : j, b = i < j ? j : i;
+ Man m;
+ collide_bodies(&W.b[a], &W.b[b], &m);
+ add_contact(a, b, 0, &m);
+ }
+ }
+ /* against the static shapes, through the grid */
+ for (int p = 0; p < n; p++) {
+ int i = W.order[p];
+ const Body *A = &W.b[i];
+ if (A->pinned && A->ii == 0) continue;
+ float x0, y0, x1, y1;
+ body_box(A, &x0, &y0, &x1, &y1);
+ if (++W.stamp_now == 0) memset(W.stamp, 0, sizeof W.stamp), W.stamp_now = 1;
+ for (int cy = cell_of(y0); cy <= cell_of(y1); cy++)
+ for (int cx = cell_of(x0); cx <= cell_of(x1); cx++) {
+ int c = cy * GRID + cx;
+ for (int t = W.cell_start[c]; t < W.cell_start[c + 1]; t++) {
+ int s = W.cell_items[t];
+ if (W.stamp[s] == W.stamp_now) continue;
+ W.stamp[s] = W.stamp_now;
+ Man m;
+ collide_static(A, s, &m);
+ add_contact(i, 0, s, &m);
+ }
+ }
+ }
+}
+
+/* ---- the solver ---- */
+
+static void contact_masses(Contact *c) {
+ const Body *A = &W.b[c->a], *B = &W.b[c->b];
+ float tx = c->ny, ty = -c->nx;
+ float ima = A->pinned ? 0 : A->im, imb = B->pinned ? 0 : B->im;
+ for (int k = 0; k < c->n; k++) {
+ CPoint *p = &c->p[k];
+ float rna = cross(p->rax, p->ray, c->nx, c->ny), rnb = cross(p->rbx, p->rby, c->nx, c->ny);
+ float kn = ima + imb + A->ii * rna * rna + B->ii * rnb * rnb;
+ p->nm = kn > 0 ? 1 / kn : 0;
+ float rta = cross(p->rax, p->ray, tx, ty), rtb = cross(p->rbx, p->rby, tx, ty);
+ float kt = ima + imb + A->ii * rta * rta + B->ii * rtb * rtb;
+ p->tm = kt > 0 ? 1 / kt : 0;
+ }
+}
+
+static inline void apply(Body *A, Body *B, float rax, float ray, float rbx, float rby, float px, float py) {
+ float ima = A->pinned ? 0 : A->im, imb = B->pinned ? 0 : B->im;
+ A->vx -= ima * px, A->vy -= ima * py, A->w -= A->ii * cross(rax, ray, px, py);
+ B->vx += imb * px, B->vy += imb * py, B->w += B->ii * cross(rbx, rby, px, py);
+}
+
+static void warm_start(void) {
+ for (int i = 0; i < W.nc; i++) {
+ Contact *c = &W.c[i];
+ float tx = c->ny, ty = -c->nx;
+ for (int k = 0; k < c->n; k++) {
+ CPoint *p = &c->p[k];
+ apply(&W.b[c->a], &W.b[c->b], p->rax, p->ray, p->rbx, p->rby, p->ni * c->nx + p->ti * tx, p->ni * c->ny + p->ti * ty);
+ }
+ }
+}
+
+static void solve_contacts(void) {
+ for (int i = 0; i < W.nc; i++) {
+ Contact *c = &W.c[i];
+ Body *A = &W.b[c->a], *B = &W.b[c->b];
+ float tx = c->ny, ty = -c->nx;
+ for (int k = 0; k < c->n; k++) {
+ CPoint *p = &c->p[k];
+ float dvx = B->vx - B->w * p->rby - A->vx + A->w * p->ray;
+ float dvy = B->vy + B->w * p->rbx - A->vy - A->w * p->rax;
+ float vt = dvx * tx + dvy * ty, lam = -p->tm * vt, maxf = c->fr * p->ni;
+ float nt = p->ti + lam;
+ nt = nt < -maxf ? -maxf : nt > maxf ? maxf : nt;
+ lam = nt - p->ti, p->ti = nt;
+ apply(A, B, p->rax, p->ray, p->rbx, p->rby, lam * tx, lam * ty);
+ }
+ for (int k = 0; k < c->n; k++) {
+ CPoint *p = &c->p[k];
+ float dvx = B->vx - B->w * p->rby - A->vx + A->w * p->ray;
+ float dvy = B->vy + B->w * p->rbx - A->vy - A->w * p->rax;
+ float vn = dvx * c->nx + dvy * c->ny, lam = -p->nm * vn;
+ float nn = p->ni + lam;
+ if (nn < 0) nn = 0;
+ lam = nn - p->ni, p->ni = nn;
+ apply(A, B, p->rax, p->ray, p->rbx, p->rby, lam * c->nx, lam * c->ny);
+ }
+ }
+}
+
+static bool solve_positions(void) {
+ float minsep = 0;
+ for (int i = 0; i < W.nc; i++) {
+ Contact *c = &W.c[i];
+ Body *A = &W.b[c->a], *B = &W.b[c->b];
+ Man m;
+ if (c->b) collide_bodies(A, B, &m);
+ else collide_static(A, c->sid, &m);
+ float ima = A->pinned ? 0 : A->im, imb = B->pinned ? 0 : B->im;
+ for (int k = 0; k < m.n; k++) {
+ float rax = m.px[k] - A->x, ray = m.py[k] - A->y, rbx = m.px[k] - B->x, rby = m.py[k] - B->y;
+ float s = m.sep[k];
+ if (s < minsep) minsep = s;
+ float C = BAUM * (s + SLOP);
+ C = C < -MAX_CORR ? -MAX_CORR : C > 0 ? 0 : C;
+ float rna = cross(rax, ray, m.nx, m.ny), rnb = cross(rbx, rby, m.nx, m.ny);
+ float K = ima + imb + A->ii * rna * rna + B->ii * rnb * rnb;
+ float imp = K > 0 ? -C / K : 0, px = imp * m.nx, py = imp * m.ny;
+ A->x -= ima * px, A->y -= ima * py, A->a -= A->ii * cross(rax, ray, px, py);
+ B->x += imb * px, B->y += imb * py, B->a += B->ii * cross(rbx, rby, px, py);
+ if (A->shape == SH_BOX) A->c = cosf(A->a), A->s = sinf(A->a);
+ if (B->shape == SH_BOX) B->c = cosf(B->a), B->s = sinf(B->a);
+ if (c->b == 0) { /* (the ground does not move) */
+ B->x = B->y = B->a = 0;
+ }
+ }
+ }
+ return minsep >= -3 * SLOP;
+}
+
+/* ---- joints (Box2D's b2RopeJoint, b2DistanceJoint, b2FrictionJoint) ---- */
+
+static void local_anchor(const Body *b, float x, float y, float *lx, float *ly) {
+ float dx = x - b->x, dy = y - b->y;
+ *lx = b->c * dx + b->s * dy, *ly = -b->s * dx + b->c * dy;
+}
+
+static int new_joint(int type, int a, int b, float ax, float ay, float bx, float by) {
+ if (W.nj >= MAX_JOINTS) return -1;
+ Joint *j = &W.j[W.nj];
+ memset(j, 0, sizeof *j);
+ j->type = (uint8_t)type, j->alive = 1, j->a = (uint8_t)a, j->b = (uint8_t)b;
+ local_anchor(&W.b[a], ax, ay, &j->lax, &j->lay);
+ local_anchor(&W.b[b], bx, by, &j->lbx, &j->lby);
+ return W.nj++;
+}
+
+int ph_rope(int a, int b, float ax, float ay, float bx, float by, float len) {
+ int k = new_joint(J_ROPE, a, b, ax, ay, bx, by);
+ if (k >= 0) W.j[k].len = len;
+ return k;
+}
+int ph_dist(int a, int b, float ax, float ay, float bx, float by) {
+ int k = new_joint(J_DIST, a, b, ax, ay, bx, by);
+ if (k >= 0) W.j[k].len = sqrtf((bx - ax) * (bx - ax) + (by - ay) * (by - ay));
+ return k;
+}
+int ph_fric(int a, int b, float ax, float ay, float maxf, float maxt) {
+ int k = new_joint(J_FRIC, a, b, ax, ay, ax, ay);
+ if (k >= 0) W.j[k].maxf = maxf, W.j[k].maxt = maxt;
+ return k;
+}
+
+static void joint_rs(Joint *j, const Body *A, const Body *B) {
+ j->rax = A->c * j->lax - A->s * j->lay, j->ray = A->s * j->lax + A->c * j->lay;
+ j->rbx = B->c * j->lbx - B->s * j->lby, j->rby = B->s * j->lbx + B->c * j->lby;
+}
+
+void ph_joint_anchors(const Joint *j, float *ax, float *ay, float *bx, float *by) {
+ const Body *A = &W.b[j->a], *B = &W.b[j->b];
+ *ax = A->x + A->c * j->lax - A->s * j->lay, *ay = A->y + A->s * j->lax + A->c * j->lay;
+ *bx = B->x + B->c * j->lbx - B->s * j->lby, *by = B->y + B->s * j->lbx + B->c * j->lby;
+}
+
+static void joints_init(void) {
+ for (int k = 0; k < W.nj; k++) {
+ Joint *j = &W.j[k];
+ if (!j->alive) continue;
+ Body *A = &W.b[j->a], *B = &W.b[j->b];
+ float ima = A->pinned ? 0 : A->im, imb = B->pinned ? 0 : B->im;
+ joint_rs(j, A, B);
+ if (j->type == J_FRIC) {
+ float a = ima + imb, ia = A->ii, ib = B->ii;
+ float k11 = a + ia * j->ray * j->ray + ib * j->rby * j->rby, k12 = -ia * j->rax * j->ray - ib * j->rbx * j->rby;
+ float k22 = a + ia * j->rax * j->rax + ib * j->rbx * j->rbx, det = k11 * k22 - k12 * k12;
+ if (det != 0) det = 1 / det;
+ j->m11 = det * k22, j->m12 = -det * k12, j->m22 = det * k11;
+ j->am = ia + ib > 0 ? 1 / (ia + ib) : 0;
+ apply(A, B, j->rax, j->ray, j->rbx, j->rby, j->fix, j->fiy);
+ A->w -= ia * j->fia, B->w += ib * j->fia;
+ continue;
+ }
+ float ux = B->x + j->rbx - A->x - j->rax, uy = B->y + j->rby - A->y - j->ray, l = sqrtf(ux * ux + uy * uy);
+ j->mass = 0;
+ if (l > SLOP) {
+ ux /= l, uy /= l;
+ float cra = cross(j->rax, j->ray, ux, uy), crb = cross(j->rbx, j->rby, ux, uy);
+ float m = ima + A->ii * cra * cra + imb + B->ii * crb * crb;
+ j->mass = m != 0 ? 1 / m : 0;
+ } else {
+ ux = uy = 0;
+ if (j->type == J_ROPE) j->imp = 0;
+ }
+ j->ux = ux, j->uy = uy;
+ j->ux = ux, j->uy = uy;
+ /* (the rope keeps its length to tell how slack it is) */
+ j->fix = l;
+ apply(A, B, j->rax, j->ray, j->rbx, j->rby, j->imp * ux, j->imp * uy);
+ }
+}
+
+static void joints_solve(void) {
+ for (int k = 0; k < W.nj; k++) {
+ Joint *j = &W.j[k];
+ if (!j->alive) continue;
+ Body *A = &W.b[j->a], *B = &W.b[j->b];
+ float dvx = B->vx - B->w * j->rby - A->vx + A->w * j->ray;
+ float dvy = B->vy + B->w * j->rbx - A->vy - A->w * j->rax;
+ if (j->type == J_FRIC) {
+ float ia = A->ii, ib = B->ii;
+ float wd = B->w - A->w, imp = -j->am * wd, old = j->fia, maxi = DT * j->maxt;
+ j->fia = old + imp;
+ j->fia = j->fia < -maxi ? -maxi : j->fia > maxi ? maxi : j->fia;
+ imp = j->fia - old;
+ A->w -= ia * imp, B->w += ib * imp;
+ dvx = B->vx - B->w * j->rby - A->vx + A->w * j->ray;
+ dvy = B->vy + B->w * j->rbx - A->vy - A->w * j->rax;
+ float ix = -(j->m11 * dvx + j->m12 * dvy), iy = -(j->m12 * dvx + j->m22 * dvy);
+ float ox = j->fix, oy = j->fiy, maxf = DT * j->maxf;
+ j->fix += ix, j->fiy += iy;
+ float l2 = j->fix * j->fix + j->fiy * j->fiy;
+ if (l2 > maxf * maxf) {
+ float s = maxf / sqrtf(l2);
+ j->fix *= s, j->fiy *= s;
+ }
+ apply(A, B, j->rax, j->ray, j->rbx, j->rby, j->fix - ox, j->fiy - oy);
+ continue;
+ }
+ float cdot = j->ux * dvx + j->uy * dvy;
+ float imp;
+ if (j->type == J_ROPE) {
+ float C = j->fix - j->len;
+ if (C < 0) cdot += C / DT;
+ imp = -j->mass * cdot;
+ float old = j->imp;
+ j->imp = old + imp < 0 ? old + imp : 0;
+ imp = j->imp - old;
+ } else {
+ imp = -j->mass * cdot;
+ j->imp += imp;
+ }
+ apply(A, B, j->rax, j->ray, j->rbx, j->rby, imp * j->ux, imp * j->uy);
+ }
+}
+
+static bool joints_positions(void) {
+ bool ok = true;
+ for (int k = 0; k < W.nj; k++) {
+ Joint *j = &W.j[k];
+ if (!j->alive || j->type == J_FRIC) continue;
+ Body *A = &W.b[j->a], *B = &W.b[j->b];
+ float ima = A->pinned ? 0 : A->im, imb = B->pinned ? 0 : B->im;
+ joint_rs(j, A, B);
+ float ux = B->x + j->rbx - A->x - j->rax, uy = B->y + j->rby - A->y - j->ray, l = sqrtf(ux * ux + uy * uy);
+ if (l < 1e-9f) continue;
+ ux /= l, uy /= l;
+ float C = l - j->len;
+ if (j->type == J_ROPE) C = C < 0 ? 0 : C > MAX_CORR ? MAX_CORR : C;
+ else C = C < -MAX_CORR ? -MAX_CORR : C > MAX_CORR ? MAX_CORR : C;
+ float cra = cross(j->rax, j->ray, ux, uy), crb = cross(j->rbx, j->rby, ux, uy);
+ float m = ima + A->ii * cra * cra + imb + B->ii * crb * crb;
+ float imp = m > 0 ? -C / m : 0, px = imp * ux, py = imp * uy;
+ A->x -= ima * px, A->y -= ima * py, A->a -= A->ii * cross(j->rax, j->ray, px, py);
+ B->x += imb * px, B->y += imb * py, B->a += B->ii * cross(j->rbx, j->rby, px, py);
+ A->c = cosf(A->a), A->s = sinf(A->a), B->c = cosf(B->a), B->s = sinf(B->a);
+ if (j->a == 0) A->x = A->y = A->a = 0, A->c = 1, A->s = 0;
+ if (j->b == 0) B->x = B->y = B->a = 0, B->c = 1, B->s = 0;
+ if ((j->type == J_ROPE ? l - j->len : fabsf(l - j->len)) > SLOP) ok = false;
+ }
+ return ok;
+}
+
+/* a fast circle may not jump through a wall: it stops where its sweep first meets one (Box2D sweeps every
+ * moving body against the static ones) */
+static float sweep_circle(float x0, float y0, float dx, float dy, float cx, float cy, float R) {
+ float fx = x0 - cx, fy = y0 - cy;
+ float a = dx * dx + dy * dy, b = fx * dx + fy * dy, c = fx * fx + fy * fy - R * R;
+ if (c < 0 || a < 1e-12f) return 1; /* already touching: the contact handles it */
+ float disc = b * b - a * c;
+ if (disc < 0) return 1;
+ float t = (-b - sqrtf(disc)) / a;
+ return t >= 0 && t < 1 ? t : 1;
+}
+
+static void sweep(Body *b) {
+ float dx = b->x - b->sx, dy = b->y - b->sy;
+ if (dx * dx + dy * dy < 0.25f * b->r * b->r) return;
+ float R = b->r - SLOP, best = 1;
+ float x0 = fminf(b->sx, b->x) - b->r, x1 = fmaxf(b->sx, b->x) + b->r;
+ float y0 = fminf(b->sy, b->y) - b->r, y1 = fmaxf(b->sy, b->y) + b->r;
+ if (++W.stamp_now == 0) memset(W.stamp, 0, sizeof W.stamp), W.stamp_now = 1;
+ for (int cy = cell_of(y0); cy <= cell_of(y1); cy++)
+ for (int cx = cell_of(x0); cx <= cell_of(x1); cx++) {
+ int c = cy * GRID + cx;
+ for (int t = W.cell_start[c]; t < W.cell_start[c + 1]; t++) {
+ int s = W.cell_items[t];
+ if (W.stamp[s] == W.stamp_now) continue;
+ W.stamp[s] = W.stamp_now;
+ float hit = 1;
+ if (s < MAX_SCIRCLES) hit = sweep_circle(b->sx, b->sy, dx, dy, W.sc[s].x, W.sc[s].y, W.sc[s].r + R);
+ else if (s < MAX_SCIRCLES + MAX_SEDGES) {
+ const SEdge *e = &W.se[s - MAX_SCIRCLES];
+ float ex = e->x2 - e->x1, ey = e->y2 - e->y1, el = sqrtf(ex * ex + ey * ey);
+ if (el < 1e-9f) continue;
+ float nx = ey / el, ny = -ex / el;
+ float d0 = (b->sx - e->x1) * nx + (b->sy - e->y1) * ny, dd = dx * nx + dy * ny;
+ if (d0 < 0) d0 = -d0, dd = -dd;
+ if (d0 > R && dd < 0) {
+ float t = (d0 - R) / -dd;
+ if (t < 1) {
+ float px = b->sx + dx * t, py = b->sy + dy * t;
+ float u = ((px - e->x1) * ex + (py - e->y1) * ey) / (el * el);
+ if (u >= 0 && u <= 1) hit = t;
+ }
+ }
+ float h1 = sweep_circle(b->sx, b->sy, dx, dy, e->x1, e->y1, R), h2 = sweep_circle(b->sx, b->sy, dx, dy, e->x2, e->y2, R);
+ if (h1 < hit) hit = h1;
+ if (h2 < hit) hit = h2;
+ }
+ if (hit < best) best = hit;
+ }
+ }
+ if (best < 1) b->x = b->sx + dx * best, b->y = b->sy + dy * best;
+}
+
+void ph_step(void) {
+ find_contacts();
+ for (int i = 1; i < W.nb; i++) {
+ Body *b = &W.b[i];
+ if (!b->alive) continue;
+ b->sx = b->x, b->sy = b->y;
+ if (!b->pinned && b->im > 0) {
+ b->vx += DT * W.gx, b->vy += DT * W.gy;
+ b->vx *= 1 / (1 + DT * b->ld), b->vy *= 1 / (1 + DT * b->ld);
+ }
+ if (b->pinned) b->vx = b->vy = 0;
+ b->w *= 1 / (1 + DT * b->ad);
+ }
+ for (int i = 0; i < W.nc; i++) contact_masses(&W.c[i]);
+ warm_start();
+ joints_init();
+ for (int it = 0; it < ITER_V; it++) {
+ joints_solve();
+ solve_contacts();
+ }
+ for (int i = 1; i < W.nb; i++) {
+ Body *b = &W.b[i];
+ if (!b->alive) continue;
+ float tx = DT * b->vx, ty = DT * b->vy;
+ if (tx * tx + ty * ty > MAX_TRANS * MAX_TRANS) {
+ float s = MAX_TRANS / sqrtf(tx * tx + ty * ty);
+ b->vx *= s, b->vy *= s;
+ }
+ float r = DT * b->w;
+ if (r * r > MAX_ROT * MAX_ROT) b->w *= MAX_ROT / fabsf(r);
+ if (!b->pinned) b->x += DT * b->vx, b->y += DT * b->vy;
+ b->a += DT * b->w;
+ b->c = cosf(b->a), b->s = sinf(b->a);
+ }
+ for (int it = 0; it < ITER_P; it++) {
+ bool a = solve_positions();
+ bool b = joints_positions();
+ if (a && b) break;
+ }
+ for (int i = 1; i < W.nb; i++)
+ if (W.b[i].alive && W.b[i].shape == SH_CIRCLE && W.b[i].im > 0) sweep(&W.b[i]);
+}
+
+bool ph_overlaps(int i, float x, float y, float r) {
+ const Body *b = &W.b[i];
+ if (b->shape == SH_CIRCLE) return (b->x - x) * (b->x - x) + (b->y - y) * (b->y - y) < (b->r + r) * (b->r + r);
+ SPoly p;
+ body_poly(b, &p);
+ Man m;
+ coll_pc(&p, x, y, r, &m);
+ return m.n > 0;
+}
diff --git a/games/circloo/src/phys.h b/games/circloo/src/phys.h
new file mode 100644
index 00000000..f4f4078d
--- /dev/null
+++ b/games/circloo/src/phys.h
@@ -0,0 +1,111 @@
+/* circloO's physics: the parts of Box2D (2.3) the game uses, set up as GameMaker does.
+ *
+ * Meters inside (50 pixels a meter), y down. Body 0 is the ground: every static shape (circles, edges,
+ * boxes, triangles) belongs to it. Moving bodies are circles, or boxes turning on a pin at their middle
+ * (the game's rotating bars). Joints: rope, distance and friction. One step is 1/60 s with 10 velocity and
+ * 10 position iterations, as GameMaker runs Box2D. */
+#ifndef CO_PHYS_H
+#define CO_PHYS_H
+#include <stdbool.h>
+#include <stdint.h>
+
+#define PX_M 0.02f /* meters a pixel */
+#define MAX_BODIES 128
+#define MAX_SCIRCLES 256
+#define MAX_SEDGES 800
+#define MAX_SPOLYS 24
+#define MAX_CONTACTS 360
+#define MAX_JOINTS 40
+#define NSTATIC (MAX_SCIRCLES + MAX_SEDGES + MAX_SPOLYS)
+
+enum { SH_CIRCLE, SH_BOX };
+
+typedef struct {
+ float x, y, a; /* place (m), angle (rad) */
+ float vx, vy, w;
+ float im, ii; /* 1/mass, 1/inertia (0: does not move / turn) */
+ float ld, ad; /* linear and angular damping */
+ float fr; /* friction */
+ float r, hx, hy; /* circle radius, or the box's half sizes */
+ float c, s; /* cos and sin of a */
+ float sx, sy; /* place at the start of the step (sweeps) */
+ uint8_t shape, alive, pinned, user;
+} Body;
+
+typedef struct { float x, y, r; } SCircle;
+typedef struct {
+ float x1, y1, x2, y2;
+ int16_t prev, next; /* the neighbours in a chain (Box2D's ghost vertices), -1 if none */
+} SEdge;
+typedef struct {
+ uint8_t n;
+ float x[4], y[4], nx[4], ny[4];
+} SPoly;
+
+enum { J_ROPE, J_DIST, J_FRIC };
+typedef struct {
+ uint8_t type, alive, a, b;
+ float lax, lay, lbx, lby; /* anchors, in each body's frame */
+ float len; /* rope: max length; distance: length */
+ float maxf, maxt; /* friction joint */
+ float ux, uy, rax, ray, rbx, rby, mass, imp; /* solver */
+ float fix, fiy, fia, m11, m12, m22, am;
+} Joint;
+
+typedef struct {
+ float rax, ray, rbx, rby, ni, ti, nm, tm;
+} CPoint;
+typedef struct {
+ uint32_t key;
+ uint8_t a, b; /* b is 0 for the ground */
+ uint16_t sid; /* the static shape, for the ground */
+ uint8_t n;
+ float nx, ny, fr;
+ CPoint p[2];
+} Contact;
+typedef struct { uint32_t key; float ni[2], ti[2]; } Warm;
+
+typedef struct {
+ Body b[MAX_BODIES];
+ int nb;
+ SCircle sc[MAX_SCIRCLES];
+ SEdge se[MAX_SEDGES];
+ SPoly sp[MAX_SPOLYS];
+ int nsc, nse, nsp;
+ int keep_se; /* edges below this stay: the level's boundary comes after them */
+ Joint j[MAX_JOINTS];
+ int nj;
+ Contact c[MAX_CONTACTS];
+ int nc;
+ Warm warm[MAX_CONTACTS];
+ int nwarm;
+ float gx, gy;
+ /* the static shapes by grid cell (2 m, the room is 60 m) */
+ uint16_t cell_start[30 * 30 + 1];
+ uint16_t cell_items[3072];
+ uint16_t stamp[NSTATIC];
+ uint16_t stamp_now;
+ uint8_t order[MAX_BODIES];
+ float minx[MAX_BODIES];
+} World;
+
+extern World W;
+
+void ph_reset(void);
+int ph_add_circle(float x, float y, float r, float density, float friction); /* a moving circle */
+int ph_add_rotor(float x, float y, float hx, float hy, float angle, float density, float adamp);
+void ph_static_circle(float x, float y, float r);
+void ph_static_edge(float x1, float y1, float x2, float y2);
+void ph_static_chain(const float *xy, int n, bool loop);
+void ph_static_poly(const float *xy, int n);
+void ph_build_grid(void);
+void ph_keep_statics(void); /* the static shapes so far stay; ph_drop_statics drops the later ones */
+void ph_drop_statics(void);
+int ph_rope(int a, int b, float ax, float ay, float bx, float by, float len);
+int ph_dist(int a, int b, float ax, float ay, float bx, float by);
+int ph_fric(int a, int b, float ax, float ay, float maxf, float maxt);
+void ph_kill(int body);
+void ph_step(void);
+void ph_joint_anchors(const Joint *j, float *ax, float *ay, float *bx, float *by);
+bool ph_overlaps(int i, float x, float y, float r); /* body i over the circle (x, y, r) */
+#endif
diff --git a/games/circloo/src/plat.h b/games/circloo/src/plat.h
new file mode 100644
index 00000000..ea8977e3
--- /dev/null
+++ b/games/circloo/src/plat.h
@@ -0,0 +1,38 @@
+/* circloO: the platform (the calculator, or a computer for tests).
+ *
+ * plat_eadk.c: the calculator's EADK display, keyboard, time and files.
+ * plat_host.c: a frame buffer that tests save as images, scripted keys and
+ * simulated time (tests/play.c). */
+#ifndef CO_PLAT_H
+#define CO_PLAT_H
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+
+/* keys held now, as bits */
+enum {
+ K_LEFT = 1 << 0, /* Left, 4: roll left */
+ K_RIGHT = 1 << 1, /* Right, 6: roll right */
+ K_UP = 1 << 2, /* Up, 8 */
+ K_DOWN = 1 << 3, /* Down, 2 */
+ K_OK = 1 << 4, /* OK, EXE, 5: choose */
+ K_BACK = 1 << 5, /* Back: pause, back a screen */
+ K_HOME = 1 << 6, /* Home, On/Off: save and quit */
+ K_ANY = 1 << 7
+};
+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); /* NULL if absent */
+/* a file of len bytes to write in place (the calculator's storage is RAM): plat_reserve gives its bytes,
+ * plat_reserved says they are written; NULL if there is no room */
+uint8_t *plat_reserve(const char *name, uint32_t len);
+void plat_reserved(const char *name, uint32_t len);
+bool plat_remove(const char *name);
+void plat_begin(void);
+int plat_end(void);
+bool plat_slow(void); /* an N0110 or N0115 (216 MHz, the N0120 has 550) */
+#endif
diff --git a/games/circloo/src/plat_eadk.c b/games/circloo/src/plat_eadk.c
new file mode 100644
index 00000000..c0c5e6aa
--- /dev/null
+++ b/games/circloo/src/plat_eadk.c
@@ -0,0 +1,38 @@
+/* The calculator: EADK display, keyboard, time and files. */
+#include <eadk.h>
+#include "../../common/epsilon_app.h"
+#include "../../common/epsilon_files.h"
+#include "plat.h"
+
+#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_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_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_ok) | KEY(eadk_key_exe) | KEY(eadk_key_five))) r |= K_OK;
+ if (k & KEY(eadk_key_back)) r |= K_BACK;
+ if (k & (KEY(eadk_key_home) | KEY(eadk_key_on_off))) r |= K_HOME;
+ if (k) r |= K_ANY;
+ 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}, 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); }
+uint8_t *plat_reserve(const char *name, uint32_t len) {
+ uint32_t n;
+ return ef_write(name, NULL, len) ? (uint8_t *)(uintptr_t)ef_read(name, &n) : NULL; /* (the storage is RAM) */
+}
+void plat_reserved(const char *name, uint32_t len) { (void)name, (void)len; }
+bool plat_remove(const char *name) { return ef_remove(name); }
+void plat_begin(void) { np_app_begin(); }
+int plat_end(void) { return np_app_end(); }
+bool plat_slow(void) { return epsilon_slow_model(); }
diff --git a/games/circloo/src/plat_host.c b/games/circloo/src/plat_host.c
new file mode 100644
index 00000000..73422b62
--- /dev/null
+++ b/games/circloo/src/plat_host.c
@@ -0,0 +1,71 @@
+/* A computer: the screen goes to a frame buffer that tests save as images,
+ * keys come from a script, time is simulated. */
+#include <stdio.h>
+#include <stdlib.h>
+#include "plat.h"
+#include "gfx.h"
+
+uint16_t host_fb[SCREEN_W * SCREEN_H];
+uint32_t host_time; /* ms */
+uint32_t host_keys;
+
+uint32_t plat_keys(void) { return host_keys; }
+uint32_t plat_millis(void) { return host_time; }
+void plat_sleep(uint32_t ms) { host_time += ms; }
+void plat_push(int x, int y, int w, int h, const uint16_t *px) {
+ for (int r = 0; r < h; r++)
+ for (int c = 0; c < w; c++)
+ if ((unsigned)(x + c) < SCREEN_W && (unsigned)(y + r) < SCREEN_H) host_fb[(y + r) * SCREEN_W + x + c] = px[r * w + c];
+}
+
+static char save_dir[256] = "build/host-saves";
+void host_save_dir(const char *d) { snprintf(save_dir, sizeof save_dir, "%s", d); }
+bool plat_save(const char *name, const void *data, uint32_t len) {
+ char p[512];
+ snprintf(p, sizeof p, "%s/%s", save_dir, name);
+ FILE *f = fopen(p, "wb");
+ if (!f) return false;
+ bool ok = fwrite(data, 1, len, f) == len;
+ fclose(f);
+ return ok;
+}
+/* (each file read gets its own buffer: callers may hold two at once) */
+static uint8_t loaded[4][1 << 16];
+static int next_load;
+const uint8_t *plat_load(const char *name, uint32_t *len) {
+ char p[512];
+ snprintf(p, sizeof p, "%s/%s", save_dir, name);
+ FILE *f = fopen(p, "rb");
+ if (!f) return NULL;
+ uint8_t *b = loaded[next_load++ & 3];
+ *len = (uint32_t)fread(b, 1, sizeof loaded[0], f);
+ fclose(f);
+ return b;
+}
+static uint8_t reserved[1 << 16];
+uint8_t *plat_reserve(const char *name, uint32_t len) {
+ (void)name;
+ return len <= sizeof reserved ? reserved : NULL;
+}
+void plat_reserved(const char *name, uint32_t len) { plat_save(name, reserved, len); }
+bool plat_remove(const char *name) {
+ char p[512];
+ snprintf(p, sizeof p, "%s/%s", save_dir, name);
+ return remove(p) == 0;
+}
+void plat_begin(void) {}
+int plat_end(void) { return 0; }
+bool plat_slow(void) { return false; }
+
+/* writes the screen as a PPM image */
+void host_shot(const char *path) {
+ FILE *f = fopen(path, "wb");
+ if (!f) return;
+ fprintf(f, "P6\n%d %d\n255\n", SCREEN_W, SCREEN_H);
+ for (int i = 0; i < SCREEN_W * SCREEN_H; i++) {
+ uint16_t c = host_fb[i];
+ uint8_t rgb[3] = {(uint8_t)((c >> 11) * 255 / 31), (uint8_t)(((c >> 5) & 63) * 255 / 63), (uint8_t)((c & 31) * 255 / 31)};
+ fwrite(rgb, 1, 3, f);
+ }
+ fclose(f);
+}
diff --git a/games/circloo/tests/play.c b/games/circloo/tests/play.c
new file mode 100644
index 00000000..bd7e024c
--- /dev/null
+++ b/games/circloo/tests/play.c
@@ -0,0 +1,141 @@
+/* Plays circloO on a computer with scripted keys and saves screenshots.
+ *
+ * play [--level N] [--hard] [--frames N] [--keys "10-40:right,50:ok,..."] [--shots 30,60|every:N] [--out DIR]
+ * [--saves DIR] [--auto] [--fuzz SEED] [--draw] [--trace N]
+ *
+ * A frame is one of the game's steps (1/60 s). Keys: left right up down ok back home. "a-b:key" holds it from
+ * frame a to b, "a:key" for one frame. --level starts that level past the menus. --auto rolls the ball towards
+ * the nearest circle it can take. --fuzz presses random keys through the menus and levels. Screenshots are
+ * DIR/shot_<frame>.ppm. At the end: END state S level L hard H taken T complete C frames F. */
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "../src/game.h"
+#include "../src/gfx.h"
+#include "../src/phys.h"
+#include "../src/plat.h"
+
+extern uint32_t host_keys, host_time;
+void host_shot(const char *path);
+void host_save_dir(const char *d);
+
+typedef struct { int a, b; uint32_t k; } Hold;
+static Hold holds[4096];
+static int nholds;
+static int shots[4096], nshots, every;
+
+static uint32_t key_of(const char *s) {
+ static const char *const names[] = {"left", "right", "up", "down", "ok", "back", "home"};
+ static const uint32_t bits[] = {K_LEFT, K_RIGHT, K_UP, K_DOWN, K_OK, K_BACK, K_HOME};
+ for (int i = 0; i < 7; i++)
+ if (!strcmp(s, names[i])) return bits[i];
+ fprintf(stderr, "unknown key %s\n", s);
+ exit(2);
+}
+
+static void parse_keys(const char *spec) {
+ static char buf[65536];
+ snprintf(buf, sizeof buf, "%s", spec);
+ for (char *tok = strtok(buf, ","); tok; tok = strtok(NULL, ",")) {
+ int a, b;
+ char k[16];
+ if (sscanf(tok, "%d-%d:%15s", &a, &b, k) == 3) holds[nholds++] = (Hold){a, b, key_of(k)};
+ else if (sscanf(tok, "%d:%15s", &a, k) == 2) holds[nholds++] = (Hold){a, a, key_of(k)};
+ }
+}
+
+static uint32_t rng = 1;
+static uint32_t rnd(void) {
+ rng ^= rng << 13, rng ^= rng >> 17, rng ^= rng << 5;
+ return rng;
+}
+
+/* rolls towards the nearest circle the ball can take */
+static uint32_t autoplay(void) {
+ if (g.state != S_PLAY || L.ball < 0) return 0;
+ const Body *b = &W.b[L.ball];
+ float best = 1e30f, tx = 0;
+ for (int k = 0; k < L.ncoll; k++) {
+ const Coll *c = &L.coll[k];
+ if (c->taken || c->io) continue;
+ float d = sqrtf((c->x - 1500) * (c->x - 1500) + (c->y - 1500) * (c->y - 1500));
+ if (d > L.R) continue;
+ float dx = c->x * PX_M - b->x, dy = c->y * PX_M - b->y, dd = dx * dx + dy * dy;
+ if (dd < best) best = dd, tx = dx;
+ }
+ if (best > 1e29f) return 0;
+ float want = tx * 2.0f; /* a speed towards it, m/s */
+ if (want > 6) want = 6;
+ if (want < -6) want = -6;
+ return b->vx < want - 0.3f ? K_RIGHT : b->vx > want + 0.3f ? K_LEFT : 0;
+}
+
+int main(int argc, char **argv) {
+ int level = 0, frames = 600, fuzz = -1, draw = 0, trace = 0, hard = 0, autop = 0;
+ const char *out = "build/shots";
+ for (int i = 1; i < argc; i++) {
+ if (!strcmp(argv[i], "--level") && i + 1 < argc) level = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "--hard")) hard = 1;
+ else if (!strcmp(argv[i], "--frames") && i + 1 < argc) frames = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "--keys") && i + 1 < argc) parse_keys(argv[++i]);
+ else if (!strcmp(argv[i], "--shots") && i + 1 < argc) {
+ const char *s = argv[++i];
+ if (!strncmp(s, "every:", 6)) every = atoi(s + 6);
+ else {
+ static char buf[65536];
+ snprintf(buf, sizeof buf, "%s", s);
+ for (char *t = strtok(buf, ","); t; t = strtok(NULL, ",")) shots[nshots++] = atoi(t);
+ }
+ } else if (!strcmp(argv[i], "--out") && i + 1 < argc) out = argv[++i];
+ else if (!strcmp(argv[i], "--saves") && i + 1 < argc) host_save_dir(argv[++i]);
+ else if (!strcmp(argv[i], "--auto")) autop = 1;
+ else if (!strcmp(argv[i], "--fuzz") && i + 1 < argc) fuzz = atoi(argv[++i]), rng = (uint32_t)fuzz * 2654435761u + 1;
+ else if (!strcmp(argv[i], "--draw")) draw = 1;
+ else if (!strcmp(argv[i], "--trace") && i + 1 < argc) trace = atoi(argv[++i]);
+ }
+ static uint16_t band[SCREEN_W * BAND];
+ gfx_init(band);
+ game_init();
+ if (level) {
+ if (hard) save.unlocked[0] = 11;
+ level_load(level, hard);
+ g.state = S_PLAY;
+ save.hard = (uint8_t)hard;
+ }
+ uint32_t fk = 0;
+ int ended = 0;
+ for (int f = 0; f < frames && g.running; f++) {
+ uint32_t k = 0;
+ for (int i = 0; i < nholds; i++)
+ if (f >= holds[i].a && f <= holds[i].b) k |= holds[i].k;
+ if (autop) k |= autoplay();
+ if (fuzz >= 0) {
+ if (f % 6 == 0) fk = rnd() & (K_LEFT | K_RIGHT | K_UP | K_DOWN | K_OK | (rnd() % 8 == 0 ? K_BACK : 0));
+ k |= fk;
+ }
+ host_keys = k;
+ host_time += 17;
+ if (k & K_HOME) {
+ ended = 1;
+ break;
+ }
+ game_tick(k);
+ int want = every ? f % every == 0 : 0;
+ for (int i = 0; i < nshots; i++) want |= shots[i] == f;
+ if (want || (draw && f % 2 == 0)) game_draw();
+ if (want) {
+ char p[512];
+ snprintf(p, sizeof p, "%s/shot_%05d.ppm", out, f);
+ host_shot(p);
+ }
+ if (trace && f % trace == 0 && L.ball >= 0)
+ printf("f %d state %d ball %.1f %.1f v %.2f %.2f R %.0f taken %d nc %d\n", f, g.state, W.b[L.ball].x / PX_M,
+ W.b[L.ball].y / PX_M, W.b[L.ball].vx, W.b[L.ball].vy, L.R, L.taken, W.nc);
+ }
+ (void)ended;
+ save_write();
+ printf("END state %d level %d hard %d taken %d complete %d frames %d R %.0f\n", g.state, L.level, L.hard, L.taken,
+ L.complete, L.frames, L.R);
+ return 0;
+}
diff --git a/games/circloo/tools/font.py b/games/circloo/tools/font.py
new file mode 100644
index 00000000..53ff7e7a
--- /dev/null
+++ b/games/circloo/tools/font.py
@@ -0,0 +1,58 @@
+"""circloO's fonts (Open Sans and Open Sans Semibold, Apache-2.0) as 4-bit glyphs: src/font.h.
+
+ python3 -I tools/font.py <folder with OpenSans-Regular.ttf and OpenSans-Semibold.ttf> src/font.h
+"""
+import sys
+from PIL import Image, ImageDraw, ImageFont
+
+# (name, file, pixel size): the game's fnt_small/fnt_medium, fnt_quitebig_semibold and fnt_big_semibold at the
+# calculator's scale, kept readable
+FONTS = [("small", "OpenSans-Regular.ttf", 12), ("medium", "OpenSans-Semibold.ttf", 16),
+ ("big", "OpenSans-Semibold.ttf", 34)]
+FIRST, LAST = 32, 126
+
+
+def main(folder, out):
+ blobs = []
+ lines = ["/* Open Sans (c) 2011 Google, Apache License 2.0: made by tools/font.py, do not edit. */",
+ "typedef struct { uint32_t off; uint8_t w, h; int8_t x, y; uint8_t adv; } Glyph;",
+ "typedef struct { const Glyph *g; const uint8_t *bits; uint8_t height, ascent; } Font;"]
+ for name, file, size in FONTS:
+ f = ImageFont.truetype(folder + "/" + file, size)
+ ascent, descent = f.getmetrics()
+ glyphs = []
+ data = bytearray()
+ for ch in range(FIRST, LAST + 1):
+ c = chr(ch)
+ box = f.getbbox(c)
+ adv = round(f.getlength(c))
+ if box[2] <= box[0] or box[3] <= box[1]:
+ glyphs.append((0, 0, 0, 0, 0, adv))
+ continue
+ w, h = box[2] - box[0], box[3] - box[1]
+ img = Image.new("L", (w, h), 0)
+ ImageDraw.Draw(img).text((-box[0], -box[1]), c, font=f, fill=255)
+ px = list(img.getdata())
+ off = len(data)
+ for i in range(0, len(px), 2):
+ a = (px[i] + 8) // 17
+ b = (px[i + 1] + 8) // 17 if i + 1 < len(px) else 0
+ data.append(min(a, 15) | min(b, 15) << 4)
+ glyphs.append((off, w, h, box[0], box[1], adv))
+ lines.append("static const uint8_t font_%s_bits[%d] = {" % (name, len(data)))
+ for i in range(0, len(data), 32):
+ lines.append(" " + ",".join(str(x) for x in data[i:i + 32]) + ",")
+ lines.append("};")
+ lines.append("static const Glyph font_%s_glyphs[%d] = {" % (name, len(glyphs)))
+ for g in glyphs:
+ lines.append(" {%d,%d,%d,%d,%d,%d}," % g)
+ lines.append("};")
+ lines.append("static const Font font_%s = {font_%s_glyphs, font_%s_bits, %d, %d};" %
+ (name, name, name, ascent + descent, ascent))
+ blobs.append((name, len(data)))
+ open(out, "w").write("\n".join(lines) + "\n")
+ print(blobs)
+
+
+if __name__ == "__main__":
+ main(sys.argv[1], sys.argv[2])
diff --git a/games/circloo/tools/levels.py b/games/circloo/tools/levels.py
new file mode 100644
index 00000000..f68544ea
--- /dev/null
+++ b/games/circloo/tools/levels.py
@@ -0,0 +1,319 @@
+"""circloO's levels, from the game's web build, as a C table (src/levels.h).
+
+ python3 -I tools/levels.py <the web build's circloO.js> src/levels.h
+
+The 2014 web build keeps each level as a script ("c 270 30 30" is a circle...), read by its level creator
+(obj_createlevel). This reads them the same way, with the same numbers, and writes what they make: the objects
+with their places in pixels, the joints between them, and the texts. The calculator builds the physics from that.
+"""
+import json
+import math
+import re
+import sys
+
+CX = CY = 1500.0 # the room's middle (3000 x 3000)
+RING0 = RING_STEP = 200.0 # obj_createlevel: y6 = 200, C6 = 200
+
+# record types (src/level.h)
+T_END, T_Y, T_C, T_I, T_IO, T_MC, T_TMC, T_B, T_T, T_RR, T_LINE, T_CHAIN, T_ROPE, T_DIST, T_FRIC, T_INFO = range(16)
+NAMES = ["END", "Y", "C", "I", "IO", "MC", "TMC", "B", "T", "RR", "LINE", "CHAIN", "ROPE", "DIST", "FRIC", "INFO"]
+
+
+def lengthdir(length, d):
+ """GameMaker's lengthdir_x/y, with its snapping to whole numbers"""
+ def snap(v):
+ r = round(v)
+ return r if abs(v - r) < 0.0001 else v
+ return snap(length * math.cos(d * math.pi / 180)), snap(-(length * math.sin(d * math.pi / 180)))
+
+
+def point_direction(x1, y1, x2, y2):
+ dx, dy = x2 - x1, y2 - y1
+ if dx == 0:
+ return 270.0 if dy > 0 else (90.0 if dy < 0 else 0.0)
+ a = 180.0 * math.atan2(dy, dx) / math.pi
+ a = int(round(a * 1000000)) / 1000000.0
+ return -a if a <= 0 else 360 - a
+
+
+def is_number(s):
+ if s == "":
+ return False
+ i = 1 if s[0] in "+-" else 0
+ dot = False
+ for ch in s[i:]:
+ if ch == ".":
+ if dot:
+ return False
+ dot = True
+ elif not ch.isdigit():
+ return False
+ return i < len(s) or False
+
+
+def valid_triangle(xs, ys):
+ """polygon_is_box2d_valid (the game's script)"""
+ n = len(xs)
+ f = [point_direction(xs[i], ys[i], xs[(i + 1) % n], ys[(i + 1) % n]) for i in range(n)]
+ total = 0
+ for i in range(n):
+ g = 360 - ((f[(i + 1) % n] - f[i] + 360) % 360)
+ if g > 180:
+ return False
+ total += g
+ return 359.99 <= total <= 360.01
+
+
+def parse(text):
+ """the level creator's script reader (_02 in the web build): a list of records"""
+ out = [] # (type, [values]) ; values in pixels / degrees / as given
+ inst = {} # instance id -> (x, y, body index or None)
+ nid = [0]
+ bodies = [0]
+ saved = {}
+ S8 = T8 = U8 = V8 = 0.0
+ X8 = 0
+ Y8 = Z8 = -1
+ chain_x = chain_y = None
+ info = {}
+
+ def new(x, y, body):
+ nid[0] += 1
+ b = None
+ if body:
+ b = bodies[0]
+ bodies[0] += 1
+ inst[nid[0]] = (x, y, b)
+ return nid[0]
+
+ def pos(a, d):
+ if X8 == 0:
+ return a + S8, d + T8
+ lx, ly = lengthdir(RING0 + RING_STEP * (X8 - 1) - (d + V8), a + U8)
+ return CX + lx + S8, CY + ly + T8
+
+ F = text
+ while True:
+ A = F.find("\n")
+ if A < 0:
+ R, F = F, ""
+ else:
+ R, F = F[:A], F[A + 1:]
+ R = R.rstrip("\r")
+ sp = R.find(" ")
+ W = R if sp < 0 else R[:sp]
+ if W not in ("/", ""):
+ R = R[sp + 1:] if sp >= 0 else R
+ nums, strs = [], []
+ while True:
+ if R[:1] == "'":
+ R = R[1:]
+ q = R.find("'")
+ strs.append(R[:q] if q >= 0 else R)
+ cut = q + 1 if q >= 0 else 0
+ R = R[cut:]
+ if q < 0:
+ break
+ else:
+ q = R.find(" ")
+ tok = R if q < 0 else R[:q]
+ if is_number(tok):
+ nums.append(float(tok))
+ if q < 0:
+ break
+ R = R[q + 1:]
+ n = len(nums)
+ exists = lambda i: i in inst
+ if W == "l":
+ if exists(Z8) and exists(Y8):
+ out.append((T_LINE, [inst[Z8][0], inst[Z8][1], inst[Y8][0], inst[Y8][1]]))
+ elif W in ("chmake", "chmake_arc"):
+ if chain_x:
+ pts = []
+ for x, y in zip(chain_x, chain_y):
+ pts += [x, y]
+ out.append((T_CHAIN, pts))
+ chain_x = chain_y = None
+ elif W in ("r", "d"):
+ if exists(Z8) and exists(Y8) and inst[Z8][2] is not None and inst[Y8][2] is not None:
+ ax, ay, bx, by = inst[Z8][0], inst[Z8][1], inst[Y8][0], inst[Y8][1]
+ o = nums[:4] if n >= 4 else [0, 0, 0, 0]
+ ax, ay, bx, by = ax + o[0], ay + o[1], bx + o[2], by + o[3]
+ if W == "r":
+ L = math.hypot(bx - ax, by - ay)
+ if n in (1, 5):
+ L = nums[n - 1]
+ out.append((T_ROPE, [inst[Z8][2], inst[Y8][2], ax, ay, bx, by, L]))
+ else:
+ out.append((T_DIST, [inst[Z8][2], inst[Y8][2], ax, ay, bx, by, o[0], o[1], o[2], o[3]]))
+ elif W == "f":
+ if exists(Z8) and exists(Y8) and inst[Z8][2] is not None and inst[Y8][2] is not None:
+ out.append((T_FRIC, [inst[Z8][2], inst[Y8][2], nums[0] if n >= 1 else 10, nums[1] if n >= 2 else 0]))
+ elif W in ("c", "y", "i", "io", "mc", "chp", "tmc", "t", "rr", "b"):
+ if n >= 2:
+ b7, c7 = pos(nums[0], nums[1])
+ if W not in ("i", "y"):
+ Z8 = Y8
+ if W == "c":
+ r = nums[2] if n > 2 else 10
+ Y8 = new(b7, c7, True)
+ out.append((T_C, [b7, c7, r]))
+ elif W == "chp":
+ chain_x = (chain_x or []) + [b7]
+ chain_y = (chain_y or []) + [c7]
+ elif W == "mc":
+ r = nums[2] if n > 2 else 10
+ dens = nums[3] if n > 3 else 1
+ Y8 = new(b7, c7, True)
+ out.append((T_MC, [b7, c7, r, dens]))
+ elif W == "tmc" and n >= 6:
+ off = nums[6] if n >= 7 else 0
+ new(b7, c7, False)
+ out.append((T_TMC, [b7, c7, nums[2], nums[3], nums[4], nums[5], off]))
+ elif W == "b" and n >= 4:
+ Y8 = new(b7, c7, True)
+ out.append((T_B, [b7, c7, nums[2], nums[3]]))
+ elif W == "t" and n >= 6:
+ xs, ys = [], []
+ for k in range(3):
+ x, y = pos(nums[2 * k], nums[2 * k + 1])
+ xs.append(x)
+ ys.append(y)
+ degenerate = (xs[0] == xs[1] and ys[0] == ys[1]) or (xs[0] == xs[2] and ys[0] == ys[2]) or \
+ (xs[1] == xs[2] and ys[1] == ys[2])
+ if not degenerate and valid_triangle(xs, ys):
+ Y8 = new(b7, c7, True)
+ out.append((T_T, [b7, c7, xs[0], ys[0], xs[1], ys[1], xs[2], ys[2]]))
+ # (an invalid one is created, then destroyed: Y8 keeps pointing at it, gone)
+ else:
+ nid[0] += 1
+ Y8 = nid[0]
+ elif W == "rr" and n >= 4:
+ ang = nums[4] if n > 4 else 0
+ dens = nums[5] if n > 5 else 1
+ damp = nums[6] if n > 6 else -1
+ Y8 = new(b7, c7, True)
+ out.append((T_RR, [b7, c7, nums[2], nums[3], ang, dens, damp]))
+ elif W == "y":
+ new(b7, c7, False)
+ out.append((T_Y, [b7, c7]))
+ elif W == "i":
+ new(b7, c7, False)
+ out.append((T_I, [b7, c7]))
+ elif W == "io":
+ new(b7, c7, False)
+ out.append((T_IO, [b7, c7]))
+ elif W == "<":
+ if n >= 1 and Y8 in inst:
+ saved[int(nums[0])] = Y8
+ elif W == ">":
+ Z8 = Y8
+ if n >= 1 and int(nums[0]) in saved:
+ Y8 = saved[int(nums[0])]
+ elif W in ("+", "+*", "++", "++*"):
+ a = nums[0] if n >= 1 else None
+ b = nums[1] if n >= 2 else a
+ if a is not None:
+ if W == "+":
+ S8, T8 = a, b
+ elif W == "+*":
+ U8, V8 = a, b
+ elif W == "++":
+ S8, T8 = S8 + a, T8 + b
+ else:
+ U8, V8 = U8 + a, V8 + b
+ elif W == "=":
+ S8 = T8 = U8 = V8 = 0
+ X8 = 0
+ elif W == "repeat":
+ if n >= 1:
+ ua = F.find("\nend")
+ if ua >= 0:
+ body = F[:ua]
+ if nums[0] > 1:
+ F = (body + "\n") * math.ceil(nums[0] - 1) + F
+ elif W == "*":
+ if n >= 1:
+ X8 = nums[0]
+ elif W == "info":
+ if n >= 1 and len(strs) == 1 and 0 <= nums[0] <= 7:
+ info[int(nums[0])] = strs[0]
+ # (infoHTML5: the same text in these levels; infoUnlocked*: not in the free levels)
+ if A < 0:
+ break
+ for ring, s in sorted(info.items()):
+ out.append((T_INFO, [ring, s]))
+ return out
+
+
+def extract(js):
+ s = open(js, encoding="utf-8-sig").read()
+ levels = {}
+ for fn, tag in (("_Y1", "base"), ("_Z1", "hard")):
+ i = s.find("function %s(" % fn)
+ j = s.find("function ", i + 10)
+ for m in re.finditer(r'case (\d+):return ("(?:[^"\\]|\\.)*")', s[i:j]):
+ levels[(tag, int(m.group(1)))] = json.loads(m.group(2)).replace("\n\r", "\n")
+ return levels
+
+
+# keypad words for the two texts that name a computer's keys
+TEXTS = {"Use escape to pause.": "Press Back to pause."}
+
+
+def emit(levels, path):
+ order = [("base", i) for i in range(1, 15)] + [("hard", i) for i in range(1, 7)]
+ texts = []
+ data = []
+ offsets = []
+ stats = []
+ for key in order:
+ recs = parse(levels[key])
+ offsets.append(len(data))
+ counts = {}
+ for t, v in recs:
+ counts[NAMES[t]] = counts.get(NAMES[t], 0) + 1
+ if t == T_INFO:
+ s = TEXTS.get(v[1], v[1])
+ if s not in texts:
+ texts.append(s)
+ data += [t, 2, int(v[0]), texts.index(s)]
+ continue
+ q = []
+ if t in (T_ROPE, T_DIST, T_FRIC):
+ q = [int(v[0]), int(v[1])] + [round(x * 8) for x in v[2:]] if t != T_FRIC else \
+ [int(v[0]), int(v[1]), round(v[2] * 100), round(v[3] * 100)]
+ elif t == T_MC:
+ q = [round(x * 8) for x in v[:3]] + [round(v[3] * 100)]
+ elif t == T_TMC:
+ q = [round(x * 8) for x in v[:3]] + [round(v[3] * 100), int(v[4]), int(v[5]), int(v[6])]
+ elif t == T_RR:
+ q = [round(x * 8) for x in v[:4]] + [round(v[4] * 100), round(v[5] * 100), round(v[6] * 100)]
+ elif t == T_CHAIN:
+ q = [len(v) // 2] + [round(x * 8) for x in v]
+ else:
+ q = [round(x * 8) for x in v]
+ for x in q:
+ assert -32768 <= x <= 32767, (key, t, v)
+ data += [t, len(q)] + q
+ data.append(T_END)
+ stats.append((key, counts))
+ with open(path, "w") as f:
+ f.write("/* circloO's levels, made by tools/levels.py from the game's web build: do not edit.\n")
+ f.write(" * Records: type, count, values (places and sizes in 1/8 pixel, densities in 1/100). */\n")
+ f.write("#define NLEVELS_BASE 14\n#define NLEVELS_HARD 6\n")
+ f.write("static const int16_t level_data[%d] = {\n" % len(data))
+ for i in range(0, len(data), 16):
+ f.write(" " + ",".join(str(x) for x in data[i:i + 16]) + ",\n")
+ f.write("};\n")
+ f.write("static const uint16_t level_start[%d] = {%s};\n" % (len(offsets), ",".join(map(str, offsets))))
+ f.write("static const char *const level_texts[%d] = {\n" % len(texts))
+ for s in texts:
+ f.write(" %s,\n" % json.dumps(s))
+ f.write("};\n")
+ for key, c in stats:
+ print(key, c)
+
+
+if __name__ == "__main__":
+ emit(extract(sys.argv[1]), sys.argv[2])
diff --git a/games/circloo/tools/sheet.py b/games/circloo/tools/sheet.py
new file mode 100644
index 00000000..a78a4966
--- /dev/null
+++ b/games/circloo/tools/sheet.py
@@ -0,0 +1,12 @@
+"""Screenshots (PPM) into one sheet, 2x, for looking at them: python3 tools/sheet.py out.png a.ppm b.ppm ..."""
+import sys
+from PIL import Image
+
+files = sys.argv[2:]
+cols = min(3, len(files))
+rows = (len(files) + cols - 1) // cols
+sheet = Image.new("RGB", (cols * 640, rows * 480), (40, 40, 40))
+for i, f in enumerate(files):
+ im = Image.open(f).convert("RGB").resize((640, 480), Image.NEAREST)
+ sheet.paste(im, ((i % cols) * 640, (i // cols) * 480))
+sheet.save(sys.argv[1])