mctspy : python implementation of Monte Carlo Tree Search algorithm
Basic python implementation of Monte Carlo Tree Search (MCTS) intended to run on small game trees.
Installation
pip3 install mctspy
Running tic-tac-toe example
to run tic-tac-toe example:
import numpy as np
from mctspy.tree.nodes import TwoPlayersGameMonteCarloTreeSearchNode
from mctspy.tree.search import MonteCarloTreeSearch
from mctspy.games.examples.tictactoe import TicTacToeGameState
state = np.zeros((3,3))
initial_board_state = TicTacToeGameState(state = state, next_to_move=1)
root = TwoPlayersGameMonteCarloTreeSearchNode(state = initial_board_state)
mcts = MonteCarloTreeSearch(root)
best_node = mcts.best_action(10000)
Running MCTS for your own 2 players zero-sum game
If you want to apply MCTS for your own game, its state implementation should derive from
mmctspy.games.common.TwoPlayersGameState
(lookup mctspy.games.examples.tictactoe.TicTacToeGameState for inspiration)
Metadata
Release files for mctspy 0.1.1
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 | Actions |
|---|---|---|---|---|
| mctspy-0.1.1.tar.gz | 4.1 kB | Without provenance | Details for mctspy-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mctspy-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for mctspy-0.1.1-py3-none-any.whl |
Total release size: 10.4 kB
Release files / mctspy-0.1.1.tar.gz
| Download URL | mctspy-0.1.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52d16193bdadeaca144bf28047367c13e8940a45d758a3a9c96c78d3b7226dfa
|
|
BLAKE2b-256 checksum How to use checksums |
b348cefb7f055e308c9ce63dbe079c23d6195be3040d42c3596ee515d66b02b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7
|
Release files / mctspy-0.1.1-py3-none-any.whl
| Download URL | mctspy-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc7a87aa7654971ede89b63a58d2ed3171a498937d38bd7b53b79f4dea880354
|
|
BLAKE2b-256 checksum How to use checksums |
9325fb9812b54a0c7c6db86fa4ca89d1eb0db9f30d7242832bdb91dde950d818
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7
|
Security for mctspy 0.1.1
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.