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.

Metadata

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

Total release size: 1.4 MB

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

Download URL gridgames-0.4.0-cp38-abi3-win_amd64.whl
Size 265.0 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
16f57b2cdaa1c83056dc864a2040400850bc853900cc4b3ecb4f829675b70d2c
BLAKE2b-256 checksum
How to use checksums
eff08d53df29c829736f27d13bc138372eedd09751432b577e10b56e341447df
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 9, 2026.

Transparency log

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

Download URL gridgames-0.4.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 417.9 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
5bee9fce9d131d837aace6f0d93948ba993c9a4c45386b148c1394a3ef9de86d
BLAKE2b-256 checksum
How to use checksums
efc8a9a4fe374801601c5c1cb1d62fb418a2242d3add46e0f4437628b6b6ab7c
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 9, 2026.

Transparency log

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

Download URL gridgames-0.4.0-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
Size 734.0 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
6637550975decf58870602518f4d243336505b5797c926af6593e623a88b3f4e
BLAKE2b-256 checksum
How to use checksums
3158afee3316d76a2df76ac448169ece61650a3d6bcadb311dc13ab8451c125b
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 9, 2026.

Transparency log

Security for gridgames 0.4.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.4.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 9, 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