项目作者: zacharyfmarion

项目描述 :
Solve games with AI Algorithms
高级语言: Python
项目地址: git://github.com/zacharyfmarion/Game-AI.git
创建时间: 2018-07-19T05:36:00Z
项目社区:https://github.com/zacharyfmarion/Game-AI

开源协议:MIT License

下载


Game AI: Your starting point for AI research

NOTE: This is still a work in progress and the API might change significantly before a stable release. Use at your own risk.

Welcome to gameai! This package contains a series of well-defined abstractions that are common in AI, such as a games, agents, and trainers which optimize the behavior of agents. As long as a class inherits from the base implemetation of a primitive (e.g. Agent) and implements the required methods, it can be used in place of the standard implementations given. To get started:

  1. from gameai.games import TicTacToe
  2. from gameai.agents import RandomAgent, MCTSAgent
  3. from gameai.core import Arena, Player
  4. # Create our game
  5. game = TicTacToe()
  6. # Inititalize our agents
  7. mcts_agent = MCTSAgent()
  8. random_agent = RandomAgent()
  9. # We train the mcts agent
  10. mcts_agent.train(game, verbose=True, num_iters=10000, num_episodes=100)
  11. player0 = Player(0, mcts_agent)
  12. player1 = Player(1, random_agent)
  13. # Pit the agents against eachother in the arena. Note that the player
  14. # ids passed in need to match the index of the player in the array
  15. arena = Arena(game, [player0, player1])
  16. arena.play_games(verbose=True)
  17. arena.statistics()

Installation

Because this is still in alpha and under active development, it has not been released to PyPi. You can install via TestPyPi using the following command:

  1. pip install --index-url https://test.pypi.org/simple/ gameai

Running locally

Clone the repository and install the neccessary dependencies with pip install -r requirements.txt. You will also need to setup a virtual environment and run pip install -e . in the root of the project, which will install the package locally.

Testing

Testing is done with pytest. Run the command make test to run all tests.

Building

Build the project with python3 setup.py sdist bdist_wheel.

Roadmap

  • Add Monte Carlo Tree Search
  • Add Alpha Beta Pruning
  • Add Othello as a game
  • Add Chess as a game
  • Add a simple RL agent & trainer
  • Add an alphazero agent & trainer

Contribution

Feel free to open an issue / submit a PR!