|
|
@ -20,8 +20,9 @@ use lib::screen::init_screen; |
|
|
|
use lib::world::{render, simulate, World}; |
|
|
|
use lib::world::{render, simulate, World}; |
|
|
|
|
|
|
|
|
|
|
|
fn main() { |
|
|
|
fn main() { |
|
|
|
let mut board = init_screen(); |
|
|
|
let mut screen = init_screen(); |
|
|
|
let mut world = World::new(&Point(board.max_x, board.max_y)); |
|
|
|
let mut world = World::new(&Point(screen.max_x, screen.max_y)); |
|
|
|
|
|
|
|
world.home.insert(screen.center); |
|
|
|
|
|
|
|
|
|
|
|
let mut entities = Entities::new(); |
|
|
|
let mut entities = Entities::new(); |
|
|
|
|
|
|
|
|
|
|
@ -32,7 +33,7 @@ fn main() { |
|
|
|
entities.add_entity(&fg); |
|
|
|
entities.add_entity(&fg); |
|
|
|
|
|
|
|
|
|
|
|
for _ in 0..5 { |
|
|
|
for _ in 0..5 { |
|
|
|
let mut a = Ant::new(board.center.0, board.center.1); |
|
|
|
let mut a = Ant::new(screen.center.0, screen.center.1); |
|
|
|
a.goal = lib::ai::AIGoal::Seek; |
|
|
|
a.goal = lib::ai::AIGoal::Seek; |
|
|
|
entities.add_entity(&a); |
|
|
|
entities.add_entity(&a); |
|
|
|
} |
|
|
|
} |
|
|
@ -42,8 +43,8 @@ fn main() { |
|
|
|
let mut t = 0; |
|
|
|
let mut t = 0; |
|
|
|
loop { |
|
|
|
loop { |
|
|
|
// TODO: add way to break out of the loop by hitting a random key
|
|
|
|
// TODO: add way to break out of the loop by hitting a random key
|
|
|
|
simulate(&mut entities, &mut world, &mut board, t); |
|
|
|
simulate(&mut entities, &mut world, &mut screen, t); |
|
|
|
render(&entities, &world, &board); |
|
|
|
render(&entities, &world, &screen); |
|
|
|
sleep(time::Duration::from_millis(100)); |
|
|
|
sleep(time::Duration::from_millis(100)); |
|
|
|
refresh(); |
|
|
|
refresh(); |
|
|
|
t += 1; |
|
|
|
t += 1; |
|
|
|