Skip to content

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

NumPico: icon, README, pictures, how to play, test

Mason363776644a6c084
diff --git a/LICENSES/MIT-femto8.txt b/LICENSES/MIT-femto8.txt
new file mode 100644
index 00000000..a30963ea
--- /dev/null
+++ b/LICENSES/MIT-femto8.txt
@@ -0,0 +1,7 @@
+Copyright 2023 Ben Baker
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/docs/media/gallery/numpico.gif b/docs/media/gallery/numpico.gif
new file mode 100644
index 00000000..2d6e1c83
Binary files /dev/null and b/docs/media/gallery/numpico.gif differ
diff --git a/docs/media/thumb_numpico.png b/docs/media/thumb_numpico.png
new file mode 100644
index 00000000..8c39fcc1
Binary files /dev/null and b/docs/media/thumb_numpico.png differ
diff --git a/docs/play.md b/docs/play.md
index 94e668fa..5acad2fb 100644
--- a/docs/play.md
+++ b/docs/play.md
@@ -864,6 +864,22 @@ Shoot every spy in the level. Bullets bounce off walls, so aim at a wall to reac
<br clear="right">
+## NumPico
+
+<img src="../games/numpico/docs/shot.png" width="320" align="right" alt="NumPico playing Combo Pool">
+
+| Key | What it does |
+| --- | --- |
+| **Arrows** or **8 4 6 2** | The D-pad |
+| **OK** or **EXE** | 🅾️ |
+| **Back** or **Ans** | ❎ |
+| **⌫** (backspace) | Pause menu (Continue, the cart's items, Reset cart, Quit) |
+| **Home** | Quit |
+
+NumPico plays PICO-8 carts. Drop your .p8 and .p8.png carts on NumPlay Studio and they come in your NumPlay with it. Pick a cart in the list and press OK. Each cart plays as on PICO-8, with the keys written at the left of the picture. A cart too big for the calculator's memory says so.
+
+<br clear="right">
+
## Portal Returns
<img src="media/portal.gif" width="320" align="right" alt="Portal Returns: falling through a portal and flying across a test chamber">
diff --git a/games/numpico/README.md b/games/numpico/README.md
new file mode 100644
index 00000000..552cf30e
--- /dev/null
+++ b/games/numpico/README.md
@@ -0,0 +1,76 @@
+> **NumPico is a [NumPlay](../../README.md) app that comes on its own.** Add your carts in [NumPlay Studio](https://mason363.github.io/NumPlay/customize/): it puts NumPico and the carts inside your NumPlay.
+
+<p align="center">
+ <img src="src/icon.png" width="84" alt="NumPico icon">
+</p>
+
+<h1 align="center">NumPico</h1>
+
+<p align="center">
+ <b>PICO-8 carts on the NumWorks calculator.</b><br>
+ Drop your .p8 and .p8.png carts on NumPlay Studio and play them with the keypad.
+</p>
+
+<p align="center">
+ <a href="https://mason363.github.io/NumPlay/customize/"><b>Add carts in NumPlay Studio</b></a>
+ &nbsp;·&nbsp; <a href="#controls">Controls</a>
+</p>
+
+<p align="center">
+ <img src="../../docs/media/gallery/numpico.gif" width="640" alt="Combo Pool: balls roll and bounce on a tiled table">
+</p>
+
+## Highlights
+
+* **PICO-8's Lua and its whole API:** drawing, sprites, the map, text with P8SCII, memory, `peek` and `poke`, `menuitem`, coroutines, fixed point numbers, from femto8.
+* **Your carts:** .p8 and .p8.png, packed or not. Several carts show in a list with their labels. Carts that load another cart (`load`) find it when you add it too.
+* **Full speed:** 30 and 60 frames a second at the cart's own pace. When the calculator can't keep up, a picture is skipped now and then, as PICO-8 does.
+* **The picture:** 128 by 128 pixels drawn on 240 by 240, with the keys written beside it.
+* **PICO-8's pause menu:** Continue, the cart's own items, Reset cart and Quit.
+* **Saves:** `cartdata` is kept on the calculator.
+
+<table>
+ <tr>
+ <td align="center"><img src="docs/shot.png" width="390" alt="Combo Pool on the calculator, the keys at the left"><br><sub>Combo Pool</sub></td>
+ <td align="center"><img src="docs/menu.png" width="390" alt="PICO-8's pause menu over Combo Pool"><br><sub>The pause menu</sub></td>
+ </tr>
+</table>
+
+## How to play
+
+Open [NumPlay Studio](https://mason363.github.io/NumPlay/customize/), drop your carts on **Your own PICO-8 carts** and install. NumPico appears in NumPlay with your carts. Only add carts you made or that their authors share.
+
+## Controls
+
+| Key | What it does |
+| --- | --- |
+| Arrows, or 8 4 6 2 | The D-pad |
+| OK, EXE | 🅾️ |
+| Back, Ans | ❎ |
+| ⌫ (backspace) | The pause menu |
+| Home | Quit |
+
+## Good to know
+
+* **Memory:** PICO-8 gives a cart 2 MB, the calculator about 110 KB. Most small and mid-sized carts fit; the biggest ones say they need more memory than the calculator has.
+* PICO-8's memory goes up to 0x7fff. The extra 32 KB above it isn't there.
+* No sound: the calculator has no speaker.
+* An error shows the line where its function starts.
+* `cstore` saves nothing: the carts are in the calculator's flash.
+
+## Credits
+
+[PICO-8](https://www.lexaloffle.com/pico-8.php) is Lexaloffle's fantasy console. NumPico runs carts made for it and is not affiliated with Lexaloffle.
+
+- **[femto8](https://github.com/benbaker76/femto8)** by Ben Baker and its contributors (MIT License, [LICENSE](src/femto8/LICENSE)) is NumPico's PICO-8: its API and its Lua.
+- Its Lua is **z8lua** by Sam Hocevar ([zepto8](https://github.com/samhocevar/zepto8), WTFPL), PICO-8's flavour of **Lua 5.2** by Lua.org, PUC-Rio (MIT License).
+- The packed code of .p8.png carts is unpacked with **Lexaloffle's own algorithms** (pxa, MIT License; the first format, zlib License).
+- The pictures show **[Combo Pool](https://www.lexaloffle.com/bbs/?pid=combopool-0)** by NuSan (CC4-BY-NC-SA), which isn't in NumPico.
+
+Made by Mason Chen as part of NumPlay.
+
+Build: `make CARTS="a.p8 b.p8.png"` makes `output/numpico.nwa` with those carts in it, and `make test` checks the carts on your computer (see `tests/`).
+
+## License
+
+NumPico is GPL-3.0, like NumPlay. femto8 and the Lua in `src/femto8/` keep their own licenses.
diff --git a/games/numpico/docs/menu.png b/games/numpico/docs/menu.png
new file mode 100644
index 00000000..f2c7b84c
Binary files /dev/null and b/games/numpico/docs/menu.png differ
diff --git a/games/numpico/docs/shot.png b/games/numpico/docs/shot.png
new file mode 100644
index 00000000..527de1d8
Binary files /dev/null and b/games/numpico/docs/shot.png differ
diff --git a/games/numpico/src/icon.png b/games/numpico/src/icon.png
index 2238e7d8..104aac90 100644
Binary files a/games/numpico/src/icon.png and b/games/numpico/src/icon.png differ
diff --git a/games/numpico/src/main.c b/games/numpico/src/main.c
index 5ec2ce77..7b18d3b2 100644
--- a/games/numpico/src/main.c
+++ b/games/numpico/src/main.c
@@ -184,7 +184,7 @@ static void panel_scene(void *ctx) {
{"arrows", "\x8b\x91\x94\x83"}, {"ok, exe", "\x8e"}, {"back, ans", "\x97"}, {"backspace", "menu"}, {"home", "quit"}};
int y = 40;
for (int i = 0; i < 5; i++) {
- ptext(4, y, hints[i][0], DARK, 2);
+ ptext(4, y, hints[i][0], pico_rgb565[13], 2);
ptext(4, y + 14, hints[i][1], WHITE, 2);
y += 34;
}
diff --git a/games/numpico/tools/icon.py b/games/numpico/tools/icon.py
new file mode 100644
index 00000000..f2546cb5
--- /dev/null
+++ b/games/numpico/tools/icon.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+"""Draws NumPico's icon (src/icon.png, 55 x 56): a cart on PICO-8's dark blue, its label a little scene in PICO-8's
+colours. Drawn 4 times bigger, then made smaller."""
+import os
+from PIL import Image, ImageDraw
+
+S = 4
+W, H = 55 * S, 56 * S
+NAVY, GREY, DARK, WHITE = (29, 43, 83), (194, 195, 199), (95, 87, 79), (255, 241, 232)
+SKY, GRASS, SUN, PINK, RED = (41, 173, 255), (0, 228, 54), (255, 236, 39), (255, 119, 168), (255, 0, 77)
+
+
+def main():
+ im = Image.new("RGB", (W, H), (255, 255, 255))
+ d = ImageDraw.Draw(im)
+ d.rounded_rectangle((0, 0, W - 1, H - 1), radius=12 * S, fill=NAVY)
+ # the cart: its body, the notch at the top right, the ridges at the bottom
+ x0, y0, x1, y1 = 13 * S, 7 * S, 42 * S, 50 * S
+ d.rounded_rectangle((x0, y0, x1, y1), radius=3 * S, fill=GREY)
+ d.polygon([(x1 - 7 * S, y0), (x1 + 1, y0), (x1 + 1, y0 + 7 * S)], fill=NAVY)
+ for k in range(3):
+ y = y1 - (4 + 3 * k) * S
+ d.rectangle((x0 + 5 * S, y, x1 - 5 * S, y + S - 1), fill=DARK)
+ # the label: 10 x 10 pixels of 2: the sky, the sun, a hill, a pink figure
+ lx, ly, px = x0 + 4 * S, y0 + 5 * S, 2 * S
+ d.rectangle((lx - S, ly - S, lx + 10 * px + S - 1, ly + 10 * px + S - 1), fill=WHITE)
+ scene = ["SSSSSSSSSS",
+ "SSSSSSSYYS",
+ "SSSSSSSYYS",
+ "SSSSSSSSSS",
+ "SSSPPSSSSS",
+ "SSSPPSSSSS",
+ "SSRRRRSSSS",
+ "SSSPSPSSSG",
+ "GGGGGGGGGG",
+ "GGGGGGGGGG"]
+ colors = {"S": SKY, "Y": SUN, "P": PINK, "R": RED, "G": GRASS}
+ for r, row in enumerate(scene):
+ for c, ch in enumerate(row):
+ d.rectangle((lx + c * px, ly + r * px, lx + (c + 1) * px - 1, ly + (r + 1) * px - 1), fill=colors[ch])
+ out = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "src", "icon.png")
+ im.resize((55, 56), Image.LANCZOS).save(out)
+ print("ICON ", out)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tests/test_games.py b/tests/test_games.py
index 25b760f2..10a6ea77 100644
--- a/tests/test_games.py
+++ b/tests/test_games.py
@@ -350,6 +350,9 @@ GAMES = {
"mrbullet": ("MrBullet.nwa", "mrbullet.sav",
presses((1500, "ok"), (2200, "ok"), (2900, "ok"), (3600, "ok"), (4300, "ok")), 7500,
presses((1500, "ok"), (2200, "ok"), (2900, "ok")), 4500),
+ # no carts in its table (NumPlay Studio adds them): the screen that says so; keys do nothing, Home leaves
+ "numpico": ("NumPico.nwa", None, presses((1500, "ok"), (2000, "back"), (2500, "backspace")), 3500,
+ presses((1500, "ok")), 2500),
}