Skip to main content

Gym Sapientino environment using Pygame.

Project description


PyPI PyPI - Python Version PyPI - Status PyPI - Implementation PyPI - Wheel GitHub

test lint docs codecov


OpenAI Gym Sapientino environment using Pygame.


The environment is inspired by a game for kids called Sapientino.

A robot moves on a gridworld-like environment, where each cell can be coloured. When a robot is on a coloured cell, it can run a beep, meaning it has visited the cell.

The environment is compliant with the OpenAI Gym APIs. The idea is that the designer of the experiment should implement the actual reward by wrapping the environment.


The environment is implemented using Pygame.

On Ubuntu, you need the following libraries:

sudo apt-get install python3-dev \
    libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev \
    libsdl1.2-dev  libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev

On MacOS (not tested):

brew install sdl sdl_ttf sdl_image sdl_mixer portmidi  # brew or use equivalent means
conda install -c pygame  # using Anaconda


Install with pip:

pip install gym_sapientino

Or, install from source:

git clone
cd gym-sapientino
pip install .


  • clone the repo:
git clone
cd gym-sapientino
  • Create/activate the virtual environment:
poetry shell --python=python3.7
  • Install development dependencies:
poetry install


To run tests: tox

To run only the code tests: tox -e py3.7

To run only the linters:

  • tox -e flake8
  • tox -e mypy
  • tox -e black-check
  • tox -e isort-check

Please look at the tox.ini file for the full list of supported commands.


To build the docs: mkdocs build

To view documentation in a browser: mkdocs serve and then go to http://localhost:8000


gym-sapientino is released under the GNU General Public License v3.0 or later (GPLv3+).

Copyright 2019-2020 Marco Favorito, Luca Iocchi



The code is largely inspired by RLGames

If you want to use this environment in your research, please consider citing this conference paper:

  title={Foundations for Restraining Bolts: Reinforcement Learning with LTLf/LDLf Restraining Specifications},
  author={Giuseppe De Giacomo and L. Iocchi and Marco Favorito and F. Patrizi},

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gym_sapientino-0.2.0.tar.gz (26.4 kB view hashes)

Uploaded Source

Built Distribution

gym_sapientino-0.2.0-py3-none-any.whl (35.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page