/* '='='=' '@' '='='='='='='='='=' '@' '='='='='='='='='=' '@' '='='='| */
/* ='='=' '@'@' '='='='='='='='=' '@'@' '='='='='='='='=' '@'@' '='='=| */
/* '='=' '@':'@' '='='='='='='=' '@':'@' '='='='='='='=' '@':'@' '='='| */
/* ='=' '@':':'@' '='='='='='=' '@':':'@' '='='='='='=' '@':':'@' '='=| */
/* '=' '@':':':'@' '='='='='=' '@':':':'@' '='='='='=' '@':':':'@' '='| */
/* =' '@':':':':'@' '='='='=' '@':':':':'@' '='='='=' '@':':':':'@' '=| */
/* ' '@':'                                                       '@' '| */
/*  '@'         3rd Year Project - ROY SCHESTOWITZ - 2002          @' | */
/* '@                                                               @'| */
/* @':':':':':':':':'@' ' '@':':':':':':':':'@' ' '@':':':':':':':':'@| */
/* ':':':':':':':':':'@' '@':':':':':':':':':'@' '@':':':':':':':':':'| */
/* :':':':':':':':':':'@'@':':':':':':':':':':'@'@':':':':':':':':':':| */
/* ':':':': : :':':':':'@':':':':': : :':':':':'@':':':':': : :':':':'| */
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/*              Name:           omcore.h                                */
/*              Version:        0.6.6                                   */
/*              Date:           12/2/2003                               */
/*                                                                      */
/*              Datastructures for the main procedures and calls of     */
/*              the application                                         */
/*                                                                      */
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */

/************************************************************************/
/**********************  INCLUDES  **************************************/
/************************************************************************/

#include <GL/glut.h>		/* GLUT library for interaction         */
#include <math.h>		/* Mathmatical operations - tan,PI etc. */
#include <stdio.h>		/* For testing & exit notice            */
#include <stdlib.h>
#include <string.h>		/* String comparison etc.               */

/************************************************************************/
/**********************  DEFINES  ***************************************/
/************************************************************************/

#define PACKAGE "Othello Master"
#define VERSION "0.7.8"
#define DATE "17/06/03"
#define YEAR 2003

#define FALSE 1==0		/* for platform independence             */
#define TRUE 0==0		/* for platform independence             */
#define NONE 2			/* meaning no stones                     */
#define BLACK 1
#define RED 0			/* all defined as integers to simplify   */
				/* switch statements                     */
#define CLEAR "\E[2J"		/* Clear screen sequence                 */

/************************************************************************/
/**********************  DATA STRUCTURES  *******************************/
/************************************************************************/


typedef enum
{				/* Holds a view identifier */
  VIEW0,			/* The various views of the game */
  VIEW1,
  VIEW2,
  VIEW3,
  VIEW4,
  VIEW5,
  VIEW6,
  VIEW7,
  VIEW8,
  VIEW9,
  HELP,				/* The help screen */
  START,			/* Opening screen  */
  BLACK_WINS,			/* View of Black winning */
  RED_WINS,			/* View of Black winning */
  DRAW,				/* Draw View */
  BEGINNER_VIEW,
  NOVICE_VIEW,
  EXPERT_VIEW,
  PREMASTER_VIEW,
  MASTER_VIEW,			/* View for difficulty annotation   */
  BOARD				/* Overview on board - default view */
}
view_type;


typedef enum
{				/* Holds a difficulty level */
  BEGINNER,
  NOVICE,
  EXPERT,
  PRE_MASTER,
  MASTER
}
difficulty_level;


typedef struct
{
  int slot[10][10];
}
board_map;

difficulty_level difficulty = BEGINNER;

				 /* A variable to hold the current  */
				 /* difficulty level                */

difficulty_level stat_mode_difficulty = BEGINNER;

				 /* A variable to hold the current  */
				 /* difficulty level of the second  */
				 /* second CPU player when in       */
				 /* mode of gathering statistics    */


