Skip to main content

rgkit – Testing kit for Robot game

This is the code from https://github.com/RobotGame/rgkit with minor changes to work in Python 3.

Installing as a package

pip

The easiest way to install the kit is with pip. From the terminal, run:

pip install rgkit-py3

Or if you want the development version:

pip install git+https://github.com/saavedra29/rgkit_py3.git

Note: This will install rgkit system-wide. It is recommended to use virtualenv to manage development environments.

virtualenv

Installing with virtualenv requires the following steps:

mkdir my_robot
cd my_robot
virtualenv env
source env/bin/activate
pip install rgkit-py3

setup.py

You can also manually install directly from the source folder. Make a local copy of the git repository or download the source files. Then, using the terminal, run the following from the root directory of the source code:

python setup.py install

Note: This will install rgkit system-wide. It is recommended to use virtualenv to manage development environments.

Running the game

After installing the package, the script is executable from the command line (if you’re using virtualenv, remember to activate the environment). There are two entry points provided: rgrun and rgmap. The general usage of run is:

usage: rgrun [-h] [-m MAP] [-c COUNT] [-A] [-q] [-H | -T | -C]
             [--game-seed GAME_SEED]
             [--match-seeds [MATCH_SEEDS [MATCH_SEEDS ...]]] [-r]
             player1 player2

Robot game execution script.

positional arguments:
  player1               File containing first robot class definition.
  player2               File containing second robot class definition.

optional arguments:
  -h, --help            show this help message and exit
  -m MAP, --map MAP     User-specified map file.
  -c COUNT, --count COUNT
                        Game count, default: 1, multithreading if >1
  -A, --animate         Enable animations in rendering.
  -q, --quiet           Quiet execution.
                        -q : suppresses bot stdout
                        -qq: suppresses bot stdout and stderr
                        -qqq: supresses all rgkit and bot output
  -H, --headless        Disable rendering game output.
  -T, --play-in-thread  Separate GUI thread from robot move calculations.
  -C, --curses          Display game in command line using curses.
  --game-seed GAME_SEED
                        Appended with game countfor per-match seeds.
  --match-seeds [MATCH_SEEDS [MATCH_SEEDS ...]]
                        Used for random seed of the first matches in order.
  -r, --random          Bots spawn randomly instead of symmetrically.

So, from a directory containing your_robot.py, you can run a game against the default robot and suppress GUI output with the following command:

rgrun -H your_robot.py defaultrobots.py

Developing with source

rgkit_py3 is packaged as a module, but you can just checkout the repository and import/run the source scripts.

./rgkit
|--- rgkit
|    |--- __init__.py
|    |--- game.py
|    |--- run.py
|    |--- ...
|    |--- your_robot.py
|--- setup.py
...
/path/your_other_robot.py

Running the game

To run the game with the source configured this way, use the terminal and execute the following from the inner rgkit folder (i.e., in the same directory as run.py):

python run.py your_robot.py /path/your_other_robot.py

Coding your own robots

Once installed, you should only need the rg module to develop your own robots. The package can be imported like any other module:

import rg

class Robot:
    def act(self):
        return ['guard']

Other Tools

Here are some excellent tools made by fellow players! (working with python2 for now)

Metadata

Release files for rgkit-py3 1.2.0

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

Source distribution (sdist)

Source distribution for rgkit-py3 1.2.0
File Size Uploaded Provenance Actions
rgkit_py3-1.2.0.tar.gz 34.1 kB Without provenance Details for rgkit_py3-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rgkit-py3 1.2.0
File Interpreter ABI Platform Actions
rgkit_py3-1.2.0-py3-none-any.whl Python 3 none any Details for rgkit_py3-1.2.0-py3-none-any.whl

Total release size: 75.2 kB

Release files / rgkit_py3-1.2.0.tar.gz

Download URL rgkit_py3-1.2.0.tar.gz
Size 34.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9933e34886c85a9393f3701017e56a2484289556d0403920894ec52efb755b08
BLAKE2b-256 checksum
How to use checksums
6c66388bb81d394849900c30a20d50d77ef6f7184bfc2cc42b1a2f05a39f09ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / rgkit_py3-1.2.0-py3-none-any.whl

Download URL rgkit_py3-1.2.0-py3-none-any.whl
Size 41.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccd9076aa98e4d6d9cff86135645922e4e7032095bdae149265ab69c616594b3
BLAKE2b-256 checksum
How to use checksums
2a2316cfea0a671278ced33dc945268fa19c8314e91a2e8249f1f3b2162adb3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for rgkit-py3 1.2.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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