boardgame2
boardgame2 is an extension of OpenAI Gym that implements multiple two-player zero-sum 2-dimension board games, such as TicTacToe, Gomuko, and Reversi.
Environments
Reversi-v0KInARow-v0, as well asGomuku-v0andTicTacToe-v0Go-v0(Experimental, not fully implemented)
Install
pip install --upgrade boardgame2
We support Windows, macOS, Linux, and other operating systems.
Usage
See API docs for all classes and functions.
Create a Game
import gym
import boardgame2
env = gym.make('TicTacToe-v0') # 3x3, 3-in-a-row
env = gym.make('Gomuku-v0') # 15x15, 5-in-a-row
env = gym.make('KInARow-v0', board_shape=5, target_length=4) # 5x5, 4-in-a-row
env = gym.make('KInARow-v0', board_shape=(3, 5), target_length=4) # 3x5, 4-in-a-row
env = gym.make('Reversi-v0') # 8x8
env = gym.make('Reversi-v0', board_shape=6) # 6x6
env = gym.make('Go-v0') # 19x19
env = gym.make('Go-v0', board_shape=15) # 15x15
Play a Game
import gym
import boardgame2
env = gym.make('TicTacToe-v0')
print('observation space = {}'.format(env.observation_space))
print('action space = {}'.format(env.action_space))
observation, info = env.reset()
while True:
action = env.action_space.sample()
observation, reward, terminated, truncated, info = env.step(action)
if terminated or truncated:
break
env.close()
BibTeX
This package has been published in the following book:
@book{xiao2019,
title = {Reinforcement Learning: Theory and {Python} Implementation},
author = {Zhiqing Xiao}
year = 2019,
month = 8,
publisher = {China Machine Press},
}
Metadata
Release files for boardgame2 0.26.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| boardgame2-0.26.0.tar.gz | 7.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| boardgame2-0.26.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.7 kB
Release files / boardgame2-0.26.0.tar.gz
| Download URL | boardgame2-0.26.0.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc2547308405348e646616c9ccbb1e5f2e91affc1f36a8a3fbc459037c447f17
|
|
BLAKE2b-256 checksum How to use checksums |
48ceb24e264564b54d16285e351319179c16033d5c019e894785df658b6360e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Release files / boardgame2-0.26.0-py3-none-any.whl
| Download URL | boardgame2-0.26.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3d594e071c81c07eabf3a0a9445fdfbbd19ae3d25cdd8c210cd503393804173
|
|
BLAKE2b-256 checksum How to use checksums |
56af0aeb59877823277d1f32fa9897b68ea6b71b786359892a3066f474dba598
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Security for boardgame2 0.26.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.