Committing results from Preliminary Round 1 (Rounds 1, 2, 3)
[progcomp2012.git] / agents / peternlewis / peternlewis.h
1 #ifndef __LL_CHALLENGE__
2 #define __LL_CHALLENGE__
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #define kBoardSize 10
9
10 typedef enum { kUnknown=0,
11         kMarshall=1,kGeneral,kColonel,kMajor,kCaptain,
12         kLieutenant,kSergeant,kMiner,kScout,kSpy,
13         kBomb,kFlag,
14         
15         kEmpty,
16         kWater,
17         kMoved, // fake rank for moved pieces
18         kAddForRankish // add this in for enemies when calculating the CRC
19 } PieceRank;
20
21 #define kPieceCharacters "0123456789sBF.+MA"
22
23 typedef enum {kNoColor, kRed, kBlue} PlayerColor;
24
25 typedef struct PieceType {
26         PieceRank       thePieceRank;  /* rank of a piece */
27         PlayerColor thePieceColor; /* color of a piece */
28 } PieceType;
29
30 typedef PieceType Board[kBoardSize][kBoardSize];
31 /* Used to provide test code with board configuration.  Red starts 
32    in rows 0..3, Blue starts in rows 6..9 */
33 /* Squares [4][2], [4][3], [4][6], [4][7] and
34            [5][2], [5][3], [5][6], [5][7] are water and cannot
35            be occupied */
36
37 typedef struct PiecePosition {
38         long row;  /* 0..9 */
39         long col;  /* 0..9 */
40 } PiecePosition;
41
42 typedef struct MoveResult {
43         PieceType rankOfAttacker;
44         /* after a strike, returns identity of attacker */
45         PieceType rankOfDefender;
46         /* after a strike, returns identity of defender */
47         Boolean attackerRemoved;
48         /* true after a strike against a piece of equal or greater rank,
49            or against a bomb when the attacker is not a Miner */
50         Boolean defenderRemoved;
51         /* true after a strike by a piece of equal or greater rank,
52            or against a bomb when the attacker is a Miner, 
53            or against a Marshall by a Spy */
54         Boolean victory;
55         /* true after a strike against the Flag */
56         Boolean legalMove;
57         /* true unless you
58              - move into an occupied square, or 
59              - move or strike in a direction other than forward, backward, or sideways, or
60              - move more than one square (except Scouts), or
61              - move a Bomb or a Flag,
62              - move into Water, or
63              - strike a square not occupied by an opponent, or
64              - make any other illegal move  */
65 } MoveResult;
66
67 #ifdef __cplusplus
68 }
69 #endif
70
71 #endif

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