-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.cc
42 lines (32 loc) · 1.11 KB
/
main.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "controller.h"
using namespace Antix;
Home::Color colors[] = { Home::Color(1,0,0),
Home::Color(0,0.5,0), // darker green
Home::Color(0.3,0.3,1), // lighter blue
Home::Color(1,1,0),
Home::Color(1,0,1),
Home::Color(0,1,1),
Home::Color(1,0,1) };
size_t color_count(7);
int main( int argc, char* argv[] )
{
// configure global robot settings
Robot::Init( argc, argv );
// create each home, and each robot within each home
for( unsigned int i=0; i<Robot::home_count; i++ )
{
Home* h( new Home( i,
i < color_count ? colors[i] : Home::Color::Random(),
i ? drand48() * Robot::worldsize : Robot::worldsize/2.0,
i ? drand48() * Robot::worldsize : Robot::worldsize/2.0,
0.1 ));
for( unsigned int i(0); i<Robot::home_population; i++ )
new Forager( h );
}
for( unsigned int i=0; i<Robot::puck_count; i++ )
new Puck( drand48() * Robot::worldsize, drand48() * Robot::worldsize );
// and start the simulation running
Robot::Run();
// we'll probably never get here, but this keeps the compiler happy.
return 0;
}