5fea5e73fd988eea20818b718710857db08c3a7a
[progcomp2012.git] / samples / forfax / main.cpp
1 /**
2  * "forfax", a sample Stratego AI for the UCC Programming Competition 2012
3  * The main function for the "forfax" AI program
4  * @author Sam Moore (matches) [SZM]
5  * @website http://matches.ucc.asn.au/stratego
6  * @email [email protected] or [email protected]
7  * @git git.ucc.asn.au/progcomp2012.git
8  */
9
10 #include <cstdlib>
11 #include <iostream>
12
13 #include "forfax.h"
14
15 using namespace std;
16
17 #include <stdio.h>
18
19 /**
20  * The AI
21  */
22 Forfax forfax;
23
24 /**
25  * The main function
26  * @param argc the number of arguments
27  * @param argv the arguments
28  * @returns exit code 0 for success, something else for error
29  * Do I really need to tell you this?
30  */
31 int main(int argc, char ** argv)
32 {
33         setbuf(stdin, NULL);
34         setbuf(stdout, NULL);
35
36
37         Forfax::Status move = forfax.Setup();
38
39         
40         while (move == Forfax::OK)
41         {
42                 move = forfax.MakeMove();
43         }
44
45         /*
46         switch (move)
47         {
48                 case Forfax::OK:
49                         cerr << argv[0] << " Error - Should never see this!\n";
50                         break;
51                 case Forfax::NO_NEWLINE:
52                         cerr << argv[0] << " Error - Expected a new line!\n";
53                         break;
54                 case Forfax::EXPECTED_ATTACKER:
55                         cerr << argv[0] << " Error - Attacking piece does not exist on board!\n";
56                         break;
57                 case Forfax::UNEXPECTED_DEFENDER:
58                         cerr << argv[0] << " Error - Unexpected defending piece on board!\n";
59                         break;
60                 case Forfax::NO_ATTACKER:
61                         cerr << argv[0] << " Error - Couldn't find attacker in list of pieces!\n";
62                         break;
63                 case Forfax::NO_DEFENDER:
64                         cerr << argv[0] << " Error - Couldn't find defender in list of pieces!\n";
65                         break;
66
67                 case Forfax::COLOUR_MISMATCH:
68                         cerr << argv[0] << " Error - Colour of attacker and defender are the same!\n";
69                         break;
70                 case Forfax::INVALID_QUERY:
71                         cerr << argv[0] << " Error - Query did not make sense\n";
72                         break;
73                 case Forfax::VICTORY:
74                         cerr << argv[0] << " Game end - VICTORY!\n";
75                         break;          
76                 case Forfax::BOARD_ERROR:
77                         cerr << argv[0] << " Error - An error occurred with the board!\n";
78                         break;
79         }
80         */
81         //cerr << "Final board state:\n";
82         //forfax.PrintBoard(cerr);
83
84         //cerr << "Forfax is now exiting!\n";
85         
86         
87         exit(EXIT_SUCCESS);
88         return 0;
89
90         
91 }
92
93

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