mocats
A fast, easy-to-use, generalized Monte Carlo Tree Search library. Works for any game, any number of players, and any tree policy (UctPolicy included as a default). As of the current version, the search is single-threaded.
Features
- Fast and efficient Monte Carlo Tree Search implementation
- Easy-to-use API
- Customizable number of players (uses paranoid approach for more than 2 players)
- Customizable tree policies
- Nicely formatted display output for debugging
Usage
In the root directory of your project, add the mocats dependency to your Cargo.toml file:
...or add this to your Cargo.toml:
[]
= "0.3.0"
Defining a game
To use mocats, you must define a game and a tree policy. A game is defined by three traits:
GameState: Represents a game state.GameAction: Represents a legal game action that can be applied to someGameState.Player: Represents a player in a game. Should be an enum.
A tree policy is defined by one trait:
TreePolicy: Represents a tree policy.
The UctPolicy struct is included as a default tree policy.
Running the search
To run the search, create a SearchTree struct with the game and tree policy, then call run on it.
use ;
Example
See the mocats::tic_tac_toe module for a full example of implementing Tic Tac Toe using mocats.
You can import tic_tac_toe to use it in your code.
use fmt;
use ;
Documentation
For more detailed documentation and usage examples, refer to the API documentation.
Contributing
Contributions in the form of pull requests are welcome! If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub repository.
License
This project is licensed under the MIT License. See the LICENSE file for details.