[−][src]Struct connect6::agent::Agent
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
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
T: From<U>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,