Multi-Agent Reinforcement Learning Environment for the board game Gobblet using PettingZoo.
Project description
gobblet-rl
Multi-Agent Reinforcement Learning Environment for the Gobblet board game board game using PettingZoo.
Installation
Using pip (recommended)
pip install gobblet-rl
Local
git clone hhttps://github.com/elliottower/gobblet-rl.git
cd gobblet-rl
pip install -e .
Usage
Setting up a basic environment
In a Python shell, run the following:
import pettingzoo
from gobblet gobblet_v0
-rl
env = gobblet_v0.env()
Train a basic agent with Tianshou
In the terminal, run the following:
python gobblet/example_tianshou.py
This will train a DQN model from Tianshou for 50 epochs, and then render the trained agent playing against a random agent in an example match.
Playing a game with a random agent
In the terminal, run the following:
python gobblet/example_random.py --render_mode="human" --agent_type="random"
Command-line arguments
--render_mode="human"
will render a 3x3 board only showing the topmost pieces (pieces which are covered by others, or 'gobbled', are hidden):
AGENT: player_1, ACTION: 50, POSITION: 5, PIECE: 6
| |
- | - | -
_______|_______|_______
| |
- | - | -
_______|_______|_______
| |
+5 | -6 | -
| |
--render_mode="human_full"
will render three different 3x3 boards representing the small, medium and large pieces. This gives full information about pieces which are covered or 'gobbled' by other pieces. :
AGENT: player_0, ACTION: 42, POSITION: 6, PIECE: 5
SMALL MED LARGE
| | | | | |
- | - | - - | - | - - | - | +5
_______|_______|_______ _______|_______|_______ _______|_______|_______
| | | | | |
- | - | -2 - | - | - - | - | -
_______|_______|_______ _______|_______|_______ _______|_______|_______
| | | | | |
- | - | - - | - | - - | - | -6
| | | | | |
Testing
Testing can be done via pytest:
git clone https://github.com/elliottower/gobblet-rl.git
cd gobblet-rl
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gobblet-rl-0.0.1.tar.gz
.
File metadata
- Download URL: gobblet-rl-0.0.1.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e98f5909c554dd459e78e6e5c9294cdc3bdfe29b0765270a71a315abfbe6373 |
|
MD5 | 939c5cf8136d4e14879bd28fa292a248 |
|
BLAKE2b-256 | 7bbe8ed791b22e8585336a52319b861cdb7901441f6c4c3656eb457337e4488e |
File details
Details for the file gobblet_rl-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: gobblet_rl-0.0.1-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fcb8dd5514f144062fc2e818c04ddcfb7542f16900712a765bded8e92f5ea51 |
|
MD5 | 241177a76a3b200d34de77ad33bb3e3e |
|
BLAKE2b-256 | f3efc5b7271cb951763ed557b16b301c96b3ecb100d4a308201d727ed28e3dc9 |