Skip to main content

gridgames

Grid games for experiments. A game is two plain-text files, a rules file and a level file. gridgames loads it, steps it and gives its picture; showing it (in PsychoPy, a browser, ...) is your program's part.

Install

Install into the Python that PsychoPy uses:

  • in PsychoPy: Tools → Plugins/Packages manager → Packages, search gridgames, Install;
  • or in a terminal: <PsychoPy's python> -m pip install gridgames (on Windows usually "C:\Program Files\PsychoPy\python.exe").

One wheel per platform (Windows, macOS, Linux) works on every Python from 3.8 on. No compiler is needed, and the only dependency is numpy.

gridgames has no built-in games: every game is loaded from its files. Example games to try or copy are a separate, optional package:

pip install gridgames-examples        # or: pip install "gridgames[examples]"
python -m gridgames_examples copy zelda_vgfmri4 games
python -m gridgames play games/zelda_vgfmri4      # arrows, space; Esc quits

Use

from gridgames import vgdl

game = vgdl.load("games/mygame", level=2, seed=1)    # a game folder
maze = vgdl.rules("rules/maze.vgdl")                 # or rules and levels
game = maze.load("levels/hard.txt")                  # from different places
game.step("up")            # up, down, left, right, use, none
game.image(cell=8)         # numpy array (H, W, 3), uint8
game.score, game.outcome   # outcome: "win", "lose" or None

A game folder contains mygame.vgdl (the rules), mygame_lvl0.txt, mygame_lvl1.txt, ... (the levels), and optionally mygame.skin (the colours). The levels next to the rules are numbered; any other level file can be loaded with the same rules. python -m gridgames check games/mygame lists each mistake with its file and line.

gridgames has no screen, keyboard or experiment code. In PsychoPy, show game.image() (pass it as a PIL image, Image.fromarray(pixels, "RGB"), to keep its exact colours) in an ImageStim with interpolate=False, and step the game 15 times a second. python -m gridgames play (needs PsychoPy) is a window to try a game.

License

MIT. The example games in gridgames-examples carry their own notices.

Puzzles

A puzzle (ARC-style) is a hidden rule, examples of it, and questions about it: one text file, mirror.arc. Nobody writes the rule down; the file holds grids (digits are ARC's ten colours) and the right answers:

example
    100
    120
    ->
    001
    021

judge follows
    300
    ->
    003

judge breaks
    300
    ->
    300
from gridgames import arc

puzzle = arc.load("puzzles/mirror.arc")
puzzle.actions                  # ("continue",), then ("follows", "breaks")
puzzle.step("continue")         # returns what happened
for panel in puzzle.screen(aspect=16 / 9).panels:   # the grids, and where they go
    panel.image(cell=12)        # numpy array (H, W, 3), uint8
python -m gridgames check puzzles                # every .arc file in the folder
python -m gridgames play puzzles                 # space, then number keys; Esc quits
python -m gridgames convert task.json puzzles    # ARC's JSON -> .arc

Metadata

Release files for gridgames 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for gridgames 0.5.1
File Interpreter ABI Platform Actions
gridgames-0.5.1-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for gridgames-0.5.1-cp38-abi3-win_amd64.whl
gridgames-0.5.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for gridgames-0.5.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
gridgames-0.5.1-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64 Details for gridgames-0.5.1-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Total release size: 1.7 MB

Release files / gridgames-0.5.1-cp38-abi3-win_amd64.whl

Download URL gridgames-0.5.1-cp38-abi3-win_amd64.whl
Size 323.5 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
44ef3b59d2efa3107360d0fc78d0847689bf83416836370125bcf68375917b87
BLAKE2b-256 checksum
How to use checksums
748d04db0be87012a80623252d924f888d158a4adb4213a31f0a7cd0b896e506
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / gridgames-0.5.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL gridgames-0.5.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 482.0 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
3077980345d0ad24ad28b2d70afb5adce6393322606e69f6cbbd9d1d4d51b50b
BLAKE2b-256 checksum
How to use checksums
d89b4a200e5f5154af4227ba7e8efdfbda700c8344d135037ede754969de88e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / gridgames-0.5.1-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Download URL gridgames-0.5.1-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
Size 845.3 kB
Tags CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
32b9195dfec479c05c4a2e2f26f9231a839bc75bb92d65a4c807b2d414473a29
BLAKE2b-256 checksum
How to use checksums
66ade3ca8d2d444965369fe2b0f9801f5f1e37cc5b003a590c0af0a35c141b89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for gridgames 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for gridgames-0.5.1-cp38-abi3-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page