pub trait Agent<S: State> {
// Required methods
fn current_state(&self) -> &S;
fn take_action(&mut self, action: &S::A);
// Provided method
fn pick_random_action(&mut self) -> S::A { ... }
}
Expand description
An Agent
is something which hold a certain state, and is able to take actions from that
state. After taking an action, the agent arrives at another state.
Required Methods§
sourcefn current_state(&self) -> &S
fn current_state(&self) -> &S
Returns the current state of this Agent
.
sourcefn take_action(&mut self, action: &S::A)
fn take_action(&mut self, action: &S::A)
Takes the given action, possibly mutating the current State
.
Provided Methods§
sourcefn pick_random_action(&mut self) -> S::A
fn pick_random_action(&mut self) -> S::A
Takes a random action from the set of possible actions from this State
. The default
implementation uses State::random_action() to
determine the action to be taken.