Stuff happened
[progcomp2013.git] / agents / c++ / main.cpp
1 /**
2  * agent++ : A Sample agent for UCC::Progcomp2013
3  * @file main.cpp
4  * @purpose The main function 
5  */
6 #include <cstdlib>
7 #include <cstdio>
8 #include <iostream>
9
10 #include "agent.h" // Declarations for agent, see also agent.cpp
11
12 using namespace std;
13
14 /**
15  * @funct main
16  * @purpose The main function; starts the agent
17  * @param argc - Number of arguments, unused
18  * @param argv - Argument string array, unused
19  */
20 int main(int argc, char ** argv)
21 {
22         srand(time(NULL)); // seed random number generator
23
24         string colour; cin >> colour; // first read the colour of the agent
25
26         try
27         {
28                 Agent agent(colour); // create an agent using the colour
29                 agent.Run(cin, cout); // run the agent (it will read from cin and output to cout)
30         }
31         catch (const Exception & e)
32         {
33                 return 1;
34         }
35         
36         
37         return 0; // Don't use exit(3), because it causes memory leaks in the C++ stdlib
38 }

UCC git Repository :: git.ucc.asn.au