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.

Cookie Clicker: the save script says the empty-looking line is the save

Mason363718de9c8de24
diff --git a/games/cookieclicker/src/save.c b/games/cookieclicker/src/save.c
index 20b322cb..baf2cae7 100644
--- a/games/cookieclicker/src/save.c
+++ b/games/cookieclicker/src/save.c
@@ -9,10 +9,13 @@
#define COPY_NAME "cookieclicker_saves.py"
#define MAGIC 0x314B4343u /* "CCK1" */
+/* (the line is about 4000 characters: the Python editor doesn't draw a line that long, so the script looks empty
+ * there, and the head says so) */
static const char copy_head[] =
- "# Cookie Clicker keeps a copy of your bakery here, so that\n"
- "# reinstalling it doesn't erase it. If you delete this file,\n"
- "# the game writes it again: your bakery stays.\n";
+ "# Cookie Clicker's save: the long line below is a copy of\n"
+ "# your bakery. It is too long for the editor to show, so\n"
+ "# the script looks empty there. Installing the game again\n"
+ "# brings your bakery back from it.\n";
static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static void copy_write(void) {
diff --git a/games/cookieclicker/tests/check.py b/games/cookieclicker/tests/check.py
index 6d5a89f5..07036047 100644
--- a/games/cookieclicker/tests/check.py
+++ b/games/cookieclicker/tests/check.py
@@ -78,9 +78,20 @@ try:
for f in os.listdir(kept):
if not f.endswith(".py"):
os.remove(os.path.join(kept, f))
+ copy = open(os.path.join(kept, "cookieclicker_saves.py"), "rb").read()
s = play(kept, presses(10, "ok", 2) + ",60:home", 100, "from the copy")
if s:
check(s["clicks"] == 22 and s["buildings"] == 1, f"the copy did not bring the bakery back: {s}")
+ # a copy written by 1.16.0 and before (another head over the same line) too
+ old = tempfile.mkdtemp(prefix="cc_old_")
+ line = copy[copy.index(b"#>cookieclicker.sav:"):]
+ open(os.path.join(old, "cookieclicker_saves.py"), "wb").write(
+ b"\0# Cookie Clicker keeps a copy of your bakery here, so that\n# reinstalling it doesn't erase it. If you "
+ b"delete this file,\n# the game writes it again: your bakery stays.\n" + line)
+ s = play(old, presses(10, "ok", 2) + ",60:home", 100, "from an old copy")
+ if s:
+ check(s["clicks"] == 22 and s["buildings"] == 1, f"an old copy did not bring the bakery back: {s}")
+ shutil.rmtree(old, ignore_errors=True)
# every screen: the store (arrows, bulk, sell), the menu and its pages, statistics' tabs, the rows
keys = ",".join([