## mctspy : python implementation of Monte Carlo Tree Search algorithm
Basic python implementation of [Monte Carlo Tree Search](https://int8.io/monte-carlo-tree-search-beginners-guide) (MCTS) intended to run on small game trees.
### Installation
```
pip3 install mctspy
```
### Running tic-tac-toe example
to run tic-tac-toe example:
```python
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)
Raw data
{
"_id": null,
"home_page": "https://github.com/int8/monte-carlo-tree-search",
"name": "mctspy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5.7",
"maintainer_email": "",
"keywords": "mcts monte carlo tree search",
"author": "Kamil Czarnog\u00f3rski",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/b3/48/cefb7f055e308c9ce63dbe079c23d6195be3040d42c3596ee515d66b02b6/mctspy-0.1.1.tar.gz",
"platform": "",
"description": "## mctspy : python implementation of Monte Carlo Tree Search algorithm\n\n\nBasic python implementation of [Monte Carlo Tree Search](https://int8.io/monte-carlo-tree-search-beginners-guide) (MCTS) intended to run on small game trees. \n\n\n### Installation\n\n```\npip3 install mctspy\n``` \n\n### Running tic-tac-toe example \n\nto run tic-tac-toe example:\n\n```python\n\nimport numpy as np\nfrom mctspy.tree.nodes import TwoPlayersGameMonteCarloTreeSearchNode\nfrom mctspy.tree.search import MonteCarloTreeSearch\nfrom mctspy.games.examples.tictactoe import TicTacToeGameState\n\nstate = np.zeros((3,3))\ninitial_board_state = TicTacToeGameState(state = state, next_to_move=1)\n\nroot = TwoPlayersGameMonteCarloTreeSearchNode(state = initial_board_state)\nmcts = MonteCarloTreeSearch(root)\nbest_node = mcts.best_action(10000)\n\n```\n\n\n### Running MCTS for your own 2 players zero-sum game \n\nIf you want to apply MCTS for your own game, its state implementation should derive from \n`mmctspy.games.common.TwoPlayersGameState` \n\n(lookup `mctspy.games.examples.tictactoe.TicTacToeGameState` for inspiration)\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Python implementation of monte carlo tree search for 2 players zero-sum game",
"version": "0.1.1",
"split_keywords": [
"mcts",
"monte",
"carlo",
"tree",
"search"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "eeed96f969d129c50d354253d8242f3c",
"sha256": "fc7a87aa7654971ede89b63a58d2ed3171a498937d38bd7b53b79f4dea880354"
},
"downloads": -1,
"filename": "mctspy-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "eeed96f969d129c50d354253d8242f3c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5.7",
"size": 6336,
"upload_time": "2019-07-16T13:55:54",
"upload_time_iso_8601": "2019-07-16T13:55:54.292767Z",
"url": "https://files.pythonhosted.org/packages/93/25/fb9812b54a0c7c6db86fa4ca89d1eb0db9f30d7242832bdb91dde950d818/mctspy-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "42d49ca857cf4dd39c5aa70cc2b018aa",
"sha256": "52d16193bdadeaca144bf28047367c13e8940a45d758a3a9c96c78d3b7226dfa"
},
"downloads": -1,
"filename": "mctspy-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "42d49ca857cf4dd39c5aa70cc2b018aa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5.7",
"size": 4064,
"upload_time": "2019-07-16T13:55:55",
"upload_time_iso_8601": "2019-07-16T13:55:55.833626Z",
"url": "https://files.pythonhosted.org/packages/b3/48/cefb7f055e308c9ce63dbe079c23d6195be3040d42c3596ee515d66b02b6/mctspy-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2019-07-16 13:55:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "int8",
"github_project": "monte-carlo-tree-search",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mctspy"
}