Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

feat(pixel-draw): a sprite or icon keeps the engine's safe area - prepare's margin given in rows and columns, the feet on its bottom row, G8 fails a pixel on the canvas edge and warns a body past it or feet off the floor; tests drawn under the old full-canvas prompt move to answers recorded under this one

Soohong Kime641f4d931b3
diff --git a/sprite_gen/gen/pixel_draw.py b/sprite_gen/gen/pixel_draw.py
index 5101b65..fbc5de9 100644
--- a/sprite_gen/gen/pixel_draw.py
+++ b/sprite_gen/gen/pixel_draw.py
@@ -15,8 +15,10 @@ One run, `--candidates` K answers to the same request:
2. G1 parse. Row issues are repaired one row at a time (`ROW <frame> <n>: …`, two rounds at most);
an answer still broken, or broken beyond its rows, is drawn once more. A candidate is drawn at
most twice in all.
-3. G2 palette, G3 alpha and G6 frames fail a candidate; G4 tile seam, G5 stray pixels and the walk
- cycle's leg alternation warn.
+3. G2 palette, G3 alpha, G6 frames and G8 safe area (a pixel on the canvas edge) fail a candidate;
+ G4 tile seam, G5 stray pixels, the walk cycle's leg alternation and G8's body and floor checks
+ warn. The prompt gives a sprite or icon the engine's safe area (`safe_area_lines`) in rows and
+ columns.
4. G7: of two or more candidates that passed, one vision call (effort low) picks, or a person
does (`--pick human`). One that passed alone is the pick.
@@ -50,7 +52,7 @@ from . import anthropic_api as api
from . import refusal
from .anthropic_api import ApiError, Reply
from .base import announce_api_billing
-from .pixel_gates import evaluate
+from .pixel_gates import evaluate, safe_area
from .pixel_grid import (
FORMATS, Grid, Issue, PaletteRule, check_rows, frame_name_ok, frame_pixels, palette_rule, parse_answer,
parse_row_answers, png_bytes, preview_scale, preview_strip, read_grid_text, recovered, row_issues, row_text,
@@ -232,13 +234,42 @@ def _format_spec(request: PixelRequest) -> str:
f"- Frames: {names}.")
+def safe_area_lines(request: PixelRequest) -> list[str]:
+ """The engine's safe area of a sprite or icon (`pixel_gates.safe_area`, G8), in rows and columns
+ counted from 1: the body inside it, only a thin detail in the margin, the canvas edge clear, and a
+ sprite's feet on its bottom row."""
+ size = request.size
+ area = safe_area(size, size)
+ margin, inner, floor = area["margin"][0], area["size"][0], area["floor_row"] + 1
+ sprite = request.kind == "sprite"
+ if margin == 0:
+ lines = [f"Safe area: at {size}x{size} there is no margin; {'the subject' if sprite else 'the icon'} may use "
+ "the whole canvas, with the four corner pixels transparent."]
+ else:
+ first, last, reach = margin + 1, size - margin, margin - 1
+ edge = f"outermost rows and columns (rows 1 and {size}, columns 1 and {size})"
+ if reach:
+ past = (f"Only a thin detail (a weapon tip, a strand of hair, an effect) may reach into the margin, at "
+ f"most {reach} pixel{'s' if reach > 1 else ''} past the safe area; the {edge} stay transparent.")
+ else:
+ past = f"The {edge} are the margin and stay transparent: at this size nothing reaches past the safe area."
+ body = "the subject's body" if sprite else "the icon"
+ lines = [f"Safe area: keep a {margin}-pixel margin on every side and draw {body} inside the central "
+ f"{inner}x{inner} pixels: rows {first}-{last} and columns {first}-{last}, counting rows and columns "
+ f"from 1. {past}"]
+ if sprite:
+ every = " in every frame" if len(request.frames) > 1 else ""
+ lines.append(f"Floor: row {floor}, the bottom row of the safe area, is the ground. The feet (or the lowest point "
+ f"the subject rests on) stand on row {floor}{every}, and nothing of the body goes below it.")
+ return lines
+
+
def generation_prompt(request: PixelRequest) -> str:
frames = request.frames
lines = [f"Draw: {request.subject}", f"Canvas: exactly {request.size}x{request.size} pixels per frame."]
if len(frames) > 1:
- same = (f"Frames: {', '.join(frames)}. All frames share one palette and show the same subject with "
- "the same proportions, colors and size")
- lines.append(same + ("; the feet stand on the same bottom row in every frame." if request.kind == "sprite" else "."))
+ lines.append(f"Frames: {', '.join(frames)}. All frames share one palette and show the same subject with "
+ "the same proportions, colors and size.")
if request.walk_cycle:
a, b, c, d = frames
lines.append(f"The frames are one looping walk cycle: {a} = contact pose with the front leg forward, "
@@ -256,8 +287,8 @@ def generation_prompt(request: PixelRequest) -> str:
lines.append("Style: clean, readable pixel art for a 2D RPG: 2-3 shades per material, light from the "
"top-left, no noisy single-pixel speckle.")
else:
- lines.append("Background: transparent. The subject should fill most of the canvas, leaving at most a "
- "1-2 pixel margin.")
+ lines.append("Background: transparent.")
+ lines += safe_area_lines(request)
lines.append("Style: clean, readable pixel art for a 2D RPG: a dark (not pure black) outline around the "
"silhouette, 2-3 shades per material, light from the top-left, no anti-aliasing noise and "
"no stray single pixels.")
@@ -320,6 +351,15 @@ def repair_prompt(request: PixelRequest, grid: Grid, issues: list[Issue]) -> tup
return prompt, wanted
+def _kept(request: PixelRequest) -> str:
+ """The safe area in the pick's words, so a margin the prompt asked for is not read as wasted canvas."""
+ area = safe_area(request.size, request.size)
+ if request.kind == "tile" or area["margin"][0] == 0:
+ return ""
+ inner = area["size"][0]
+ return f", the body kept inside the central {inner}x{inner} with a {area['margin'][0]}-pixel margin"
+
+
def pick_prompt(request: PixelRequest, labels: list[str]) -> str:
multi = len(request.frames) > 1
lines = [
@@ -333,7 +373,7 @@ def pick_prompt(request: PixelRequest, labels: list[str]) -> str:
if multi:
lines.append(f"Each candidate is a row of {len(request.frames)} frames in this order: {', '.join(request.frames)}.")
lines += [
- f"The request was: {request.subject} Canvas {request.size}x{request.size} pixels per frame.",
+ f"The request was: {request.subject} Canvas {request.size}x{request.size} pixels per frame{_kept(request)}.",
"Score every candidate:",
"- subject_read 1-5: how clearly it reads as the requested subject (5 instantly, 1 unrecognisable).",
"- craft 1-5: pixel-art craft: clean silhouette and outline, consistent shading and light, no noise, sensible "
diff --git a/sprite_gen/gen/pixel_gates.py b/sprite_gen/gen/pixel_gates.py
index 2ae1900..7f0ec0d 100644
--- a/sprite_gen/gen/pixel_gates.py
+++ b/sprite_gen/gen/pixel_gates.py
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
-"""Gates G2..G6 of `pixel-draw`, on the pixels of a grid that passed G1 (it parsed whole).
+"""Gates G2..G6 and G8 of `pixel-draw`, on the pixels of a grid that passed G1 (it parsed whole).
- G2 palette: the opaque colours used are at most the rule's limit; a fixed palette allows only its
own colours.
@@ -13,6 +13,13 @@
no two frames are the same. A walk cycle (contact, passing, contact, passing) also warns when
its two contact frames differ by less than 40% of the mean contact↔passing difference: the legs
barely change sides.
+- G8 safe area, on a sprite or icon: the engine's safe area (`safe_area`, the margin `prepare`
+ keeps around every cell). A pixel on the canvas's outermost row or column fails — the margin
+ is room for a weapon tip, a strand of hair or an effect, never the canvas edge. It warns when
+ the body box — the rows and columns holding at least a quarter as many opaque pixels as the
+ fullest one, so a thin tip drops out of it — reaches more than a pixel past the safe area, and
+ when a sprite's bottom row (G6's) is not the floor row, the safe area's own bottom row, where
+ `prepare`'s fit grounds a frame. Below 11 px the margin is 0 and there is no edge to keep.
A failed gate fails the candidate; a warning is reported and passes.
"""
@@ -26,6 +33,8 @@ SEAM_RATIO_MAX = 1.5
BORDER_TRANSPARENT_MIN = 0.5
HEIGHT_SPREAD_MAX = 1
WALK_CONTACT_RATIO_MIN = 0.4
+BODY_LINE_SHARE = 0.25
+SAFE_OVERFLOW_MAX = 1
Frame = Sequence[Sequence[Pixel]]
@@ -143,9 +152,84 @@ def g6_frames(frames: dict[str, Frame], *, walk_cycle: bool) -> dict[str, Any]:
return result
+def safe_area(width: int, height: int) -> dict[str, Any]:
+ """The engine's safe area of a width x height canvas, as `prepare` keeps it around a cell
+ (`normalize_cell`: DEFAULT_SAFE_MARGIN_RATIO of each side, floored — 32 px keeps 3 and 26
+ inside). `box` is its first and last column and row, `floor_row` its bottom row."""
+ # Imported here: `prepare` owns the margin and pulls in the row machinery.
+ from .prepare import normalize_cell
+
+ cell = normalize_cell({"width": width, "height": height}, width, None)
+ mx, my = cell["safe_margin_x"], cell["safe_margin_y"]
+ return {"margin": [mx, my], "size": [width - 2 * mx, height - 2 * my],
+ "box": [mx, my, width - 1 - mx, height - 1 - my], "floor_row": height - 1 - my}
+
+
+def _body_lines(counts: list[int]) -> list[int]:
+ fullest = max(counts)
+ return [i for i, n in enumerate(counts) if n and n >= BODY_LINE_SHARE * fullest]
+
+
+def _frame_safe(frame: Frame, area: dict[str, Any]) -> dict[str, Any]:
+ height, width = len(frame), len(frame[0])
+ mx, my = area["margin"]
+ left, top, right, bottom = area["box"]
+ rows = [sum(1 for p in row if _opaque(p)) for row in frame]
+ columns = [sum(1 for y in range(height) if _opaque(frame[y][x])) for x in range(width)]
+ edge = {(x, y) for y in range(height) for x in range(width) if _opaque(frame[y][x])
+ and ((mx and x in (0, width - 1)) or (my and y in (0, height - 1)))}
+ if not any(rows):
+ return {"edge_pixels": 0, "bbox": None, "body_box": None, "overflow": None, "baseline": None}
+ used_rows = [y for y, n in enumerate(rows) if n]
+ used_columns = [x for x, n in enumerate(columns) if n]
+ body_rows, body_columns = _body_lines(rows), _body_lines(columns)
+ body = [body_columns[0], body_rows[0], body_columns[-1], body_rows[-1]]
+ return {
+ "edge_pixels": len(edge),
+ "bbox": [used_columns[0], used_rows[0], used_columns[-1], used_rows[-1]],
+ "body_box": body,
+ "overflow": {"left": max(0, left - body[0]), "top": max(0, top - body[1]),
+ "right": max(0, body[2] - right), "bottom": max(0, body[3] - bottom)},
+ "baseline": used_rows[-1],
+ }
+
+
+def g8_safe_area(frames: dict[str, Frame], kind: str) -> dict[str, Any]:
+ first = next(iter(frames.values()))
+ area = safe_area(len(first[0]), len(first))
+ per = {name: _frame_safe(frame, area) for name, frame in frames.items()}
+ edge = sum(m["edge_pixels"] for m in per.values())
+ body_overflow = {}
+ for name, m in per.items():
+ sides = {side: px for side, px in (m["overflow"] or {}).items() if px > SAFE_OVERFLOW_MAX}
+ if sides:
+ body_overflow[name] = sides
+ floor = area["floor_row"] if kind == "sprite" else None
+ off_floor = {name: m["baseline"] - floor for name, m in per.items()
+ if floor is not None and m["baseline"] is not None and m["baseline"] != floor}
+ return {"ok": edge == 0, "margin": area["margin"], "safe_area": area["size"], "safe_box": area["box"],
+ "floor_row": floor, "edge_pixels": edge, "overflow_max": SAFE_OVERFLOW_MAX,
+ "body_overflow": body_overflow, "off_floor": off_floor, "frames": per}
+
+
+def _g8_warnings(g8: dict[str, Any]) -> list[str]:
+ lines = []
+ if g8["body_overflow"]:
+ (width, height), (mx, my) = g8["safe_area"], g8["margin"]
+ where = "; ".join(f"{name}: " + ", ".join(f"{px} px {side}" for side, px in sides.items())
+ for name, sides in g8["body_overflow"].items())
+ margin = f"{mx}" if mx == my else f"{mx}x{my}"
+ lines.append(f"G8 the body reaches past the {width}x{height} safe area by more than {SAFE_OVERFLOW_MAX} px "
+ f"({where}) — only a thin detail may go into the {margin} px margin")
+ if g8["off_floor"]:
+ where = ", ".join(f"{name} {abs(d)} px {'below' if d > 0 else 'above'} it" for name, d in g8["off_floor"].items())
+ lines.append(f"G8 the feet are not on the floor row (the safe area's bottom row): {where}")
+ return lines
+
+
def evaluate(frames: dict[str, Frame], *, kind: str, rule: PaletteRule, walk_cycle: bool) -> dict[str, Any]:
- """Every gate of one candidate. `ok` is G2, G3 and G6 together; `warnings` say what G4, G5 and
- the walk check found, one line each."""
+ """Every gate of one candidate. `ok` is G2, G3, G6 and G8 together; `warnings` say what G4, G5,
+ the walk check and G8 found, one line each."""
gates: dict[str, Any] = {"G2": g2_palette(frames, rule), "G3": g3_alpha(frames, kind)}
warnings: list[str] = []
if kind == "tile":
@@ -164,5 +248,8 @@ def evaluate(frames: dict[str, Frame], *, kind: str, rule: PaletteRule, walk_cyc
warnings.append(f"G6 weak leg alternation: the contact frames differ by {walk['contact_difference']} "
f"pixels, {walk['ratio']:.0%} of the contact-passing difference (under "
f"{WALK_CONTACT_RATIO_MIN:.0%}) — touch up the legs")
- failed = [name for name in ("G2", "G3", "G6") if name in gates and not gates[name]["ok"]]
+ if kind != "tile":
+ gates["G8"] = g8_safe_area(frames, kind)
+ warnings += _g8_warnings(gates["G8"])
+ failed = [name for name in ("G2", "G3", "G6", "G8") if name in gates and not gates[name]["ok"]]
return {"ok": not failed, "failed": failed, "warnings": warnings, **gates}
diff --git a/tests/fixtures/pixel_draw/attack-32-safe-area-pass.txt b/tests/fixtures/pixel_draw/attack-32-safe-area-pass.txt
new file mode 100644
index 0000000..1ca7296
--- /dev/null
+++ b/tests/fixtures/pixel_draw/attack-32-safe-area-pass.txt
@@ -0,0 +1,151 @@
+```pixels
+PALETTE
+. transparent
+o #2a1e2e
+s #e4e8f0
+m #a0a8b8
+d #5e6678
+r #e04040
+R #902434
+p #f6c8a0
+P #c88a68
+b #3f6fd0
+B #26458e
+L #6f9cf0
+w #8c5a30
+W #5a361c
+y #e8c050
+FRAME attack1
+................................
+................................
+................................
+................................
+............ooo.................
+...........orrro................
+..........orrrRo................
+..........oooooooo..............
+..........ossmmmmdo.............
+..........osmmmmmmdo............
+..........osmdpppppo............
+..........osmdpopopo............
+..........osmdppppPo............
+..........ommdPpppo.............
+...........odddooo..............
+.......o..ommmmmdo..............
+...ooooyoooooommdo..............
+..ossssyppmmmmmmdo..............
+..ommmmyPpdddddddo..............
+...ooooyoooooooBBo..............
+.......o..owwwwyWo..............
+.........obbbbbbBBo.............
+.........oBBBBBBBBo.............
+.........omdoooomdo.............
+.........omdo..omdo.............
+.........owWo..owWo.............
+.........owWo..owWo.............
+.........owwWo.owwWo............
+.........ooooo.ooooo............
+................................
+................................
+................................
+FRAME attack2
+................................
+................................
+................................
+................................
+............ooo.................
+...........orrro................
+..........orrrRo................
+..........oooooooo..............
+..........ossmmmmdo.............
+..........osmmmmmmdo.....o......
+..........osmdpppppo....oso.....
+..........osmdpopopo...osmo.....
+..........osmdppppPo..osmo......
+..........ommdPpppo..osmo.......
+...........odddooo..osmo........
+..........ommmmoooooyyyo........
+..........oLbommmmmmppo.........
+..........oLboddddddPpo.........
+..........obboooooooooo.........
+..........obbbbBBo..............
+..........owwwwyWo..............
+.........obbbbbbBBo.............
+.........oBBBBBBBBo.............
+.........omdoooomdo.............
+.........omdo..omdo.............
+.........owWo..owWo.............
+.........owWo..owWo.............
+.........owwWo.owwWo............
+.........ooooo.ooooo............
+................................
+................................
+................................
+FRAME attack3
+................................
+................................
+................................
+................................
+............ooo.................
+...........orrro................
+..........orrrRo................
+..........oooooooo..............
+..........ossmmmmdo.............
+..........osmmmmmmdo............
+..........osmdpppppo............
+..........osmdpopopo............
+..........osmdppppPo............
+..........ommdPpppo.............
+...........odddooo....o.........
+..........ommmooooooooyoooooo...
+..........oLbommmmmmppysssssso..
+..........oLboddddddPpymmmmmmo..
+..........obboooooooooyoooooo...
+..........obbbbBBo....o.........
+..........owwwwyWo..............
+.........obbbbbbBBo.............
+.........oBBBBBBBBo.............
+.........omdoooomdo.............
+.........omdo..omdo.............
+.........owWo..owWo.............
+.........owWo..owWo.............
+.........owwWo.owwWo............
+.........ooooo.ooooo............
+................................
+................................
+................................
+FRAME attack4
+................................
+................................
+................................
+................................
+............ooo.................
+...........orrro................
+..........orrrRo................
+..........oooooooo..............
+..........ossmmmmdo.............
+..........osmmmmmmdo............
+..........osmdpppppo............
+..........osmdpopopo............
+..........osmdppppPo............
+..........ommdPpppo.............
+...........odddooo..............
+..........ommmmmdo..............
+..........oLbommdo..............
+..........oLbommdo.o............
+..........obbommdooyoooooo......
+..........obbommmppysssssso.....
+..........owwodddPpymmmmmmo.....
+.........obbbooooooyoooooo......
+.........oBBBBBBBBoo............
+.........omdoooomdo.............
+.........omdo..omdo.............
+.........owWo..owWo.............
+.........owWo..owWo.............
+.........owwWo.owwWo............
+.........ooooo.ooooo............
+................................
+................................
+................................
+END
+```
\ No newline at end of file
diff --git a/tests/fixtures/pixel_draw/sprite-16-safe-area-pass.txt b/tests/fixtures/pixel_draw/sprite-16-safe-area-pass.txt
new file mode 100644
index 0000000..c9cc7f6
--- /dev/null
+++ b/tests/fixtures/pixel_draw/sprite-16-safe-area-pass.txt
@@ -0,0 +1,37 @@
+```pixels
+PALETTE
+. transparent
+o #2a1f2e
+r #d03a34
+R #8a1e24
+s #d0d8e0
+S #8a96a4
+d #5a6470
+p #f4c49a
+P #d89a70
+b #4a7ad0
+B #2c4a94
+c #a0a4a8
+C #6c7078
+n #7a4a28
+N #4a2c1a
+y #e0c040
+FRAME sprite
+................
+......orRo......
+.....oorRoo.....
+....ossssSSo....
+....osSSSSdo....
+....osppppSo....
+....osopPoSo....
+....osppPPdo....
+...oSsbbbbSdo...
+...ocbbbbbBCo...
+...ocbbbbBBCo...
+...opnnynnnPo...
+....obbbBBBo....
+....onNoonNo....
+...onNNoonNNo...
+................
+END
+```
\ No newline at end of file
diff --git a/tests/fixtures/pixel_draw/walk-32-safe-area-pass.txt b/tests/fixtures/pixel_draw/walk-32-safe-area-pass.txt
new file mode 100644
index 0000000..2cfd152
--- /dev/null
+++ b/tests/fixtures/pixel_draw/walk-32-safe-area-pass.txt
@@ -0,0 +1,150 @@
+```pixels
+PALETTE
+. transparent
+o #2b1d2e
+s #dfe6ee
+m #9ca7b4
+d #5f6877
+r #e04848
+R #9a2433
+p #f4c9a0
+P #cf966c
+b #3f6fd0
+B #283f8a
+L #77a3ee
+n #8a5530
+N #573418
+FRAME walk1
+................................
+................................
+................................
+................................
+............oooo................
+...........orrrRo...............
+..........orrrRRo...............
+..........ooooooooo.............
+...........ossssmmmo............
+..........ossmmmddddo...........
+..........osmmdpopopo...........
+..........osmmdpppppo...........
+..........ommddPppppo...........
+...........odddPPPPo............
+...........ommmmdddo............
+..........oLbmmdbBBo............
+..........oLmmdbbBBo............
+..........omdbbbbBBo............
+.........opPbbbbbBBo............
+..........onnnnnnsNo............
+..........obbBbbBbBo............
+..........oooooooooo............
+...........oddommdo.............
+..........oddo.ommdo............
+.........oddo...ommdo...........
+........oNNo....onnNo...........
+.......onNNo....onnnNo..........
+.......onNNNo...onnnnNo.........
+.......oooooo...ooooooo.........
+................................
+................................
+................................
+FRAME walk2
+................................
+................................
+................................
+............oooo................
+...........orrrRo...............
+..........orrrRRo...............
+..........ooooooooo.............
+...........ossssmmmo............
+..........ossmmmddddo...........
+..........osmmdpopopo...........
+..........osmmdpppppo...........
+..........ommddPppppo...........
+...........odddPPPPo............
+...........ommmmdddo............
+..........oLbbmmdBBo............
+..........oLbbmmdBBo............
+..........obbbmdbBBo............
+..........obbbmdbBBo............
+..........onnnpPnsNo............
+..........obbBbbBbBo............
+..........oooooooooo............
+..........oddommdo..............
+..........oddommdo..............
+.........oddoommdo..............
+........oNNo.ommdo..............
+.......onNNo.onnNo..............
+.......onNNNoonnnNo.............
+.......oooooooonnnnNo...........
+.............ooooooo............
+................................
+................................
+................................
+FRAME walk3
+................................
+................................
+................................
+................................
+............oooo................
+...........orrrRo...............
+..........orrrRRo...............
+..........ooooooooo.............
+...........ossssmmmo............
+..........ossmmmddddo...........
+..........osmmdpopopo...........
+..........osmmdpppppo...........
+..........ommddPppppo...........
+...........odddPPPPo............
+...........ommmmdddo............
+..........oLbbbmmdBo............
+..........oLbbbbmmdo............
+..........obbbbbbmdo............
+..........obbbbbbBppo...........
+..........onnnnnnsNo............
+..........obbBbbBbBo............
+..........oooooooooo............
+...........ommodddo.............
+..........ommo.odddo............
+.........ommo...odddo...........
+........onNo....oNNNo...........
+.......onnNo....onNNNo..........
+.......onnnNo...onNNNNo.........
+.......oooooo...ooooooo.........
+................................
+................................
+................................
+FRAME walk4
+................................
+................................
+................................
+............oooo................
+...........orrrRo...............
+..........orrrRRo...............
+..........ooooooooo.............
+...........ossssmmmo............
+..........ossmmmddddo...........
+..........osmmdpopopo...........
+..........osmmdpppppo...........
+..........ommddPppppo...........
+...........odddPPPPo............
+...........ommmmdddo............
+..........oLbbmmdBBo............
+..........oLbbmmdBBo............
+..........obbbmdbBBo............
+..........obbbmdbBBo............
+..........onnnpPnsNo............
+..........obbBbbBbBo............
+..........oooooooooo............
+..........ommodddo..............
+..........ommodddo..............
+.........ommoodddo..............
+........onNo.odddo..............
+.......onnNo.oNNNo..............
+.......onnNNoonNNNo.............
+.......oooooooonNNNNo...........
+.............ooooooo............
+................................
+................................
+................................
+END
+```
\ No newline at end of file
diff --git a/tests/gen/test_pixel_draw.py b/tests/gen/test_pixel_draw.py
index f02d1d2..52d02cd 100644
--- a/tests/gen/test_pixel_draw.py
+++ b/tests/gen/test_pixel_draw.py
@@ -29,13 +29,14 @@ def fixture(name: str) -> str:
return (FIXTURES / name).read_text(encoding="utf-8")
-SPRITE16 = fixture("sprite-16-pass.txt")
+SPRITE16 = fixture("sprite-16-safe-area-pass.txt") # one frame, `sprite`, inside the 14x14 safe area
+FULL16 = fixture("sprite-16-pass.txt") # drawn when the prompt asked to fill the canvas: rows 1 and 16 used
ICON32 = fixture("icon-32-pass.txt")
ICON_ROW = fixture("icon-32-row-width.txt")
ICON_ROW_FIX = fixture("icon-32-row-width.repair.txt")
TILE_CUT = fixture("tile-32-truncated.txt")
TILE_CUT_FIX = fixture("tile-32-truncated.repair.txt")
-WALK16 = fixture("walk-16-pass.txt")
+WALK32 = fixture("walk-32-safe-area-pass.txt")
FOURDIR16 = fixture("fourdir-16-pass.txt")
VERDICT = fixture("pick-verdict.json") # best: "A"
@@ -120,16 +121,16 @@ def asked(fake: FakeClaude) -> list[str]:
def test_one_candidate_is_drawn_checked_and_written(tmp_path, claude, capsys):
fake = claude({"c1-gen1": reply(SPRITE16, output=2515, thinking=2300)})
out = tmp_path / "run"
- assert draw(out, "--subject", "a knight", "--size", "16", "--frames", "front", "--candidates", "1") == 0
+ assert draw(out, "--subject", "a knight", "--size", "16", "--candidates", "1") == 0
report = report_of(out)
captured = capsys.readouterr()
assert json.loads(captured.out) == report
assert "[gen] claude: running on ANTHROPIC_API_KEY — this is a per-call API charge" in captured.err
assert report["status"] == "ok" and report["chosen"] == "c1" and report["pick"] == {"by": "only", "best": "c1"}
assert sorted(p.name for p in out.iterdir()) == sorted([
- "report.json", "request.json", "calls", "candidates", "grid.txt", "palette.json", "frame-front.png",
+ "report.json", "request.json", "calls", "candidates", "grid.txt", "palette.json", "frame-sprite.png",
"preview-x16.png"])
- assert report["files"] == {"grid": "grid.txt", "palette": "palette.json", "frames": {"front": "frame-front.png"},
+ assert report["files"] == {"grid": "grid.txt", "palette": "palette.json", "frames": {"sprite": "frame-sprite.png"},
"preview": "preview-x16.png"}
(call,) = report["calls"]
assert {k: call[k] for k in ("id", "purpose", "candidate", "outcome", "mode", "model", "effort", "max_tokens",
@@ -143,17 +144,18 @@ def test_one_candidate_is_drawn_checked_and_written(tmp_path, claude, capsys):
(candidate,) = report["candidates"]
assert candidate["status"] == "passed" and candidate["G1"] == {"ok": True, "issues": [], "recovered": []}
assert candidate["gates"]["ok"] and candidate["files"]["grid"] == "candidates/c1/grid.txt"
- grid, _ = pg.parse_answer(SPRITE16, "chargrid", 16, 16, ("front",))
+ assert candidate["gates"]["G8"]["ok"] and candidate["warnings"] == []
+ grid, _ = pg.parse_answer(SPRITE16, "chargrid", 16, 16, ("sprite",))
assert (out / "grid.txt").read_text(encoding="utf-8") == pg.to_text(grid)
- assert (out / "frame-front.png").read_bytes() == pg.png_bytes(pg.frame_pixels(grid, "front"))
- assert (out / "frame-front.png").read_bytes() == (out / "candidates" / "c1" / "frame-front.png").read_bytes()
+ assert (out / "frame-sprite.png").read_bytes() == pg.png_bytes(pg.frame_pixels(grid, "sprite"))
+ assert (out / "frame-sprite.png").read_bytes() == (out / "candidates" / "c1" / "frame-sprite.png").read_bytes()
record = json.loads((out / "calls" / "c1-gen1.json").read_text(encoding="utf-8"))
assert record["reply"]["text"] == SPRITE16 and record["prompt"].startswith("Draw: a knight\nCanvas: exactly 16x16")
body = fake.asked[0][1]
assert body["model"] == "claude-opus-5-5" and body["system"] == pixel_draw.SYSTEM
assert body["thinking"] == {"type": "adaptive", "display": "summarized"} and body["output_config"] == {"effort": "high"}
request = json.loads((out / "request.json").read_text(encoding="utf-8"))
- assert request["palette"] == {"name": "free:16", "limit": 16, "colors": []} and request["frames"] == ["front"]
+ assert request["palette"] == {"name": "free:16", "limit": 16, "colors": []} and request["frames"] == ["sprite"]
def test_a_broken_row_is_asked_for_alone_and_spliced(tmp_path, claude):
@@ -221,8 +223,7 @@ def test_a_structural_failure_is_drawn_again_without_repair_and_a_second_one_end
def test_no_answer_at_max_tokens_is_drawn_once_more_one_effort_lower(tmp_path, claude, capsys):
fake = claude({"c1-gen1": reply("", stop="max_tokens", output=32000, thinking=32000), "c1-gen2": reply(SPRITE16)})
out = tmp_path / "run"
- assert draw(out, "--subject", "a knight", "--size", "16", "--frames", "front", "--candidates", "1",
- "--effort", "xhigh") == 0
+ assert draw(out, "--subject", "a knight", "--size", "16", "--candidates", "1", "--effort", "xhigh") == 0
assert [body["output_config"]["effort"] for _, body in fake.asked] == ["xhigh", "high"]
report = report_of(out)
(candidate,) = report["candidates"]
@@ -233,17 +234,17 @@ def test_no_answer_at_max_tokens_is_drawn_once_more_one_effort_lower(tmp_path, c
def test_an_answer_cut_off_at_max_tokens_keeps_its_rows_and_is_repaired(tmp_path, claude):
- rows = SPRITE16.split("FRAME front\n")[1].split("\nEND")[0].splitlines()
- cut = SPRITE16[:SPRITE16.index("FRAME front\n")] + "FRAME front\n" + "\n".join(rows[:10])
- fix = "\n".join(f"ROW front {n}: {rows[n - 1]}" for n in range(11, 17))
+ rows = SPRITE16.split("FRAME sprite\n")[1].split("\nEND")[0].splitlines()
+ cut = SPRITE16[:SPRITE16.index("FRAME sprite\n")] + "FRAME sprite\n" + "\n".join(rows[:10])
+ fix = "\n".join(f"ROW sprite {n}: {rows[n - 1]}" for n in range(11, 17))
fake = claude({"c1-gen1": reply(cut, stop="max_tokens", output=32000, thinking=31000), "c1-gen1-fix1": reply(fix)})
out = tmp_path / "run"
- assert draw(out, "--subject", "a knight", "--size", "16", "--frames", "front", "--candidates", "1") == 0
+ assert draw(out, "--subject", "a knight", "--size", "16", "--candidates", "1") == 0
assert asked(fake) == ["c1-gen1", "c1-gen1-fix1"]
(candidate,) = report_of(out)["candidates"]
- assert candidate["redraws"] == [] and candidate["repairs"][0]["rows_asked"] == [f"front {n}" for n in range(11, 17)]
+ assert candidate["redraws"] == [] and candidate["repairs"][0]["rows_asked"] == [f"sprite {n}" for n in range(11, 17)]
assert [r["code"] for r in candidate["G1"]["recovered"]] == ["block_unclosed", "no_end"]
- grid, _ = pg.parse_answer(SPRITE16, "chargrid", 16, 16, ("front",))
+ grid, _ = pg.parse_answer(SPRITE16, "chargrid", 16, 16, ("sprite",))
assert (out / "grid.txt").read_text(encoding="utf-8") == pg.to_text(grid)
@@ -290,10 +291,10 @@ def test_a_failed_call_is_not_asked_again(tmp_path, claude):
def test_the_vision_pick_chooses_between_two_that_passed(tmp_path, claude):
- variant = SPRITE16.replace("r #d84040", "r #c03030")
+ variant = SPRITE16.replace("r #d03a34", "r #c03030")
fake = claude({"c1-gen1": reply(SPRITE16), "c2-gen1": reply(variant), "pick": reply(VERDICT, output=300, thinking=90)})
out = tmp_path / "run"
- assert draw(out, "--subject", "a knight", "--size", "16", "--frames", "front") == 0
+ assert draw(out, "--subject", "a knight", "--size", "16") == 0
report = report_of(out)
pick = report["pick"]
assert pick["by"] == "vision" and sorted(pick["labels"]) == ["A", "B"] and sorted(pick["labels"].values()) == ["c1", "c2"]
@@ -307,14 +308,14 @@ def test_the_vision_pick_chooses_between_two_that_passed(tmp_path, claude):
assert "system" not in body
chosen = out / "candidates" / report["chosen"]
assert (out / "grid.txt").read_bytes() == (chosen / "grid.txt").read_bytes()
- assert (out / "frame-front.png").read_bytes() == (chosen / "frame-front.png").read_bytes()
+ assert (out / "frame-sprite.png").read_bytes() == (chosen / "frame-sprite.png").read_bytes()
assert [c["id"] for c in report["calls"]] == ["c1-gen1", "c2-gen1", "pick"]
def test_a_person_picks_when_asked(tmp_path, claude):
- fake = claude({"c1-gen1": reply(SPRITE16), "c2-gen1": reply(SPRITE16.replace("r #d84040", "r #c03030"))})
+ fake = claude({"c1-gen1": reply(SPRITE16), "c2-gen1": reply(SPRITE16.replace("r #d03a34", "r #c03030"))})
out = tmp_path / "run"
- assert draw(out, "--subject", "a knight", "--size", "16", "--frames", "front", "--pick", "human") == 0
+ assert draw(out, "--subject", "a knight", "--size", "16", "--pick", "human") == 0
report = report_of(out)
assert report["pick"] == {"by": "human", "best": None, "candidates": ["c1", "c2"]}
assert report["status"] == "ok" and report["chosen"] is None and not (out / "grid.txt").exists()
@@ -324,18 +325,18 @@ def test_a_person_picks_when_asked(tmp_path, claude):
def test_a_pick_that_names_no_candidate_fails_the_run(tmp_path, claude):
verdict = json.loads(VERDICT)
verdict["best"] = "Z"
- claude({"c1-gen1": reply(SPRITE16), "c2-gen1": reply(SPRITE16.replace("r #d84040", "r #c03030")),
+ claude({"c1-gen1": reply(SPRITE16), "c2-gen1": reply(SPRITE16.replace("r #d03a34", "r #c03030")),
"pick": reply(json.dumps(verdict))})
out = tmp_path / "run"
with pytest.raises(SystemExit, match=r"2 candidates passed but the pick failed \(the pick named 'Z', not one of A, B\)"):
- draw(out, "--subject", "a knight", "--size", "16", "--frames", "front")
+ draw(out, "--subject", "a knight", "--size", "16")
assert report_of(out)["status"] == "pick_failed" and not (out / "grid.txt").exists()
def test_one_that_passed_alone_is_the_pick(tmp_path, claude):
fake = claude({"c1-gen1": reply(SPRITE16), "c2-gen1": reply(""), "c2-gen2": reply("")})
out = tmp_path / "run"
- assert draw(out, "--subject", "a knight", "--size", "16", "--frames", "front") == 0
+ assert draw(out, "--subject", "a knight", "--size", "16") == 0
report = report_of(out)
assert report["pick"] == {"by": "only", "best": "c1"} and "pick" not in asked(fake)
assert [c["status"] for c in report["candidates"]] == ["passed", "failed"]
@@ -364,8 +365,7 @@ def test_a_batch_cut_short_is_collected_on_resume_and_not_bought_twice(tmp_path,
claude(script, polls={"msgbatch_1": ["in_progress"]})
out = tmp_path / "run"
with pytest.raises(SystemExit) as caught:
- draw(out, "--subject", "a knight", "--size", "16", "--frames", "front", "--candidates", "1", "--batch",
- "--batch-wait", "0")
+ draw(out, "--subject", "a knight", "--size", "16", "--candidates", "1", "--batch", "--batch-wait", "0")
message = str(caught.value)
assert "batch msgbatch_1 has not ended after 0s; nothing is asked twice" in message
assert f"`sprite-gen pixel-draw --out-dir {out.resolve()} --resume`" in message
@@ -394,7 +394,7 @@ def test_resume_reads_answered_calls_back(tmp_path, claude):
def test_resume_takes_the_request_from_the_run(tmp_path, claude):
claude({"c1-gen1": reply(SPRITE16)})
out = tmp_path / "run"
- assert draw(out, "--subject", "a knight", "--size", "16", "--frames", "front", "--candidates", "1") == 0
+ assert draw(out, "--subject", "a knight", "--size", "16", "--candidates", "1") == 0
with pytest.raises(SystemExit, match=r"--resume reads the request from .*request.json; drop --size"):
pixel_draw.main(["--out-dir", str(out), "--resume", "--size", "16"])
request = json.loads((out / "request.json").read_text(encoding="utf-8"))
@@ -467,10 +467,10 @@ def test_a_json_answer_is_kept_as_a_chargrid(tmp_path, claude):
def test_a_walk_cycle_is_one_call_of_four_frames(tmp_path, claude):
- fake = claude({"c1-gen1": reply(WALK16)})
+ fake = claude({"c1-gen1": reply(WALK32)})
out = tmp_path / "run"
- assert draw(out, "--subject", "a knight walking right", "--size", "16", "--frames", "walk1,walk2,walk3,walk4",
- "--walk-cycle", "--candidates", "1") == 0
+ assert draw(out, "--subject", "a knight walking right", "--frames", "walk1,walk2,walk3,walk4", "--walk-cycle",
+ "--candidates", "1") == 0
body = fake.asked[0][1]
assert body["max_tokens"] == 64000
assert ("The frames are one looping walk cycle: walk1 = contact pose with the front leg forward"
@@ -480,8 +480,8 @@ def test_a_walk_cycle_is_one_call_of_four_frames(tmp_path, claude):
assert report["files"]["gif"] == "anim.gif"
with Image.open(out / "anim.gif") as gif:
assert gif.n_frames == 4
- with Image.open(out / "preview-x16.png") as preview:
- assert preview.size == (4 * 256 + 3 * 32, 256)
+ with Image.open(out / "preview-x8.png") as preview:
+ assert preview.size == (4 * 256 + 3 * 16, 256)
def test_prompts_say_the_kind_and_the_format():
@@ -495,28 +495,30 @@ def test_prompts_say_the_kind_and_the_format():
assert "Palette: at most 8 colors plus transparent." in tile and "Background: transparent" not in tile
assert "```pixels\nPALETTE\n. transparent" in tile and "exactly 32 lines of exactly 32 characters" in tile
sprite = pixel_draw.generation_prompt(request(kind="sprite", frames=("down", "up"), subject="a knight"))
- assert "the feet stand on the same bottom row in every frame." in sprite and "Background: transparent." in sprite
+ assert "stand on row 29 in every frame, and nothing of the body goes below it." in sprite
+ assert "Background: transparent." in sprite
assert "Frames in this order: down, up." in sprite
def test_an_edited_grid_is_checked_and_rendered_without_a_call(tmp_path, claude, monkeypatch):
claude({"c1-gen1": reply(SPRITE16)})
first = tmp_path / "first"
- assert draw(first, "--subject", "a knight", "--size", "16", "--frames", "front", "--candidates", "1") == 0
+ assert draw(first, "--subject", "a knight", "--size", "16", "--candidates", "1") == 0
monkeypatch.delenv("ANTHROPIC_API_KEY")
edited = tmp_path / "edited.txt"
edited.write_text((first / "grid.txt").read_text(encoding="utf-8").replace(
- "FRAME front\n......oooo......", "FRAME front\n......oooo....o."), encoding="utf-8")
+ "FRAME sprite\n................\n......orRo......", "FRAME sprite\n................\n......orRo...o.."),
+ encoding="utf-8") # a speck beside the plume, inside the safe area
second = tmp_path / "second"
assert pixel_draw.main(["--grid", str(edited), "--out-dir", str(second)]) == 0
report = report_of(second)
assert report["source"] == "grid" and report["calls"] == [] and report["cost_usd"] == 0.0
assert report["status"] == "ok" and report["warnings"] == ["G5 1 stray pixel(s) with no opaque neighbour"]
grid, issues = pg.read_grid_text(edited.read_text(encoding="utf-8"))
- assert (second / "frame-front.png").read_bytes() == pg.png_bytes(pg.frame_pixels(grid, "front"))
+ assert (second / "frame-sprite.png").read_bytes() == pg.png_bytes(pg.frame_pixels(grid, "sprite"))
broken = tmp_path / "broken.txt"
- broken.write_text(edited.read_text(encoding="utf-8").replace("......oooo....o.\n", "......oooo....o\n"), encoding="utf-8")
- with pytest.raises(SystemExit, match=r"does not parse whole: row_width front row 1"):
+ broken.write_text(edited.read_text(encoding="utf-8").replace("......orRo...o..\n", "......orRo...o.\n"), encoding="utf-8")
+ with pytest.raises(SystemExit, match=r"does not parse whole: row_width sprite row 2"):
pixel_draw.main(["--grid", str(broken), "--out-dir", str(tmp_path / "third")])
with pytest.raises(SystemExit, match=r"--grid checks and renders a grid as it is; drop --candidates"):
pixel_draw.main(["--grid", str(edited), "--out-dir", str(tmp_path / "fourth"), "--candidates", "2"])
@@ -593,7 +595,7 @@ def test_the_pick_knows_the_margin_is_meant():
def test_an_edited_grid_goes_through_the_safe_area_gate(tmp_path):
- grid, _ = pg.parse_answer(SPRITE16, "chargrid", 16, 16, ("front",))
+ grid, _ = pg.parse_answer(FULL16, "chargrid", 16, 16, ("front",))
full = tmp_path / "full.txt"
full.write_text(pg.to_text(grid), encoding="utf-8") # drawn under the old prompt: rows 1 and 16 are used
with pytest.raises(SystemExit, match=r"full.txt fails G8"):
diff --git a/tests/gen/test_pixel_gates.py b/tests/gen/test_pixel_gates.py
index ddd151e..cc4dd0a 100644
--- a/tests/gen/test_pixel_gates.py
+++ b/tests/gen/test_pixel_gates.py
@@ -1,6 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
-"""Gates G2..G6 of `pixel-draw` on recorded answers (tests/fixtures/pixel_draw) and on grids made
-to break exactly one rule. G2, G3 and G6 fail a candidate; G4, G5 and the walk check only warn."""
+"""Gates G2..G6 and G8 of `pixel-draw` on recorded answers (tests/fixtures/pixel_draw) and on grids
+made to break exactly one rule. G2, G3, G6 and G8's canvas edge fail a candidate; G4, G5, the walk
+check and G8's body and floor checks only warn. The `*-safe-area-pass` answers were drawn under the
+safe-area prompt; the other recorded sprites when the prompt asked to fill the canvas."""
from __future__ import annotations
from pathlib import Path
@@ -32,11 +34,13 @@ def blob(size: int = 8, top: int = 2, bottom: int = 5, fill=INK):
def test_recorded_sprite_passes_every_gate():
- gates = evaluate(frames_of("sprite-16-pass.txt", 16, ("front",)), kind="sprite", rule=FREE16, walk_cycle=False)
+ gates = evaluate(frames_of("sprite-16-safe-area-pass.txt", 16, ("sprite",)), kind="sprite", rule=FREE16,
+ walk_cycle=False)
assert gates["ok"] and gates["failed"] == [] and gates["warnings"] == []
assert gates["G2"]["colors_used"] <= 16
- assert gates["G3"]["frames"]["front"]["corners_transparent"]
+ assert gates["G3"]["frames"]["sprite"]["corners_transparent"]
assert gates["G5"]["isolated_pixels"] == 0 and "G6" not in gates and "G4" not in gates
+ assert gates["G8"]["frames"]["sprite"]["bbox"] == [3, 1, 12, 14] and gates["G8"]["floor_row"] == 14
def test_recorded_tile_is_opaque_and_repeats():
@@ -46,14 +50,14 @@ def test_recorded_tile_is_opaque_and_repeats():
def test_g2_counts_colours_against_the_limit_and_the_fixed_set():
- frames = frames_of("sprite-16-pass.txt", 16, ("front",))
+ frames = frames_of("sprite-16-safe-area-pass.txt", 16, ("sprite",))
used = evaluate(frames, kind="sprite", rule=FREE16, walk_cycle=False)["G2"]["colors_used"]
few = evaluate(frames, kind="sprite", rule=pg.palette_rule("free:4"), walk_cycle=False)
assert not few["ok"] and few["failed"] == ["G2"] and few["G2"]["colors_used"] == used
pico = evaluate(frames, kind="sprite", rule=pg.palette_rule("pico8"), walk_cycle=False)
assert not pico["ok"] and pico["G2"]["off_palette"]
exact = pg.palette_rule(",".join(sorted({"#{:02X}{:02X}{:02X}".format(*p[:3])
- for row in frames["front"] for p in row if p[3]})))
+ for row in frames["sprite"] for p in row if p[3]})))
assert evaluate(frames, kind="sprite", rule=exact, walk_cycle=False)["G2"]["ok"]
@@ -81,23 +85,25 @@ def test_g5_stray_pixels_only_warn():
frame = blob()
frame[7][7] = CLEAR
frame[0][4] = INK # a speck above the block, touching nothing
- gates = evaluate({"f": frame}, kind="sprite", rule=FREE16, walk_cycle=False)
+ gates = evaluate({"f": frame}, kind="icon", rule=FREE16, walk_cycle=False) # an icon has no floor row
assert gates["G5"]["isolated_pixels"] == 1 and gates["ok"]
assert gates["warnings"] == ["G5 1 stray pixel(s) with no opaque neighbour"]
def test_recorded_four_directions_stand_on_one_line():
gates = evaluate(frames_of("fourdir-16-pass.txt", 16, FOURDIR), kind="sprite", rule=FREE16, walk_cycle=False)
- assert gates["ok"] and gates["G6"]["ok"] and gates["G6"]["identical_pairs"] == []
+ assert gates["G6"]["ok"] and gates["G6"]["identical_pairs"] == []
assert len(set(gates["G6"]["baselines"].values())) == 1 and "walk" not in gates["G6"]
+ assert gates["failed"] == ["G8"] # drawn to fill the canvas: the plumes on row 1, the boots on row 16
def test_recorded_walk_passes_with_the_weak_leg_warning():
- gates = evaluate(frames_of("walk-16-pass.txt", 16, WALK), kind="sprite", rule=FREE16, walk_cycle=True)
+ gates = evaluate(frames_of("walk-32-safe-area-pass.txt", 32, WALK), kind="sprite", rule=FREE16, walk_cycle=True)
g6 = gates["G6"]
assert gates["ok"] and g6["ok"] and g6["height_spread"] == 1 # the passing pose is a pixel higher
assert g6["walk"]["warn"] and g6["walk"]["ratio"] < 0.4
- assert any(w.startswith("G6 weak leg alternation") for w in gates["warnings"])
+ assert [w[:30] for w in gates["warnings"]] == ["G6 weak leg alternation: the c"]
+ assert set(g6["baselines"].values()) == {gates["G8"]["floor_row"]} == {28} # row 29 of 32, counted from 1
def test_g6_failures():
@@ -213,6 +219,15 @@ def test_g8_leaves_tiles_alone():
assert gates["ok"] and "G8" not in gates
+def test_a_recorded_blade_reaches_into_the_margin_and_the_body_stays_inside():
+ frames = frames_of("attack-32-safe-area-pass.txt", 32, ("attack1", "attack2", "attack3", "attack4"))
+ gates = evaluate(frames, kind="sprite", rule=FREE16, walk_cycle=False)
+ measures = gates["G8"]["frames"]
+ assert gates["ok"] and gates["warnings"] == []
+ assert measures["attack1"]["bbox"][0] == 2 and measures["attack3"]["bbox"][2] == 29 # the blade, 1 px past it
+ assert all(3 <= m["body_box"][0] and m["body_box"][2] <= 28 and m["baseline"] == 28 for m in measures.values())
+
+
def test_recorded_answers_from_the_full_canvas_prompt_fail_g8():
"""Drawn when the prompt asked to fill the canvas: the knight's helmet is on row 1 and its boots
on row 16, the 16 px canvas's own edge rows."""
diff --git a/tests/gen/test_pixel_grid.py b/tests/gen/test_pixel_grid.py
index 987c0f2..2340a8d 100644
--- a/tests/gen/test_pixel_grid.py
+++ b/tests/gen/test_pixel_grid.py
@@ -39,6 +39,9 @@ PASSING = [
("walk-16-pass.txt", "chargrid", 16, WALK),
("fourdir-16-pass.txt", "chargrid", 16, FOURDIR),
("icon-16-json-pass.txt", "json", 16, ("icon",)),
+ ("sprite-16-safe-area-pass.txt", "chargrid", 16, ("sprite",)),
+ ("walk-32-safe-area-pass.txt", "chargrid", 32, WALK),
+ ("attack-32-safe-area-pass.txt", "chargrid", 32, ("attack1", "attack2", "attack3", "attack4")),
]