GLfloat eyex,
  eyey,
  eyez;				/* Eye point                            */
GLfloat centerx,
  centery,
  centerz;			/* Look point                           */
GLfloat upx,
  upy,
  upz;				/* View up vector                       */

int VERBOSE = FALSE;		/* Program is verbose or not            */

int ang = 0;			/* Keeps the angle of the torus         */
view_type view = VIEW0;		/* Current view identifier              */

int movecount,
  redscore,
  blackscore;

			   /* Counts the number of stones and the score */

int red_mobility,
  black_mobility;		/* counts the number of moves available */

int enable_edit = FALSE;	/* flag indicating if in editing mode   */
int edit_element = NONE;	/* The current type of placemnt in      */
				/* editing mode                         */

int illum_val=10;               /* the illumination coefficient value   */

int debugging = FALSE;		/* indicates debugging mode             */

int turn;			/* Indicates whose turn it is           */
int togglescore = TRUE,
  cpuflag;			/* By default, display score            */

				/* CPU flag says if it is CPU's turn    */
int display_grid = TRUE;	/* By Default, display grid             */
int playing_against_cpu = TRUE;	/* Indicates if the game is player      */

				/* versus player or player versus cpu   */
int toggle_meters = TRUE;	/* whether meters should be displayed   */
int exit_game_when_finished;	/* indicates if the program should      */

				/* quit when the game has finished      */

int keyboard_number = 1;	/* to allow keyboard interaction        */

				/* stores the 1-8 number coordinate     */
int keyboard_letter = 1;	/* to allow keyboard interaction        */

				/* stores the A-H letter coordinate     */

char *player_name = "PLAYER";	/* stores the name of the player        */

FILE *log_file;			/* file pointer to file that retains    */

				/* full log of game events and info.    */

int keep_log_file = FALSE;	/* boolean for keeping a log file       */
board_map board;		/* Represents the boards surrounded by  */

FILE *report_file;		/* file pointer to report of multiple games */
int add_to_report_file = FALSE;	/* indicates whether a report is kept   */

int gather_statistics = FALSE;	/* flag indicating if the game is       */

				/* to be played by CPU only             */

int game_on = FALSE;		/* indicates if the game is on i.e. if  */

				/* playing a move is now legal          */

int non_determinism = FALSE;	/* flag indicating if the program will  */

				/* currently use some randomisation     */
				/* for non-determinism                  */
int use_opening_library = FALSE;	/* flag indicating if opening moves     */

				/* library is to be used                */
int load_flag = FALSE;		/* indicates if a game is loaded in     */

				/* this session                         */

int enable_line_eval = TRUE;	/* evaluation components flags          */
int enable_score_eval = TRUE;
int enable_mobility_eval = TRUE;
int enable_position_eval = TRUE;

GLint width = 500,
  height = 500;			/* Size of window                       */

/************************************************************************/
/**********************  PROTOTYPES  ************************************/
/************************************************************************/

/******************************/
/** Misc. graphics functions **/
/******************************/

void adjust_look_at_center ( void );
void draw_objects ( void );

/******************************/
/** Initialisation functions **/
/******************************/

void initboard ( void );
void initmenu ( void );
void init ( int );

/****************************/
/** Command-line functions **/
/****************************/

void display_debugging_instructions ( void );
void display_help ( void );
void process_command_line ( int argc, char *argv[] );
void set_difficulty ( char *diff );
void set_up_stat_mode_difficulty ( char *diff );

/********************************/
/** Main application functions **/
/********************************/

int main ( int argc, char **argv );
void quit_game ( void );

/**********************************/
/** Misc. text-related functions **/
/**********************************/

void annotate_help ( void );
void annotate_difficulty ( void );
void annotate_board ( void );
void annotate ( void );
void set_name_of_player ( char *name );
void draw_ascii_board ( board_map board );

/*                                                                      */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
/*                     end of omcore.h                                  */
/************************************************************************/

