2 * UCC 2012 Programming Competition Entry
10 #include "interface.h"
31 static const int MAX_RANK_COUNTS[N_RANKS] = {
32 40, 1, 1, 2, 3, 4, 4, 4, 5, 8, 1, 6, 1
34 static const char cRANK_CHARS[N_RANKS] = "#123456789sBF";
35 static inline enum eRanks CharToRank(char ch)
39 case '1': return RANK_MARSHAL;
40 case '2': return RANK_GENERAL;
41 case '3': return RANK_COLONEL;
42 case '4': return RANK_MAJOR;
43 case '5': return RANK_CAPTAIN;
44 case '6': return RANK_LIEUTENANT;
45 case '7': return RANK_SERGEANT;
46 case '8': return RANK_MINER;
47 case '9': return RANK_SCOUT;
48 case 's': return RANK_SPY;
49 case 'B': return RANK_BOMB;
50 case 'F': return RANK_FLAG;
51 case '#': return RANK_UNKNOWN;
54 DEBUG("Unknown character '%c'", ch);
65 enum eRanks Rank; // -1 = unknown
68 // TODO: Keep last moved
70 BOOL bExposed; // Marks when the piece is known by the other team
72 int StartX, StartY; // Used to save initial layout
73 enum eRanks GuessedRank; // Only used it bGuessValid is set
76 typedef struct sPlayerStats
83 int nKilledRanks[N_RANKS];
84 tPiece Pieces[N_PIECES];
88 typedef struct sPieceRef
90 char Index; // Index into tPlayerStats.Pieces
91 char Team; // 0 = Empty, 1 = Me, 2 = Opponent, 3 = Block
94 typedef struct sGameState
96 tPlayerStats Opponent;
97 tPlayerStats MyExposed;
98 tPlayerStats MyActual;
99 tPieceRef BoardState[]; //
103 extern char *DB_GetOpponentFile(const char *Opponent);
104 extern void DB_LoadGuesses(const char *DBFile, enum eColours Colour);
105 extern void DB_WriteBackInitialState(const char *DBFile, enum eColours Colour, tPiece *Pieces);