[][src]Module connect6::policy

Predefined policy for agent to play game.

Policy represents algorithm that make choice in given situation. This module provides 5 predefined policies, AlphaZero policy, random policy, io policy, multi-policy and pure MCTS policy.

Examples

struct ZeroPolicy {}
impl Policy for ZeroPolicy {
    fn next(&mut self, game: &Game) -> Option<(usize, usize)> {
        Some((0, 0))
    }
}

let mut policy = ZeroPolicy {};
let result = Agent::new(&mut policy).play();
assert!(result.is_err());

Structs

AlphaZero

Implementation of policy AlphaZero based on combined MCTS with non-linear value approximator.

DefaultPolicy

Policy for pure Monte Carlo tree search implementation

HyperParameter

Hyperparameter for implementing AlphaZero.

IoPolicy

Policy for in-game user selection with io

MultiPolicy

Black-White seperable policy

Node

Shared memory for making simulation wihout copying board and possible selections.

RandomEvaluator

Evaluator for test, Random Value Evaluator

RandomPolicy

Play game with random selection.

Simulate

Game simulator with shared memory for efficient tree searching

Traits

Evaluator

Evaluator for applying value, policy approximator to AlphaZero.

Policy

trait for playing game with Agent.

Functions

diff_board

compare the board and return the difference between position by position.

hash

generate hash value of board