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
4 Players: README, screenshots, gallery GIF and its place in the tests and the release
Mason363600a0c9c32f6
diff --git a/docs/media/gallery/fourplayer.gif b/docs/media/gallery/fourplayer.gifnew file mode 100644index 00000000..9a1b581bBinary files /dev/null and b/docs/media/gallery/fourplayer.gif differdiff --git a/docs/media/thumb_fourplayer.png b/docs/media/thumb_fourplayer.pngnew file mode 100644index 00000000..ed000fddBinary files /dev/null and b/docs/media/thumb_fourplayer.png differdiff --git a/games/fourplayer/README.md b/games/fourplayer/README.mdnew file mode 100644index 00000000..0c0e2af8--- /dev/null+++ b/games/fourplayer/README.md@@ -0,0 +1,119 @@+> **2 3 4 Players is a [NumPlay](../../README.md) game that comes on its own.** Get `FourPlayers.nwa` from the [latest release](https://github.com/Mason363/NumPlay/releases/latest).++<p align="center">+ <img src="src/icon.png" width="84" alt="2 3 4 Players icon">+</p>++<h1 align="center">2 3 4 Players</h1>++<p align="center">+ <b>One-key party games for 2, 3 or 4 players on one NumWorks calculator.</b><br>+ 14 minigames, and teams, 2 v 2 and 3 v 3.+</p>++<p align="center">+ <a href="https://github.com/Mason363/NumPlay/releases/latest/download/FourPlayers.nwa"><b>Download FourPlayers.nwa</b></a>+ · <a href="#controls">Controls</a>+</p>++<p align="center">+ <img src="../../docs/media/gallery/fourplayer.gif" width="640" alt="Four players: Sumo, Racing, Soccer, Tanks, Snakes and Paint">+</p>++## Highlights++* **One key each:** shift, ⌫, 0 and EXE, at the four corners of the keypad, with 7 and ) for 3 v 3. Every game is played with that key alone.+* **14 minigames:** Sumo, Racing, Tanks, Snakes, Soccer, Grab the Fish, Skate Race, Jump Rope, Paint, Balloons, Birds, Gravity Run, Frog Jump and Stop the Clock. Or Mix, another one every round.+* **2, 3 or 4 players, or teams:** 2 v 2, or 3 v 3 with six around one calculator.+* **Quick rounds:** 10 to 60 seconds each, the scores between them, first to 3 rounds (or anything from 1 to 9).+* **Before each game:** its rules, and a map of the keypad with each player's key in their colour. Everyone presses theirs, and it starts.+* **Kept:** the matches each colour has won, for every game. Home saves and quits. It's also copied into `fourplayer_saves.py`, so installing apps again doesn't erase it.++<table>+ <tr>+ <td align="center"><img src="docs/players.png" width="390" alt="How many play: 2, 3 or 4 players, 2 v 2 or 3 v 3, and the keys on the keypad"><br><sub>How many play, and their keys</sub></td>+ <td align="center"><img src="docs/games.png" width="390" alt="The fourteen minigames and Mix"><br><sub>The minigames</sub></td>+ </tr>+ <tr>+ <td align="center"><img src="docs/rules.png" width="390" alt="Sumo's rules, two players ready"><br><sub>The rules, and everyone ready</sub></td>+ <td align="center"><img src="docs/sumo.png" width="390" alt="Sumo on a ring of ice"><br><sub>Sumo</sub></td>+ </tr>+ <tr>+ <td align="center"><img src="docs/racing.png" width="390" alt="Four cars on the track"><br><sub>Racing</sub></td>+ <td align="center"><img src="docs/tanks.png" width="390" alt="Tanks in a walled arena"><br><sub>Tanks</sub></td>+ </tr>+ <tr>+ <td align="center"><img src="docs/snakes.png" width="390" alt="Four snakes and the stars"><br><sub>Snakes</sub></td>+ <td align="center"><img src="docs/soccer.png" width="390" alt="Four players, a goal in each corner"><br><sub>Soccer</sub></td>+ </tr>+ <tr>+ <td align="center"><img src="docs/fish.png" width="390" alt="Cats round a pond, a goldfish jumping"><br><sub>Grab the Fish</sub></td>+ <td align="center"><img src="docs/skate.png" width="390" alt="Six skaters, two teams"><br><sub>Skate Race, 3 v 3</sub></td>+ </tr>+ <tr>+ <td align="center"><img src="docs/rope.png" width="390" alt="A bar sweeping round the platform"><br><sub>Jump Rope</sub></td>+ <td align="center"><img src="docs/paint.png" width="390" alt="The floor painted in four colours"><br><sub>Paint</sub></td>+ </tr>+ <tr>+ <td align="center"><img src="docs/balloons.png" width="390" alt="Four balloons on their pumps"><br><sub>Balloons</sub></td>+ <td align="center"><img src="docs/birds.png" width="390" alt="Birds flying between the columns"><br><sub>Birds</sub></td>+ </tr>+ <tr>+ <td align="center"><img src="docs/gravity.png" width="390" alt="Runners on the floor and the ceiling"><br><sub>Gravity Run</sub></td>+ <td align="center"><img src="docs/frogs.png" width="390" alt="Frogs gathering their jumps"><br><sub>Frog Jump</sub></td>+ </tr>+ <tr>+ <td align="center"><img src="docs/clock.png" width="390" alt="Stop at 6.00: each player's time"><br><sub>Stop the Clock</sub></td>+ <td align="center"><img src="docs/teams.png" width="390" alt="Soccer, 3 v 3"><br><sub>Soccer, 3 v 3</sub></td>+ </tr>+</table>++## How to play++Choose how many play, then a game. Each player has one key: red **shift**, blue **⌫**, green **0** and yellow **EXE**. In teams, the left of the keypad is the red team and the right the blue team, and 3 v 3 adds **7** and **)**. Before a game its rules show, with the keys on the keypad. When everyone has pressed their key, 3, 2, 1, go. Each round won is a point, and the first to 3 takes the match.++| Game | Your key | The round goes to |+| --- | --- | --- |+| Sumo | Tap to dash where your arrow points. It then spins the other way | The last one on the ice |+| Racing | Hold to turn left | The first to finish three laps |+| Tanks | Hold to drive, let go to fire | The last tank left |+| Snakes | Tap to turn right | The last snake left |+| Soccer | Tap to dash where your arrow points | Two sides, the first goal. Three or four players, the last one who hasn't let one in |+| Grab the Fish | Tap to swipe at a goldfish, never at junk | The first to three goldfish |+| Skate Race | Tap as fast as you can | The first over the line |+| Jump Rope | Tap to jump over the bar | The last one on the platform |+| Paint | Tap to curve the other way | The most floor after 30 seconds |+| Balloons | Tap to pump, but not too much | The biggest balloon still whole after 10 seconds |+| Birds | Tap to flap | The last bird flying |+| Gravity Run | Tap to flip to the floor or the ceiling | The last runner left |+| Frog Jump | Hold to gather a jump, let go to jump | The first frog across |+| Stop the Clock | Tap when you think the hidden stopwatch shows the time asked | The closest |++In teams, a round won by one of you is the team's. In Grab the Fish your goldfish count together, in Paint you paint one colour, and in Balloons your air adds up.++## Controls++| Key | What it does |+| --- | --- |+| shift, ⌫, 0, EXE | The players' keys, with 7 and ) in 3 v 3 |+| Arrows, OK | Choose the players and a game |+| Left and Right | On the rules, the rounds to win |+| Back | Pause: Resume, Restart, Other games, Quit game |+| Home | Save and quit |++With two or three players, EXE works as OK too.++## Good to know++* **On its own:** NumPlay is full, so 2 3 4 Players is an app of its own.+* **Together:** there's no single player and no computer to play against, and no shop: every game is there from the start.++## Credits++Inspired by the party app 2 3 4 Player Games by JindoBlu. Made by Mason Chen as part of NumPlay. Not affiliated with JindoBlu.++* The text uses NumPlay's **Nunito** font (SIL Open Font License). The minigames, the players and the pictures are the game's own, drawn from shapes as it goes.++## License++The game's code is licensed under the GNU General Public License v3.0: see the `LICENSE` file at the root of the repository.diff --git a/games/fourplayer/docs/balloons.png b/games/fourplayer/docs/balloons.pngnew file mode 100644index 00000000..e080df5eBinary files /dev/null and b/games/fourplayer/docs/balloons.png differdiff --git a/games/fourplayer/docs/birds.png b/games/fourplayer/docs/birds.pngnew file mode 100644index 00000000..ab50cf7aBinary files /dev/null and b/games/fourplayer/docs/birds.png differdiff --git a/games/fourplayer/docs/clock.png b/games/fourplayer/docs/clock.pngnew file mode 100644index 00000000..cffe0afeBinary files /dev/null and b/games/fourplayer/docs/clock.png differdiff --git a/games/fourplayer/docs/fish.png b/games/fourplayer/docs/fish.pngnew file mode 100644index 00000000..59f6f8abBinary files /dev/null and b/games/fourplayer/docs/fish.png differdiff --git a/games/fourplayer/docs/frogs.png b/games/fourplayer/docs/frogs.pngnew file mode 100644index 00000000..c709c914Binary files /dev/null and b/games/fourplayer/docs/frogs.png differdiff --git a/games/fourplayer/docs/games.png b/games/fourplayer/docs/games.pngnew file mode 100644index 00000000..51038bcaBinary files /dev/null and b/games/fourplayer/docs/games.png differdiff --git a/games/fourplayer/docs/gravity.png b/games/fourplayer/docs/gravity.pngnew file mode 100644index 00000000..04e5fec2Binary files /dev/null and b/games/fourplayer/docs/gravity.png differdiff --git a/games/fourplayer/docs/paint.png b/games/fourplayer/docs/paint.pngnew file mode 100644index 00000000..5909765fBinary files /dev/null and b/games/fourplayer/docs/paint.png differdiff --git a/games/fourplayer/docs/players.png b/games/fourplayer/docs/players.pngnew file mode 100644index 00000000..345bfa00Binary files /dev/null and b/games/fourplayer/docs/players.png differdiff --git a/games/fourplayer/docs/racing.png b/games/fourplayer/docs/racing.pngnew file mode 100644index 00000000..168168b7Binary files /dev/null and b/games/fourplayer/docs/racing.png differdiff --git a/games/fourplayer/docs/rope.png b/games/fourplayer/docs/rope.pngnew file mode 100644index 00000000..042090c6Binary files /dev/null and b/games/fourplayer/docs/rope.png differdiff --git a/games/fourplayer/docs/rules.png b/games/fourplayer/docs/rules.pngnew file mode 100644index 00000000..ce590329Binary files /dev/null and b/games/fourplayer/docs/rules.png differdiff --git a/games/fourplayer/docs/shot.png b/games/fourplayer/docs/shot.pngnew file mode 100644index 00000000..48486847Binary files /dev/null and b/games/fourplayer/docs/shot.png differdiff --git a/games/fourplayer/docs/skate.png b/games/fourplayer/docs/skate.pngnew file mode 100644index 00000000..e8593284Binary files /dev/null and b/games/fourplayer/docs/skate.png differdiff --git a/games/fourplayer/docs/snakes.png b/games/fourplayer/docs/snakes.pngnew file mode 100644index 00000000..131aebf1Binary files /dev/null and b/games/fourplayer/docs/snakes.png differdiff --git a/games/fourplayer/docs/soccer.png b/games/fourplayer/docs/soccer.pngnew file mode 100644index 00000000..aebb324fBinary files /dev/null and b/games/fourplayer/docs/soccer.png differdiff --git a/games/fourplayer/docs/sumo.png b/games/fourplayer/docs/sumo.pngnew file mode 100644index 00000000..48486847Binary files /dev/null and b/games/fourplayer/docs/sumo.png differdiff --git a/games/fourplayer/docs/tanks.png b/games/fourplayer/docs/tanks.pngnew file mode 100644index 00000000..33fb4d36Binary files /dev/null and b/games/fourplayer/docs/tanks.png differdiff --git a/games/fourplayer/docs/teams.png b/games/fourplayer/docs/teams.pngnew file mode 100644index 00000000..e5d7f293Binary files /dev/null and b/games/fourplayer/docs/teams.png differdiff --git a/games/fourplayer/src/app.c b/games/fourplayer/src/app.cindex 417dee4f..7edef087 100644--- a/games/fourplayer/src/app.c+++ b/games/fourplayer/src/app.c@@ -127,6 +127,7 @@ static struct {uint8_t ready, prev_h[NMAX];uint64_t held, stale;float tag_x[NMAX], tag_y[NMAX];+ int8_t tag_side[NMAX];} u;static int nsides(void) { return teams ? 2 : np; }@@ -148,7 +149,8 @@ static void open(int s) {}/* ---- the round */-void tag_at(int p, float x, float y) { u.tag_x[p] = x, u.tag_y[p] = y; }+void tag_by(int p, float x, float y, int side) { u.tag_x[p] = x, u.tag_y[p] = y, u.tag_side[p] = (int8_t)side; }+void tag_at(int p, float x, float y) { tag_by(p, x, y, 0); }void out(int p) { gone[p] = 1; }int alive(void) {int n = 0;@@ -343,15 +345,18 @@ static void hud(void) {for (int s = 0; s < ns; s++) /* keys on the left of the keypad on the left, the others on the right */if (!(s & 1)) chip(3 + (w + 3) * l++, w, s);else chip(SCREEN_W - 3 - w - (w + 3) * r++, w, s);- gfx_text_center(&np_font_small, 160, 15, "Back pause", SOFT, 256);+ gfx_text_center(&np_font_small, (3 + (w + 3) * l + SCREEN_W - 3 - (w + 3) * r) / 2, 15, "Back pause", SOFT, 256);}-/* the players' keys over them during the countdown */+/* the players' keys by them during the countdown: over them, or to their left or right */static void key_tags(void) {for (int p = 0; p < np; p++) {if (u.tag_x[p] < -500) continue;- int w = keytag_w(p) + 10, x = clampi((int)u.tag_x[p] - w / 2, 2, SCREEN_W - 2 - w), y = clampi((int)u.tag_y[p] - 22, TOP + 2, 220);+ int w = keytag_w(p) + 10, side = u.tag_side[p], tx = (int)u.tag_x[p], ty = (int)u.tag_y[p];+ int x = side ? (side < 0 ? tx - 10 - w : tx + 10) : tx - w / 2, y = side ? ty - 8 : ty - 22;+ x = clampi(x, 2, SCREEN_W - 2 - w), y = clampi(y, TOP + 2, 220);box(x, y, w, 17, 6, col[p]);- gfx_fill(x + w / 2 - 3, y + 17, 6, 2, col[p]);+ if (side) gfx_fill(side < 0 ? x + w : x - 2, y + 6, 2, 5, col[p]);+ else gfx_fill(x + w / 2 - 3, y + 17, 6, 2, col[p]);keytag(x + w / 2, y + 13, p, WHITE);}}@@ -374,7 +379,8 @@ static void scores(int y0, bool pop) {for (int s = 0; s < u.nsides; s++) {int y = y0 + s * (u.nsides > 3 ? 22 : 26);blob(66, y, 8, s, 0);- gfx_text(&np_font_body, 82, y + 5, side_name(s), s == u.winner ? GOLD : WHITE, 256);+ int e = gfx_text(&np_font_body, 82, y + 5, side_name(s), s == u.winner ? GOLD : WHITE, 256);+ if (!teams) keytag(e + 8 + keytag_w(s) / 2, y + 5, s, SOFT);pips(176, y, s, pop && s == u.winner);}}@@ -512,7 +518,7 @@ static void scene(void *ctx) {int w = u.winner, h = 100 + u.nsides * (u.nsides > 3 ? 22 : 26);card(118 - h / 2, h);say(&np_font_title, 160, 118 - h / 2 + 32, side_name(w), lite[w]);- gfx_text_center(&np_font_body, 160, 118 - h / 2 + 50, teams ? "wins the match!" : "wins the match!", WHITE, 256);+ gfx_text_center(&np_font_body, 160, 118 - h / 2 + 50, "wins the match!", WHITE, 256);scores(118 - h / 2 + 68, false);static const char *const ITEM[2] = {"Rematch", "Other games"};for (int i = 0; i < 2; i++) button(48 + i * 116, 118 + h / 2 - 34, 108, ITEM[i], u.sel == i && sc == S_OVER);diff --git a/games/fourplayer/src/fp.h b/games/fourplayer/src/fp.hindex e64a9c07..aad7b3e5 100644--- a/games/fourplayer/src/fp.h+++ b/games/fourplayer/src/fp.h@@ -76,6 +76,7 @@ void keytag(int cx, int base, int p, color_t c);int keytag_w(int p);/* where p is drawn (the top of them): their key's label shows there during the countdown */void tag_at(int p, float x, float y);+void tag_by(int p, float x, float y, int side); /* (by its side: -1 to its left, 1 to its right) */char *num(char *o, uint32_t v);/* ---- the minigames */diff --git a/games/fourplayer/src/g_birds.c b/games/fourplayer/src/g_birds.cindex 9f22a0c5..589bae7d 100644--- a/games/fourplayer/src/g_birds.c+++ b/games/fourplayer/src/g_birds.c@@ -19,7 +19,7 @@ static void column(int i, float x) {c[i].x = x, c[i].gap = gap, c[i].mid = rr(TOP + 22 + gap / 2, GROUND - 16 - gap / 2);}static void start(void) {- for (int p = 0; p < np; p++) y[p] = 110 + (p & 1) * 16 - p * 3, vy[p] = -120, dead_t[p] = -1, flap_t[p] = -10000;+ for (int p = 0; p < np; p++) y[p] = 66 + p * (np > 4 ? 24 : 34), vy[p] = -120, dead_t[p] = -1, flap_t[p] = -10000;for (int i = 0; i < NCOL; i++) column(i, 360 + i * 150);scroll = 0, speed = 80;}diff --git a/games/fourplayer/src/g_gravity.c b/games/fourplayer/src/g_gravity.cindex 900535ce..e5c44d29 100644--- a/games/fourplayer/src/g_gravity.c+++ b/games/fourplayer/src/g_gravity.c@@ -20,7 +20,7 @@ static struct {int32_t dead_t;} r[NMAX];-static float rx(int p) { return 64 + p * 17; }+static float rx(int p) { return 50 + p * 24; }static void add_gap(void) {float later = (rt < 60000 ? (rt > 0 ? rt : 0) : 60000) / 60000.0f; /* (holes get wider, and come sooner) */float w = rr(30, 56) + later * 40;@@ -39,8 +39,7 @@ static bool solid(float x, int up) {static void start(void) {world = 0, speed = 105, ngap = 0, next_x = 420;for (int p = 0; p < np; p++) r[p].g = 1, r[p].y = FLOOR - R, r[p].vy = 0, r[p].on = true, r[p].dead_t = -1;- if (np > 2) /* (half of them start on the ceiling) */- for (int p = 1; p < np; p += 2) r[p].g = -1, r[p].y = CEIL + R;+ for (int p = 1; p < np; p += 2) r[p].g = -1, r[p].y = CEIL + R; /* (half of them start on the ceiling) */while (next_x < world + 700) add_gap();}static void step(void) {diff --git a/games/fourplayer/src/g_race.c b/games/fourplayer/src/g_race.cindex a5c8b945..01ad997e 100644--- a/games/fourplayer/src/g_race.c+++ b/games/fourplayer/src/g_race.c@@ -41,7 +41,7 @@ static void start(void) {if (i != skip) oil[k][0] = SPOT[i][0] + rr(-30, 30) * (i == 0), oil[k][1] = SPOT[i][1] + rr(-22, 22) * (i > 0), k++;for (int p = 0; p < np; p++) {int row = p / 3, lane = p % 3, lanes = np < 3 ? np : 3;- c[p].x = 148 - row * 22 - lane * 3, c[p].y = 212 + (lane - (lanes - 1) / 2.0f) * 14;+ c[p].x = 148 - row * 22 - lane * 3, c[p].y = 212 + (lane - (lanes - 1) / 2.0f) * 16;c[p].h = c[p].va = 0, c[p].s = 0, c[p].oil_t = -10000, c[p].bump_t = -10000;c[p].last_a = fatan2(c[p].y - MY, c[p].x - MX), c[p].prog = PI / 2 - c[p].last_a;}@@ -144,7 +144,7 @@ static void draw(void) {float h = c[p].h;if (rt - c[p].oil_t < 550) h += (rt - c[p].oil_t) * 0.012f; /* a spin on the oil */car(p, c[p].x, c[p].y, h);- tag_at(p, c[p].x, c[p].y - 6);+ tag_by(p, c[p].x - 6, c[p].y, -1);}}diff --git a/games/fourplayer/src/g_skate.c b/games/fourplayer/src/g_skate.cindex 3f3fae9e..017a9c67 100644--- a/games/fourplayer/src/g_skate.c+++ b/games/fourplayer/src/g_skate.c@@ -61,7 +61,7 @@ static void draw(void) {disc(sx - 6, y + 10, 2, HEX(0xEDE7D6)), disc(sx + 6, y + 10, 2, HEX(0xEDE7D6));blob(sx, y - 1, 7, p, 0);if (behind) disc_a(sx, y - 1, 8, INK, 120);- tag_at(p, sx, y - 8);+ tag_by(p, sx + 8, y, 1);}}diff --git a/games/fourplayer/tests/check.py b/games/fourplayer/tests/check.pyindex 664ddbde..f3e6e133 100644--- a/games/fourplayer/tests/check.py+++ b/games/fourplayer/tests/check.py@@ -253,11 +253,11 @@ if "--docs" in sys.argv:shot("players", save_bytes(2, 0, 3, wins), "", 5, bots=False)shot("games", save_bytes(2, 0, 3, wins), "ok", 5, bots=False)shot("rules", save_bytes(2, 0, 3, wins), "ok ok w10 p1 p3", 5, bots=False)- for name, mode, game, frames, seed in [("sumo", 2, 0, 230, 5), ("racing", 2, 1, 520, 7), ("tanks", 2, 2, 320, 2),+ for name, mode, game, frames, seed in [("sumo", 2, 0, 230, 5), ("racing", 2, 1, 520, 7), ("tanks", 2, 2, 190, 2),("snakes", 2, 3, 420, 4), ("soccer", 2, 4, 330, 6), ("fish", 2, 5, 390, 3),("skate", 4, 6, 330, 1), ("rope", 2, 7, 300, 9), ("paint", 2, 8, 700, 5),("balloons", 2, 9, 520, 8), ("birds", 2, 10, 420, 6), ("gravity", 2, 11, 420, 3),- ("frogs", 2, 12, 520, 4), ("clock", 2, 13, 700, 2), ("teams", 4, 4, 300, 3)]:+ ("frogs", 2, 12, 520, 4), ("clock", 2, 13, 422, 2), ("teams", 4, 4, 300, 3)]:shot(name, save_bytes(mode, game), "ok ok ok", frames, seed)shutil.copy(os.path.join(docs, "sumo.png"), os.path.join(docs, "shot.png"))print("docs: screenshots saved")diff --git a/games/fourplayer/tests/play.c b/games/fourplayer/tests/play.cindex d8fbb421..f692eba2 100644--- a/games/fourplayer/tests/play.c+++ b/games/fourplayer/tests/play.c@@ -1,13 +1,14 @@/* Plays 2 3 4 Players on a computer, with scripted keys and computer players, and saves screenshots.** play [--frames N] [--keys "10:ok,20-30:p1,..."] [--shots "40:name.ppm,..."] [--out DIR] [--saves DIR]- * [--trace] [--fuzz SEED] [--seed N] [--bots FRAME] [--raw DIR] [--every K]+ * [--trace] [--fuzz SEED] [--seed N] [--bots FRAME] [--raw DIR] [--raw-frames A-B/K] [--every K]** A frame is 20 ms. Keys: left right up down ok exe back home onoff, and p1 to p6 the players' (shift,* backspace, 0, EXE, 7 and )). "a-b:key" holds the key from frame a to b, "a:key" for one frame.* --bots F: from frame F on, the computer plays for every player whenever a round is on (each game's bot).* --fuzz presses random keys (Home now and then ends a session, the next one starts from the save).- * --raw DIR saves every frame drawn as raw RGB565 (tools/record.py --frames); --every K draws every Kth frame+ * --raw DIR saves every frame drawn as raw RGB565 (tools/record.py --frames), or with --raw-frames those from A to B,+ * every Kth; --every K draws every Kth frame* (the screenshots and --raw draw theirs anyway). --trace prints each screen as it comes (SCREEN ...).* At the end: STATE ... */#include <stdio.h>@@ -83,7 +84,7 @@ static void print_state(const char *what) {}int main(int argc, char **argv) {- int frames = 600, fuzz = -1, bots = -1, every = 1;+ int frames = 600, fuzz = -1, bots = -1, every = 1, raw_a = 0, raw_b = 1 << 30, raw_k = 1;bool trace = false;for (int i = 1; i < argc; i++) {if (!strcmp(argv[i], "--frames") && i + 1 < argc) frames = atoi(argv[++i]);@@ -97,6 +98,7 @@ int main(int argc, char **argv) {else if (!strcmp(argv[i], "--seed") && i + 1 < argc) host_seed = (uint32_t)atoi(argv[++i]) | 1;else if (!strcmp(argv[i], "--bots") && i + 1 < argc) bots = atoi(argv[++i]);else if (!strcmp(argv[i], "--every") && i + 1 < argc) every = atoi(argv[++i]);+ else if (!strcmp(argv[i], "--raw-frames") && i + 1 < argc) sscanf(argv[++i], "%d-%d/%d", &raw_a, &raw_b, &raw_k);else {fprintf(stderr, "play: what is %s?\n", argv[i]);return 2;@@ -141,8 +143,9 @@ int main(int argc, char **argv) {last_screen = s.screen;bool shot = false;for (int i = 0; i < nshots; i++) shot |= shots[i].frame == f;- if (app_dirty() && (f % every == 0 || shot || raw_dir[0])) app_draw();- if (raw_dir[0]) {+ bool raw = raw_dir[0] && f >= raw_a && f <= raw_b && (f - raw_a) % raw_k == 0;+ if (app_dirty() && (f % every == 0 || shot || raw)) app_draw();+ if (raw) {char p[1024];snprintf(p, sizeof p, "%s/%06d_%06d.raw", raw_dir, raw_n++, f * 20);host_raw(p);diff --git a/games/fourplayer/tests/rules/gravity.c b/games/fourplayer/tests/rules/gravity.cindex ffede290..268d202a 100644--- a/games/fourplayer/tests/rules/gravity.c+++ b/games/fourplayer/tests/rules/gravity.c@@ -3,7 +3,7 @@void rules_gravity(void) {app_test_round(M2, G_GRAVITY);- CHECK(r[0].on && r[1].on, "gravity: the runners start on the ground");+ CHECK(r[0].on && r[1].on && r[0].g == 1 && r[1].g == -1, "gravity: the runners start on the floor and the ceiling");app_test_step(1), app_test_step(0);CHECK(r[0].g == -1 && !r[0].on, "gravity: a tap flips it");app_test_step(1), app_test_step(0);@@ -12,9 +12,9 @@ void rules_gravity(void) {CHECK(r[0].on && r[0].y == CEIL + R, "gravity: on the ceiling");app_test_round(M2, G_GRAVITY); /* a hole */- ngap = 1, gap[0].x0 = world + rx(1) + 20, gap[0].x1 = gap[0].x0 + 50, gap[0].up = 0, next_x = 1e9f;+ ngap = 1, gap[0].x0 = world + rx(0) + 20, gap[0].x1 = gap[0].x0 + 50, gap[0].up = 0, next_x = 1e9f;run(0, 300);- CHECK(gone[1] && WINNER == 0, "gravity: through a hole, out");+ CHECK(gone[0] && !gone[1] && WINNER == 1, "gravity: through a hole, out");app_test_round(M3V3, G_GRAVITY); /* the holes never face each other */bool fair = true;diff --git a/tests/ci.py b/tests/ci.pyindex bc7e9c76..2ca866f2 100644--- a/tests/ci.py+++ b/tests/ci.py@@ -24,7 +24,8 @@ HOST = ["numblocks", "numdrive", "championisland", "undertale", "doom", "isaac","hillclimb", "leveldevil", "cookieclicker", "jetpackjoyride", "donkeykong", "dune", "monkeymart","tombofthemask", "invaders", "sudoku", "uttt", "sokoban", "twoplayer", "flappydunk", "towerblock", "suika","doodlejump", "stickmanhook", "coreball", "uno", "fnf", "angrybirds", "polytrack", "paperclips", "badtime",- "mahjong", "rider", "snowrider", "templerun", "fnaf2", "famidash", "catninja", "motox3m", "amongus", "imposter"]+ "mahjong", "rider", "snowrider", "templerun", "fnaf2", "famidash", "catninja", "motox3m", "amongus", "imposter",+ "fourplayer"]HOST_ARGS = {"fnf": " BUILD_DIR=../../build/data/games/fnf"}# seconds on CI (v1.24.3's run); the emulator's 71 apps took 2450 in all, the Python tests about 380WEIGHT = {"numblocks": 89, "numdrive": 20, "championisland": 69, "undertale": 445, "doom": 54, "isaac": 380,@@ -33,7 +34,8 @@ WEIGHT = {"numblocks": 89, "numdrive": 20, "championisland": 69, "undertale": 44"invaders": 7, "sudoku": 3, "uttt": 2, "sokoban": 2, "twoplayer": 114, "flappydunk": 2, "towerblock": 2,"suika": 112, "doodlejump": 5, "stickmanhook": 103, "coreball": 26, "uno": 36, "fnf": 80, "angrybirds": 627,"polytrack": 116, "paperclips": 164, "badtime": 59, "mahjong": 25, "rider": 137, "snowrider": 30,- "templerun": 384, "fnaf2": 654, "famidash": 7, "catninja": 60, "motox3m": 10, "amongus": 110, "imposter": 20}+ "templerun": 384, "fnaf2": 654, "famidash": 7, "catninja": 60, "motox3m": 10, "amongus": 110, "imposter": 20,+ "fourplayer": 40}EMULATOR = 2450PYTHON = 380diff --git a/tests/test_games.py b/tests/test_games.pyindex 3d147cd2..42edf15d 100644--- a/tests/test_games.py+++ b/tests/test_games.py@@ -333,6 +333,11 @@ GAMES = {# Start, the first "Pass to", the role; Home saves the round. Next time, from the copy, the settings, then On/Off"imposter": ("Imposter.nwa", "imposter.sav",presses((1500, "ok"), (2500, "ok"), (3500, "ok")), 6000, presses((1500, "down")), 3500),+ # 4 players, Sumo, its rules, the round and two dashes; Home saves. Next time, from the copy, the players, then+ # On/Off+ "fourplayer": ("FourPlayers.nwa", "fourplayer.sav",+ presses((1500, "ok"), (2200, "ok"), (2900, "ok"), (5300, "shift"), (5600, "exe")), 6500,+ presses((1500, "down")), 3500),# Play, the first level, the gas held a while; Home saves. Next time, from the copy, the map, then On/Off"motox3m": ("MotoX3M.nwa", "motox3m.sav",presses((1500, "ok"), (2200, "ok"), (3000, "up", 4000)), 9000,@@ -436,7 +441,8 @@ COPIES = {"championisland": "champion_saves.py", "numblocks": "numblocks_saves.p"clashroyale": "clashroyale_saves.py","catninja": "catninja_saves.py","kingdomrush": "kingdomrush_saves.py",- "mrbullet": "mrbullet_saves.py", "motox3m": "motox3m_saves.py", "amongus": "amongus_saves.py", "imposter": "imposter_saves.py"}+ "mrbullet": "mrbullet_saves.py", "motox3m": "motox3m_saves.py", "amongus": "amongus_saves.py", "imposter": "imposter_saves.py",+ "fourplayer": "fourplayer_saves.py"}def paperclips_ok(v):@@ -741,6 +747,8 @@ CHECKS = {"amongus": (lambda v: v[:4] == b"AUSG" and v[4] == 1,) * 2,# "IMPS", version 1: the players and the round; after the reinstall, from the copy, the same"imposter": (lambda v: v[:4] == b"IMPS" and v[4] == 1,) * 2,+ # "FOUR", version 1, its size (188): 4 players (5), Sumo (6), first to 3 (7); after the reinstall, from the copy+ "fourplayer": (lambda v: len(v) == 188 and v[:4] == b"FOUR" and v[4:8] == bytes([1, 2, 0, 3]),) * 2,"breakout": (lambda v: len(v) == 12 and v[:2] == b"B\2" and v[4] == 1 and struct.unpack_from("<I", v, 8)[0] >= 10,lambda v: v[4] == 0 and struct.unpack_from("<I", v, 8)[0] >= 1), # best kept, shake off# Air Hockey and the easy computer chosen; then the normal computer and Tanks, the tallies of the six games keptdiff --git a/tools/release.py b/tools/release.pyindex 613399a7..8c877fa2 100644--- a/tools/release.py+++ b/tools/release.py@@ -72,6 +72,7 @@ ALONE = {"motox3m": ("Moto X3M", "Madpuffers' stunt bike racing: all 50 levels, the flips, the stars and the six bikes, on the game's own physics"),"amongus": ("Among Us", "Innersloth's game on the Skeld against up to 9 bots: every task, sabotages, vents, kills, meetings and votes"),"imposter": ("Imposter", "the party game: pass the calculator, everyone sees the secret word but the imposter, 30 categories"),+ "fourplayer": ("2 3 4 Players", "one-key party games for 2, 3 or 4 players on one calculator, and teams: 14 minigames"),"numpico": ("NumPico", "PICO-8 carts on the calculator: add your own .p8 and .p8.png carts in NumPlay Studio"),}VARIANTS = [