
const int SIZE = 3;
const char BLANK = '_';
enum coordinates {X_COORD = 0, Y_COORD = 1};
const int DEBUG = false;

/* Board coordinates are represented as a Cartesian x, y pair stored
   in an array of two integers */

/* */
void initialize(char board[][SIZE]);

/* 
 * The top level function for controlling the game.
 * Calls:  getNextMove,updateBoard,draw,isWin,isDraw,play
 */
void play(char board[][SIZE], char player);

/* 
 * Modifies coords. Looks at spaces available, chooses move with
 * highest rating for this player based solely on current board.
 * Calls: rateMove
 */
void getNextMove(char board[][SIZE], char player, int coords[]);

/* 
 * Assigns a rating to a move given a certain board and player,
 * returns it. Higher rating is better. Does NOT modify board.
 * Calls: updateBoard,countPlayerInRow,countPlayerInColumn,countPlayerInDiagonal
 */
double rateMove(char board[][SIZE], char player, int coords[]);

/* Modifies board by adding player at coords. */
void updateBoard(char board[][SIZE], char player, int coords[]);

/* 
 * Returns true iff player has won. 
 * Calls: countPlayerInRow,countPlayerInColumn,countPlayerInDiagonal
 */
bool isWin(char board[][SIZE], char player);

/* Returns true iff game is a draw. */
bool isDraw(char board[][SIZE]);

/* Assumes player is either X or O, return other player. */
char other(char player);

/* Draw the board. */
void draw(char board[][SIZE]);

/* 
 * Count the number of times player occurs in row. 
 * Calls: convertCoordRowToArrayRow
 */
int countPlayerInRow(char board[][SIZE], char player, int row);

/* Count the number of times player occurs in column. */
int countPlayerInColumn(char board[][SIZE], char player, int column);

/* 
 * Count the number of times player occurs in diagonal. First diagonal
 * is top left to bottom right.
 */
int countPlayerInDiagonal(char board[][SIZE], char player, int diag);

/* 
 * Useful since Cartesian coords count rows with zero at bottom, while
 * arrays start at top.
 */
int convertCoordRowToArrayRow(int coordRow);

