You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
544 B
30 lines
544 B
pub type Distance = isize;
|
|
|
|
pub struct Position {
|
|
pub x: Distance,
|
|
pub y: Distance,
|
|
}
|
|
|
|
pub struct Direction {
|
|
pub x: Distance,
|
|
pub y: Distance,
|
|
}
|
|
|
|
pub type AgentId = usize;
|
|
|
|
pub struct WorldView {
|
|
pub self_tagged: bool,
|
|
pub bounds_distance: (Distance, Distance, Distance, Distance),
|
|
pub other_agents: Vec<(Direction, AgentId)>,
|
|
}
|
|
|
|
pub enum Move {
|
|
Noop, // Why not an Option?
|
|
TryTag(AgentId),
|
|
TryMove(Direction),
|
|
}
|
|
|
|
pub trait Agent {
|
|
fn next_move(&self, view: WorldView) -> Move;
|
|
fn get_tagged(&mut self, by: AgentId);
|
|
}
|