KAZIK/tools/tests/check_card_table_frames.py
Artvasil09 3ad5bf4c9d Develop assembly-only casino scenes and native games
Add native Durak, poker, blackjack, roulette, Buckshot and billiards scenes with animation assets and regression tests. Improve arrival, city, hall, profiles, shops, audio and exit handling; remove the portable C game core and refresh shipping executables.
2026-10-08 22:39:19 +03:00

34 lines
1.4 KiB
Python

"""Visual evidence from the actual MASM framebuffer, not a simulation."""
import hashlib
import json
from pathlib import Path
from PIL import Image, ImageDraw, ImageStat
def main():
root = Path(__file__).resolve().parents[2]
output = root / "build/actions"
names = ["poker-deal", "poker-flop", "poker-turn", "poker-reveal", "poker-result",
"blackjack-deal", "blackjack-hit", "blackjack-result"]
sheet = Image.new("RGB", (1280, 8 // 2 * 510), "#131c1e")
draw = ImageDraw.Draw(sheet)
hashes = []
for index, name in enumerate(names):
frame = Image.open(output / f"{name}.bmp").convert("RGB")
assert frame.size == (640, 480)
assert len(frame.getcolors(640 * 480)) > 500, f"Missing table artwork: {name}"
assert sum(ImageStat.Stat(frame).mean) > 30, f"Blank scene: {name}"
assert sum(ImageStat.Stat(frame.crop((0, 444, 640, 476))).stddev) > 10, name
hashes.append(hashlib.sha256(frame.tobytes()).hexdigest())
x, y = (index % 2) * 640, (index // 2) * 510
sheet.paste(frame, (x, y))
draw.text((x + 12, y + 488), f"Native MASM / {name}", fill="#f0e5c7")
frame.save(output / f"{name}.png")
assert len(set(hashes)) == len(names), "Repeated/stuck render states"
sheet.save(output / "card-tables-contact-sheet.png")
print(json.dumps({"result": "PASS", "native_snapshots": len(names)}))
if __name__ == "__main__":
main()