[][src]Struct connect6::agent::Agent

pub struct Agent<'a> { /* fields omitted */ }

Loop based single policy agent.

Agent is structure for playing game with given policy. As we pass the policy, agent play the game with given based on loop. Method play return the SetResult and it can be converted as PyObject.

Examples

For black-white seperable policy, reference MultiPolicy.

This example is not tested
io_policy_stdio!(io_policy);
let mut rand_policy = RandomPolicy::new();

let mut multi_policy = MultiPolicy::new(&mut rand_policy, &mut io_policy);
let result = Agent::debug(&mut multi_policy).play();

Methods

impl<'a> Agent<'a>[src]

pub fn new(policy: &'a mut dyn Policy) -> Agent<'a>[src]

Construct a new Agent with given policy.

Examples

let mut policy = RandomPolicy::new();
let mut agent = Agent::new(&mut policy);

pub fn debug(policy: &'a mut dyn Policy) -> Agent<'a>[src]

Construct a debug mode Agent with given policy, it will display the dbg info.

Examples

let mut policy = RandomPolicy::new();
let mut agent = Agent::debug(&mut policy);

pub fn play(&mut self) -> Result<PlayResult, Box<dyn Error + Send>>[src]

Self-play the game with given policy.

Examples

let mut policy = RandomPolicy::new();
let mut agent = Agent::new(&mut policy);

let result = agent.play();
assert!(result.is_ok());
println!("winner: {:?}", result.unwrap().winner);

Errors

if selected position raise Err at Game::play.

Auto Trait Implementations

impl<'a> !Send for Agent<'a>

impl<'a> !Sync for Agent<'a>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T