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.0

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.0
File Interpreter ABI Platform Actions
gridgames-0.5.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for gridgames-0.5.0-cp38-abi3-win_amd64.whl
gridgames-0.5.0-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.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
gridgames-0.5.0-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64 Details for gridgames-0.5.0-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Total release size: 1.6 MB

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

Download URL gridgames-0.5.0-cp38-abi3-win_amd64.whl
Size 322.1 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
dce8f2c5e174d0ffa77eb9938415b0f8adc47cba56ee465cc6d0ca13a586082e
BLAKE2b-256 checksum
How to use checksums
a9ecc1e4733d98116e70da5ce1a9c7d7b9990b3038313fea38971ac159ffffd3
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.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL gridgames-0.5.0-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
19667052341a04b33b98333f4948e4f25672508d54f96bce1acf77c63c5b416a
BLAKE2b-256 checksum
How to use checksums
b51d19c5ef4a59427fe6f9aada42dce9aa31cf19ae37c9011b94aeaa57750213
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.0-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Download URL gridgames-0.5.0-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
Size 845.1 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
14b7be9bf04c7a794a935bb6c198d1d0e0023e0bb852a33fc3beaf5f4c585c95
BLAKE2b-256 checksum
How to use checksums
dc11261d856406a911eef0cdab240139f141bf97918f212aecb553919073281f
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.0

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.0-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