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.
C calculatorcalculator-gamescasiochesscrossy-roaddrive-madfx-cg50gamesgeometry-dashgraphing-calculatorndlessnumworksnumworks-appsnumworks-calculatornumworks-gamenumworks-gamestetristi-84-plus-ceti-nspire
Level Devil: the game's own pictures and fonts, its title, 1 Player card, map of portals, jaws with the Devil's eyes, and its buttons for the pause
Mason363d4a02b1813b1
diff --git a/games/leveldevil/Makefile b/games/leveldevil/Makefileindex 5fa5ee0d..ed14e559 100644--- a/games/leveldevil/Makefile+++ b/games/leveldevil/Makefile@@ -6,7 +6,8 @@## The rooms are the game's own: tools/scenes.json has their tiles and actors (tools/fetch.py takes# them from the game's web build) and tools/rooms.py their scripts, which it packs into-# output/rooms.inc (Python 3). The game draws with the launcher's strips, shapes and fonts.+# output/rooms.inc (Python 3). Its pictures and fonts are the game's own, in src/pictures.h+# (tools/pictures.py takes them from the game's web build); it draws them in the launcher's strips.Q ?= @CC = arm-none-eabi-gccNWLINK ?= npx --yes -- [email protected]@@ -35,7 +36,7 @@ $(ROOMS): tools/rooms.py tools/scenes.json | $(BUILD_DIR)$(Q) python3 tools/rooms.py $(BUILD_DIR)# compiled, then linked (the link options would upset the compiler)-$(BUILD_DIR)/main.o: $(SRC) $(ROOMS) $(HEADERS) | $(BUILD_DIR)+$(BUILD_DIR)/main.o: $(SRC) src/pictures.h $(ROOMS) $(HEADERS) | $(BUILD_DIR)@echo "CC $<"$(Q) $(CC) $(CFLAGS) -c $(SRC) -o $@$(BUILD_DIR)/gfx.o: ../../launcher/src/gfx.c $(HEADERS) | $(BUILD_DIR)@@ -65,7 +66,7 @@ clean:HOST_FLAGS = -std=gnu11 -O1 -g -Wall -Wextra -Wno-unused-parameter -DPLATFORM_DEVICE=1 -DHOST -I$(BUILD_DIR) \$(shell $(NWLINK) eadk-cflags-simulator) -fsanitize=address,undefined -fno-sanitize-recover=undefinedhost: build/play-build/play: $(SRC) $(ROOMS) tests/play.c $(HEADERS)+build/play: $(SRC) src/pictures.h $(ROOMS) tests/play.c $(HEADERS)$(Q) mkdir -p build$(Q) cc $(HOST_FLAGS) tests/play.c ../../launcher/src/gfx.c ../../launcher/src/font_data.c \../../launcher/src/xfont.c -lm -o $@diff --git a/games/leveldevil/src/main.c b/games/leveldevil/src/main.cindex cdb82048..d6ae33f5 100644--- a/games/leveldevil/src/main.c+++ b/games/leveldevil/src/main.c@@ -10,7 +10,11 @@* room starting, the runner touching a trigger, a key) after so many 60ths of a second, that move,* grow, show or hide objects, or change the runner (its speed, its jump, its size, gravity). The* game steps 60 times a second, in the scene's pixels; it is drawn at 3/4 (the screen shows x 50- * to 477 of the 528 pixels, all 240 high), in the launcher's strips (launcher/src/gfx.c). */+ * to 477 of the 528 pixels, all 240 high), in the launcher's strips (launcher/src/gfx.c).+ *+ * All it shows is the game's own: its pictures and fonts (src/pictures.h, tools/pictures.py), its+ * title and its 1 Player card, its map of the worlds with their portals, the jaws with the Devil's+ * eyes that shut between two screens, its buttons. */#include <eadk.h>#include "../../../launcher/src/gfx.h"#include "../../common/np_text.h"@@ -54,7 +58,7 @@ void np_push(int x, int y, int w, int h, const color_t *px) {#define D_C (D_B + 2 * STEPS)#define D_K (D_C + 2 * STEPS)-enum { K_BLOCK, K_SPIKE, K_SAW, K_SPRING, K_DOOR, K_TRIG, K_COIN, K_BAD, K_WARP, K_BUTTON, K_THRU, K_GSPIKE, K_DEATH };+enum { K_BLOCK, K_SPIKE, K_SAW, K_SPRING, K_DOOR, K_TRIG, K_COIN, K_BAD, K_WARP, K_BUTTON, K_THRU, K_GSPIKE, K_DEATH, K_SIGN };#define F_HIDE 1#define F_GHOST 2 /* nothing to stand on */#define F_OFF 4 /* not there (yet, or any more) */@@ -80,9 +84,6 @@ static const uint32_t colors[LEVELS][2] = {};#define BLACK 0#define WHITE 0xFFFF-#define GREY HEX(0xC8C8C8)-#define DARK HEX(0x6D1102) /* the game's dark red: its transitions, its buttons */-#define YELLOW HEX(0xFCF965)/* leveldevil.sav */static struct {@@ -119,22 +120,22 @@ static int no, ns, nr;static uint16_t gcol[33];static color_t strip[SCREEN_W * STRIP_H];-static int level, rnum, ri, scr, ov, sel, banner, full, tries, modes, frame, shake, shake_n;+static int level, rnum, ri, scr, ov, sel, tries, modes, frame, shake, shake_n;static uint8_t cnt[EVENTS];static uint16_t at_[EVENTS];/* the runner: its box's corner and its speed (256ths of a pixel, a step), its size (pixels) */static int32_t hx, hy, vx, vy;static int hw, hh, hsx, hsy, tsx, tsy, hgl;static int run, jumpv, maxup, maxdown, back, downjump, dir, slide, pushx, gx, gy, keyev;-static int face, ground, coyote, jumping, anim, dead, won, frozen, born, started, flapped, held_in, fade, waiting;-static uint32_t seed, banner_t, now;+static int face, ground, coyote, jumping, anim, dead, won, frozen, born, started, flapped, held_in, waiting;+static uint32_t seed, now;static color_t bg, fg;static struct {int32_t x, y;int16_t vx, vy;-} bits[8]; /* the runner, in pieces */-enum { SC_HUB, SC_PLAY };-enum { OV_NONE, OV_PAUSE, OV_HELP, OV_QUIT, OV_END };+} bits[8]; /* the runner in pieces (or coming together: where from, and its place about the middle) */+enum { SC_TITLE, SC_MAP, SC_PLAY, SC_END };+enum { OV_NONE, OV_PAUSE, OV_QUIT };enum { I_LEFT = 1, I_RIGHT = 2, I_UP = 4, I_DOWN = 8 };static uint32_t rnd(void) {@@ -147,11 +148,6 @@ static int imax(int a, int b) { return a > b ? a : b; }static int clampi(int v, int a, int b) { return v < a ? a : v > b ? b : v; }static int iabs(int v) { return v < 0 ? -v : v; }static int rd16(int at) { return (int16_t)(data[at] | data[at + 1] << 8); }-static char *cat(char *o, const char *s) {- while (*s) *o++ = *s++;- *o = 0;- return o;-}static char *num(char *o, uint32_t v) {char t[10];int n = 0;@@ -161,7 +157,9 @@ static char *num(char *o, uint32_t v) {return o;}static char *label(char *o, const char *s, uint32_t v) {- num(cat(o, s), v);+ char *e = o;+ while (*s) *e++ = *s++;+ num(e, v);return o;}/* The save, and a copy of it in a Python script: installing apps from the NumWorks website keeps only@@ -312,7 +310,11 @@ static void reset(void) { /* the room as it starts */run = PS(fl ? 70 : 80), jumpv = PS(fl ? 251 : 188), maxup = PS(fl ? 9999 : 300), maxdown = PS(fl ? 300 : 200);gx = 0, gy = PS2(fl ? 1200 : 800), back = downjump = slide = pushx = 0, dir = 1, keyev = -1;face = 1, ground = coyote = jumping = dead = won = frozen = started = flapped = waiting = 0, born = 18;- frame = 0, shake = 0, full = 1;+ frame = 0, shake = 0;+ for (int i = 0; i < 8; i++) { /* the game's eight pieces, from up to 40 pixels away */+ bits[i].x = hx + hw * 128 + ((int)(rnd() % 81) - 40) * 256, bits[i].y = hy + hh * 128 + ((int)(rnd() % 81) - 40) * 256;+ bits[i].vx = (int16_t)(rnd() % 7) - 3, bits[i].vy = (int16_t)(rnd() % 11) - 5;+ }fire(0);}static void enter(void) { /* room rnum of the level */@@ -322,13 +324,17 @@ static void enter(void) { /* room rnum of the level */reset();}+/* the runner in eight pieces, thrown up at 300 to 400 pixels a second, anywhere from left to right */+static const int16_t sine[33] = {0, 25, 50, 74, 98, 121, 142, 162, 181, 198, 213, 226, 237, 245, 251, 255, 256,+ 255, 251, 245, 237, 226, 213, 198, 181, 162, 142, 121, 98, 74, 50, 25, 0};static void die(void) {if (dead || won) return;dead = 1, shake = 5, shake_n = 30;sv.deaths++, sv.run++;for (int i = 0; i < 8; i++) {+ int a = (int)(rnd() % 33), v = PS(300 + (int)(rnd() % 101)), c = a <= 16 ? sine[16 - a] : -sine[a - 16];bits[i].x = hx + hw * 128, bits[i].y = hy + hh * 128;- bits[i].vx = (int16_t)PS((int)(rnd() % 361) - 180), bits[i].vy = (int16_t)-PS(300 + (int)(rnd() % 100));+ bits[i].vx = (int16_t)(v * c / 256), bits[i].vy = (int16_t)(-v * sine[a] / 256);}save();}@@ -492,8 +498,8 @@ static void contacts(void) {o->f |= F_OFF;} else if (kind == K_BUTTON) {o->f |= F_USED;- } else if (kind == K_DOOR) {- won = 1;+ } else if (kind == K_DOOR) { /* (and the screen shakes a little, a quarter of a second) */+ won = 1, shake = 0, shake_n = 15;}}}@@ -579,94 +585,149 @@ static void step(int in) {}/* ------------------------------------------------------------ drawing */+/* The game's own pictures and fonts (tools/pictures.py): the rooms are drawn at 3/4, as the scene is,+ the rest (the jaws, the title, the map, what is written) as the game has them, a pixel a pixel. */+#include "pictures.h"+#define DARK HEX(0x6D1102) /* the game's dark red: the jaws, its buttons, its writing */+#define YELLOW HEX(0xFCF965)+#define ORANGE HEX(0xFFAB33) /* the title's */+#define BTN HEX(0xC57D17) /* its buttons, and their lower edge */+#define BTN_EDGE HEX(0xA2650F)+static int sxp(int32_t x) { return (int)((x * 3 >> 10) - 38) + sdx; } /* 256ths of a scene pixel: the screen's */static int syp(int32_t y) { return (int)((y * 3 >> 10) + 30) + sdy; }static void put(int x, int y, color_t c) {if (x >= 0 && x < SCREEN_W && y >= gfx_y0 && y < gfx_y1) gfx_buf[(y - gfx_y0) * SCREEN_W + x] = c;}-/* pictures: 16 rows of 16 bits (the first pixel the lowest) */-static const uint16_t spike_px[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x318C, 0x318C, 0x7BDE, 0x7BDE, 0xFFFF};-static const uint16_t button_px[2][16] = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7E0, 0xFF0, 0xFF0, 0xFF0, 0xFF0, 0x1FF8},- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF0, 0x1FF8}};-/* the runner (columns 3 to 11, rows 2 to 15): standing, jumping, running (four) */-static const uint16_t hero_px[6][14] = {- {0, 0x1C0, 0x1C0, 0x1C0, 0x3E0, 0x3E0, 0x3E0, 0x3E0, 0x3E0, 0x3E0, 0x3E0, 0x360, 0x360, 0x360},- {0, 0x1C0, 0x1C0, 0x1C0, 0x7E0, 0x7E0, 0x7E0, 0x7E0, 0x3E0, 0x3F8, 0xFF8, 0xF18, 0, 0},- {0, 0, 0x1C0, 0x1C0, 0x1C0, 0x3E0, 0x3E0, 0x3E0, 0x3E0, 0x3E0, 0x3F0, 0x3F0, 0x330, 0x630},- {0x1C0, 0x1C0, 0x1C0, 0x7E0, 0x7E0, 0x7E0, 0x3E0, 0x3E0, 0xFE0, 0xFF8, 0xF18, 0, 0, 0},- {0, 0x1C0, 0x1C0, 0x1C0, 0x3E0, 0x3E0, 0x3E0, 0x3E0, 0x3E0, 0x3E0, 0x7E0, 0x7E0, 0x660, 0xC60},- {0x1C0, 0x1C0, 0x3F0, 0x3F0, 0x3F0, 0x3E0, 0x3E0, 0xFE0, 0xFF8, 0xF18, 0, 0, 0, 0},-};--/* a picture over the box (x0, y0)-(x1, y1) of the screen, turned t quarters, upside down if fy */-static void picture(const uint16_t *px, int rows, int x0, int y0, int x1, int y1, int t, int fx, int fy, color_t c) {+/* a picture into the box (x0, y0)-(x1, y1) of the screen, each pixel the nearest of the picture's,+ turned t quarters (clockwise), mirrored if fx, upside down if fy; its grey in tint (the room's colour) */+static void spr(int id, int x0, int y0, int x1, int y1, int t, int fx, int fy, color_t tint) {+ const pic_t *p = &pics[id];int w = x1 - x0, h = y1 - y0;- if (w <= 0 || h <= 0 || y1 <= gfx_y0 || y0 >= gfx_y1) return;- for (int y = imax(y0, gfx_y0); y < imin(y1, gfx_y1); y++)- for (int x = x0; x < x1; x++) {- int u = (x - x0) * 16 / w, v = (y - y0) * 16 / h, s;- if (fx) u = 15 - u;- if (fy) v = 15 - v;- if (t & 1) s = u, u = v, v = 15 - s;- if (t & 2) u = 15 - u, v = 15 - v;- v -= 16 - rows;- if (v >= 0 && px[v] >> u & 1) put(x, y, c);+ if (w <= 0 || h <= 0 || y1 <= gfx_y0 || y0 >= gfx_y1 || x1 <= 0 || x0 >= SCREEN_W) return;+ const uint8_t *d = pic_data + p->at;+ int stride = (p->w + 1) >> 1, tw = t & 1 ? p->h : p->w, th = t & 1 ? p->w : p->h;+ for (int y = imax(y0, gfx_y0); y < imin(y1, gfx_y1); y++) {+ int v = ((y - y0) * 2 + 1) * th / (2 * h);+ color_t *row = gfx_buf + (y - gfx_y0) * SCREEN_W;+ if (fy) v = th - 1 - v;+ for (int x = imax(x0, 0); x < imin(x1, SCREEN_W); x++) {+ int u = ((x - x0) * 2 + 1) * tw / (2 * w), sx, sy;+ if (fx) u = tw - 1 - u;+ if (t == 0) sx = u, sy = v;+ else if (t == 1) sx = v, sy = p->h - 1 - u;+ else if (t == 2) sx = p->w - 1 - u, sy = p->h - 1 - v;+ else sx = p->w - 1 - v, sy = u;+ int n = d[sy * stride + (sx >> 1)] >> (sx & 1) * 4 & 15;+ if (n) row[x] = n == p->tint ? tint : pic_pal[p->pal + n - 1];}+ }}-static void draw_hero(int32_t x, int32_t y, int w, int h, int flip, int f) {- /* its picture is 16 x 16 about the 5 x 13 box, the box at (5, 3) */- int32_t px = x - w * 256, py = y - h * 3 * 256 / 13, pw = w * 16 * 256 / 5, ph = h * 16 * 256 / 13;- if (flip) py = y + h * 256 - ph + h * 3 * 256 / 13; /* (upside down: the box at the picture's top) */- picture(hero_px[f], 14, sxp(px), syp(py), sxp(px + pw), syp(py + ph), 0, face < 0, flip, BLACK);-}--static void draw_door(int x0, int y0, int x1, int y1, int shut) {- int w = x1 - x0, h = y1 - y0, e = imax(1, w / 8);- gfx_rrect(x0, y0, w, h + e, e * 2, fg, 256);- gfx_fill(x0 + e, y0 + e, w - 2 * e, h - e, GREY);- if (shut) gfx_fill(x0 + e, y0 + e, w - 2 * e, (h - e) * imin(shut, 12) / 12, fg);+/* a picture as it is, its rows r0 to r1 (its row r at y + r), its corner at x */+static void blit_rows(int id, int x, int y, int r0, int r1, color_t tint) {+ const pic_t *p = &pics[id];+ const uint8_t *d = pic_data + p->at;+ r0 = imax(r0, gfx_y0 - y), r1 = imin(imin(r1, p->h), gfx_y1 - y);+ for (int r = r0; r < r1; r++) {+ color_t *row = gfx_buf + (y + r - gfx_y0) * SCREEN_W;+ if (p->runs) { /* a byte a run (its colour, its length less one; 15: 16 and the next byte) */+ const uint8_t *q = d + (d[2 * r] | d[2 * r + 1] << 8);+ for (int u = 0; u < p->w;) {+ int b = *q++, n = (b & 15) + 1, c = b >> 4;+ if (n == 16) n += *q++;+ if (c) {+ color_t k = c == p->tint ? tint : pic_pal[p->pal + c - 1];+ for (int i = imax(0, x + u); i < imin(SCREEN_W, x + u + n); i++) row[i] = k;+ }+ u += n;+ }+ } else {+ const uint8_t *q = d + r * ((p->w + 1) >> 1);+ for (int u = imax(0, -x); u < p->w && x + u < SCREEN_W; u++) {+ int n = q[u >> 1] >> (u & 1) * 4 & 15;+ if (n) row[x + u] = n == p->tint ? tint : pic_pal[p->pal + n - 1];+ }+ }+ }}-+static void blit(int id, int x, int y) { blit_rows(id, x, y, 0, SCREEN_H, 0); }++/* the game's writing: y is the top of the line */+static const glyph_t *glyph(const pfont_t *f, char c) { return &f->g[(c < 32 || c > 126 ? '?' : c) - 32]; }+static int text_w(const pfont_t *f, const char *s) {+ int w = 0;+ for (; *s; s++) w += glyph(f, *s)->adv;+ return w;+}+static int text(const pfont_t *f, int x, int y, const char *s, color_t c) {+ for (; *s; s++) {+ const glyph_t *g = glyph(f, *s);+ const uint8_t *b = f->bits + g->at;+ int bw = (g->w + 7) >> 3;+ if (y + g->y + g->h > gfx_y0 && y + g->y < gfx_y1)+ for (int j = 0; j < g->h; j++)+ for (int i = 0; i < g->w; i++)+ if (b[j * bw + (i >> 3)] >> (i & 7) & 1) put(x + g->x + i, y + g->y + j, c);+ x += g->adv;+ }+ return x;+}+static void text_c(const pfont_t *f, int cx, int y, const char *s, color_t c) { text(f, cx - text_w(f, s) / 2, y, s, c); }++/* ---- the jaws: the game's scene change, the Devil's eyes on its upper jaw. They shut (500 ms, slow+ then fast), stay shut a while, then something changes behind them (then) and they open again. */+static const uint16_t expo[31] = {0, 1, 2, 2, 3, 3, 4, 5, 6, 8, 10, 13, 16, 20, 25, 32,+ 40, 51, 64, 81, 102, 128, 161, 203, 256, 323, 406, 512, 645, 813, 1024};+enum { J_OPEN, J_CLOSING, J_SHUT, J_OPENING };+enum { THEN_NONE, THEN_MAP, THEN_ROOM, THEN_NEXT };+static int jaw = J_SHUT, jaw_t, jaw_hold = 40, jaw_then, jaw_still; /* still: the room waits until they open */+static void jaws_close(int hold, int then) { jaw = J_CLOSING, jaw_t = 0, jaw_hold = hold, jaw_then = then; }+static void jaws_shut(void) { jaw = J_SHUT, jaw_t = 0, jaw_hold = -1; } /* at once, until told */+static void jaws_open(void) { jaw = J_OPENING, jaw_t = 0; }+static void draw_jaws(void) {+ int e = expo[imin(jaw_t, 30)], top, bot;+ if (jaw == J_OPEN) return;+ if (jaw == J_CLOSING) top = -136 + 136 * e / 1024, bot = 336 - 233 * e / 1024;+ else if (jaw == J_SHUT) top = 0, bot = 103;+ else top = -136 * e / 1024, bot = 103 + 466 * e / 1024;+ if (jaw == J_SHUT) gfx_fill(0, 0, SCREEN_W, SCREEN_H, DARK); /* (a pixel shows between the teeth) */+ if (bot < SCREEN_H) blit(P_JAW_BOTTOM, -56, bot), gfx_fill(0, bot + 135, SCREEN_W, SCREEN_H, DARK);+ blit(P_JAW_TOP, -56, top);+}++/* ---- the room */static void draw_object(obj_t *o) {int kind = o->kind & 15, t = o->kind >> 4 & 3, b[4];- if (o->f & (F_HIDE | F_OFF) || kind == K_TRIG || o->w <= 0 || o->h <= 0) return;+ if (o->f & (F_HIDE | F_OFF) || kind == K_TRIG || kind == K_SIGN || o->w <= 0 || o->h <= 0) return;box(o, b);- int x0 = sxp(b[0] * 256), y0 = syp(b[1] * 256), x1 = sxp(b[2] * 256), y1 = syp(b[3] * 256), w = x1 - x0, h = y1 - y0;+ int x0 = sxp(b[0] * 256), y0 = syp(b[1] * 256), x1 = sxp(b[2] * 256), y1 = syp(b[3] * 256);+ if (kind == K_BLOCK) { /* (on through the margins, as the ground) */+ if (b[1] <= 0) y0 = 0;+ if (b[3] >= 240) y1 = SCREEN_H;+ }if (y1 < gfx_y0 - 4 || y0 > gfx_y1 + 4) return;- if (kind == K_BLOCK && b[1] <= 0) y0 = 0, h = y1; /* (on through the margins, as the ground) */- if (kind == K_BLOCK && b[3] >= 240) h = SCREEN_H - y0;- if (kind == K_BLOCK || kind == K_GSPIKE) {- int s = kind == K_GSPIKE ? h * 5 / 26 : 0;- gfx_fill(x0, y0 + s, w, h - 2 * s, fg);- if (s) picture(spike_px, 5, x0, y0 - h * 11 / 26, x1, y0 + s, 0, 0, 0, fg), picture(spike_px, 5, x0, y1 - s, x1, y1 + h * 11 / 26, 2, 0, 0, fg);- } else if (kind == K_SPIKE) {- picture(spike_px, 5, x0, y0, x1, y1, t, 0, 0, fg);- } else if (kind == K_SAW) {- int r = w / 2;- gfx_circle(x0 + r, y0 + r, r, fg, 256);- gfx_fill(x0 + r - imax(1, r / 8), y0 + r - imax(1, r / 8), imax(2, r / 4), imax(2, r / 4), bg);- } else if (kind == K_SPRING) { /* its plate, up on its stem while it pushes */- int up = o->t ? 8 : 0;- gfx_fill(x0, y0 + h * (13 - up) / 16, w, imax(1, h / 16), fg);- gfx_fill(x0 + w * 6 / 16, y0 + h * (14 - up) / 16, w / 4, h * (2 + up) / 16, fg);- } else if (kind == K_DOOR) {- if (modes & R_SWAP) draw_hero(o->x - 5 * 128 + 256, o->y - 128, 5, 13, 0, 0);- else draw_door(x0, y0, x1, y1, won ? won : 0);- } else if (kind == K_COIN || kind == K_BAD) {- gfx_rrect(x0 + w * 5 / 16, y0 + h * 5 / 16, w * 6 / 16, h * 6 / 16, 1, fg, 256);- } else if (kind == K_WARP) { /* rings of squares, turning */- for (int i = (anim >> 3 & 1); i < 7; i += 2) {- int d = w * (i + 1) / 16;- gfx_fill(x0 + d, y0 + d, w - 2 * d, imax(1, w / 16), fg), gfx_fill(x0 + d, y1 - d - 1, w - 2 * d, imax(1, w / 16), fg);- gfx_fill(x0 + d, y0 + d, imax(1, w / 16), h - 2 * d, fg), gfx_fill(x1 - d - 1, y0 + d, imax(1, w / 16), h - 2 * d, fg);- }- } else if (kind == K_BUTTON) {- picture(button_px[!!(o->f & F_USED)], 6, x0, y0, x1, y1, t, 0, 0, fg);- } else if (kind == K_THRU) {- for (int i = 0; i < 3; i++) gfx_fill(x0 + w * (1 + 5 * i) / 16, y0, w / 4, imax(1, h / 8), fg);+ if (kind == K_BLOCK) {+ gfx_fill(x0, y0, x1 - x0, y1 - y0, fg);+ return;}+ int id = kind == K_SPIKE ? P_SPIKE+ : kind == K_GSPIKE ? P_GSPIKE+ : kind == K_SAW ? (o->f & F_BIG ? P_SAW_BIG : P_SAW)+ : kind == K_SPRING ? (o->t ? P_SPRING_UP : P_SPRING)+ : kind == K_COIN ? P_COIN+ : kind == K_BAD ? P_BAD_COIN+ : kind == K_WARP ? P_WARP0 + (anim % 33 >= 24) /* (400 ms, then 150) */+ : kind == K_BUTTON ? (o->f & F_USED ? P_BUTTON_DOWN : P_BUTTON)+ : kind == K_THRU ? P_THRU+ : -1;+ if (kind == K_DOOR) { /* the door; once reached, it shuts (300, 100, 75, 50, 25 ms) and is gone at 600 */+ if (modes & R_SWAP) id = P_DOOR_HERO; /* (dressed as the runner) */+ else if (!won) id = P_DOOR;+ else if (won < 36) id = P_DOOR_SHUT0 + (won >= 18) + (won >= 24) + (won >= 29) + (won >= 32);+ }+ if (id >= 0) spr(id, x0, y0, x1, y1, t, 0, 0, fg);}static void ground_draw(void) {@@ -685,126 +746,139 @@ static void ground_draw(void) {}}-static void say(int cx, int base, const char *s) {- gfx_text_center(&np_font_title, cx + 1, base + 2, s, BLACK, 256);- gfx_text_center(&np_font_title, cx, base, s, YELLOW, 256);-}-static void button(int y, const char *s, bool on) {- if (on) gfx_rrect(96, y, 128, 24, 12, YELLOW, 256);- gfx_text_center(&np_font_body, 160, y + 17, s, on ? DARK : WHITE, 256);+/* the runner: its 16 x 16 picture about its 5 x 13 box (the box at 5, 3), standing, running (60 ms a+ picture), jumping, or flapping; in the swap room it looks like the door */+static void draw_hero(void) {+ int flip = gy < 0, id;+ int32_t px = hx - hw * 256, py = hy - hh * 3 * 256 / 13, pw = hw * 16 * 256 / 5, ph = hh * 16 * 256 / 13;+ if (flip) py = hy + hh * 256 - ph + hh * 3 * 256 / 13; /* (upside down: the box at the picture's top) */+ if (modes & R_SWAP) id = P_DOOR_DUMMY;+ else if (modes & R_FLAPPY) id = vx > 0 ? P_FLAP_R : vx < 0 ? P_FLAP_L : P_FLAP_STAND;+ else if (!ground) id = face < 0 ? P_HERO_JUMP_L : P_HERO_JUMP_R;+ else if (vx) id = (face < 0 ? P_HERO_RUN_L0 : P_HERO_RUN_R0) + anim * 5 / 18 % 4;+ else id = P_HERO_IDLE;+ spr(id, sxp(px), syp(py), sxp(px + pw), syp(py + ph), 0, 0, flip, fg);+}+static void piece(int id, int32_t x, int32_t y) { /* 4 x 3, about (2, 1) */+ spr(id, sxp(x - 512), syp(y - 256), sxp(x + 512), syp(y + 512), 0, 0, 0, BLACK);+}++static void play_hud(void) {+ for (int i = 0; i < ROOMS; i++) { /* the five rooms: those reached fill in, growing and back, at 750 ms */+ int t = frame - 45, d = 6 * (i + 1), s = 0, x = 136 + 10 * i;+ if (i <= rnum && t >= 0 && t < 2 * d) s = t < d ? t * 4 / d : (2 * d - t) * 4 / d; /* (8ths of its size) */+ spr(i <= rnum && t >= 0 ? P_ROOM_DONE : P_ROOM_SQUARE, x - s / 2, 4 - s / 2, x + 9 + s / 2 + s % 2, 12 + s / 2 + s % 2, 0, 0,+ 0, 0);+ }+ if (frame >= 30 && !ov && (jaw == J_OPEN || jaw == J_OPENING)) { /* the game's back button, the calculator's key */+ blit(P_BACK, 8, 6);+ text(&font, 4, 22, T("back"), YELLOW);+ }+ if (waiting && sv.open <= 3) text_c(&font, 160, 40, T("PRESS ANY KEY"), YELLOW); /* (the first worlds) */}+/* ---- the menus: the game's buttons */+static void button(int x, int y, int w, const char *s, int on) {+ int tx = x + (w - text_w(&font, s)) / 2;+ gfx_fill(x, y, w, 14, on ? YELLOW : BTN);+ gfx_fill(x, y + 14, w, 2, on ? BTN : BTN_EDGE);+ if (!on) text(&font, tx, y + 3, s, BTN_EDGE);+ text(&font, tx, y + 2, s, on ? DARK : YELLOW);+}static const char *const pause_items[] = {T("Resume"), T("Restart"), T("Levels"), T("Quit game")};-static void overlay(void) {- char s[24];- gfx_fill_alpha(0, 0, SCREEN_W, SCREEN_H, BLACK, 100);- gfx_rrect(56, 36, 208, 168, 12, DARK, 256);- if (ov == OV_PAUSE) {- say(160, 68, T("Paused"));- for (int i = 0; i < 4; i++) button(84 + 28 * i, pause_items[i], sel == i);- } else if (ov == OV_QUIT) {- say(160, 100, T("Quit game?"));- for (int i = 0; i < 2; i++) {- if (sel == i) gfx_rrect(92 + 72 * i, 128, 64, 24, 12, YELLOW, 256);- gfx_text_center(&np_font_body, 124 + 72 * i, 145, i ? T("Yes") : T("No"), sel == i ? DARK : WHITE, 256);- }- } else if (ov == OV_HELP) {- static const char *const keys[][2] = {{T("Left Right"), T("run")}, {T("Up, OK, EXE"), T("jump")}, {T("Back"), T("pause")}};- say(160, 66, T("How to play"));- gfx_paragraph(&np_font_body, 160, 88, 192, 15, T("Reach the door. The level has other plans: trust nothing."), WHITE,- 256);- for (int i = 0; i < 3; i++) {- gfx_text_right(&np_font_body, 136, 136 + 16 * i, keys[i][0], YELLOW, 256);- gfx_text(&np_font_body, 146, 136 + 16 * i, keys[i][1], WHITE, 256);- }- button(172, T("Play"), true);- } else { /* OV_END: the Devil beaten */- say(160, 80, T("You beat the Devil!"));- gfx_paragraph(&np_font_body, 160, 106, 184, 15, T("Every door of Level Devil is open behind you."), WHITE, 256);- gfx_text_center(&np_font_body, 160, 150, label(s, T("Deaths in all: "), sv.deaths), WHITE, 256);- button(164, T("OK"), true);+static void overlay(void) { /* over the shut jaws */+ if (ov == OV_PAUSE)+ for (int i = 0; i < 4; i++) button(112, 134 + 22 * i, 96, pause_items[i], sel == i);+ if (ov == OV_QUIT) {+ text_c(&font, 160, 142, T("Quit game?"), YELLOW);+ button(100, 168, 52, T("No"), sel == 0), button(168, 168, 52, T("Yes"), sel == 1);}}static void play_scene(void *ctx) {- char s[16];gfx_fill(0, 0, SCREEN_W, SCREEN_H, bg);for (int k = 0; k < no; k++) draw_object(&ob[k]);ground_draw();+ for (int k = 0; k < no; k++) /* (the sign with the keys, over the ground, as it is: small, its arrows would go) */+ if ((ob[k].kind & 15) == K_SIGN) blit(P_KEYS, sxp(ob[k].x) - pics[P_KEYS].w / 2, syp(ob[k].y) - pics[P_KEYS].h / 2);if (dead) {- for (int i = 0; i < 8; i++) gfx_fill(sxp(bits[i].x), syp(bits[i].y), 3, 2, BLACK);+ for (int i = 0; i < 8; i++)+ if (dead < 42 + i) piece(P_BODY0 + (i & 3), bits[i].x, bits[i].y);} else if (!won && !born && !(frozen && frozen < 45)) {- int f = !ground && !(modes & R_FLAPPY) ? 1 : vx ? 2 + (anim >> 2 & 3) : 0;- if (modes & R_SWAP) {- int b[4] = {(hx >> 8) - 6, (hy >> 8) - 3, (hx >> 8) + 11, (hy >> 8) + 13};- draw_door(sxp(b[0] * 256), syp(b[1] * 256), sxp(b[2] * 256), syp(b[3] * 256), 0);- } else {- draw_hero(hx, hy, hw, hh, gy < 0, f);- }+ draw_hero();}- if (born) /* coming together */+ if (born) /* the pieces coming together, faster and faster (300 ms) */for (int i = 0; i < 8; i++) {- int d = born * born / 6;- gfx_fill(sxp(hx + hw * 128 + (i & 3) * d * 64 - d * 96), syp(hy + hh * 128 + (i >> 2) * d * 128 - d * 64), 3, 2, BLACK);+ int e = expo[(18 - born) * 30 / 18];+ int32_t tx = hx + hw * 128 + bits[i].vx * 256, ty = hy + hh * 128 + bits[i].vy * 256;+ piece(P_PRE0 + (i & 3), bits[i].x + (tx - bits[i].x) / 1024 * e, bits[i].y + (ty - bits[i].y) / 1024 * e);}- for (int i = 0; i < ROOMS; i++) { /* the rooms of the level, as the game shows them */- int x = 136 + 10 * i;- gfx_fill(x, 6, 9, 8, BLACK);- if (i > rnum || (i == rnum && frame < 45)) gfx_fill(x + 1, 7, 7, 6, gfx_mix(BLACK, fg, 20));- }- if (waiting) { /* the game's retry button */- gfx_rrect(134, 104, 52, 30, 4, DARK, 256);- gfx_circle(160, 119, 9, YELLOW, 256), gfx_circle(160, 119, 6, DARK, 256);- gfx_fill(146, 110, 14, 9, DARK), gfx_fill(152, 106, 4, 13, YELLOW);- gfx_text_center(&np_font_body, 160, 96, T("Press any key"), WHITE, 256);- }- (void)s;- if (fade) gfx_fill_alpha(0, 0, SCREEN_W, SCREEN_H, DARK, fade * 16);+ draw_jaws();+ play_hud();if (ov) overlay();}-/* the doors to the levels: two rows of eight, on two floors */-static void hub_door(int i, int *x, int *y) { *x = 13 + 38 * (i & 7), *y = 70 + 80 * (i >> 3); }-static void hub_scene(void *ctx) {- char s[48];- int sel_ = sv.sel;- bg = gfx_rgb(colors[0][0]);- gfx_fill(0, 0, SCREEN_W, SCREEN_H, bg);- gfx_fill(0, 0, SCREEN_W, 44, DARK);- if (banner) say(160, 32, label(s, T("Level cleared! Deaths: "), (uint32_t)banner - 1));- else say(160, 32, "LEVEL DEVIL");- for (int i = 0; i < LEVELS; i++) {- int x, y, open = i < sv.open;- hub_door(i, &x, &y);- fg = gfx_rgb(colors[i][1]);- if (!(i & 7)) gfx_fill(0, y + 40, SCREEN_W, 8, gfx_rgb(colors[0][1]));- if (!open) fg = gfx_mix(fg, bg, 20);- draw_door(x, y, x + 22, y + 40, open ? 0 : 12); /* (a world cleared: its colour in the window) */- if (sv.done >> i & 1) gfx_fill(x + 3, y + 3, 16, 34, gfx_rgb(colors[i][0]));- num(s, (uint32_t)i + 1);- gfx_text_center(&np_font_small, x + 11, y - 6, s, fg, 256);- if (i == sel_) picture(hero_px[0], 14, x - 22, y + 8, x - 2, y + 40, 0, 0, 0, BLACK);- }- fg = gfx_rgb(colors[0][1]);- gfx_fill(0, 214, SCREEN_W, 26, fg);- if (sel_ >= sv.open) cat(s, T("Locked"));- else if (sv.done >> sel_ & 1) label(s, T("Cleared. Fewest deaths: "), sv.best[sel_]);- else cat(s, T("Not cleared yet"));- gfx_text(&np_font_body, 8, 232, s, bg, 256);- gfx_text_right(&np_font_body, 312, 232, label(s, T("Deaths "), sv.deaths), bg, 256);+/* ---- the title (the game's 1 Player card) and the map of the worlds (its title, its portals on their paths) */+static const char *const world_names[LEVELS] = {"Pits", "Spikes", "Push", "Coins", "Controls", "Platforms",+ "Springs", "Warps", "Scale", "Doors", "Saws", "Flappy",+ "Gravity", "Movement", "Wraparound", "Boss"};+static const int16_t portal_at[LEVELS][2] = { /* the game's (its screen's pixels: the scene's less 48) */+ {42, 109}, {85, 97}, {135, 100}, {171, 121}, {147, 158}, {160, 198}, {207, 193}, {235, 160},+ {227, 118}, {262, 100}, {295, 129}, {307, 172}, {331, 203}, {373, 207}, {390, 169}, {365, 113}};+static int pan, menu_anim, credits_y; /* the map scrolled (its 432 pixels on the screen's 320) */+static int pan_for(int i) { return clampi(portal_at[i][0] + (i == 15 ? 16 : 8) - 160, 0, 112); }++static void title_scene(void *ctx) {+ blit_rows(P_TITLE, -56, 0, 0, 90, 0); /* (its top: LEVEL DEVIL, and the flames) */+ gfx_fill(0, 90, SCREEN_W, SCREEN_H - 90, ORANGE);+ if (!ov) blit(P_CARD_ON, 122, 120), text_c(&font_small, 160, 206, T("press OK"), YELLOW);+ draw_jaws();if (ov) overlay();}-/* ------------------------------------------------------------ the levels */-static void open_room(void) { /* room rnum, coming out of the game's dark red */- enter();- fade = 15;+static void map_scene(void *ctx) {+ char s[24];+ int i = sv.sel, f = menu_anim / 9 & 3, boss = i == LEVELS - 1;+ blit_rows(P_TITLE, -56, 0, 0, 90, 0); /* its top stays */+ blit_rows(P_TITLE, -pan, 0, 90, SCREEN_H, 0);+ for (int k = 0; k < LEVELS; k++) {+ int x = portal_at[k][0] - pan, y = portal_at[k][1];+ if (k == LEVELS - 1) blit(k < sv.open ? P_BOSS_OPEN : P_BOSS_LOCKED, x, y);+ else blit(P_DIRT, x - 2, y + 15), blit(k < sv.open ? P_PORTAL0 + k : P_PORTAL_LOCKED, x, y);+ }+ if (!ov) { /* the one picked: the game's highlight, its name, and the key */+ int x = portal_at[i][0] - pan, y = portal_at[i][1], cx = x + (boss ? 16 : 8), ty = y + (boss ? 33 : 18);+ if (boss) blit(P_HILITE_BOSS0 + f, x + 9, y - 6);+ else blit(P_HILITE0 + f, x + 2, y - 15);+ text_c(&font_small, cx, ty, world_names[i], DARK);+ text_c(&font_small, cx, ty + 7, T("press"), YELLOW);+ text_c(&font_small, cx, ty + 13, T("OK"), YELLOW);+ text(&font_small, 4, 231, label(s, T("deaths "), sv.deaths), DARK);+ if (sv.done >> i & 1) label(s, T("best "), sv.best[i]), text(&font_small, 316 - text_w(&font_small, s), 231, s, DARK);+ }+ draw_jaws();+ if (ov) overlay();}++/* the end: the Devil laughs, and the game's credits come up */+static void end_scene(void *ctx) {+ char s[24];+ gfx_fill(0, 0, SCREEN_W, SCREEN_H, ORANGE);+ blit(menu_anim / 12 & 1 ? P_EYES_LAUGH : P_EYES, 40, 20);+ blit(P_CREDITS, 20, credits_y);+ if (credits_y <= 100) {+ text_c(&font, 160, 184, label(s, T("Deaths: "), sv.deaths), DARK);+ text_c(&font_small, 160, 206, T("press OK"), DARK);+ }+ draw_jaws();+}++/* ------------------------------------------------------------ the levels */static void start_level(int l) {if (l != sv.level || sv.room >= ROOMS) sv.room = 0, sv.run = 0;level = sv.level = (uint8_t)l, rnum = sv.room;- scr = SC_PLAY;- open_room();+ scr = SC_PLAY, ov = OV_NONE;+ enter();save();}static void level_done(void) {@@ -812,28 +886,39 @@ static void level_done(void) {if (first || sv.run < sv.best[level]) sv.best[level] = sv.run;sv.done |= (uint16_t)(1u << level);sv.open = (uint8_t)imax(sv.open, imin(level + 2, LEVELS));- banner = sv.run + 1, banner_t = now;sv.room = 0, sv.run = 0, sv.sel = (uint16_t)imin(level + 1, LEVELS - 1);- scr = SC_HUB, full = 1;- if (level == LEVELS - 1 && first) ov = OV_END;+ scr = level == LEVELS - 1 && first ? SC_END : SC_MAP, pan = pan_for(sv.sel), credits_y = SCREEN_H;save();}--/* a step of the room: the fade, the door reached (it shuts), or the runner */-static void tick(int in) {- full = 1;- if (fade && !won) {- fade--;- return;- }- if (won > 30) fade = imin(won - 30, 15);- if (won > 46) {- won = 0, fade = 15;+/* what changes behind the shut jaws */+static void then_do(int what) {+ if (what == THEN_MAP) scr = SC_MAP, ov = OV_NONE, pan = pan_for(sv.sel);+ if (what == THEN_ROOM) start_level(sv.sel);+ if (what == THEN_NEXT) { /* the next room, or the map */if (++rnum == ROOMS) level_done();else sv.room = (uint8_t)rnum, save(), enter();- return;}- step(in);+}++/* a 60th of a second: the jaws, the room (unless paused, or waiting for the jaws), the map scrolling */+static void frame_step(int in) {+ menu_anim++;+ if (jaw == J_CLOSING && ++jaw_t >= 30) jaw = J_SHUT, jaw_t = 0;+ else if (jaw == J_SHUT && jaw_hold >= 0 && ++jaw_t >= jaw_hold) {+ int what = jaw_then;+ jaw_then = THEN_NONE;+ jaws_open();+ then_do(what);+ } else if (jaw == J_OPENING && ++jaw_t >= 30) jaw = J_OPEN, jaw_still = 0;+ if (scr == SC_PLAY && !ov && !jaw_still) {+ if (won == 45) jaws_close(45, THEN_NEXT); /* (the door shut: the jaws at 750 ms, the next room at 2 s) */+ step(in);+ }+ if (scr == SC_MAP) {+ int to = pan_for(sv.sel);+ pan += (to - pan) / 4 + (to > pan) - (to < pan);+ }+ if (scr == SC_END && credits_y > 100 && !(menu_anim % 3)) credits_y--;}static void load(void) {@@ -843,10 +928,23 @@ static void load(void) {uint8_t *v = (uint8_t *)&sv;bool ok = d && len == sizeof sv && d[0] == 'L' && d[1] == 1;for (uint32_t i = 0; i < sizeof sv; i++) v[i] = ok ? d[i] : 0;- sv.open = (uint8_t)clampi(sv.open, 1, LEVELS), sv.sel = (uint16_t)clampi(sv.sel, 0, LEVELS - 1);+ sv.open = (uint8_t)clampi(sv.open, 1, LEVELS), sv.sel = (uint16_t)clampi(sv.sel, 0, sv.open - 1);if (sv.level >= LEVELS) sv.level = 0;}+static void ask_quit(void) { ov = OV_QUIT, sel = 0, jaws_shut(); }+/* the map: Left and Right the world before and after, Up and Down the nearest one up or down */+static void map_move(int dx, int dy) {+ int best = -1, bd = 1 << 30, x = portal_at[sv.sel][0], y = portal_at[sv.sel][1];+ if (dx) best = clampi(sv.sel + dx, 0, sv.open - 1);+ else+ for (int k = 0; k < sv.open; k++) {+ int ex = portal_at[k][0] - x, ey = (portal_at[k][1] - y) * dy, d = ex * ex * 2 + ey * ey;+ if (ey > 8 && d < bd) bd = d, best = k;+ }+ if (best >= 0) sv.sel = (uint16_t)best;+}+int main(void) {np_app_begin();color_t *their_strip = gfx_buf;@@ -855,8 +953,7 @@ int main(void) {seed = eadk_random() ^ now;if (!seed) seed = 1;load();- if (!(sv.flags & 1)) ov = OV_HELP;- full = 1;+ scr = SC_TITLE; /* (the jaws shut, then open on the title: the game's start) */const uint64_t left = KEY(eadk_key_left) | KEY(eadk_key_four), right = KEY(eadk_key_right) | KEY(eadk_key_six);const uint64_t up = KEY(eadk_key_up) | KEY(eadk_key_eight), down = KEY(eadk_key_down) | KEY(eadk_key_two);const uint64_t ok = KEY(eadk_key_ok) | KEY(eadk_key_exe) | KEY(eadk_key_five), back_k = KEY(eadk_key_back);@@ -868,46 +965,49 @@ int main(void) {stale &= k, held = k, k &= ~stale, hitk &= ~stale;if (k & (KEY(eadk_key_home) | KEY(eadk_key_on_off))) break;int dx = !!(hitk & right) - !!(hitk & left), dy = !!(hitk & down) - !!(hitk & up), quit = 0;- if (hitk) full |= scr == SC_HUB || ov;- if (ov) {- if (ov == OV_PAUSE) sel = (sel + dy + 4) % 4;- if (ov == OV_QUIT) sel ^= dx != 0;- if (hitk & ok) {- if (ov == OV_PAUSE && sel == 1) ov = OV_NONE, reset(); /* Restart */- else if (ov == OV_PAUSE && sel) ov = sel == 2 ? (scr = SC_HUB, save(), OV_NONE) : OV_QUIT, sel = 0;- else if (ov == OV_QUIT && sel) quit = 1;- else ov = ov == OV_QUIT && scr == SC_PLAY ? (sel = 3, OV_PAUSE) : OV_NONE;- if (!(sv.flags & 1)) sv.flags |= 1, save();- } else if (hitk & back_k) {- ov = ov == OV_QUIT && scr == SC_PLAY ? (sel = 3, OV_PAUSE) : OV_NONE;+ int moving = jaw == J_CLOSING || (jaw == J_SHUT && !ov); /* (between two screens: keys wait) */+ if (ov == OV_PAUSE) {+ sel = (sel + dy + 4) % 4;+ if (hitk & back_k || (hitk & ok && sel == 0)) ov = OV_NONE, jaws_open(), jaw_still = 1; /* Resume */+ else if (hitk & ok && sel == 1) ov = OV_NONE, reset(), jaws_open(); /* Restart */+ else if (hitk & ok && sel == 2) ov = OV_NONE, sv.room = (uint8_t)rnum, save(), jaw_hold = 20, jaw_then = THEN_MAP;+ else if (hitk & ok) ov = OV_QUIT, sel = 0;+ } else if (ov == OV_QUIT) {+ if (dx || dy) sel ^= 1;+ if (hitk & ok && sel) quit = 1;+ else if (hitk & (ok | back_k)) {+ if (scr == SC_PLAY) ov = OV_PAUSE, sel = 3;+ else ov = OV_NONE, jaws_open();}- } else if (scr == SC_HUB) {- sv.sel = (uint16_t)clampi(sv.sel + dx + 8 * dy, 0, LEVELS - 1);- if (hitk & ok && sv.sel < sv.open) start_level(sv.sel);- if (hitk & back_k) ov = OV_QUIT, sel = 0;- } else if (hitk & back_k) {- ov = OV_PAUSE, sel = 0, full = 1;+ } else if (moving) {+ } else if (scr == SC_TITLE) {+ if (hitk & ok) jaws_close(10, THEN_MAP);+ else if (hitk & back_k) ask_quit();+ } else if (scr == SC_MAP) {+ if (dx || dy) map_move(dx, dy);+ if (hitk & ok) jaws_close(30, THEN_ROOM);+ else if (hitk & back_k) ask_quit();+ } else if (scr == SC_END) {+ if (hitk & (ok | back_k) && credits_y <= 100) jaws_close(10, THEN_MAP);+ } else if (hitk & back_k) { /* in a room: the jaws shut, and the game's buttons on them */+ ov = OV_PAUSE, sel = 0, jaws_shut();save();} else if (waiting && hitk) { /* the game's retry: any key */tries++, reset();hitk = 0;}if (quit) break;- if (banner && now - banner_t > 2600) banner = 0, full = 1;acc += (now - last) * 3, last = now;- if (scr == SC_PLAY && !ov) {- int in = (k & left ? I_LEFT : 0) | (k & right ? I_RIGHT : 0) | (k & (up | ok) ? I_UP : 0) | (k & down ? I_DOWN : 0);- for (int n = 0; acc >= 50 && n < 4; acc -= 50, n++) tick(in);- if (acc >= 50) acc = 0; /* (too far behind: let it go) */- } else {- acc = 0;- }- if (full) {+ int in = (k & left ? I_LEFT : 0) | (k & right ? I_RIGHT : 0) | (k & (up | ok) ? I_UP : 0) | (k & down ? I_DOWN : 0);+ int n = 0;+ for (; acc >= 50 && n < 4; acc -= 50) frame_step(in), n++;+ if (acc >= 50) acc = 0; /* (too far behind: let it go) */+ if (n || hitk) {eadk_display_wait_for_vblank();- gfx_render(scr == SC_HUB ? hub_scene : play_scene, 0, 0, SCREEN_H);- full = 0;+ gfx_render(scr == SC_PLAY ? play_scene : scr == SC_MAP ? map_scene : scr == SC_END ? end_scene : title_scene, 0, 0,+ SCREEN_H);} else {- eadk_timing_msleep(8);+ eadk_timing_msleep(2);}}if (scr == SC_PLAY) sv.room = (uint8_t)rnum;diff --git a/games/leveldevil/src/pictures.h b/games/leveldevil/src/pictures.hnew file mode 100644index 00000000..5d0e13d2--- /dev/null+++ b/games/leveldevil/src/pictures.h@@ -0,0 +1,1079 @@+/* Level Devil's own pictures and fonts (tools/pictures.py, from the game's web build) */+typedef struct {+ uint16_t w, h, pal;+ uint8_t tint, runs;+ uint32_t at;+} pic_t;+enum {+ P_HERO_IDLE,+ P_HERO_JUMP_L,+ P_HERO_JUMP_R,+ P_HERO_RUN_L0,+ P_HERO_RUN_L1,+ P_HERO_RUN_L2,+ P_HERO_RUN_L3,+ P_HERO_RUN_R0,+ P_HERO_RUN_R1,+ P_HERO_RUN_R2,+ P_HERO_RUN_R3,+ P_FLAP_STAND,+ P_FLAP_R,+ P_FLAP_L,+ P_DOOR,+ P_DOOR_SHUT0,+ P_DOOR_SHUT1,+ P_DOOR_SHUT2,+ P_DOOR_SHUT3,+ P_DOOR_SHUT4,+ P_DOOR_HERO,+ P_DOOR_DUMMY,+ P_SPIKE,+ P_COIN,+ P_BAD_COIN,+ P_WARP0,+ P_WARP1,+ P_SPRING,+ P_SPRING_UP,+ P_BUTTON,+ P_BUTTON_DOWN,+ P_SAW,+ P_SAW_BIG,+ P_GSPIKE,+ P_THRU,+ P_DEATH_SQUARE,+ P_BODY0,+ P_BODY1,+ P_BODY2,+ P_BODY3,+ P_PRE0,+ P_PRE1,+ P_PRE2,+ P_PRE3,+ P_KEYS,+ P_ROOM_SQUARE,+ P_ROOM_DONE,+ P_BACK,+ P_PORTAL_LOCKED,+ P_PORTAL0,+ P_PORTAL1,+ P_PORTAL2,+ P_PORTAL3,+ P_PORTAL4,+ P_PORTAL5,+ P_PORTAL6,+ P_PORTAL7,+ P_PORTAL8,+ P_PORTAL9,+ P_PORTAL10,+ P_PORTAL11,+ P_PORTAL12,+ P_PORTAL13,+ P_PORTAL14,+ P_BOSS_LOCKED,+ P_BOSS_OPEN,+ P_DIRT,+ P_HILITE0,+ P_HILITE1,+ P_HILITE2,+ P_HILITE3,+ P_HILITE_BOSS0,+ P_HILITE_BOSS1,+ P_HILITE_BOSS2,+ P_HILITE_BOSS3,+ P_CARD,+ P_CARD_ON,+ P_EYES,+ P_EYES_LAUGH,+ P_TITLE,+ P_JAW_TOP,+ P_JAW_BOTTOM,+ P_CREDITS,+ PICS+};+static const uint16_t pic_pal[69] = {+ 0x0000, 0x630C, 0xCE59, 0x630C, 0xCE59, 0x9492, 0xFDCA, 0xF79E, 0xF504, 0xBCED, 0xF79E, 0xBDD7,+ 0xBDD7, 0xF79E, 0xAC4A, 0x6880, 0xFFCC, 0x2820, 0xC3E2, 0xA321, 0x9B40, 0xFDCA, 0xBBA1, 0xF587,+ 0xCC20, 0xFE2A, 0xE3C0, 0xEEAE, 0xE344, 0xE629, 0xD2E5, 0xFD66, 0xD265, 0xFE46, 0xB265, 0xECCE,+ 0xA245, 0xCDAF, 0x8246, 0xF44F, 0x7267, 0xFDCC, 0x6268, 0xF4EF, 0x49C6, 0xEBCA, 0x4185, 0xCBA8,+ 0x40E1, 0xAB8A, 0x28A1, 0xCBA8, 0xC3E2, 0xFFCC, 0xC3E2, 0xD265, 0xFFCC, 0x0000, 0x6880, 0x6880,+ 0xFFCC, 0x0000, 0x7000, 0x6880, 0xD265, 0x2820, 0x6840, 0xFD46, 0xC3E2,+};+static const pic_t pics[PICS] = {+ {16, 16, 0, 0, 0, 0}, /* HERO_IDLE */+ {16, 16, 0, 0, 0, 128}, /* HERO_JUMP_L */+ {16, 16, 0, 0, 0, 256}, /* HERO_JUMP_R */+ {16, 16, 0, 0, 0, 384}, /* HERO_RUN_L0 */+ {16, 16, 0, 0, 0, 512}, /* HERO_RUN_L1 */+ {16, 16, 0, 0, 0, 640}, /* HERO_RUN_L2 */+ {16, 16, 0, 0, 0, 768}, /* HERO_RUN_L3 */+ {16, 16, 0, 0, 0, 896}, /* HERO_RUN_R0 */+ {16, 16, 0, 0, 0, 1024}, /* HERO_RUN_R1 */+ {16, 16, 0, 0, 0, 1152}, /* HERO_RUN_R2 */+ {16, 16, 0, 0, 0, 1280}, /* HERO_RUN_R3 */+ {16, 16, 0, 0, 0, 1408}, /* FLAP_STAND */+ {16, 16, 0, 0, 0, 1536}, /* FLAP_R */+ {16, 16, 0, 0, 0, 1664}, /* FLAP_L */+ {16, 16, 1, 1, 0, 1792}, /* DOOR */+ {16, 16, 3, 1, 0, 1920}, /* DOOR_SHUT0 */+ {16, 16, 3, 1, 0, 2048}, /* DOOR_SHUT1 */+ {16, 16, 3, 1, 0, 2176}, /* DOOR_SHUT2 */+ {16, 16, 3, 1, 0, 2304}, /* DOOR_SHUT3 */+ {16, 16, 1, 1, 0, 2432}, /* DOOR_SHUT4 */+ {16, 16, 0, 0, 0, 2560}, /* DOOR_HERO */+ {16, 16, 1, 1, 0, 2688}, /* DOOR_DUMMY */+ {16, 16, 1, 1, 0, 2816}, /* SPIKE */+ {16, 16, 1, 1, 0, 2944}, /* COIN */+ {16, 16, 1, 1, 0, 3072}, /* BAD_COIN */+ {16, 16, 1, 1, 0, 3200}, /* WARP0 */+ {16, 16, 1, 1, 0, 3328}, /* WARP1 */+ {16, 16, 1, 1, 0, 3456}, /* SPRING */+ {16, 16, 1, 1, 0, 3584}, /* SPRING_UP */+ {16, 16, 1, 1, 0, 3712}, /* BUTTON */+ {16, 16, 1, 1, 0, 3840}, /* BUTTON_DOWN */+ {16, 16, 1, 1, 0, 3968}, /* SAW */+ {32, 32, 1, 1, 0, 4096}, /* SAW_BIG */+ {16, 26, 1, 1, 0, 4608}, /* GSPIKE */+ {16, 16, 1, 1, 0, 4816}, /* THRU */+ {16, 16, 1, 1, 0, 4944}, /* DEATH_SQUARE */+ {4, 3, 0, 0, 0, 5072}, /* BODY0 */+ {4, 3, 0, 0, 0, 5078}, /* BODY1 */+ {4, 3, 0, 0, 0, 5084}, /* BODY2 */+ {4, 3, 0, 0, 0, 5090}, /* BODY3 */+ {4, 3, 0, 0, 0, 5096}, /* PRE0 */+ {4, 3, 0, 0, 0, 5102}, /* PRE1 */+ {4, 3, 0, 0, 0, 5108}, /* PRE2 */+ {4, 3, 0, 0, 0, 5114}, /* PRE3 */+ {50, 31, 6, 0, 0, 5120}, /* KEYS */+ {9, 8, 0, 0, 0, 5895}, /* ROOM_SQUARE */+ {9, 8, 0, 0, 0, 5935}, /* ROOM_DONE */+ {16, 16, 15, 0, 0, 5975}, /* BACK */+ {16, 16, 18, 0, 0, 6103}, /* PORTAL_LOCKED */+ {16, 16, 20, 0, 0, 6231}, /* PORTAL0 */+ {16, 16, 22, 0, 0, 6359}, /* PORTAL1 */+ {16, 16, 24, 0, 0, 6487}, /* PORTAL2 */+ {16, 16, 26, 0, 0, 6615}, /* PORTAL3 */+ {16, 16, 28, 0, 0, 6743}, /* PORTAL4 */+ {16, 16, 30, 0, 0, 6871}, /* PORTAL5 */+ {16, 16, 32, 0, 0, 6999}, /* PORTAL6 */+ {16, 16, 34, 0, 0, 7127}, /* PORTAL7 */+ {16, 16, 36, 0, 0, 7255}, /* PORTAL8 */+ {16, 16, 38, 0, 0, 7383}, /* PORTAL9 */+ {16, 16, 40, 0, 0, 7511}, /* PORTAL10 */+ {16, 16, 42, 0, 0, 7639}, /* PORTAL11 */+ {16, 16, 44, 0, 0, 7767}, /* PORTAL12 */+ {16, 16, 46, 0, 0, 7895}, /* PORTAL13 */+ {16, 16, 48, 0, 0, 8023}, /* PORTAL14 */+ {32, 32, 18, 0, 0, 8151}, /* BOSS_LOCKED */+ {32, 32, 50, 0, 0, 8663}, /* BOSS_OPEN */+ {22, 4, 18, 0, 0, 9175}, /* DIRT */+ {12, 30, 53, 0, 0, 9219}, /* HILITE0 */+ {12, 30, 53, 0, 0, 9399}, /* HILITE1 */+ {12, 30, 53, 0, 0, 9579}, /* HILITE2 */+ {12, 30, 53, 0, 0, 9759}, /* HILITE3 */+ {22, 37, 53, 0, 0, 9939}, /* HILITE_BOSS0 */+ {22, 37, 53, 0, 0, 10346}, /* HILITE_BOSS1 */+ {22, 37, 53, 0, 0, 10753}, /* HILITE_BOSS2 */+ {22, 37, 53, 0, 0, 11160}, /* HILITE_BOSS3 */+ {76, 78, 55, 0, 1, 11567}, /* CARD */+ {76, 78, 59, 0, 1, 12291}, /* CARD_ON */+ {240, 60, 62, 0, 1, 12998}, /* EYES */+ {240, 60, 62, 0, 1, 13600}, /* EYES_LAUGH */+ {432, 240, 63, 0, 1, 14090}, /* TITLE */+ {432, 136, 63, 0, 1, 19939}, /* JAW_TOP */+ {432, 135, 15, 0, 1, 21978}, /* JAW_BOTTOM */+ {279, 70, 32, 0, 1, 23671}, /* CREDITS */+};+static const uint8_t pic_data[25507] = {+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,1,17,0,0,0,0,0,16,1,17,0,0,0,0,0,16,1,17,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,0,0,16,17,17,1,0,0,0,0,16,17,17,1,0,0,+ 0,0,16,17,17,1,0,0,0,0,16,17,17,1,0,0,0,0,16,17,17,0,0,0,0,16,17,17,17,0,0,0,+ 0,16,17,17,17,17,0,0,0,16,1,0,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,17,17,17,0,0,0,0,0,17,17,17,0,0,0,0,0,17,17,17,0,0,0,+ 0,0,17,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,17,0,0,0,16,17,17,17,17,0,0,+ 0,16,17,1,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,17,17,17,0,0,0,0,0,17,17,17,0,0,0,0,0,17,0,17,0,0,0,0,0,17,0,16,1,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,0,0,16,17,17,1,0,0,0,0,16,17,17,1,0,0,+ 0,0,16,17,17,1,0,0,0,0,16,17,17,1,0,0,0,0,16,17,17,0,0,0,0,16,17,17,17,0,0,0,+ 0,16,17,17,17,17,0,0,0,16,1,0,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,1,17,1,0,0,0,0,16,1,16,17,0,0,0,0,16,1,0,1,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,17,1,0,0,0,0,0,16,17,1,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,1,0,0,+ 0,0,16,17,17,1,0,0,0,0,16,1,16,1,0,0,0,0,17,0,16,1,0,0,0,0,17,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,17,17,17,0,0,0,0,0,17,17,17,0,0,0,0,0,17,17,17,0,0,0,+ 0,0,17,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,17,0,0,0,16,17,17,17,17,0,0,+ 0,16,17,1,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,17,1,17,0,0,0,0,16,17,0,17,0,0,0,0,0,1,0,17,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,0,17,17,0,0,0,0,0,0,17,17,0,0,0,0,0,0,17,1,0,0,0,0,0,0,16,1,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,1,17,0,0,0,0,0,16,1,17,0,0,0,0,0,16,1,17,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,17,17,17,0,0,0,0,0,17,17,17,0,0,0,0,0,17,17,17,0,0,0,+ 0,0,17,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,17,0,0,0,16,17,17,17,17,0,0,+ 0,16,17,1,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,0,0,16,17,17,1,0,0,0,0,16,17,17,1,0,0,+ 0,0,16,17,17,1,0,0,0,0,16,17,17,1,0,0,0,0,16,17,17,0,0,0,0,16,17,17,17,0,0,0,+ 0,16,17,17,17,17,0,0,0,16,1,0,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,17,17,17,17,17,17,0,16,17,17,17,17,17,17,1,17,33,34,34,34,34,18,17,17,34,34,34,34,34,34,17,+ 17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,+ 17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,+ 17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,+ 0,17,17,17,17,17,17,0,16,17,17,17,17,17,17,1,17,17,18,33,17,18,17,17,17,18,34,49,19,34,33,17,+ 17,34,34,51,35,34,34,17,17,34,34,51,35,34,34,17,17,34,50,51,51,34,34,17,17,34,50,51,51,34,34,17,+ 17,34,50,51,51,34,34,17,17,34,50,51,51,34,34,17,17,34,50,51,51,34,34,17,17,34,50,51,51,34,34,17,+ 17,34,50,51,51,34,34,17,17,34,50,35,51,34,34,17,17,34,50,35,51,34,34,17,17,34,50,35,51,34,34,17,+ 0,17,17,17,17,17,17,0,16,17,17,17,17,17,17,1,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,49,17,18,33,17,17,18,50,49,19,34,33,17,+ 17,34,50,51,51,34,34,17,17,34,50,51,51,34,34,17,17,34,50,51,51,34,34,17,17,34,50,51,51,34,34,17,+ 17,34,50,51,51,34,34,17,17,34,50,35,51,34,34,17,17,34,50,35,51,34,34,17,17,34,50,35,51,34,34,17,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,17,17,17,17,17,17,0,16,17,17,17,17,17,17,1,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,49,17,18,33,17,17,18,50,49,19,34,33,17,+ 17,34,50,51,51,34,34,17,17,34,50,35,51,34,34,17,17,34,50,35,51,34,34,17,17,34,50,35,51,34,34,17,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,17,17,17,17,17,17,0,16,17,17,17,17,17,17,1,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,33,17,18,33,17,17,18,50,33,19,34,33,17,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,17,17,17,17,17,17,0,16,17,17,17,17,17,17,1,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,+ 0,0,0,17,1,0,0,0,0,0,0,17,1,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,0,0,16,17,17,0,0,0,+ 0,0,16,17,17,0,0,0,0,0,16,1,17,0,0,0,0,0,16,1,17,0,0,0,0,0,16,1,17,0,0,0,+ 0,17,17,17,17,17,17,0,16,17,17,17,17,17,17,1,17,33,34,34,34,34,18,17,17,34,34,34,34,34,34,17,+ 17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,+ 17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,+ 17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,16,1,0,17,0,+ 0,17,0,16,1,0,17,0,16,17,1,17,17,16,17,1,16,17,1,17,17,16,17,1,17,17,17,17,17,17,17,17,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,17,17,0,0,0,0,0,16,17,17,1,0,0,0,0,16,17,17,1,0,0,+ 0,0,16,17,17,1,0,0,0,0,16,17,17,1,0,0,0,0,0,17,17,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,17,17,0,0,0,0,0,16,17,17,1,0,0,0,0,16,17,17,1,0,0,+ 0,0,16,17,17,1,0,0,0,0,16,17,17,1,0,0,0,0,0,17,17,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,16,17,17,17,17,17,17,1,16,0,0,0,0,0,0,1,16,16,17,17,17,17,1,1,+ 16,16,0,0,0,0,1,1,16,16,16,17,17,1,1,1,16,16,16,0,0,1,1,1,16,16,16,16,1,1,1,1,+ 16,16,16,16,1,1,1,1,16,16,16,0,0,1,1,1,16,16,16,17,17,1,1,1,16,16,0,0,0,0,1,1,+ 16,16,17,17,17,17,1,1,16,0,0,0,0,0,0,1,16,17,17,17,17,17,17,1,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,17,17,17,17,17,0,0,1,0,0,0,0,16,0,+ 0,1,17,17,17,17,16,0,0,1,1,0,0,16,16,0,0,1,1,17,17,16,16,0,0,1,1,1,16,16,16,0,+ 0,1,1,1,16,16,16,0,0,1,1,17,17,16,16,0,0,1,1,0,0,16,16,0,0,1,17,17,17,17,16,0,+ 0,1,0,0,0,0,16,0,0,17,17,17,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,17,17,17,17,17,17,17,17,0,0,0,17,17,0,0,0,0,0,0,17,17,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,17,17,17,17,17,17,17,17,0,0,0,17,17,0,0,0,0,0,0,17,17,0,0,0,+ 0,0,0,17,17,0,0,0,0,0,0,17,17,0,0,0,0,0,0,17,17,0,0,0,0,0,0,17,17,0,0,0,+ 0,0,0,17,17,0,0,0,0,0,0,17,17,0,0,0,0,0,0,17,17,0,0,0,0,0,0,17,17,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,17,17,1,0,0,0,0,17,17,17,17,0,0,+ 0,0,17,17,17,17,0,0,0,0,17,17,17,17,0,0,0,0,17,17,17,17,0,0,0,16,17,17,17,17,1,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,17,17,17,0,0,0,16,17,17,17,17,1,0,+ 0,0,16,17,17,1,0,0,0,16,17,17,17,17,1,0,0,17,17,17,17,17,17,0,16,17,17,17,17,17,17,1,+ 16,17,17,17,17,17,17,1,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,1,16,17,17,17,+ 17,17,17,1,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16,17,17,17,17,17,17,1,+ 16,17,17,17,17,17,17,1,0,17,17,17,17,17,17,0,0,16,17,17,17,17,1,0,0,0,16,17,17,1,0,0,+ 0,0,0,0,0,0,17,17,17,17,0,0,0,0,0,0,0,0,0,0,16,17,17,17,17,17,17,1,0,0,0,0,+ 0,0,0,16,17,17,17,17,17,17,17,17,1,0,0,0,0,0,0,17,17,17,17,17,17,17,17,17,17,0,0,0,+ 0,0,16,17,17,17,17,17,17,17,17,17,17,1,0,0,0,0,17,17,17,17,17,17,17,17,17,17,17,17,0,0,+ 0,16,17,17,17,17,17,17,17,17,17,17,17,17,1,0,0,17,17,17,17,17,17,17,17,17,17,17,17,17,17,0,+ 0,17,17,17,17,17,17,17,17,17,17,17,17,17,17,0,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,1,+ 16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,1,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,1,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,1,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,0,0,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,0,0,17,17,17,17,17,17,17,17,17,17,17,17,17,17,1,16,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,1,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,1,+ 16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,1,0,17,17,17,17,17,17,17,17,17,17,17,17,17,17,0,+ 0,17,17,17,17,17,17,17,17,17,17,17,17,17,17,0,0,16,17,17,17,17,17,17,17,17,17,17,17,17,1,0,+ 0,0,17,17,17,17,17,17,17,17,17,17,17,17,0,0,0,0,16,17,17,17,17,17,17,17,17,17,17,1,0,0,+ 0,0,0,17,17,17,17,17,17,17,17,17,17,0,0,0,0,0,0,16,17,17,17,17,17,17,17,17,1,0,0,0,+ 0,0,0,0,16,17,17,17,17,17,17,1,0,0,0,0,0,0,0,0,0,0,17,17,17,17,0,0,0,0,0,0,+ 0,17,0,16,1,0,17,0,0,17,0,16,1,0,17,0,16,17,1,17,17,16,17,1,16,17,1,17,17,16,17,1,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16,17,1,17,17,16,17,1,16,17,1,17,17,16,17,1,+ 0,17,0,16,1,0,17,0,0,17,0,16,1,0,17,0,16,17,1,17,17,16,17,1,16,17,1,17,17,16,17,1,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,17,17,17,17,17,17,0,0,17,17,17,17,17,17,0,0,17,17,17,17,17,17,0,0,17,17,17,17,17,17,0,+ 0,17,17,17,17,17,17,0,0,17,17,17,17,17,17,0,0,17,17,17,17,17,17,0,0,17,17,17,17,17,17,0,+ 0,17,17,17,17,17,17,0,0,17,17,17,17,17,17,0,0,17,17,17,17,17,17,0,0,17,17,17,17,17,17,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,17,1,17,1,0,0,17,17,17,17,0,0,16,1,+ 17,1,0,0,17,0,17,0,17,1,17,1,17,1,0,0,17,17,17,17,0,0,16,1,17,1,0,0,17,0,17,0,+ 0,0,0,0,0,0,0,0,16,17,17,17,17,17,17,17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,16,17,17,17,17,17,17,17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,17,17,17,17,17,+ 17,17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,17,17,17,17,17,17,17,1,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,16,17,17,17,34,17,17,17,1,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,16,17,17,33,34,18,17,17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,17,+ 17,34,34,34,17,17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,17,33,34,34,34,18,17,1,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,17,34,34,34,34,34,17,1,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,16,17,17,17,17,17,17,17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,16,17,17,17,17,17,17,17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,17,17,17,17,+ 17,17,17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,17,17,17,17,17,17,17,1,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,48,51,51,51,51,51,51,51,3,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,48,51,51,51,51,51,51,51,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,17,17,17,17,17,17,17,17,64,68,68,68,68,68,68,68,+ 4,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,64,68,68,68,68,68,68,68,4,17,17,17,17,17,17,+ 17,17,17,17,17,17,81,17,17,17,64,68,68,68,68,68,68,68,4,17,17,17,21,17,17,17,17,17,17,17,17,34,+ 17,17,17,64,68,68,68,68,68,68,68,4,17,17,17,82,17,17,17,17,17,17,17,81,85,17,17,17,64,68,68,68,+ 68,68,68,68,4,17,17,17,34,18,17,17,17,17,17,17,82,82,17,17,17,64,68,102,102,102,102,102,68,4,17,17,+ 17,34,82,17,17,17,17,17,81,37,82,17,17,17,64,68,116,119,103,118,70,68,4,17,17,17,34,34,18,17,17,17,+ 17,81,34,82,17,17,17,64,68,68,103,103,118,68,68,4,17,17,17,37,37,18,17,17,17,17,17,34,130,17,17,17,+ 64,68,68,116,102,70,68,68,4,17,17,17,82,85,17,17,17,17,17,17,81,85,17,17,17,64,68,68,68,119,68,68,+ 68,4,17,17,17,85,21,17,17,17,17,17,17,17,34,17,17,17,64,68,68,68,68,68,68,68,4,17,17,17,34,17,+ 17,17,17,17,17,17,17,33,17,17,17,64,68,68,68,68,68,68,68,4,17,17,17,21,17,17,17,17,17,17,17,17,+ 17,17,17,17,64,68,68,68,68,68,68,68,4,17,17,17,17,17,17,17,17,51,51,51,51,51,51,51,51,144,153,153,+ 153,153,153,153,153,9,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,144,153,153,153,153,153,153,153,9,51,+ 51,51,51,51,51,51,51,16,17,17,17,1,16,0,0,0,1,16,0,0,0,1,16,0,0,0,1,16,0,0,0,1,+ 16,0,0,0,1,16,0,0,0,1,16,17,17,17,1,17,17,17,17,0,17,17,17,17,0,17,17,17,17,0,17,17,+ 17,17,0,17,17,17,17,0,17,17,17,17,0,17,17,17,17,0,17,17,17,17,0,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,34,17,17,17,17,17,17,34,34,17,17,17,+ 17,17,34,34,34,17,17,17,17,34,34,34,34,17,17,17,17,34,34,34,34,17,17,17,17,17,34,34,34,17,17,17,+ 17,17,17,34,34,17,17,17,17,17,17,17,34,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,16,17,17,17,17,1,0,0,+ 17,33,34,34,18,17,0,16,17,34,34,34,34,17,1,16,33,34,34,34,34,18,1,17,33,34,34,34,34,18,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,34,34,34,34,34,34,17,17,+ 34,34,34,34,34,34,17,17,33,34,34,34,34,18,17,16,17,17,17,17,17,17,1,0,0,0,16,17,1,0,0,0,+ 16,17,1,0,0,0,0,0,0,0,17,17,0,0,0,0,0,17,17,0,0,0,0,0,0,16,17,1,0,0,0,0,+ 0,16,17,1,0,0,0,0,0,17,17,1,0,0,0,0,0,16,17,17,0,0,0,0,0,17,17,1,0,0,0,0,+ 0,16,17,17,0,0,0,0,0,17,17,17,0,0,0,0,0,17,17,17,0,0,0,0,0,17,17,17,17,17,17,17,+ 17,17,17,17,0,0,0,0,0,17,17,33,34,34,34,34,34,18,17,17,0,0,0,0,0,17,33,34,34,34,34,34,+ 34,34,18,17,0,0,0,0,0,17,34,34,34,34,34,34,34,34,34,17,0,0,0,0,16,33,34,34,34,34,34,34,+ 34,34,34,18,1,0,0,0,17,33,34,34,34,34,34,34,34,34,34,18,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,33,34,34,34,34,34,34,34,34,34,18,17,0,0,0,17,33,34,34,34,34,34,34,+ 34,34,34,18,17,0,0,0,17,33,34,34,34,34,34,34,34,34,34,18,17,0,0,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,16,0,16,17,17,17,17,17,17,17,17,17,17,17,17,0,0,16,1,0,17,0,17,1,0,17,+ 0,17,1,0,1,0,0,0,0,16,0,0,0,0,0,16,0,1,0,0,16,0,1,0,0,0,16,17,1,0,0,0,+ 16,17,1,0,0,0,0,0,0,0,17,17,0,0,0,0,0,17,17,0,0,0,0,0,0,16,17,1,0,0,0,0,+ 0,16,17,1,0,0,0,0,0,17,17,1,0,0,0,0,0,16,17,17,0,0,0,0,0,17,17,1,0,0,0,0,+ 0,16,17,17,0,0,0,0,0,17,17,17,0,0,0,0,0,17,17,17,0,0,0,0,0,17,17,17,17,17,17,17,+ 17,17,17,17,0,0,0,0,0,17,17,33,34,34,34,34,34,18,17,17,0,0,0,0,0,17,33,34,34,34,34,34,+ 34,34,18,17,0,0,0,0,0,17,34,34,34,34,34,34,34,34,34,17,0,0,0,0,16,33,34,34,34,34,34,34,+ 34,34,34,18,1,0,0,0,17,33,34,34,34,34,34,34,34,34,34,18,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,34,34,34,34,17,0,0,0,17,34,34,34,34,34,34,34,+ 34,34,34,34,17,0,0,0,17,33,34,34,34,34,34,34,34,34,34,18,17,0,0,0,17,33,34,34,34,34,34,34,+ 34,34,34,18,17,0,0,0,17,33,34,34,34,34,34,34,34,34,34,18,17,0,0,51,51,17,17,17,17,17,17,17,+ 17,17,17,17,51,51,48,0,48,51,51,51,51,51,51,51,51,51,51,51,51,0,0,48,3,0,51,0,51,3,0,51,+ 0,51,3,0,3,0,0,0,0,48,0,0,0,0,0,48,0,3,0,0,48,0,3,17,1,0,0,0,0,0,0,16,+ 17,16,0,16,17,17,17,17,17,17,17,0,0,16,1,0,17,0,17,1,0,1,0,0,0,0,16,0,0,0,0,0,+ 16,0,1,16,17,17,17,17,1,32,17,17,17,17,2,0,18,17,17,33,0,0,32,17,17,2,0,0,0,18,33,0,+ 0,0,0,32,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,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,16,17,17,1,0,0,17,17,17,17,0,16,17,17,17,17,1,16,17,17,17,17,1,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16,17,17,17,17,1,0,0,0,0,0,0,16,17,17,+ 17,17,1,32,17,17,17,17,2,0,18,17,17,33,0,0,32,17,17,2,0,0,0,18,33,0,0,0,0,32,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,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,17,17,1,0,0,17,17,+ 17,17,0,16,17,17,17,17,1,16,17,17,17,17,1,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,16,17,17,17,17,1,0,0,0,0,0,0,0,0,0,0,0,0,16,17,17,17,17,1,32,17,17,+ 17,17,2,0,18,17,17,33,0,0,32,17,17,2,0,0,0,18,33,0,0,0,0,32,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,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,16,17,17,1,0,0,17,17,17,17,0,16,17,17,17,17,1,16,17,17,+ 17,17,1,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16,17,17,17,17,1,0,+ 0,0,0,0,0,16,17,17,17,17,1,32,17,17,17,17,2,0,18,17,17,33,0,0,32,17,17,2,0,0,0,18,+ 33,0,0,0,0,32,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 16,17,17,1,0,0,17,17,17,17,0,16,17,17,17,17,1,16,17,17,17,17,1,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,16,17,17,17,17,1,0,0,0,17,17,17,17,17,0,0,0,0,0,+ 0,18,17,17,17,33,0,0,0,0,0,0,32,17,17,17,2,0,0,0,0,0,0,0,18,17,33,0,0,0,0,0,+ 0,0,0,32,17,2,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,16,17,17,17,17,17,1,0,0,0,16,17,17,17,17,17,17,17,1,0,0,17,17,17,17,17,17,+ 17,17,17,0,16,17,17,17,17,17,17,17,17,17,1,16,17,17,17,17,17,17,17,17,17,1,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,16,17,17,17,17,17,17,17,17,17,1,16,17,17,17,17,17,17,17,17,17,1,16,+ 17,17,17,17,17,17,17,17,17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,17,17,17,17,0,0,0,+ 0,0,0,18,17,17,17,33,0,0,0,0,0,0,32,17,17,17,2,0,0,0,0,0,0,0,18,17,33,0,0,0,+ 0,0,0,0,0,32,17,2,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,17,17,17,+ 17,17,1,0,0,0,16,17,17,17,17,17,17,17,1,0,0,17,17,17,17,17,17,17,17,17,0,16,17,17,17,17,+ 17,17,17,17,17,1,16,17,17,17,17,17,17,17,17,17,1,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 16,17,17,17,17,17,17,17,17,17,1,16,17,17,17,17,17,17,17,17,17,1,16,17,17,17,17,17,17,17,17,17,+ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,17,17,17,17,0,+ 0,0,0,0,0,18,17,17,17,33,0,0,0,0,0,0,32,17,17,17,2,0,0,0,0,0,0,0,18,17,33,0,+ 0,0,0,0,0,0,0,32,17,2,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,17,17,17,17,17,1,0,0,0,16,17,17,+ 17,17,17,17,17,1,0,0,17,17,17,17,17,17,17,17,17,0,16,17,17,17,17,17,17,17,17,17,1,16,17,17,+ 17,17,17,17,17,17,17,1,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16,17,17,17,17,17,17,17,17,+ 17,1,16,17,17,17,17,17,17,17,17,17,1,16,17,17,17,17,17,17,17,17,17,1,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,17,17,17,17,17,0,0,0,0,0,0,18,17,17,17,33,0,0,0,0,0,0,32,17,17,17,+ 2,0,0,0,0,0,0,0,18,17,33,0,0,0,0,0,0,0,0,32,17,2,0,0,0,0,0,0,0,0,0,34,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+ 0,0,0,0,0,0,0,0,0,0,16,17,17,17,17,17,1,0,0,0,16,17,17,17,17,17,17,17,1,0,0,17,+ 17,17,17,17,17,17,17,17,0,16,17,17,17,17,17,17,17,17,17,1,16,17,17,17,17,17,17,17,17,17,1,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,+ 17,17,17,17,17,17,17,17,17,17,17,17,17,17,16,17,17,17,17,17,17,17,17,17,1,16,17,17,17,17,17,17,+ 17,17,17,1,16,17,17,17,17,17,17,17,17,17,1,156,0,158,0,160,0,164,0,168,0,172,0,176,0,180,0,184,+ 0,188,0,192,0,196,0,200,0,207,0,214,0,221,0,228,0,235,0,242,0,249,0,0,1,7,1,14,1,21,1,28,+ 1,35,1,42,1,49,1,56,1,63,1,70,1,78,1,86,1,95,1,104,1,108,1,112,1,116,1,120,1,124,1,128,+ 1,132,1,136,1,147,1,158,1,169,1,180,1,191,1,202,1,213,1,224,1,232,1,240,1,242,1,244,1,246,1,248,+ 1,250,1,252,1,4,2,12,2,23,2,42,2,62,2,83,2,101,2,120,2,140,2,155,2,171,2,187,2,192,2,197,+ 2,202,2,204,2,206,2,208,2,210,2,31,60,31,60,17,47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,+ 47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,47,17,53,47,17,17,17,47,+ 17,53,47,17,17,17,47,17,53,47,17,17,17,47,17,53,47,17,17,17,47,17,53,47,17,17,17,47,17,53,47,17,+ 17,17,47,13,59,47,15,17,17,47,13,59,47,15,17,17,47,13,59,47,15,17,17,47,13,59,47,15,17,17,47,13,+ 59,47,15,17,17,47,13,59,47,15,17,17,47,13,59,47,15,17,17,47,13,59,47,15,17,17,47,15,57,47,15,17,+ 17,47,15,57,47,15,17,17,47,15,61,47,11,17,17,47,15,61,47,11,17,17,47,11,63,2,47,11,17,17,47,11,+ 63,2,47,11,17,17,47,11,55,37,51,47,11,17,17,47,11,55,37,51,47,11,17,17,47,56,17,17,47,56,17,17,+ 47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,47,8,19,37,19,37,19,47,+ 8,17,17,47,8,19,37,19,37,19,47,8,17,17,47,8,19,37,19,37,19,47,8,17,17,47,8,19,37,19,37,19,+ 47,8,17,17,47,6,23,33,23,33,23,47,6,17,17,47,6,23,33,23,33,23,47,6,17,17,47,6,23,33,23,33,+ 23,47,6,17,17,47,6,23,33,23,33,23,47,6,17,17,47,4,31,16,47,4,17,17,47,4,31,16,47,4,17,31,+ 60,31,60,31,60,31,60,31,60,31,60,23,34,22,39,17,34,31,29,22,35,22,39,17,34,31,29,22,64,34,22,34,+ 66,33,17,34,31,29,23,34,22,34,18,33,17,34,17,38,17,34,17,34,17,39,17,39,21,23,34,22,34,17,34,17,+ 34,17,38,17,34,17,34,17,39,17,38,64,21,23,34,22,39,17,34,17,67,34,17,34,17,34,17,34,65,34,17,34,+ 67,22,23,34,22,34,68,17,34,16,39,17,34,17,34,17,39,17,34,26,23,34,22,34,22,34,16,34,65,34,17,34,+ 17,34,17,39,17,34,26,23,34,22,34,22,34,16,34,17,34,17,34,17,34,17,34,68,17,34,26,23,34,22,34,22,+ 34,16,39,17,39,17,38,18,34,26,23,34,22,34,22,34,16,39,17,39,17,37,64,18,34,26,23,66,22,66,22,66,+ 16,71,17,68,34,17,69,19,66,26,31,27,38,31,10,31,27,38,31,10,31,27,70,31,10,31,60,31,60,31,60,79,+ 60,79,60,156,0,158,0,160,0,164,0,168,0,172,0,176,0,180,0,184,0,188,0,192,0,196,0,200,0,204,0,208,+ 0,215,0,222,0,229,0,236,0,243,0,250,0,1,1,8,1,15,1,22,1,29,1,36,1,43,1,50,1,57,1,64,+ 1,71,1,78,1,86,1,94,1,103,1,112,1,116,1,120,1,124,1,128,1,132,1,136,1,140,1,144,1,155,1,166,+ 1,177,1,188,1,199,1,210,1,221,1,232,1,240,1,248,1,250,1,252,1,254,1,0,2,2,2,4,2,12,2,20,+ 2,30,2,49,2,68,2,87,2,104,2,123,2,142,2,157,2,172,2,177,2,182,2,187,2,189,2,191,2,193,2,31,+ 60,31,60,17,47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,+ 47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,47,17,53,47,17,17,17,47,17,53,47,17,+ 17,17,47,17,53,47,17,17,17,47,17,53,47,17,17,17,47,17,53,47,17,17,17,47,17,53,47,17,17,17,47,13,+ 59,47,15,17,17,47,13,59,47,15,17,17,47,13,59,47,15,17,17,47,13,59,47,15,17,17,47,13,59,47,15,17,+ 17,47,13,59,47,15,17,17,47,13,59,47,15,17,17,47,13,59,47,15,17,17,47,15,57,47,15,17,17,47,15,57,+ 47,15,17,17,47,15,61,47,11,17,17,47,15,61,47,11,17,17,47,11,63,2,47,11,17,17,47,11,63,2,47,11,+ 17,17,47,11,55,37,51,47,11,17,17,47,11,55,37,51,47,11,17,17,47,56,17,17,47,56,17,17,47,56,17,17,+ 47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,47,56,17,17,47,8,19,37,19,37,19,47,8,17,17,47,+ 8,19,37,19,37,19,47,8,17,17,47,8,19,37,19,37,19,47,8,17,17,47,8,19,37,19,37,19,47,8,17,17,+ 47,6,23,33,23,33,23,47,6,17,17,47,6,23,33,23,33,23,47,6,17,17,47,6,23,33,23,33,23,47,6,17,+ 17,47,6,23,33,23,33,23,47,6,17,17,47,4,31,16,47,4,17,17,47,4,31,16,47,4,17,31,60,31,60,31,+ 60,31,60,31,60,31,60,23,34,22,39,17,34,31,29,22,35,22,39,17,34,31,29,23,34,22,34,18,33,17,34,31,+ 29,23,34,22,34,18,33,17,34,17,38,17,34,17,34,17,39,17,39,21,23,34,22,34,17,34,17,34,17,38,17,34,+ 17,34,17,39,17,38,22,23,34,22,39,17,34,21,34,17,34,17,34,17,34,17,34,17,34,26,23,34,22,34,22,34,+ 16,39,17,34,17,34,17,39,17,34,26,23,34,22,34,22,34,16,34,17,34,17,34,17,34,17,39,17,34,26,23,34,+ 22,34,22,34,16,34,17,34,17,34,17,34,17,34,22,34,26,23,34,22,34,22,34,16,39,17,39,17,38,18,34,26,+ 23,34,22,34,22,34,16,39,17,39,17,37,19,34,26,31,31,34,31,10,31,27,38,31,10,31,27,38,31,10,31,60,+ 31,60,31,60,31,60,120,0,126,0,130,0,134,0,138,0,142,0,146,0,152,0,158,0,164,0,170,0,176,0,182,0,+ 188,0,194,0,200,0,206,0,212,0,218,0,224,0,230,0,236,0,242,0,248,0,0,1,8,1,26,1,40,1,54,1,+ 62,1,70,1,78,1,86,1,94,1,102,1,110,1,118,1,126,1,134,1,142,1,150,1,158,1,168,1,178,1,188,1,+ 198,1,208,1,218,1,228,1,238,1,248,1,2,2,12,2,22,2,32,2,42,2,52,2,62,2,72,2,82,2,0,16,+ 15,220,16,0,18,15,218,18,18,15,218,18,18,15,218,18,19,15,216,19,19,15,216,19,0,18,15,216,18,0,0,18,+ 15,216,18,0,0,19,15,214,19,0,0,19,15,214,19,0,0,20,15,212,20,0,0,20,15,212,20,0,0,21,15,210,+ 21,0,1,21,15,208,21,1,1,21,15,208,21,1,1,23,15,204,23,1,2,22,15,204,22,2,2,23,15,202,23,2,+ 3,23,15,200,23,3,3,24,15,198,24,3,4,25,15,194,25,4,4,27,15,190,27,4,5,28,15,186,28,5,5,31,+ 0,15,180,31,0,5,5,31,5,15,170,31,5,5,6,31,8,15,33,20,0,16,15,50,16,0,20,15,33,31,8,6,+ 6,31,13,15,23,27,15,50,27,15,23,31,13,6,7,31,21,12,31,12,15,52,31,12,12,31,21,7,7,31,61,15,+ 54,31,61,7,8,31,60,15,54,31,60,8,9,31,58,15,56,31,58,9,9,31,57,15,58,31,57,9,10,31,56,15,+ 58,31,56,10,10,31,55,15,60,31,55,10,11,31,54,15,60,31,54,11,11,31,53,15,62,31,53,11,11,31,53,15,+ 62,31,53,11,12,31,51,15,64,31,51,12,13,31,50,15,64,31,50,13,13,31,50,15,64,31,50,13,14,31,48,15,+ 66,31,48,14,15,0,31,46,15,68,31,46,15,0,15,0,31,46,15,68,31,46,15,0,15,1,31,45,15,68,31,45,+ 15,1,15,2,31,43,15,70,31,43,15,2,15,3,31,42,15,70,31,42,15,3,15,3,31,41,15,72,31,41,15,3,+ 15,4,31,40,15,72,31,40,15,4,15,5,31,38,15,74,31,38,15,5,15,6,31,37,15,74,31,37,15,6,15,7,+ 31,35,15,76,31,35,15,7,15,10,31,32,15,76,31,32,15,10,15,11,31,30,15,78,31,30,15,11,15,14,31,27,+ 15,78,31,27,15,14,15,15,31,25,15,80,31,25,15,15,15,20,31,19,15,82,31,19,15,20,15,22,31,16,15,84,+ 31,16,15,22,15,25,31,13,15,84,31,13,15,25,15,31,31,5,15,88,31,5,15,31,15,43,18,15,100,18,15,43,+ 120,0,122,0,124,0,126,0,128,0,130,0,132,0,134,0,136,0,138,0,140,0,142,0,144,0,146,0,148,0,150,0,+ 152,0,158,0,164,0,174,0,184,0,194,0,204,0,216,0,226,0,236,0,244,0,0,1,14,1,28,1,42,1,50,1,+ 60,1,70,1,80,1,94,1,104,1,122,1,136,1,150,1,162,1,174,1,184,1,194,1,202,1,204,1,206,1,208,1,+ 210,1,212,1,214,1,216,1,218,1,220,1,222,1,224,1,226,1,228,1,230,1,232,1,15,224,15,224,15,224,15,224,+ 15,224,15,224,15,224,15,224,15,224,15,224,15,224,15,224,15,224,15,224,15,224,15,224,4,20,15,203,20,5,4,23,+ 15,197,23,5,4,25,8,17,15,171,17,8,25,5,4,25,8,23,15,159,23,8,25,5,6,24,7,25,15,155,25,7,+ 24,7,8,24,6,27,15,149,27,6,24,9,13,19,6,31,0,15,141,31,0,6,19,14,15,12,31,0,15,135,31,0,+ 15,13,15,14,31,1,15,129,31,1,15,15,15,18,30,15,125,30,15,19,8,21,15,7,30,15,117,30,15,7,21,9,+ 9,29,15,1,31,0,15,109,31,0,15,1,29,10,9,31,7,10,31,3,15,97,31,3,10,31,7,10,12,31,16,0,+ 31,5,15,89,31,5,0,31,16,13,12,31,39,15,87,31,39,13,15,3,31,35,15,83,31,35,15,4,15,11,31,31,+ 15,75,31,31,15,12,15,28,31,21,15,61,31,21,15,29,15,32,16,0,31,15,15,61,31,15,0,16,15,33,15,29,+ 31,19,15,63,31,19,15,30,9,31,1,12,31,18,1,18,15,65,18,1,31,18,12,31,1,10,4,31,4,9,31,19,+ 15,83,31,19,9,31,4,5,4,31,5,6,31,21,15,83,31,21,6,31,5,5,4,29,8,31,26,15,83,31,26,8,+ 29,5,4,23,14,31,20,15,95,31,20,14,23,5,15,10,31,13,15,113,31,13,15,11,15,8,31,9,15,125,31,9,+ 15,9,15,9,23,15,157,23,15,10,15,224,15,224,15,224,15,224,15,224,15,224,15,224,15,224,15,224,15,224,15,224,+ 15,224,15,224,15,224,15,224,15,224,224,1,228,1,232,1,236,1,240,1,244,1,248,1,252,1,0,2,4,2,8,2,+ 12,2,16,2,20,2,24,2,28,2,32,2,36,2,69,2,102,2,135,2,175,2,215,2,255,2,37,3,75,3,113,3,+ 151,3,189,3,227,3,9,4,47,4,85,4,123,4,159,4,195,4,229,4,7,5,41,5,75,5,110,5,145,5,180,5,+ 221,5,6,6,48,6,79,6,110,6,141,6,145,6,149,6,153,6,157,6,161,6,165,6,171,6,177,6,184,6,194,6,+ 206,6,221,6,244,6,15,7,52,7,112,7,180,7,254,7,85,8,189,8,42,9,160,9,24,10,141,10,1,11,117,11,+ 226,11,64,12,149,12,225,12,36,13,99,13,154,13,205,13,239,13,11,14,27,14,38,14,47,14,56,14,65,14,74,14,+ 78,14,82,14,86,14,90,14,94,14,98,14,102,14,106,14,110,14,114,14,118,14,122,14,126,14,130,14,134,14,138,14,+ 142,14,146,14,150,14,154,14,158,14,162,14,166,14,170,14,174,14,178,14,183,14,188,14,193,14,198,14,202,14,207,14,+ 212,14,220,14,228,14,239,14,252,14,12,15,28,15,44,15,65,15,86,15,104,15,125,15,147,15,167,15,187,15,208,15,+ 229,15,253,15,16,16,35,16,57,16,79,16,106,16,133,16,159,16,190,16,213,16,236,16,3,17,23,17,43,17,65,17,+ 87,17,109,17,131,17,153,17,175,17,197,17,219,17,241,17,7,18,29,18,51,18,73,18,95,18,117,18,135,18,153,18,+ 171,18,189,18,207,18,225,18,243,18,5,19,26,19,44,19,59,19,74,19,94,19,114,19,134,19,154,19,174,19,194,19,+ 214,19,234,19,252,19,14,20,29,20,47,20,68,20,91,20,114,20,137,20,160,20,180,20,199,20,220,20,241,20,6,21,+ 25,21,44,21,64,21,84,21,106,21,129,21,150,21,171,21,189,21,204,21,219,21,234,21,250,21,18,22,39,22,58,22,+ 75,22,91,22,105,22,115,22,125,22,138,22,147,22,158,22,165,22,169,22,173,22,177,22,181,22,185,22,189,22,193,22,+ 197,22,201,22,205,22,209,22,213,22,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,+ 31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,+ 31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,70,38,31,2,47,5,18,39,27,39,18,47,5,19,38,31,18,+ 47,4,20,47,5,18,39,27,39,18,38,19,38,31,86,31,70,38,31,2,47,5,18,39,27,39,18,47,5,19,38,31,+ 18,47,5,19,47,5,18,39,27,39,18,38,19,38,31,86,31,70,38,31,2,47,4,20,39,26,38,19,47,4,20,38,+ 31,18,47,5,19,47,4,20,39,26,38,19,38,19,38,31,86,31,70,38,31,2,47,4,48,18,48,39,25,39,48,18,+ 47,4,48,19,38,31,18,47,5,19,47,4,48,18,48,39,25,39,48,18,38,19,38,31,86,31,70,38,31,2,47,3,+ 49,18,49,38,25,39,48,18,47,3,49,19,38,31,18,47,5,19,47,3,49,18,49,38,25,39,48,18,38,19,38,31,+ 86,31,70,38,31,2,47,3,48,20,48,39,24,38,48,19,47,3,48,20,38,31,18,47,5,19,47,3,48,20,48,39,+ 24,38,48,19,38,19,38,31,86,31,70,38,31,2,38,60,20,48,39,23,39,48,19,38,60,20,38,31,18,38,55,37,+ 19,38,60,20,48,39,23,39,48,19,38,19,38,31,86,31,70,38,31,2,38,59,22,48,38,23,39,48,19,38,59,21,+ 38,31,18,38,55,37,19,38,59,22,48,38,23,39,48,19,38,19,38,31,86,31,70,38,31,2,38,59,22,48,39,21,+ 39,48,20,38,59,21,38,31,18,38,55,37,19,38,59,22,48,39,21,39,48,20,38,19,38,31,86,31,70,38,31,2,+ 38,31,3,48,39,21,39,48,20,38,31,2,38,31,18,38,23,37,19,38,31,3,48,39,21,39,48,20,38,19,38,31,+ 86,31,70,38,31,2,38,31,4,48,39,20,38,49,20,38,31,2,38,31,18,38,23,37,19,38,31,4,48,39,20,38,+ 49,20,38,19,38,31,86,31,70,38,31,2,38,31,4,48,39,19,39,48,21,38,31,2,38,31,18,38,23,37,19,38,+ 31,4,48,39,19,39,48,21,38,19,38,31,86,31,70,38,31,2,47,2,24,49,38,19,39,48,21,47,2,22,38,31,+ 18,38,23,37,19,47,2,24,49,38,19,39,48,21,38,19,38,31,86,31,70,38,31,2,47,2,25,48,39,18,38,48,+ 22,47,2,22,38,31,18,38,23,37,19,47,2,25,48,39,18,38,48,22,38,19,38,31,86,31,70,38,31,2,47,2,+ 25,48,39,17,39,48,22,47,2,22,38,31,18,38,23,37,19,47,2,25,48,39,17,39,48,22,38,19,38,31,86,31,+ 70,38,31,2,47,2,26,48,38,17,39,48,22,47,2,22,38,31,18,38,23,37,19,47,2,26,48,38,17,39,48,22,+ 38,19,38,31,86,31,70,38,31,2,38,58,26,48,47,0,48,23,38,58,22,38,31,18,38,23,37,19,38,58,26,48,+ 47,0,48,23,38,19,38,31,86,31,70,38,31,2,38,58,26,48,47,0,48,23,38,58,22,38,31,18,38,23,37,19,+ 38,58,26,48,47,0,48,23,38,19,38,31,86,31,70,38,31,2,38,58,27,48,46,48,23,38,58,22,38,31,18,38,+ 23,37,19,38,58,27,48,46,48,23,38,19,38,31,86,31,70,38,31,2,38,31,7,48,45,48,24,38,31,2,38,31,+ 18,38,23,37,19,38,31,7,48,45,48,24,38,19,38,31,86,31,70,38,31,2,38,31,7,48,45,48,24,38,31,2,+ 38,31,18,38,23,37,19,38,31,7,48,45,48,24,38,19,38,31,86,31,70,38,31,2,38,31,8,48,43,49,24,38,+ 31,2,38,31,18,38,23,37,19,38,31,8,48,43,49,24,38,19,38,31,86,31,70,47,5,19,47,5,25,48,43,48,+ 25,47,5,19,47,5,31,4,47,5,19,47,5,25,48,43,48,25,38,19,47,5,31,72,31,70,47,5,19,47,5,25,+ 49,42,48,25,47,5,19,47,5,31,4,47,5,19,47,5,25,49,42,48,25,38,19,47,5,31,72,31,70,47,4,20,+ 47,4,27,48,41,48,26,47,4,20,47,4,31,5,47,5,19,47,4,27,48,41,48,26,38,19,47,4,31,73,31,70,+ 47,4,48,19,47,4,48,26,48,41,48,26,47,4,48,19,47,4,48,31,4,47,5,19,47,4,48,26,48,41,48,26,+ 38,19,47,4,48,31,72,31,70,47,3,49,19,47,3,49,27,48,40,48,26,47,3,49,19,47,3,49,31,4,47,5,+ 19,47,3,49,27,48,40,48,26,38,19,47,3,49,31,72,31,70,47,3,48,20,47,3,48,28,48,39,48,27,47,3,+ 48,20,47,3,48,31,5,47,4,48,19,47,3,48,28,48,39,48,27,38,19,47,3,48,31,73,31,70,63,4,20,63,+ 4,28,57,27,63,4,20,63,4,31,5,63,5,19,63,4,28,57,27,54,19,63,4,31,73,31,70,63,3,21,63,3,+ 30,56,27,63,3,21,63,3,31,6,63,5,19,63,3,30,56,27,54,19,63,3,31,74,31,70,63,3,21,63,3,30,+ 55,28,63,3,21,63,3,31,6,63,4,20,63,3,30,55,28,54,19,63,3,31,74,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,27,64,31,255,31,132,26,65,31,255,31,132,26,66,31,229,64,+ 31,156,25,68,31,227,65,31,33,66,31,104,25,65,80,65,31,226,66,31,31,68,31,104,25,64,81,66,31,170,64,31,+ 38,66,31,30,69,31,104,24,65,82,66,31,168,65,23,64,19,64,31,24,65,80,31,28,71,31,12,65,31,74,24,64,+ 84,65,31,36,64,31,114,66,22,65,19,64,31,23,65,81,31,25,71,82,31,12,65,31,74,24,64,84,65,31,36,64,+ 31,10,64,31,54,64,31,15,67,22,65,19,64,31,22,65,82,64,31,22,71,84,31,11,66,31,27,64,31,30,24,64,+ 85,64,23,64,21,64,31,19,65,20,64,31,4,64,31,13,64,24,64,31,13,65,31,15,66,80,21,66,18,65,26,64,+ 31,0,64,23,66,82,64,23,64,31,12,71,85,64,31,10,66,31,19,64,22,65,23,64,31,20,24,87,64,22,64,21,+ 64,31,0,64,31,1,66,19,65,31,3,65,31,13,64,24,64,31,0,64,27,66,31,13,66,81,20,66,80,17,65,80,+ 64,24,65,31,0,64,22,67,82,64,23,65,31,9,71,87,64,31,9,65,81,31,18,65,21,66,22,65,31,20,23,64,+ 87,64,22,64,21,65,23,64,21,64,31,0,66,80,17,67,22,64,25,66,23,65,26,64,21,65,22,66,30,65,26,68,+ 31,11,66,82,64,18,66,81,17,65,80,64,22,68,29,65,21,67,83,64,22,66,31,7,72,88,64,31,9,65,81,31,+ 17,66,20,67,21,67,31,19,23,64,87,64,21,65,21,66,21,65,20,65,24,64,20,67,80,64,16,67,21,65,24,66,+ 80,22,66,25,66,20,65,22,67,27,67,24,67,80,66,31,10,65,83,64,17,67,81,67,80,64,21,69,28,66,21,66,+ 85,21,67,22,65,27,74,88,64,24,64,29,65,82,64,24,64,26,64,24,67,20,65,80,64,21,67,31,13,64,20,22,+ 65,87,64,21,64,80,21,80,65,21,65,20,66,23,64,19,67,81,17,66,80,20,66,24,66,80,20,68,24,67,19,65,+ 80,22,65,80,64,25,69,23,67,81,66,31,9,66,83,65,17,65,82,66,81,64,20,68,80,64,27,66,80,64,19,66,+ 86,21,65,80,64,21,66,25,71,83,64,89,23,66,27,66,82,64,24,64,25,65,24,66,80,19,66,81,20,66,80,64,+ 21,65,24,65,24,65,20,21,66,88,20,65,80,64,20,80,65,21,65,20,64,80,64,23,64,18,67,82,16,66,81,64,+ 18,68,22,66,81,19,69,24,67,18,66,80,21,66,80,64,24,69,80,22,68,82,67,31,6,66,84,64,16,66,83,65,+ 83,64,17,69,81,64,26,67,80,64,18,66,87,64,19,66,81,20,67,25,69,95,1,64,22,66,26,66,83,64,24,65,+ 24,66,22,66,81,64,17,66,82,20,65,81,64,20,66,23,66,24,65,20,21,65,89,64,19,65,80,64,20,81,64,20,+ 65,80,64,18,65,80,64,22,65,17,67,83,16,64,83,64,17,67,80,64,21,66,82,17,69,81,64,22,66,80,64,17,+ 66,81,20,65,82,64,24,68,81,22,67,84,66,31,4,67,86,16,65,84,65,83,65,16,67,84,64,25,66,81,64,17,+ 66,88,64,18,66,82,20,67,24,68,95,3,64,22,66,25,67,83,64,24,65,23,67,21,66,82,64,16,66,83,19,65,+ 83,19,67,21,68,23,66,17,65,16,21,65,89,64,18,65,81,65,18,64,82,20,64,81,64,17,65,81,64,22,64,80,+ 64,17,65,85,64,83,69,81,64,20,66,83,17,68,82,64,21,66,82,68,81,64,18,66,83,23,67,83,21,66,87,66,+ 26,64,22,67,86,65,91,65,16,66,85,64,24,66,82,64,16,67,88,64,18,65,83,19,66,81,23,67,95,5,65,22,+ 80,65,23,67,85,23,64,80,64,23,65,80,64,20,66,83,64,16,66,83,64,16,67,83,18,68,20,69,22,66,80,16,+ 66,16,21,64,90,64,17,66,81,65,18,64,82,20,64,81,65,16,65,82,64,20,65,80,65,16,64,85,65,83,68,82,+ 64,20,66,83,16,67,84,64,20,66,83,67,82,64,16,68,83,22,66,85,20,66,88,68,24,64,21,67,88,65,90,65,+ 16,65,86,64,24,65,84,67,89,64,17,66,83,17,67,82,64,22,65,95,7,65,21,82,64,22,67,86,64,22,64,80,+ 65,21,65,81,65,19,66,83,67,84,68,84,17,67,81,19,68,81,21,66,81,67,16,21,91,64,17,65,83,64,17,65,+ 82,64,18,65,81,65,16,65,82,65,18,66,80,65,16,86,64,85,66,84,20,65,84,16,66,85,65,18,67,83,66,83,+ 64,16,67,84,21,66,86,19,66,91,67,22,65,20,67,88,64,93,64,16,88,64,23,65,85,16,65,91,16,66,84,16,+ 67,83,64,21,66,95,8,64,21,82,65,21,66,87,64,21,65,81,64,20,66,82,64,18,66,85,65,85,68,84,64,16,+ 66,82,64,18,67,82,64,21,65,81,68,21,92,64,16,65,83,64,16,66,82,64,17,65,83,64,16,64,83,65,18,65,+ 81,65,86,16,64,85,65,85,19,65,85,16,64,88,70,84,65,84,64,16,66,85,64,18,68,86,18,67,91,68,21,65,+ 19,66,89,65,94,16,89,64,21,66,85,16,64,92,16,65,85,16,67,83,64,21,65,95,9,65,20,82,67,19,65,88,+ 65,21,64,81,65,20,64,83,65,17,65,86,64,86,67,85,64,16,65,83,64,17,66,84,64,20,65,82,65,81,64,21,+ 92,64,17,85,16,65,83,64,17,65,83,65,84,65,17,66,82,65,85,16,94,64,17,65,86,65,88,65,17,65,93,16,+ 65,86,64,16,69,87,18,66,93,68,19,65,80,18,67,95,11,16,89,65,20,65,86,64,93,16,65,85,64,16,65,84,+ 65,20,64,95,11,65,19,64,82,66,17,66,89,65,20,64,82,65,19,65,83,66,16,64,87,64,87,64,87,64,16,64,+ 84,64,16,66,85,64,19,65,83,64,82,64,66,17,64,92,65,86,66,83,17,66,84,64,85,18,65,84,64,85,64,94,+ 65,16,65,86,64,89,66,16,64,94,64,88,70,88,18,65,95,1,68,18,64,80,69,95,12,16,89,66,18,66,95,6,+ 16,64,86,16,64,87,64,19,65,95,11,65,19,83,66,17,65,91,65,19,64,83,65,17,65,85,65,16,64,95,10,64,+ 16,85,17,65,86,64,19,64,88,64,69,92,65,86,65,85,66,85,64,86,16,64,16,85,65,84,64,94,66,17,86,64,+ 90,66,95,0,64,88,69,89,17,65,95,3,67,17,64,81,68,95,13,16,89,67,17,65,87,64,92,16,64,87,16,88,+ 64,19,64,95,12,65,19,84,66,17,64,91,65,18,64,84,65,17,64,86,65,16,95,12,64,86,66,87,18,66,88,69,+ 93,64,86,64,86,65,86,64,86,66,86,64,84,64,94,67,86,65,95,14,64,89,66,91,66,95,5,67,17,81,67,95,+ 14,64,90,67,17,88,64,93,64,87,16,88,65,17,65,95,13,64,19,64,85,65,17,92,64,17,66,84,65,16,65,86,+ 64,16,95,12,64,86,65,88,17,66,89,69,93,65,85,64,86,65,94,65,93,65,94,65,95,6,65,94,65,89,64,93,+ 66,95,6,67,82,66,95,15,65,90,67,16,89,64,92,64,88,64,88,64,16,66,95,14,17,65,86,65,94,17,66,85,+ 64,17,64,88,64,95,12,64,86,64,89,16,66,90,82,65,95,0,64,92,65,94,66,94,64,95,0,64,95,7,64,94,+ 64,95,10,66,95,8,66,95,20,64,92,66,95,9,64,87,64,89,64,16,65,95,15,64,17,64,86,65,95,0,67,86,+ 16,64,89,64,95,12,64,85,65,89,17,65,90,95,5,65,89,66,95,1,64,80,65,93,64,95,0,65,95,48,65,95,+ 9,65,95,20,65,93,65,95,8,64,88,64,89,64,17,64,95,15,65,16,64,87,65,94,66,87,65,89,64,95,18,65,+ 90,64,17,91,95,7,64,89,64,95,5,64,93,65,95,0,64,95,46,65,95,12,66,95,18,64,95,0,65,95,7,64,+ 88,64,90,64,16,95,16,65,17,88,65,93,65,89,64,89,65,95,17,64,91,65,92,95,40,65,93,64,95,62,65,95,+ 15,65,95,35,65,95,5,65,87,64,91,64,95,17,65,91,64,92,65,89,65,95,42,64,93,95,41,64,95,75,65,95,+ 71,65,95,4,64,88,64,91,64,95,18,65,95,9,64,90,64,95,43,65,92,95,255,91,65,95,18,64,95,8,65,95,+ 56,65,80,64,89,95,255,92,64,95,18,65,95,82,66,89,95,255,92,64,95,19,64,95,95,95,255,93,64,95,19,64,+ 95,94,95,255,93,65,95,19,64,95,93,95,255,94,64,95,21,64,95,91,95,255,95,145,95,255,95,145,95,255,95,145,+ 95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,+ 95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,+ 95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,217,96,95,+ 182,95,215,98,95,182,95,214,97,95,184,95,212,98,95,185,95,255,95,145,95,245,96,95,154,95,246,97,95,152,95,223,+ 99,95,4,97,95,151,95,221,98,95,8,97,95,150,95,30,96,95,171,99,95,11,96,95,150,95,30,96,95,170,98,95,+ 1,101,85,96,95,150,95,30,96,95,64,97,95,87,97,95,8,97,84,97,95,149,95,30,97,95,65,96,95,86,96,95,+ 10,96,85,96,95,149,95,31,97,95,65,97,95,83,96,95,11,96,85,96,95,149,95,20,96,90,97,95,33,96,95,16,+ 98,95,79,97,95,12,96,84,96,95,149,95,21,99,87,98,95,29,97,95,19,107,95,67,97,95,13,96,84,96,95,149,+ 95,24,97,88,97,95,27,97,95,115,97,95,13,96,83,96,95,150,95,26,97,87,98,95,23,97,95,13,106,95,77,96,+ 95,13,96,84,96,95,150,95,28,97,87,97,95,21,97,87,97,95,1,99,88,98,95,105,96,84,96,95,150,95,30,97,+ 87,96,95,18,98,85,99,95,17,97,95,103,96,85,96,95,150,95,31,97,87,97,95,14,98,85,98,95,22,97,95,101,+ 96,85,96,95,150,95,32,97,95,18,101,85,98,95,25,97,95,43,96,95,39,97,85,96,95,150,95,33,96,95,16,98,+ 89,97,95,28,97,95,41,97,95,39,97,85,97,95,149,95,33,97,95,15,96,90,97,95,30,96,95,41,96,95,41,96,+ 86,96,95,71,96,95,61,95,34,97,95,25,96,95,89,97,95,41,97,85,97,95,70,99,95,58,95,35,96,95,24,96,+ 95,90,96,95,43,97,85,97,95,73,99,95,54,95,35,97,95,22,97,95,90,96,95,44,97,85,106,95,66,99,95,7,+ 98,95,25,95,36,97,95,21,96,95,91,96,88,100,95,31,98,95,83,98,95,4,98,95,27,95,37,96,95,20,96,95,+ 43,97,92,98,95,14,97,87,97,95,37,99,95,82,97,95,2,97,95,29,95,38,96,95,18,97,95,44,96,90,98,95,+ 16,96,87,97,95,41,101,95,78,96,95,1,97,95,30,95,38,97,95,17,96,95,45,96,88,97,95,19,96,86,97,95,+ 47,98,95,76,96,94,98,95,31,95,39,96,95,17,96,95,45,96,86,97,95,22,96,85,96,95,50,97,95,14,96,95,+ 43,97,91,99,82,96,95,29,95,135,96,85,97,95,23,96,85,97,95,50,97,95,13,97,95,41,97,90,98,95,36,95,+ 134,97,84,97,95,24,96,86,96,95,51,97,95,13,97,95,39,97,89,97,95,39,95,134,96,85,96,95,25,96,86,96,+ 95,52,96,95,14,97,95,35,99,89,97,95,40,95,134,96,85,96,95,25,96,86,96,95,84,97,95,32,99,90,97,95,+ 41,95,134,96,85,96,95,25,96,86,96,95,85,97,95,31,96,92,97,95,42,95,134,96,85,96,95,25,96,86,96,95,+ 74,98,88,97,95,29,97,91,97,95,43,95,134,96,85,96,95,25,96,86,96,95,76,100,85,97,95,28,96,91,97,95,+ 44,95,134,96,85,96,95,25,96,86,96,95,80,98,84,96,95,28,96,90,97,95,45,95,134,96,85,96,95,25,96,86,+ 96,95,82,96,84,96,95,28,96,88,97,95,47,95,134,96,85,96,95,25,96,86,96,95,82,96,84,97,95,27,97,85,+ 99,95,47,95,134,96,85,96,95,25,96,87,96,95,82,96,84,96,95,28,97,84,97,95,49,95,134,96,85,96,95,25,+ 96,87,96,95,82,96,84,96,95,29,97,84,97,95,48,95,134,96,85,96,95,26,96,86,96,95,82,96,84,97,95,29,+ 97,85,97,95,46,95,134,96,85,96,95,26,96,86,96,95,82,97,84,96,95,31,97,85,97,95,44,95,133,97,85,96,+ 95,26,96,87,96,95,82,96,84,96,95,32,97,85,98,95,42,95,133,96,86,96,95,26,96,87,96,95,82,97,83,97,+ 95,32,98,85,97,95,41,95,132,97,86,96,95,26,96,88,96,95,82,96,84,96,95,34,97,85,98,95,39,95,131,97,+ 87,96,95,26,96,88,96,95,82,96,84,96,95,36,97,85,97,95,38,95,129,98,88,96,95,26,96,89,96,95,81,96,+ 84,96,95,37,97,85,96,95,38,95,129,96,91,96,95,25,96,89,96,95,81,96,84,96,95,38,97,85,96,95,37,95,+ 142,96,95,25,96,95,93,96,83,97,95,39,96,84,97,95,36,95,142,96,95,25,97,95,92,96,84,96,95,39,97,84,+ 96,95,36,95,141,97,95,26,97,95,91,96,84,96,95,40,97,83,97,95,35,95,141,96,95,28,97,95,89,97,84,96,+ 95,41,96,84,96,95,35,95,141,96,95,29,96,95,89,96,85,96,95,42,96,83,96,95,35,95,141,96,95,29,97,95,+ 88,96,85,96,95,42,96,83,97,95,34,95,140,97,95,30,97,95,87,96,85,96,95,42,97,83,96,95,34,95,139,97,+ 95,33,96,95,85,97,84,96,95,44,96,83,96,95,34,95,103,96,95,18,97,95,35,96,95,84,96,85,96,95,44,96,+ 83,96,95,34,95,103,96,95,14,99,95,137,97,84,97,95,45,96,82,96,95,34,95,103,96,95,171,96,85,96,95,46,+ 96,82,96,95,34,95,102,96,95,171,96,85,96,95,47,96,82,96,95,34,95,102,96,90,96,95,65,97,95,75,96,85,+ 97,95,47,96,82,97,95,33,95,101,97,89,97,95,66,96,92,96,95,66,98,95,48,96,83,96,95,33,95,101,96,88,+ 97,95,68,97,90,97,95,66,96,95,50,96,83,96,95,33,95,101,96,87,97,95,70,96,89,97,95,66,97,95,50,96,+ 83,96,95,33,95,100,96,87,97,95,71,96,89,96,95,67,96,95,51,96,83,96,95,33,95,100,96,87,96,95,73,96,+ 87,97,95,66,97,95,51,96,83,96,95,33,95,99,97,87,96,95,72,96,87,97,95,67,96,95,52,97,82,97,95,32,+ 95,99,96,87,96,95,73,96,86,97,95,68,96,95,53,96,84,99,95,28,95,99,96,87,96,95,73,96,86,96,95,69,+ 96,95,53,96,95,37,95,99,96,87,96,95,72,97,85,97,95,69,96,95,53,96,95,37,95,99,96,87,96,95,72,96,+ 86,96,95,141,96,95,36,95,99,96,87,96,95,71,97,85,97,95,42,97,95,81,97,95,35,95,99,96,88,96,95,69,+ 97,86,96,95,42,97,95,83,97,95,13,96,95,4,95,99,96,88,96,95,69,96,86,96,95,42,97,88,96,95,75,97,+ 95,12,97,95,3,95,99,96,88,96,95,68,96,86,97,95,42,96,86,99,95,76,97,95,12,98,95,1,95,99,96,88,+ 96,95,67,97,84,97,95,44,96,85,97,95,80,97,95,13,97,95,0,95,99,96,88,96,95,67,96,84,97,95,45,96,+ 85,96,95,83,96,95,13,96,95,0,95,99,96,89,96,95,65,97,83,97,95,46,96,85,96,95,113,96,95,0,95,99,+ 97,88,96,95,65,96,84,96,95,47,96,85,97,95,112,97,94,95,100,96,88,96,95,65,96,83,96,95,48,96,86,96,+ 95,104,97,86,96,94,95,100,97,87,96,95,64,97,82,97,95,48,97,85,97,95,104,97,85,96,94,95,101,97,86,96,+ 95,61,98,84,96,95,50,97,85,96,95,105,96,85,96,94,95,102,96,86,96,95,69,96,95,51,96,86,96,95,104,96,+ 85,96,94,95,102,97,85,97,95,68,96,95,51,97,85,97,95,103,96,84,97,94,95,103,96,86,97,95,67,96,95,52,+ 97,85,96,95,103,96,84,96,95,0,95,104,96,86,97,95,66,96,95,53,96,85,97,95,101,97,84,96,95,0,95,104,+ 97,86,97,81,97,95,61,96,95,54,96,85,97,95,99,97,84,96,95,1,95,105,96,87,99,95,28,98,95,15,96,95,+ 54,97,85,96,95,98,97,84,97,95,1,95,105,96,95,35,101,95,17,96,95,55,97,85,96,95,96,97,84,97,95,2,+ 95,106,96,95,27,103,95,21,96,95,57,97,84,97,95,93,98,85,96,95,3,95,106,97,95,18,104,95,103,97,84,97,+ 95,90,98,86,96,95,4,95,107,99,95,144,97,84,97,95,88,97,87,97,95,4,95,110,97,95,144,97,84,97,95,86,+ 97,86,98,95,5,95,111,96,95,145,97,84,97,95,83,97,87,97,95,7,95,255,95,3,96,85,97,95,67,97,90,98,+ 86,97,95,9,95,113,96,95,24,111,6,95,83,96,85,96,95,14,96,95,37,101,80,100,87,98,95,10,95,151,99,95,+ 5,100,95,79,96,85,98,95,11,99,95,39,97,90,98,95,12,95,148,98,95,13,97,95,78,97,86,104,95,6,100,95,+ 47,97,95,14,95,146,98,95,113,96,95,25,99,95,3,97,95,19,100,95,15,95,144,98,95,115,98,95,27,100,90,99,+ 95,17,99,95,19,95,142,98,95,120,98,95,28,108,95,16,99,95,23,95,255,95,12,98,95,69,97,95,27,95,255,95,+ 15,98,95,65,97,95,28,95,255,95,14,96,95,12,105,95,29,97,95,29,95,255,95,42,97,87,102,95,70,95,255,95,+ 40,97,95,0,111,3,95,52,95,255,95,76,97,95,51,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,+ 255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,255,95,145,95,+ 255,95,145,16,1,20,1,24,1,28,1,32,1,36,1,40,1,44,1,48,1,52,1,56,1,60,1,64,1,68,1,72,+ 1,76,1,80,1,84,1,88,1,92,1,96,1,100,1,104,1,108,1,112,1,116,1,120,1,124,1,128,1,132,1,136,+ 1,140,1,144,1,148,1,156,1,164,1,172,1,180,1,188,1,196,1,204,1,212,1,220,1,228,1,236,1,244,1,252,+ 1,4,2,12,2,20,2,28,2,36,2,44,2,52,2,60,2,68,2,76,2,86,2,96,2,116,2,132,2,148,2,158,+ 2,168,2,178,2,188,2,198,2,208,2,218,2,228,2,238,2,248,2,2,3,12,3,22,3,32,3,42,3,52,3,62,+ 3,72,3,82,3,92,3,102,3,112,3,122,3,132,3,142,3,152,3,162,3,172,3,182,3,192,3,202,3,212,3,220,+ 3,224,3,228,3,232,3,236,3,240,3,244,3,248,3,252,3,0,4,4,4,8,4,15,4,22,4,32,4,46,4,65,+ 4,87,4,114,4,150,4,195,4,241,4,33,5,80,5,128,5,177,5,227,5,21,6,72,6,125,6,177,6,226,6,16,+ 7,58,7,96,7,133,7,165,7,189,7,207,7,218,7,229,7,240,7,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,81,32,31,221,32,31,80,31,+ 80,34,31,219,34,31,79,31,80,34,31,219,34,31,79,31,80,34,31,219,34,31,79,31,80,35,31,217,35,31,79,31,+ 80,35,31,217,35,31,79,31,81,34,31,217,34,31,80,31,81,34,31,217,34,31,80,31,81,35,31,215,35,31,80,31,+ 81,35,31,215,35,31,80,31,81,36,31,213,36,31,80,31,81,36,31,213,36,31,80,31,81,37,31,211,37,31,80,31,+ 82,37,31,209,37,31,81,31,82,37,31,209,37,31,81,31,82,39,31,205,39,31,81,31,83,38,31,205,38,31,82,31,+ 83,39,31,203,39,31,82,31,84,39,31,201,39,31,83,31,84,40,31,199,40,31,83,31,85,41,31,195,41,31,84,31,+ 85,43,31,191,43,31,84,31,86,44,31,187,44,31,85,31,86,47,0,31,181,47,0,31,85,31,86,47,5,31,171,47,+ 5,31,85,31,87,47,8,31,33,36,16,32,31,51,32,16,36,31,33,47,8,31,86,31,87,47,13,31,23,43,31,51,+ 43,31,23,47,13,31,86,31,88,47,21,28,47,12,31,53,47,12,28,47,21,31,87,31,88,47,61,31,55,47,61,31,+ 87,31,89,47,60,31,55,47,60,31,88,31,89,47,59,31,57,47,59,31,88,31,90,47,58,31,57,47,58,31,89,31,+ 90,47,57,31,59,47,57,31,89,31,91,47,56,31,59,47,56,31,90,31,91,47,55,31,61,47,55,31,90,31,92,47,+ 54,31,61,47,54,31,91,31,92,47,53,31,63,47,53,31,91,31,92,47,53,31,63,47,53,31,91,31,93,47,51,31,+ 65,47,51,31,92,31,94,47,50,31,65,47,50,31,93,31,94,47,50,31,65,47,50,31,93,31,95,47,48,31,67,47,+ 48,31,94,31,96,47,46,31,69,47,46,31,95,31,96,47,46,31,69,47,46,31,95,31,97,47,45,31,69,47,45,31,+ 96,31,98,47,43,31,71,47,43,31,97,31,99,47,42,31,71,47,42,31,98,31,99,47,41,31,73,47,41,31,98,31,+ 100,47,40,31,73,47,40,31,99,31,101,47,38,31,75,47,38,31,100,31,102,47,37,31,75,47,37,31,101,31,103,47,+ 35,31,77,47,35,31,102,31,106,47,32,31,77,47,32,31,105,31,107,47,30,31,79,47,30,31,106,31,110,47,27,31,+ 79,47,27,31,109,31,111,47,25,31,81,47,25,31,110,31,116,47,19,31,83,47,19,31,115,31,118,47,16,31,85,47,+ 16,31,117,31,121,47,13,31,85,47,13,31,120,31,127,47,5,31,89,47,5,31,126,31,139,34,31,101,34,31,138,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,79,0,31,255,31,49,31,79,1,31,255,31,48,31,28,0,31,33,2,31,+ 255,31,48,31,27,1,31,32,3,30,0,31,255,21,0,31,25,31,27,2,31,30,5,29,1,31,33,0,31,125,0,31,+ 67,1,31,25,31,26,3,31,30,5,29,1,31,33,1,31,44,0,31,63,0,31,66,3,31,24,31,26,4,24,0,31,+ 18,6,28,2,31,33,1,31,44,0,31,62,2,31,32,0,31,15,4,31,24,31,10,0,29,5,23,2,31,16,8,27,+ 2,31,33,1,31,30,1,26,2,31,40,0,31,4,2,29,0,31,17,0,31,14,6,31,23,31,9,1,29,5,22,3,+ 31,16,8,27,2,31,17,1,28,3,31,3,1,31,7,2,26,3,31,14,0,30,0,23,1,31,2,3,29,1,31,15,+ 1,31,12,8,31,23,22,1,30,2,29,6,20,5,31,14,9,26,4,31,15,3,27,3,31,3,2,31,6,3,25,3,+ 31,13,2,29,0,22,3,31,1,4,27,3,31,14,1,31,11,10,31,22,21,3,29,2,28,7,19,7,31,12,10,26,+ 4,31,1,0,27,5,26,3,31,2,4,31,4,5,24,4,31,12,2,29,0,22,3,31,1,4,27,4,31,12,2,31,+ 10,11,31,22,20,4,28,4,27,8,17,8,31,12,11,25,4,31,0,0,27,7,25,4,31,0,6,31,2,6,23,6,+ 31,10,4,27,1,22,4,30,6,26,5,31,11,2,31,9,12,31,22,19,6,26,5,26,9,17,9,31,10,12,24,5,+ 30,1,26,8,25,4,30,8,31,0,8,22,6,31,10,4,27,1,22,5,29,6,25,7,26,0,28,3,31,8,14,25,+ 0,31,10,17,9,25,5,26,15,7,31,8,13,24,5,30,1,25,10,23,5,29,10,30,8,22,7,31,3,0,19,6,+ 26,1,21,7,28,6,25,9,24,1,26,4,31,6,15,1,25,1,31,9,16,10,24,6,25,15,8,31,7,15,0,23,+ 6,28,2,24,12,22,6,28,11,28,10,20,9,31,1,1,18,7,25,2,21,8,26,8,23,11,22,4,24,5,31,4,+ 15,3,23,3,31,8,12,22,7,25,15,9,26,1,24,15,0,22,7,27,3,23,14,21,6,27,13,26,12,19,9,31,+ 0,2,18,8,24,2,21,8,26,8,23,12,21,6,21,6,31,3,15,4,23,4,31,7,13,21,8,24,15,9,25,2,+ 23,15,1,22,7,26,4,22,15,0,21,6,26,15,0,25,12,19,10,29,3,17,9,23,4,20,9,25,8,22,14,20,+ 7,20,6,31,2,15,5,23,5,31,6,13,20,9,23,15,11,23,3,22,15,3,21,7,25,5,21,15,2,19,8,24,+ 15,2,23,14,18,11,27,4,17,10,22,4,19,11,23,10,21,15,0,18,10,17,7,31,1,15,7,21,7,31,4,0,+ 14,18,10,23,15,12,22,4,21,15,3,20,8,24,6,20,15,4,18,8,23,15,4,21,15,0,17,12,26,5,16,12,+ 21,4,19,12,22,10,20,15,2,17,15,5,30,15,9,21,8,31,2,1,15,0,16,11,22,15,13,21,5,20,15,4,+ 20,8,24,6,19,15,6,17,8,23,15,5,19,15,2,16,13,24,15,5,20,5,19,13,20,12,19,15,25,29,15,11,+ 20,9,31,0,2,15,0,16,11,22,15,14,19,6,19,15,6,19,9,22,7,17,15,8,17,9,21,15,8,17,15,18,+ 22,15,7,19,5,19,13,20,12,19,15,25,28,15,12,19,12,28,3,15,14,21,15,15,17,8,18,15,6,18,10,21,+ 8,16,15,10,16,9,20,15,45,21,15,8,19,5,18,15,0,19,12,18,15,26,27,15,13,19,13,26,4,15,14,20,+ 15,16,16,9,17,15,7,18,10,20,15,32,19,15,47,19,15,10,17,6,18,15,1,17,14,17,15,26,26,15,15,18,+ 14,24,5,15,14,20,15,27,16,15,8,18,10,19,15,34,17,15,49,17,15,11,17,6,18,15,2,16,14,16,15,28,+ 24,15,16,17,15,1,22,6,15,14,19,15,54,16,11,18,15,35,17,15,49,16,15,13,16,6,18,15,18,16,15,28,+ 22,15,19,16,15,2,20,7,15,14,19,15,54,16,12,16,15,36,16,15,88,18,15,63,21,15,20,16,15,3,18,8,+ 15,15,17,15,55,16,12,16,15,142,16,15,64,20,15,42,16,9,15,15,17,15,228,16,15,64,19,15,54,15,15,17,+ 15,228,16,15,64,18,15,55,15,15,16,15,229,16,15,64,16,15,57,15,15,16,15,255,15,113,14,1,21,1,28,1,+ 38,1,52,1,71,1,93,1,120,1,156,1,201,1,247,1,39,2,86,2,134,2,183,2,233,2,27,3,78,3,131,3,+ 183,3,232,3,22,4,64,4,102,4,139,4,171,4,195,4,213,4,224,4,235,4,246,4,253,4,1,5,5,5,9,5,+ 13,5,17,5,21,5,25,5,29,5,33,5,37,5,41,5,45,5,49,5,53,5,57,5,61,5,65,5,69,5,73,5,+ 77,5,81,5,85,5,89,5,93,5,97,5,101,5,105,5,109,5,113,5,117,5,121,5,125,5,129,5,133,5,137,5,+ 141,5,145,5,149,5,153,5,157,5,161,5,165,5,169,5,173,5,177,5,181,5,185,5,189,5,193,5,197,5,201,5,+ 205,5,209,5,213,5,217,5,221,5,225,5,229,5,233,5,237,5,241,5,245,5,249,5,253,5,1,6,5,6,9,6,+ 13,6,17,6,21,6,25,6,29,6,33,6,37,6,41,6,45,6,49,6,53,6,57,6,61,6,65,6,69,6,73,6,+ 77,6,81,6,85,6,89,6,93,6,97,6,101,6,105,6,109,6,113,6,117,6,121,6,125,6,129,6,133,6,137,6,+ 141,6,145,6,149,6,153,6,15,79,16,15,255,15,49,15,79,17,15,255,15,48,15,28,16,15,33,18,15,255,15,48,+ 15,27,17,15,32,19,14,16,15,255,5,16,15,25,15,27,18,15,30,21,13,17,15,33,16,15,125,16,15,67,17,15,+ 25,15,26,19,15,30,21,13,17,15,33,17,15,44,16,15,63,16,15,66,19,15,24,15,26,20,8,16,15,18,22,12,+ 18,15,33,17,15,44,16,15,62,18,15,32,16,15,15,20,15,24,15,10,16,13,21,7,18,15,16,24,11,18,15,33,+ 17,15,30,17,10,18,15,40,16,15,4,18,13,16,15,17,16,15,14,22,15,23,15,9,17,13,21,6,19,15,16,24,+ 11,18,15,17,17,12,19,15,3,17,15,7,18,10,19,15,14,16,14,16,7,17,15,2,19,13,17,15,15,17,15,12,+ 24,15,23,6,17,14,18,13,22,4,21,15,14,25,10,20,15,15,19,11,19,15,3,18,15,6,19,9,19,15,13,18,+ 13,16,6,19,15,1,20,11,19,15,14,17,15,11,26,15,22,5,19,13,18,12,23,3,23,15,12,26,10,20,15,1,+ 16,11,21,10,19,15,2,20,15,4,21,8,20,15,12,18,13,16,6,19,15,1,20,11,20,15,12,18,15,10,27,15,+ 22,4,20,12,20,11,24,1,24,15,12,27,9,20,15,0,16,11,23,9,20,15,0,22,15,2,22,7,22,15,10,20,+ 11,17,6,20,14,22,10,21,15,11,18,15,9,28,15,22,3,22,10,21,10,25,1,25,15,10,28,8,21,14,17,10,+ 24,9,20,14,24,15,0,24,6,22,15,10,20,11,17,6,21,13,22,9,23,10,16,12,19,15,8,30,9,16,15,10,+ 1,25,9,21,10,31,7,15,8,29,8,21,14,17,9,26,7,21,13,26,14,24,6,23,15,3,16,3,22,10,17,5,+ 23,12,22,9,25,8,17,10,20,15,6,31,1,9,17,15,9,0,26,8,22,9,31,8,15,7,31,0,7,22,12,18,+ 8,28,6,22,12,27,12,26,4,25,15,1,17,2,23,9,18,5,24,10,24,7,27,6,20,8,21,15,4,31,3,7,+ 19,15,8,28,6,23,9,31,9,10,17,8,31,0,6,23,11,19,7,30,5,22,11,29,10,28,3,25,15,0,18,2,+ 24,8,18,5,24,10,24,7,28,5,22,5,22,15,3,31,4,7,20,15,7,29,5,24,8,31,9,9,18,7,31,1,+ 6,23,10,20,6,31,0,5,22,10,31,0,9,28,3,26,13,19,1,25,7,20,4,25,9,24,6,30,4,23,4,22,+ 15,2,31,5,7,21,15,6,29,4,25,7,31,11,7,19,6,31,3,5,23,9,21,5,31,2,3,24,8,31,2,7,+ 30,2,27,11,20,1,26,6,20,3,27,7,26,5,31,0,2,26,1,23,15,1,31,7,5,23,15,4,16,30,2,26,+ 7,31,12,6,20,5,31,3,4,24,8,22,4,31,4,2,24,7,31,4,5,31,0,1,28,10,21,0,28,5,20,3,+ 28,6,26,4,31,2,1,31,5,14,31,9,5,24,15,2,17,31,0,0,27,6,31,13,5,21,4,31,4,4,24,8,+ 22,3,31,6,1,24,7,31,5,3,31,2,0,29,8,31,5,4,21,3,29,4,28,3,31,25,13,31,11,4,25,15,+ 0,18,31,0,0,27,6,31,14,3,22,3,31,6,3,25,6,23,1,31,8,1,25,5,31,8,1,31,18,6,31,7,+ 3,21,3,29,4,28,3,31,25,12,31,12,3,28,12,19,31,14,5,31,15,1,24,2,31,6,2,26,5,24,0,31,+ 10,0,25,4,31,45,5,31,8,3,21,2,31,0,3,28,2,31,26,11,31,13,3,29,10,20,31,14,4,31,16,0,+ 25,1,31,7,2,26,4,31,32,3,31,47,3,31,10,1,22,2,31,1,1,30,1,31,26,10,31,15,2,30,8,21,+ 31,14,4,31,27,0,31,8,2,26,3,31,34,1,31,49,1,31,11,1,22,2,31,2,0,30,0,31,28,8,31,16,+ 1,31,1,6,22,31,14,3,31,54,0,27,2,31,35,1,31,49,0,31,13,0,22,2,31,18,0,31,28,6,31,19,+ 0,31,2,4,23,31,14,3,31,54,0,28,0,31,36,0,31,88,2,31,63,5,31,20,0,31,3,2,24,31,15,1,+ 31,55,0,28,0,31,142,0,31,64,4,31,42,0,25,31,15,1,31,228,0,31,64,3,31,54,31,15,1,31,228,0,+ 31,64,2,31,55,31,15,0,31,229,0,31,64,0,31,57,31,15,0,31,255,31,113,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,+ 255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,31,255,31,145,140,0,172,0,204,0,236,0,12,+ 1,44,1,76,1,109,1,142,1,175,1,208,1,241,1,18,2,51,2,84,2,117,2,150,2,181,2,212,2,241,2,14,+ 3,43,3,72,3,101,3,130,3,159,3,188,3,217,3,246,3,249,3,252,3,255,3,2,4,5,4,8,4,11,4,14,+ 4,35,4,58,4,81,4,130,4,179,4,228,4,45,5,115,5,181,5,247,5,61,6,111,6,161,6,211,6,222,6,232,+ 6,242,6,252,6,255,6,2,7,5,7,8,7,11,7,14,7,17,7,20,7,23,7,26,7,29,7,32,7,35,7,38,+ 7,41,7,10,22,15,2,31,5,2,23,11,23,2,31,5,3,22,15,18,31,4,4,31,5,2,23,11,23,2,22,3,+ 22,15,8,10,22,15,2,31,5,2,23,11,23,2,31,5,3,22,15,18,31,5,3,31,5,2,23,11,23,2,22,3,+ 22,15,8,10,22,15,2,31,4,4,23,10,22,3,31,4,4,22,15,18,31,5,3,31,4,4,23,10,22,3,22,3,+ 22,15,8,10,22,15,2,31,4,4,23,9,23,3,31,4,4,22,15,18,31,5,3,31,4,4,23,9,23,3,22,3,+ 22,15,8,10,22,15,2,31,3,6,22,9,23,3,31,3,5,22,15,18,31,5,3,31,3,6,22,9,23,3,22,3,+ 22,15,8,10,22,15,2,31,3,6,23,8,22,4,31,3,5,22,15,18,31,5,3,31,3,6,23,8,22,4,22,3,+ 22,15,8,10,22,15,2,22,15,3,23,7,23,4,22,15,2,22,15,18,22,7,21,3,22,15,3,23,7,23,4,22,+ 3,22,15,8,10,22,15,2,22,15,4,22,7,23,4,22,15,2,22,15,18,22,7,21,3,22,15,4,22,7,23,4,+ 22,3,22,15,8,10,22,15,2,22,15,4,23,5,23,5,22,15,2,22,15,18,22,7,21,3,22,15,4,23,5,23,+ 5,22,3,22,15,8,10,22,15,2,22,15,4,23,5,23,5,22,15,2,22,15,18,22,7,21,3,22,15,4,23,5,+ 23,5,22,3,22,15,8,10,22,15,2,22,15,5,23,4,22,6,22,15,2,22,15,18,22,7,21,3,22,15,5,23,+ 4,22,6,22,3,22,15,8,10,22,15,2,22,15,5,23,3,23,6,22,15,2,22,15,18,22,7,21,3,22,15,5,+ 23,3,23,6,22,3,22,15,8,10,22,15,2,31,2,10,22,3,23,6,31,2,6,22,15,18,22,7,21,3,31,2,+ 10,22,3,23,6,22,3,22,15,8,10,22,15,2,31,2,10,23,2,22,7,31,2,6,22,15,18,22,7,21,3,31,+ 2,10,23,2,22,7,22,3,22,15,8,10,22,15,2,31,2,10,23,1,23,7,31,2,6,22,15,18,22,7,21,3,+ 31,2,10,23,1,23,7,22,3,22,15,8,10,22,15,2,31,2,11,22,1,23,7,31,2,6,22,15,18,22,7,21,+ 3,31,2,11,22,1,23,7,22,3,22,15,8,10,22,15,2,22,15,7,31,0,8,22,15,2,22,15,18,22,7,21,+ 3,22,15,7,31,0,8,22,3,22,15,8,10,22,15,2,22,15,7,31,0,8,22,15,2,22,15,18,22,7,21,3,+ 22,15,7,31,0,8,22,3,22,15,8,10,22,15,2,22,15,8,30,8,22,15,2,22,15,18,22,7,21,3,22,15,+ 8,30,8,22,3,22,15,8,10,22,15,2,22,15,8,29,9,22,15,2,22,15,18,22,7,21,3,22,15,8,29,9,+ 22,3,22,15,8,10,22,15,2,22,15,8,29,9,22,15,2,22,15,18,22,7,21,3,22,15,8,29,9,22,3,22,+ 15,8,10,22,15,2,22,15,9,27,10,22,15,2,22,15,18,22,7,21,3,22,15,9,27,10,22,3,22,15,8,10,+ 31,5,3,31,5,10,27,10,31,5,3,31,5,15,4,31,5,3,31,5,10,27,10,22,3,31,5,9,10,31,5,3,+ 31,5,11,26,10,31,5,3,31,5,15,4,31,5,3,31,5,11,26,10,22,3,31,5,9,10,31,4,4,31,4,12,+ 25,11,31,4,4,31,4,15,5,31,5,3,31,4,12,25,11,22,3,31,4,10,10,31,4,4,31,4,12,25,11,31,+ 4,4,31,4,15,5,31,5,3,31,4,12,25,11,22,3,31,4,10,10,31,3,5,31,3,14,24,11,31,3,5,31,+ 3,15,6,31,5,3,31,3,14,24,11,22,3,31,3,11,10,31,3,5,31,3,14,23,12,31,3,5,31,3,15,6,+ 31,4,4,31,3,14,23,12,22,3,31,3,11,15,255,7,15,255,7,15,255,7,15,255,7,15,255,7,15,255,7,15,+ 255,7,15,255,7,18,15,17,20,12,18,15,23,26,15,53,18,15,13,27,1,18,3,19,15,30,18,15,17,20,12,18,+ 15,23,25,15,54,18,15,13,27,1,18,3,19,15,24,19,1,18,15,17,20,12,18,15,23,25,15,54,18,15,13,27,+ 1,18,3,19,15,24,19,1,24,2,18,3,18,12,22,5,24,3,22,2,29,10,18,9,23,3,24,2,23,2,18,3,+ 18,11,22,2,18,2,19,3,22,10,18,4,19,1,18,3,19,1,24,3,23,2,24,2,23,25,1,18,3,18,12,22,+ 4,25,3,23,1,30,9,18,8,25,1,25,1,25,1,18,3,18,11,23,1,18,2,19,3,23,9,18,0,23,1,18,+ 3,19,1,25,1,25,1,25,1,23,25,1,18,3,18,12,23,3,25,2,24,1,30,9,18,8,25,1,24,2,25,1,+ 18,3,18,10,24,1,18,1,19,3,24,9,18,0,23,1,18,3,19,1,25,1,25,1,25,1,23,18,3,18,1,18,+ 3,18,11,19,0,19,3,19,2,18,8,18,1,18,2,18,1,19,9,18,8,19,2,18,1,19,7,19,2,18,1,18,+ 3,18,15,1,18,1,18,0,19,10,18,9,18,0,18,0,19,1,18,3,19,1,18,3,18,1,19,2,18,1,18,3,+ 18,3,19,1,18,3,18,1,18,3,18,11,19,0,19,3,18,3,18,2,24,1,18,2,18,2,18,9,18,8,18,3,+ 18,1,18,8,18,3,18,1,18,3,18,10,24,1,18,0,19,4,24,9,18,0,23,1,18,3,19,1,18,3,18,1,+ 18,3,18,1,18,3,18,3,19,1,18,3,18,1,18,3,18,11,18,2,19,2,18,3,18,1,25,1,18,2,18,2,+ 18,9,18,8,18,3,18,1,18,8,25,1,18,3,18,9,25,1,18,0,19,3,25,9,18,0,23,1,18,3,19,1,+ 18,3,18,1,25,1,18,3,18,3,19,1,18,3,18,1,18,3,18,10,19,2,19,2,18,3,18,1,25,1,18,2,+ 18,2,18,9,18,8,18,3,18,1,18,8,25,1,18,3,18,9,25,1,18,0,19,3,25,9,18,0,22,2,18,3,+ 19,1,18,3,18,1,25,1,18,3,18,3,19,1,18,3,18,1,18,3,18,10,19,2,19,2,18,3,18,1,18,3,+ 18,1,18,2,18,2,18,9,18,8,18,3,18,1,18,8,18,8,18,3,18,9,18,3,18,1,18,1,19,2,18,3,+ 18,9,19,9,18,3,19,1,18,3,18,1,18,8,18,3,18,3,19,1,25,1,25,9,19,1,22,1,25,1,25,1,+ 18,2,18,2,18,9,26,0,25,1,18,8,24,2,25,9,25,1,18,1,19,2,25,9,25,3,26,1,18,3,18,1,+ 24,2,25,3,19,1,25,1,25,9,19,1,22,1,25,1,25,1,18,2,18,2,18,9,25,1,25,1,18,8,24,2,+ 25,9,25,1,18,2,18,2,25,9,25,3,26,1,18,3,18,1,24,2,25,3,19,1,25,1,25,9,19,1,22,1,+ 25,1,25,1,18,2,18,2,18,9,25,1,25,1,18,8,23,3,25,9,25,1,18,2,19,1,25,10,23,4,25,2,+ 18,3,18,1,23,3,25,3,19,1,15,3,18,15,113,18,15,89,18,15,1,13,23,15,108,23,15,89,18,15,1,13,+ 23,15,108,23,15,89,18,15,1,12,24,15,107,24,15,89,18,15,1,15,255,7,15,255,7,15,255,7,15,255,7,15,+ 255,7,15,255,7,15,255,7,15,255,7,15,255,7,15,255,7,15,255,7,15,255,7,15,255,7,15,255,7,15,255,7,+ 15,255,7,+};+typedef struct {+ uint8_t adv, w, h;+ int8_t x, y;+ uint16_t at;+} glyph_t;+typedef struct {+ uint8_t line, base;+ const glyph_t *g;+ const uint8_t *bits;+} pfont_t;+static const glyph_t font_small_glyphs[95] = {+ {4, 0, 0, 0, 0, 0}, {2, 2, 7, 0, 0, 0}, {4, 4, 4, 0, 0, 7}, {6, 6, 7, 0, 0, 11}, {5, 5, 8, 0, 0, 18}, {6, 6, 7, 0, 0, 26}, {6, 6, 7, 0, 0, 33}, {2, 2, 4, 0, 0, 40},+ {3, 3, 7, 0, 0, 44}, {3, 3, 7, 0, 0, 51}, {4, 4, 5, 0, 0, 58}, {4, 4, 5, 0, 1, 63}, {3, 3, 4, 0, 4, 68}, {4, 4, 3, 0, 2, 72}, {2, 2, 3, 0, 4, 75}, {6, 6, 7, 0, 0, 78},+ {5, 5, 7, 0, 0, 85}, {3, 3, 7, 0, 0, 92}, {5, 5, 7, 0, 0, 99}, {5, 5, 7, 0, 0, 106}, {5, 5, 7, 0, 0, 113}, {5, 5, 7, 0, 0, 120}, {5, 5, 7, 0, 0, 127}, {5, 5, 7, 0, 0, 134},+ {5, 5, 7, 0, 0, 141}, {5, 5, 7, 0, 0, 148}, {2, 2, 5, 0, 1, 155}, {2, 2, 6, 0, 1, 160}, {4, 4, 7, 0, 0, 166}, {4, 4, 5, 0, 1, 173}, {4, 4, 7, 0, 0, 178}, {5, 5, 7, 0, 0, 185},+ {6, 6, 7, 0, 0, 192}, {5, 5, 7, 0, 0, 199}, {5, 5, 7, 0, 0, 206}, {4, 4, 7, 0, 0, 213}, {5, 5, 7, 0, 0, 220}, {4, 4, 7, 0, 0, 227}, {4, 4, 7, 0, 0, 234}, {5, 5, 7, 0, 0, 241},+ {5, 5, 7, 0, 0, 248}, {4, 4, 7, 0, 0, 255}, {5, 5, 7, 0, 0, 262}, {5, 5, 7, 0, 0, 269}, {4, 4, 7, 0, 0, 276}, {6, 6, 7, 0, 0, 283}, {5, 5, 7, 0, 0, 290}, {5, 5, 7, 0, 0, 297},+ {5, 5, 7, 0, 0, 304}, {5, 5, 8, 0, 0, 311}, {5, 5, 7, 0, 0, 319}, {5, 5, 7, 0, 0, 326}, {4, 4, 7, 0, 0, 333}, {5, 5, 7, 0, 0, 340}, {5, 5, 7, 0, 0, 347}, {6, 6, 7, 0, 0, 354},+ {5, 5, 7, 0, 0, 361}, {5, 5, 7, 0, 0, 368}, {4, 4, 7, 0, 0, 375}, {3, 3, 7, 0, 0, 382}, {6, 6, 7, 0, 0, 389}, {3, 3, 7, 0, 0, 396}, {4, 4, 4, 0, 0, 403}, {5, 5, 3, 0, 4, 407},+ {3, 3, 4, 0, 0, 410}, {5, 5, 6, 0, 1, 414}, {5, 5, 7, 0, 0, 420}, {4, 4, 6, 0, 1, 427}, {5, 5, 7, 0, 0, 433}, {5, 5, 6, 0, 1, 440}, {4, 4, 7, 0, 0, 446}, {5, 5, 8, 0, 1, 453},+ {5, 5, 7, 0, 0, 461}, {2, 2, 7, 0, 0, 468}, {3, 3, 9, 0, 0, 475}, {5, 5, 7, 0, 0, 484}, {2, 2, 7, 0, 0, 491}, {6, 6, 6, 0, 1, 498}, {5, 5, 6, 0, 1, 504}, {5, 5, 6, 0, 1, 510},+ {5, 5, 8, 0, 1, 516}, {5, 5, 8, 0, 1, 524}, {4, 4, 6, 0, 1, 532}, {5, 5, 6, 0, 1, 538}, {4, 4, 7, 0, 0, 544}, {5, 5, 6, 0, 1, 551}, {5, 5, 6, 0, 1, 557}, {6, 6, 6, 0, 1, 563},+ {4, 4, 6, 0, 1, 569}, {5, 5, 8, 0, 1, 575}, {5, 5, 6, 0, 1, 583}, {4, 4, 7, 0, 0, 589}, {2, 2, 7, 0, 0, 596}, {4, 4, 7, 0, 0, 603}, {5, 5, 4, 0, 0, 610},+};+static const uint8_t font_small_bits[614] = {+ 0,1,1,1,0,1,0,0,5,5,0,0,10,31,10,31,10,0,0,4,14,3,12,7,4,0,0,9,8,4,2,18,+ 0,0,6,1,22,9,22,0,0,1,1,0,0,2,1,1,1,2,0,0,1,2,2,2,1,0,0,5,2,5,0,0,+ 2,7,2,0,0,2,1,0,0,7,0,0,1,0,0,16,8,4,2,1,0,0,6,9,9,9,6,0,0,3,2,2,+ 2,2,0,0,7,8,6,1,15,0,0,7,8,6,8,7,0,0,4,6,5,15,4,0,0,15,1,7,8,7,0,0,+ 6,1,7,9,6,0,0,15,8,4,2,2,0,0,6,9,6,9,6,0,0,6,9,14,8,6,0,0,1,0,1,0,+ 0,1,0,1,1,0,0,4,2,1,2,4,0,0,7,0,7,0,0,1,2,4,2,1,0,0,7,8,6,0,2,0,+ 0,14,17,29,21,14,0,0,6,9,9,15,9,0,0,7,9,7,9,7,0,0,6,1,1,1,6,0,0,7,9,9,+ 9,7,0,0,7,1,7,1,7,0,0,7,1,7,1,1,0,0,14,1,13,9,14,0,0,9,9,15,9,9,0,0,+ 7,2,2,2,7,0,0,12,8,8,9,6,0,0,9,5,3,5,9,0,0,1,1,1,1,7,0,0,17,27,21,17,+ 17,0,0,9,11,13,9,9,0,0,6,9,9,9,6,0,0,7,9,9,7,1,0,0,6,9,9,9,6,8,0,0,+ 7,9,9,7,9,0,0,14,1,6,8,7,0,0,7,2,2,2,2,0,0,9,9,9,9,6,0,0,9,9,5,5,+ 2,0,0,17,21,21,21,10,0,0,9,9,6,9,9,0,0,9,9,14,8,6,0,0,7,4,2,1,7,0,0,3,+ 1,1,1,3,0,0,1,2,4,8,16,0,0,3,2,2,2,3,0,0,2,5,0,0,15,0,0,1,2,0,0,14,+ 9,9,14,0,0,1,7,9,9,7,0,0,6,1,1,6,0,0,8,14,9,9,14,0,0,6,13,3,6,0,0,4,+ 2,7,2,2,0,0,14,9,9,14,8,6,0,0,1,7,9,9,9,0,0,1,0,1,1,1,0,0,2,0,2,2,+ 2,2,1,0,0,1,9,5,7,9,0,0,1,1,1,1,1,0,0,15,21,21,21,0,0,7,9,9,9,0,0,6,+ 9,9,6,0,0,7,9,9,7,1,1,0,0,14,9,9,14,8,8,0,0,5,3,1,1,0,0,14,3,12,7,0,+ 0,2,7,2,2,4,0,0,9,9,9,14,0,0,9,9,5,2,0,0,21,21,10,10,0,0,5,2,2,5,0,0,+ 9,9,9,14,8,6,0,0,15,4,2,15,0,0,6,2,1,2,6,0,0,1,1,1,1,1,0,0,3,2,4,2,+ 3,0,0,10,5,0,+};+static const pfont_t font_small = {9, 6, font_small_glyphs, font_small_bits};+static const glyph_t font_glyphs[95] = {+ {5, 0, 0, 0, 0, 0}, {3, 3, 10, 0, 1, 0}, {5, 5, 5, 0, 1, 10}, {9, 9, 10, 0, 1, 15}, {7, 7, 10, 0, 1, 35}, {9, 9, 10, 0, 1, 45}, {6, 6, 10, 0, 1, 65}, {4, 4, 6, 0, 1, 75},+ {5, 5, 10, 0, 1, 81}, {5, 5, 10, 0, 1, 91}, {8, 8, 8, 0, 1, 101}, {7, 7, 8, 0, 1, 109}, {4, 4, 7, 0, 6, 117}, {5, 5, 4, 0, 4, 124}, {4, 4, 5, 0, 6, 128}, {8, 8, 9, 0, 2, 133},+ {7, 7, 10, 0, 1, 142}, {5, 5, 10, 0, 1, 152}, {7, 7, 10, 0, 1, 162}, {7, 7, 10, 0, 1, 172}, {7, 7, 10, 0, 1, 182}, {7, 7, 10, 0, 1, 192}, {7, 7, 10, 0, 1, 202}, {7, 7, 10, 0, 1, 212},+ {7, 7, 10, 0, 1, 222}, {7, 7, 10, 0, 1, 232}, {4, 4, 9, 0, 2, 242}, {4, 4, 11, 0, 2, 251}, {6, 6, 10, 0, 1, 262}, {6, 6, 6, 0, 3, 272}, {6, 6, 10, 0, 1, 278}, {6, 6, 10, 0, 1, 288},+ {9, 9, 10, 0, 1, 298}, {7, 7, 10, 0, 1, 318}, {7, 7, 10, 0, 1, 328}, {7, 7, 10, 0, 1, 338}, {7, 7, 10, 0, 1, 348}, {6, 6, 10, 0, 1, 358}, {6, 6, 10, 0, 1, 368}, {7, 7, 10, 0, 1, 378},+ {7, 7, 10, 0, 1, 388}, {3, 3, 10, 0, 1, 398}, {6, 6, 10, 0, 1, 408}, {7, 7, 10, 0, 1, 418}, {6, 6, 10, 0, 1, 428}, {9, 9, 10, 0, 1, 438}, {7, 7, 10, 0, 1, 458}, {7, 7, 10, 0, 1, 468},+ {7, 7, 10, 0, 1, 478}, {7, 7, 10, 0, 1, 488}, {7, 7, 10, 0, 1, 498}, {7, 7, 10, 0, 1, 508}, {7, 7, 10, 0, 1, 518}, {7, 7, 10, 0, 1, 528}, {7, 7, 10, 0, 1, 538}, {9, 9, 10, 0, 1, 548},+ {7, 7, 10, 0, 1, 568}, {7, 7, 10, 0, 1, 578}, {7, 7, 10, 0, 1, 588}, {5, 5, 10, 0, 1, 598}, {8, 8, 9, 0, 2, 608}, {5, 5, 10, 0, 1, 617}, {7, 7, 6, 0, 1, 627}, {9, 9, 4, 0, 7, 633},+ {4, 4, 6, 0, 1, 641}, {7, 7, 8, 0, 3, 647}, {7, 7, 10, 0, 1, 655}, {7, 7, 8, 0, 3, 665}, {7, 7, 10, 0, 1, 673}, {7, 7, 8, 0, 3, 683}, {6, 6, 10, 0, 1, 691}, {7, 7, 11, 0, 3, 701},+ {7, 7, 10, 0, 1, 712}, {3, 3, 10, 0, 1, 722}, {5, 5, 12, 0, 1, 732}, {6, 6, 10, 0, 1, 744}, {3, 3, 10, 0, 1, 754}, {9, 9, 8, 0, 3, 764}, {7, 7, 8, 0, 3, 780}, {7, 7, 8, 0, 3, 788},+ {7, 7, 11, 0, 3, 796}, {7, 7, 11, 0, 3, 807}, {7, 7, 8, 0, 3, 818}, {7, 7, 8, 0, 3, 826}, {5, 5, 10, 0, 1, 834}, {7, 7, 8, 0, 3, 844}, {7, 7, 8, 0, 3, 852}, {9, 9, 8, 0, 3, 860},+ {7, 7, 8, 0, 3, 876}, {7, 7, 11, 0, 3, 884}, {7, 7, 8, 0, 3, 895}, {5, 5, 10, 0, 1, 903}, {3, 3, 10, 0, 1, 913}, {5, 5, 10, 0, 1, 923}, {9, 9, 6, 0, 3, 933},+};+static const uint8_t font_bits[945] = {+ 0,0,1,1,1,1,1,0,1,0,0,0,5,5,0,0,0,0,0,20,0,20,0,127,0,20,0,127,0,20,0,20,+ 0,0,0,0,0,4,30,5,14,20,15,4,0,0,0,0,0,66,0,37,0,18,0,8,0,36,0,82,0,33,0,0,+ 0,0,0,2,5,5,2,13,5,14,0,0,0,2,3,1,0,0,0,4,2,1,1,1,2,4,0,0,0,1,2,4,+ 4,4,2,1,0,0,0,18,12,63,12,18,0,0,0,4,4,31,4,4,0,0,0,3,3,1,0,0,0,0,7,0,+ 0,0,3,3,0,0,0,32,16,8,4,2,1,0,0,0,14,17,17,17,17,17,14,0,0,0,2,3,2,2,2,2,+ 7,0,0,0,14,17,16,12,2,1,31,0,0,0,14,17,16,12,16,17,14,0,0,0,24,20,18,17,31,16,16,0,+ 0,0,31,1,1,15,16,17,14,0,0,0,14,17,1,15,17,17,14,0,0,0,31,16,8,8,4,4,4,0,0,0,+ 14,17,17,14,17,17,14,0,0,0,14,17,17,30,16,17,14,0,0,0,3,3,0,0,3,3,0,0,0,3,3,0,+ 0,3,3,1,0,0,0,0,8,4,2,1,2,4,8,0,0,0,15,0,15,0,0,0,1,2,4,8,4,2,1,0,+ 0,0,6,9,8,4,2,0,2,0,0,0,0,0,60,0,66,0,89,0,85,0,57,0,2,0,60,0,0,0,0,0,+ 4,10,17,17,31,17,17,0,0,0,15,17,17,15,17,17,15,0,0,0,14,17,1,1,1,17,14,0,0,0,15,17,+ 17,17,17,17,15,0,0,0,15,1,1,7,1,1,15,0,0,0,15,1,1,7,1,1,1,0,0,0,14,17,1,25,+ 17,17,14,0,0,0,17,17,17,31,17,17,17,0,0,0,1,1,1,1,1,1,1,0,0,0,8,8,8,8,8,9,+ 6,0,0,0,17,17,9,7,9,17,17,0,0,0,1,1,1,1,1,1,15,0,0,0,0,0,65,0,99,0,85,0,+ 73,0,65,0,65,0,65,0,0,0,0,0,17,19,19,21,25,25,17,0,0,0,14,17,17,17,17,17,14,0,0,0,+ 15,17,17,15,1,1,1,0,0,0,14,17,17,17,17,9,22,0,0,0,15,17,17,15,17,17,17,0,0,0,14,17,+ 1,14,16,17,14,0,0,0,31,4,4,4,4,4,4,0,0,0,17,17,17,17,17,17,14,0,0,0,17,17,17,17,+ 17,10,4,0,0,0,0,0,65,0,65,0,65,0,73,0,85,0,99,0,65,0,0,0,0,0,17,17,10,4,10,17,+ 17,0,0,0,17,17,10,4,4,4,4,0,0,0,31,16,8,4,2,1,31,0,0,0,7,1,1,1,1,1,7,0,+ 0,0,1,2,4,8,16,32,0,0,0,7,4,4,4,4,4,7,0,0,0,4,10,17,0,0,0,0,0,127,0,0,+ 0,0,0,1,3,2,0,0,0,14,16,30,17,30,0,0,0,1,1,15,17,17,17,15,0,0,0,14,17,1,17,14,+ 0,0,0,16,16,30,17,17,17,30,0,0,0,14,17,31,1,30,0,0,0,12,2,2,7,2,2,2,0,0,0,30,+ 17,17,17,30,16,15,0,0,0,0,1,1,15,17,17,17,17,0,0,0,1,0,1,1,1,1,1,0,0,0,4,0,+ 4,4,4,4,4,3,0,0,0,0,1,1,9,5,3,5,9,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,+ 55,0,73,0,73,0,73,0,73,0,0,0,0,0,15,17,17,17,17,0,0,0,14,17,17,17,14,0,0,0,15,17,+ 17,17,15,1,1,0,0,0,0,30,17,17,17,30,16,16,0,0,0,0,15,17,1,1,1,0,0,0,30,1,14,16,+ 15,0,0,0,2,2,7,2,2,2,2,0,0,0,17,17,17,17,30,0,0,0,17,17,10,10,4,0,0,0,0,0,+ 73,0,73,0,73,0,73,0,54,0,0,0,0,0,17,10,4,10,17,0,0,0,17,17,17,18,28,16,14,0,0,0,+ 0,31,8,4,2,31,0,0,0,4,2,2,1,2,2,4,0,0,0,1,1,1,0,1,1,1,0,0,0,1,2,2,+ 4,2,2,1,0,0,0,0,0,6,0,73,0,48,0,0,0,+};+static const pfont_t font = {15, 10, font_glyphs, font_bits};diff --git a/games/leveldevil/tests/play.c b/games/leveldevil/tests/play.cindex 35d36b98..f75b0f3e 100644--- a/games/leveldevil/tests/play.c+++ b/games/leveldevil/tests/play.c@@ -14,7 +14,7 @@* play rooms DIR a picture of every room as it starts (DIR/room_LL_R.ppm)* play film L R DIR [KEYS] the room played with its keys (or these), a picture every 2 steps* (DIR/f_NNNN.ppm)- * play screens DIR the map and the menus+ * play screens DIR the title, the map, the pause and the end*/#define main ld_main#include "../src/main.c"@@ -76,7 +76,7 @@ static void setup(int i) {gfx_buf = strip, seed = 1;scr = SC_PLAY, ov = 0, level = i / ROOMS, rnum = i % ROOMS;enter();- fade = 0;+ jaw = J_OPEN;}static int keys_of(char c) {return c == 'L' ? I_LEFT : c == 'R' ? I_RIGHT : c == 'J' ? I_UP : c == 'D' ? I_DOWN : 0;@@ -326,19 +326,24 @@ int main(int argc, char **argv) {}return 0;}- if (!strcmp(cmd, "screens") && argc > 2) {+ if (!strcmp(cmd, "screens") && argc > 2) { /* the title, the map, the pause and the end */static const struct {- int scr, ov, sel;+ int scr, ov, sel, jaw;const char *name;- } screens[] = {{SC_HUB, OV_NONE, 0, "map"}, {SC_HUB, OV_HELP, 0, "help"}, {SC_PLAY, OV_PAUSE, 1, "pause"},- {SC_PLAY, OV_QUIT, 1, "quit"}, {SC_HUB, OV_END, 0, "end"}, {SC_HUB, OV_NONE, 0, "banner"}};- setup(15 * ROOMS + 4);- sv.open = 12, sv.done = 0x7FF, sv.deaths = 173, sv.sel = 6, sv.run = 4;+ } screens[] = {{SC_TITLE, OV_NONE, 0, J_OPEN, "title"}, {SC_TITLE, OV_NONE, 0, J_SHUT, "jaws"},+ {SC_MAP, OV_NONE, 6, J_OPEN, "map"}, {SC_MAP, OV_NONE, 13, J_OPEN, "map_right"},+ {SC_PLAY, OV_PAUSE, 1, J_SHUT, "pause"}, {SC_PLAY, OV_QUIT, 1, J_SHUT, "quit"},+ {SC_END, OV_NONE, 0, J_OPEN, "end"}};+ sv.open = 15, sv.done = 0x3FFF, sv.deaths = 173;for (int l = 0; l < LEVELS; l++) sv.best[l] = (uint16_t)(l * 3 % 7);for (unsigned k = 0; k < sizeof screens / sizeof screens[0]; k++) {- scr = screens[k].scr, ov = screens[k].ov, sel = screens[k].sel, banner = k == 5 ? 4 : 0;- if (scr == SC_PLAY) setup(15 * ROOMS + 4), scr = SC_PLAY, ov = screens[k].ov, sel = screens[k].sel;- gfx_render(scr == SC_HUB ? hub_scene : play_scene, 0, 0, SCREEN_H);+ setup(0);+ scr = screens[k].scr, ov = screens[k].ov, sel = screens[k].sel, jaw = screens[k].jaw;+ if (scr == SC_MAP) sv.sel = (uint16_t)sel, pan = pan_for(sel);+ credits_y = 100, menu_anim = 0;+ for (int s = 0; s < 60; s++) step(0);+ gfx_render(scr == SC_PLAY ? play_scene : scr == SC_MAP ? map_scene : scr == SC_END ? end_scene : title_scene, 0, 0,+ SCREEN_H);snprintf(path, sizeof path, "%s/%s.ppm", argv[2], screens[k].name);shot(path);}diff --git a/games/leveldevil/tools/pictures.py b/games/leveldevil/tools/pictures.pynew file mode 100644index 00000000..715cad83--- /dev/null+++ b/games/leveldevil/tools/pictures.py@@ -0,0 +1,265 @@+#!/usr/bin/env python3+"""Level Devil's own pictures and fonts, packed into src/pictures.h.++They come from the game's web build (the one tools/fetch.py reads): its packed library (default.pak)+has every picture at 1x, 1.5x, 2x and 4x; these are the 1x ones (assets/graphics/1x), where a sprite+is "sprite-ID-ANIMATION.png" (the frames of an animation side by side, then down) and a font is+"font-ID.png" with its "font-ID.fnt" (AngelCode BMFont text). The sprites' names and frames are the+game's (data/resources.mbs): 591 Hero, 599 Door, 610 Spikes, 681 Portals, 711 and 713+Scene_Change_Top and _Bottom (the jaws with the Devil's eyes), 743 the title...++A picture is up to 15 colours and clear: its colours are in pic_pal, from its pal on; a pixel is+4 bits (0 clear, n its n-th colour), rows of whole bytes. The game paints its traps grey+(99, 99, 99) and swaps that grey for the world's ground colour as a room starts; such a picture+says which of its colours is that grey (tint), and the game draws it in the room's colour.+Big pictures (the title, the jaws, the credits) are runs instead: a byte a run, its colour in the+high 4 bits and its length less one in the low 4 (15: 16 more than the next byte), each row+starting where the row table (16 bits a row, from the picture's start) says.++A font: for each letter from ' ' to '~', its advance, its bitmap's size and place (from the top of+the line), and its bits (row by row, the first pixel the lowest bit, whole bytes a letter).++Usage: pictures.py [--from DIR] (DIR: a folder with "Level Devil.js" and default.pak; without it they+ are downloaded, as tools/fetch.py does)+"""+import argparse+import io+import os+import re+import sys+import tempfile+import urllib.parse+import zlib++from PIL import Image++HERE = os.path.dirname(os.path.abspath(__file__))+sys.path.insert(0, HERE)+import fetch # noqa: E402++OUT = os.path.join(HERE, "..", "src", "pictures.h")+GREY = (99, 99, 99)++# name: file (sprite-ID-ANIM), the frame size (or None: the whole picture), its frames (or one), runs?+PICTURES = [+ ("HERO_IDLE", "sprite-591-5", None, None),+ ("HERO_JUMP_L", "sprite-591-6", None, None),+ ("HERO_JUMP_R", "sprite-591-7", None, None),+ ("HERO_RUN_L", "sprite-591-8", (16, 16), 4),+ ("HERO_RUN_R", "sprite-591-9", (16, 16), 4),+ ("FLAP_STAND", "sprite-693-0", None, None),+ ("FLAP_R", "sprite-693-2", None, None),+ ("FLAP_L", "sprite-693-3", None, None),+ ("DOOR", "sprite-599-20", None, None),+ ("DOOR_SHUT", "sprite-599-21", (16, 16), 5), # Level_Complete: the door shutting+ ("DOOR_HERO", "sprite-599-15", None, None), # Hero_Dummy: the door dressed as the runner+ ("DOOR_DUMMY", "sprite-683-0", None, None),+ ("SPIKE", "sprite-610-17", None, None),+ ("COIN", "sprite-614-0", None, None),+ ("BAD_COIN", "sprite-660-0", None, None),+ ("WARP", "sprite-620-0", (16, 16), 2),+ ("SPRING", "sprite-622-0", None, None),+ ("SPRING_UP", "sprite-622-34", None, None),+ ("BUTTON", "sprite-662-0", None, None),+ ("BUTTON_DOWN", "sprite-662-1", None, None),+ ("SAW", "sprite-685-0", None, None),+ ("SAW_BIG", "sprite-685-1", None, None),+ ("GSPIKE", "sprite-699-14", None, None), # Grav_Spike_Block+ ("THRU", "sprite-563-0", None, None), # Tile_Jumpthrough_2+ ("DEATH_SQUARE", "sprite-847-17", None, None),+ ("BODY", "sprite-593-%d", None, (1, 2, 3, 4)), # Body_Parts: the runner in pieces+ ("PRE", "sprite-715-%d", None, (0, 1, 2, 3)), # Body_Precursors: the pieces coming together+ ("KEYS", "sprite-767-0", None, None), # Keyboard_Tutorial+ ("ROOM_SQUARE", "sprite-849-0", None, None), # Level_Indicator+ ("ROOM_DONE", "sprite-849-1", None, None),+ ("BACK", "sprite-760-0", (16, 16), 1), # Btn_Back+ ("PORTAL_LOCKED", "sprite-681-17", None, None),+ ("PORTAL", "sprite-681-%d", None, tuple(range(18, 33))),+ ("BOSS_LOCKED", "sprite-723-0", None, None),+ ("BOSS_OPEN", "sprite-723-1", None, None),+ ("DIRT", "sprite-725-0", None, None), # Portal_Dirt, under each portal+ ("HILITE", "sprite-745-0", (12, 30), 4), # Portal_Highlight+ ("HILITE_BOSS", "sprite-745-1", (22, 37), 4),+ ("CARD", "sprite-855-0", None, "runs"), # Btn_1_Player+ ("CARD_ON", "sprite-855-1", None, "runs"),+ ("EYES", "sprite-833-0", None, "runs"), # Boss_Eyes+ ("EYES_LAUGH", "sprite-833-1", None, "runs"),+ ("TITLE", "background-743-0", None, "runs"), # Title_Background+ ("JAW_TOP", "sprite-711-2", None, "runs"), # Scene_Change_Top (Slim)+ ("JAW_BOTTOM", "sprite-713-2", None, "runs"), # Scene_Change_Bottom (Slim)+ ("CREDITS", "sprite-719-1", None, "runs"),+]+FONTS = [("FONT_SMALL", 543), ("FONT", 783)] # "8px" and "13px Yellow" (drawn in any colour)+++def library(script, pak):+ """the 1x pictures and fonts of the packed library: {name: bytes}"""+ js = script.decode("utf-8", "replace")+ end = js.find('libraryType":"lime.utils.PackedAssetLibrary')+ manifest = js[js.rfind('{"name":null,"assets":"', 0, end):end]+ out = {}+ for m in re.finditer(r"(?:position|R0)i(\d+)(?:y4:size|R1)(?:z|i\d+)(?:y4:type|R2)(?:y\d+:[A-Z]+|R\d+)(?:y2:id|R4)y(\d+):",+ manifest):+ pos, n = int(m.group(1)), int(m.group(2))+ rest = manifest[m.end():]+ ident = urllib.parse.unquote(rest[:n])+ length = re.match(r"(?:y6:length|R6)i(\d+)", rest[n:])+ if length and ident.startswith("assets/graphics/1x/"):+ raw = pak[pos:pos + int(length.group(1))]+ try:+ raw = zlib.decompress(raw, 31)+ except zlib.error:+ pass+ out[ident.rsplit("/", 1)[1]] = raw+ return out+++def rgb565(c):+ r, g, b = c+ return (r & 0xF8) << 8 | (g & 0xFC) << 3 | b >> 3+++class Packer:+ def __init__(self):+ self.pal, self.data, self.pics, self.names = [], bytearray(), [], []++ def palette(self, colours):+ """where these colours are in pic_pal (shared when the same)"""+ v = [rgb565(c) for c in colours]+ for i in range(len(self.pal) - len(v) + 1):+ if self.pal[i:i + len(v)] == v:+ return i+ self.pal += v+ return len(self.pal) - len(v)++ def add(self, name, im, runs=False):+ im = im.convert("RGBA")+ w, h = im.size+ px = im.load()+ colours = []+ for y in range(h):+ for x in range(w):+ r, g, b, a = px[x, y]+ if a >= 128 and (r, g, b) not in colours:+ colours.append((r, g, b))+ assert len(colours) <= 15, (name, colours)+ colours.sort(key=lambda c: c != GREY)+ idx = [[colours.index(px[x, y][:3]) + 1 if px[x, y][3] >= 128 else 0 for x in range(w)] for y in range(h)]+ at = len(self.data)+ if runs:+ body = bytearray()+ table = []+ for row in idx:+ table.append(2 * h + len(body))+ x = 0+ while x < w:+ n = 1+ while x + n < w and row[x + n] == row[x] and n < 16 + 255:+ n += 1+ if n <= 15:+ body.append(row[x] << 4 | (n - 1))+ else:+ body += bytes([row[x] << 4 | 15, n - 16])+ x += n+ assert 2 * h + len(body) < 65536+ self.data += b"".join(t.to_bytes(2, "little") for t in table) + body+ else:+ for row in idx:+ row = row + [0] * (w & 1)+ self.data += bytes(row[i] | row[i + 1] << 4 for i in range(0, len(row), 2))+ tint = colours.index(GREY) + 1 if GREY in colours else 0+ self.pics.append((w, h, self.palette(colours), tint, int(runs), at))+ self.names.append(name)+++def font(png, fnt):+ """(line height, base, glyphs: (adv, w, h, x, y, bits) for ' ' to '~')"""+ im = Image.open(io.BytesIO(png)).convert("RGBA")+ text = fnt.decode("utf-8", "replace")+ common = re.search(r'lineHeight="(\d+)" base="(\d+)"', text)+ chars = {}+ for m in re.finditer(r"<char ([^>]*)>", text):+ a = dict(re.findall(r'(\w+)="(-?\d+)"', m.group(1)))+ chars[int(a["id"])] = {k: int(v) for k, v in a.items()}+ glyphs = []+ for cp in range(32, 127):+ c = chars.get(cp, chars[32])+ bits = bytearray()+ for y in range(c["height"]):+ for x0 in range(0, c["width"], 8):+ v = 0+ for i in range(min(8, c["width"] - x0)):+ if im.getpixel((c["x"] + x0 + i, c["y"] + y))[3] >= 128:+ v |= 1 << i+ bits.append(v)+ glyphs.append((c["xadvance"], c["width"], c["height"], c["xoffset"], c["yoffset"], bytes(bits)))+ return int(common.group(1)), int(common.group(2)), glyphs+++def main():+ ap = argparse.ArgumentParser()+ ap.add_argument("--from", dest="src")+ a = ap.parse_args()+ folder = a.src or tempfile.mkdtemp()+ script = fetch.fetch("Level Devil.js", folder)+ pak = (open(os.path.join(folder, "default.pak"), "rb").read() if a.src+ else fetch.fetch("lib/default.pak", folder))+ files = library(script, pak)+ p = Packer()+ for name, src, size, frames in PICTURES:+ if frames == "runs":+ p.add(name, Image.open(io.BytesIO(files[src + ".png"])), runs=True)+ elif isinstance(frames, tuple):+ for i, f in enumerate(frames):+ p.add(f"{name}{i}", Image.open(io.BytesIO(files[(src % f) + ".png"])))+ elif size:+ im = Image.open(io.BytesIO(files[src + ".png"]))+ across = im.width // size[0]+ for k in range(frames):+ x, y = k % across * size[0], k // across * size[1]+ p.add(f"{name}{k}" if frames > 1 else name, im.crop((x, y, x + size[0], y + size[1])))+ else:+ p.add(name, Image.open(io.BytesIO(files[src + ".png"])))+ out = ["/* Level Devil's own pictures and fonts (tools/pictures.py, from the game's web build) */",+ "typedef struct {", " uint16_t w, h, pal;", " uint8_t tint, runs;", " uint32_t at;", "} pic_t;",+ "enum {"]+ out += [f" P_{n}," for n in p.names]+ out += [" PICS", "};"]+ out.append("static const uint16_t pic_pal[%d] = {" % len(p.pal))+ for i in range(0, len(p.pal), 12):+ out.append(" " + " ".join("0x%04X," % v for v in p.pal[i:i + 12]))+ out.append("};")+ out.append("static const pic_t pics[PICS] = {")+ for (w, h, pal, tint, runs, at), n in zip(p.pics, p.names):+ out.append(f" {{{w}, {h}, {pal}, {tint}, {runs}, {at}}}, /* {n} */")+ out.append("};")+ out.append("static const uint8_t pic_data[%d] = {" % len(p.data))+ for i in range(0, len(p.data), 32):+ out.append(" " + ",".join(str(b) for b in p.data[i:i + 32]) + ",")+ out.append("};")+ out += ["typedef struct {", " uint8_t adv, w, h;", " int8_t x, y;", " uint16_t at;", "} glyph_t;",+ "typedef struct {", " uint8_t line, base;", " const glyph_t *g;", " const uint8_t *bits;", "} pfont_t;"]+ for name, fid in FONTS:+ line, base, glyphs = font(files[f"font-{fid}.png"], files[f"font-{fid}.fnt"])+ bits, table = bytearray(), []+ for adv, w, h, x, y, b in glyphs:+ table.append(f"{{{adv}, {w}, {h}, {x}, {y}, {len(bits)}}}")+ bits += b+ low = name.lower()+ out.append(f"static const glyph_t {low}_glyphs[95] = {{")+ for i in range(0, 95, 8):+ out.append(" " + ", ".join(table[i:i + 8]) + ",")+ out.append("};")+ out.append(f"static const uint8_t {low}_bits[{len(bits)}] = {{")+ for i in range(0, len(bits), 32):+ out.append(" " + ",".join(str(v) for v in bits[i:i + 32]) + ",")+ out.append("};")+ out.append(f"static const pfont_t {low} = {{{line}, {base}, {low}_glyphs, {low}_bits}};")+ with open(OUT, "w") as f:+ f.write("\n".join(out) + "\n")+ print(f"{len(p.pics)} pictures, {len(p.data)} bytes, {len(p.pal)} colours into {os.path.relpath(OUT)}",+ file=sys.stderr)+++if __name__ == "__main__":+ main()diff --git a/games/leveldevil/tools/rooms.py b/games/leveldevil/tools/rooms.pyindex c728fc7d..54b08015 100644--- a/games/leveldevil/tools/rooms.py+++ b/games/leveldevil/tools/rooms.py@@ -31,7 +31,7 @@ FPS = 60# kinds, flags, modes, ops (src/main.c)(K_BLOCK, K_SPIKE, K_SAW, K_SPRING, K_DOOR, K_TRIG, K_COIN, K_BAD, K_WARP, K_BUTTON, K_THRU, K_GSPIKE,- K_DEATH) = range(13)+ K_DEATH, K_SIGN) = range(14)F_HIDE, F_GHOST, F_OFF, F_BIG, F_USED, F_ICE = 1, 2, 4, 8, 16, 32R_WRAP, R_WRAPY, R_SWAP, R_FLAPPY, R_GRAVITY = 1, 2, 4, 16, 32(O_VEL, O_MOVE, O_SET, O_GROW, O_FLAG, O_SPAWN, O_WARP, O_HERO, O_GRAV, O_HGROW, O_SHAKE, O_FIRE, O_REARM,@@ -48,8 +48,8 @@ WORLDS = ["Pits", "Spikes", "Push", "Coins", "Controls", "Platforms", "Springs",FAKE = [600, 645, 647, 649, 651, 653, 655, 657] # Fake_Tile_1 to 8 (Enemy_Fake_Tile is a 600 too)TRIGGER = [602, 604, 615, 617, 665, 667, 673, 675] # Trigger_1 to 8KINDS = {609: K_SPIKE, 684: K_SAW, 621: K_SPRING, 598: K_DOOR, 613: K_COIN, 659: K_BAD, 619: K_WARP, 661: K_BUTTON,- 562: K_THRU, 698: K_GSPIKE, 846: K_DEATH, 682: K_DOOR}-SKIP = {596, 766, 682} # blood, the keyboard sign, the door's double (Doors_5)+ 562: K_THRU, 698: K_GSPIKE, 846: K_DEATH, 682: K_DOOR, 766: K_SIGN}+SKIP = {596, 682} # blood, the door's double (Doors_5)SCENES = {r["name"]: r for r in json.load(open(os.path.join(HERE, "scenes.json")))}@@ -62,7 +62,7 @@ class Obj:self.kind, self.x, self.y, self.sx, self.sy, self.angle = kind, x, y, sx, sy, angleself.typ, self.name, self.ev = typ, name, evself.flags, self.back, self.index, self.made = 0, False, None, False- self.iw, self.ih = (16, 26) if kind == K_GSPIKE else (16, 16)+ self.iw, self.ih = {K_GSPIKE: (16, 26), K_SIGN: (50, 31)}.get(kind, (16, 16)) # (the sign: the arrow keys)@propertydef cx(self):