X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=agents%2Fagent%2B%2B%2Fmain.cpp;fp=agents%2Fagent%2B%2B%2Fmain.cpp;h=316df26aaf88c1af3579a18bb718d70a456f6eb5;hb=559edeecb292c9971ddd8226e132e1bf1d2640e1;hp=0000000000000000000000000000000000000000;hpb=8ac03672ef496924adb437b66c75d70d9e2bcde3;p=progcomp2013.git diff --git a/agents/agent++/main.cpp b/agents/agent++/main.cpp new file mode 100644 index 0000000..316df26 --- /dev/null +++ b/agents/agent++/main.cpp @@ -0,0 +1,29 @@ +/** + * agent++ : A Sample agent for UCC::Progcomp2013 + * @file main.cpp + * @purpose The main function + */ +#include +#include +#include + +#include "agent.h" // Declarations for agent, see also agent.cpp + +using namespace std; + +/** + * @funct main + * @purpose The main function; starts the agent + * @param argc - Number of arguments, unused + * @param argv - Argument string array, unused + */ +int main(int argc, char ** argv) +{ + srand(time(NULL)); // seed random number generator + + string colour; cin >> colour; // first read the colour of the agent + Agent agent(colour); // create an agent using the colour + agent.Run(cin, cout); // run the agent (it will read from cin and output to cout) + + return 0; // Don't use exit(3), because it causes memory leaks in the C++ stdlib +}