Skip to main content

gridgames

Grid games for experiments. A game is two plain-text files, a rules file and a level file. gridgames plays it in PsychoPy, for example in an MEG session.

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.

In PsychoPy, two tools from gridgames.psychopy go into your own frame loop: GameView(win).draw(game) draws a game, and KeyReader(kb, keys) turns key presses into actions (.action() at each game step: the press since the last step, else the held key, else none). When the game steps, what a win or loss does and which triggers to send are your script's own code. The package has no hardware code.

License

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

Metadata

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

Download URL gridgames-0.3.0-cp38-abi3-win_amd64.whl
Size 267.2 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
54364fd99dee2d5263a9724bbd3f6cb4a9a0019332b8ef30ab497942d8848ac6
BLAKE2b-256 checksum
How to use checksums
426973eb4cc8def8e165d61100581f10da67220cea40e4131a85247378fba7af
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.3.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL gridgames-0.3.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 420.1 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
2bdd525d0337f99b359bf73f059e7994a8d7e524fc769831d783c1a8128fee13
BLAKE2b-256 checksum
How to use checksums
e4851e2d005fbb436133da1a9578b4f9af1ede09c52a25e7b2c68861ce9aae63
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.3.0-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Download URL gridgames-0.3.0-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
Size 735.7 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
72ceb5a9ba4ed9a889046f5bfc725e632981b85e8302d3e6ae249f9973089dd2
BLAKE2b-256 checksum
How to use checksums
f55429fd1bfc1b54795b08695c0231d435dc26685b731a99e5035f0e2047caf7
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.3.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.3.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