split ai and entity test
This commit is contained in:
+1
-21
@@ -2,7 +2,7 @@ use antf::lib::screen::init_screen;
|
|||||||
use antf::lib::point::Point;
|
use antf::lib::point::Point;
|
||||||
use antf::lib::ai::AIGoal;
|
use antf::lib::ai::AIGoal;
|
||||||
use antf::lib::world::{World, simulate, render};
|
use antf::lib::world::{World, simulate, render};
|
||||||
use antf::lib::entity::{Entities, Ant, FoodGenerator};
|
use antf::lib::entity::{Entities, Ant};
|
||||||
|
|
||||||
use ncurses::*;
|
use ncurses::*;
|
||||||
use std::thread::sleep;
|
use std::thread::sleep;
|
||||||
@@ -34,23 +34,3 @@ fn test_reach_astar() {
|
|||||||
clear();
|
clear();
|
||||||
endwin();
|
endwin();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_foodgen() {
|
|
||||||
let mut board = init_screen();
|
|
||||||
let mut world = World::new();
|
|
||||||
|
|
||||||
let mut entities = Entities::new();
|
|
||||||
let fg = FoodGenerator::new();
|
|
||||||
entities.add_entity(&fg);
|
|
||||||
|
|
||||||
for _ in 0..60 {
|
|
||||||
// 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();
|
|
||||||
}
|
|
||||||
clear();
|
|
||||||
endwin();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
use antf::lib::screen::init_screen;
|
||||||
|
use antf::lib::world::{World, simulate, render};
|
||||||
|
use antf::lib::entity::{Entities, FoodGenerator};
|
||||||
|
|
||||||
|
use ncurses::*;
|
||||||
|
use std::thread::sleep;
|
||||||
|
use std::time;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_foodgen() {
|
||||||
|
let mut board = init_screen();
|
||||||
|
let mut world = World::new();
|
||||||
|
|
||||||
|
let mut entities = Entities::new();
|
||||||
|
let fg = FoodGenerator::new();
|
||||||
|
entities.add_entity(&fg);
|
||||||
|
|
||||||
|
for _ in 0..60 {
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
|
clear();
|
||||||
|
endwin();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user