项目作者: LucidTaZ

项目描述 :
MiniMax engine for game decision making
高级语言: PHP
项目地址: git://github.com/LucidTaZ/minimax.git
创建时间: 2016-05-06T10:33:52Z
项目社区:https://github.com/LucidTaZ/minimax

开源协议:MIT License

下载


Build Status
Scrutinizer Code Quality
Code Coverage

MiniMax engine in PHP

This library provides easy integration of the MiniMax game decision making
algorithm into your game, using a simple interface to separate the algorithm
from the game logic.

Usage

To use this library, first make sure you implement each interface in
lucidtaz\minimax\game.

Then, simply construct an instance of lucidtaz\minimax\engine\Engine, give it
the Player to act as, and when it is the player’s turn, call the decide()
method. This will result in the GameState instance that results after the
engine takes its move.

In code:

  1. class MyPlayer implements \lucidtaz\minimax\game\Player
  2. {
  3. ...
  4. }
  5. class MyGameState implements \lucidtaz\minimax\game\GameState
  6. {
  7. ...
  8. }
  9. $player = new MyPlayer(...);
  10. $engine = new \lucidtaz\minimax\engine\Engine($player);
  11. $gameState = new MyGameState(...);
  12. $newGameState = $engine->decide($gameState);

For an example, see the tests/tictactoe directory or any of the other sample
game implementations in tests/.