simple ant colony program written in rust i originally started with C but then started to miss data structures so I re-wrote it in rust
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.
antf/src/main.rs

40 lines
898 B

extern crate downcast_rs;
extern crate ncurses;
use ncurses::*;
use std::thread::sleep;
use std::time;
mod lib {
pub mod point;
pub mod screen;
pub mod world;
pub mod entity;
pub mod ai;
}
use lib::point::Point;
use lib::screen::init_screen;
use lib::world::{World, simulate, render};
use lib::entity::{Entities, Queen};
fn main() {
let mut board = init_screen();
let mut world = World::new();
let mut entities = Entities::new();
let q = Queen::new(board.center.0,board.center.1);
entities.add_entity(&q);
world.create_chamber(Point(board.center.0, board.center.1), 3);
loop {
// TODO: add way to break out of the loop by hitting a random key
simulate(&mut entities, &mut world, &mut board);
render(&entities, &world, &board);
sleep(time::Duration::from_millis(100));
refresh();
}
endwin();
}