APIリファレンス
コアサービス
ベースモデル
- class mcts_gen.models.game_state.GameStateBase
Abstract base class for any game environment that can be used with McpMcts.
- abstractmethod getCurrentPlayer() int
プレイヤー1の手番なら+1、プレイヤー2の手番なら-1を返します。
- abstractmethod getPossibleActions() List[Any]
Return a list of all possible actions from this state. The actions MUST be serializable and preferably human-readable strings (e.g., USI for shogi) to allow AI agents to process them.
- abstractmethod getReward() float
Return the reward for the current player if the game is terminal. Convention: +1 (win), -1 (loss), 0 (draw).
- get_state_summary() Any
Returns a summary of the current state. This can be overridden by subclasses to provide richer, game-specific information.
- abstractmethod isTerminal() bool
この状態が終端(ゲームオーバー)であればTrueを返します。
- abstractmethod takeAction(action: Any) GameStateBase
指定されたアクションを適用した後の新しいGameStateを返します。
ゲームモジュール
This framework can be extended with different games. Below are the provided examples.
テストおよびデモンストレーション用のダミーゲーム実装(三目並べ)。
- class mcts_gen.games.dummy_game.TicTacToeDummy(board: List[int] | None = None, player: int = 1)
MCTSエンジンをテストするための単純化された三目並べのゲーム状態。
- getCurrentPlayer() int
現在のプレイヤーを返します。
- getPossibleActions() List[int]
可能な手のリスト(空のマス)を返します。
- getReward() float
ゲーム結果の報酬を返します。
- isTerminal() bool
ゲームが終了したかどうか(これ以上手がないか)をチェックします。
- takeAction(action: int) TicTacToeDummy
手を適用し、新しいゲーム状態を返します。