Main Page | File List

omcore.h

00001 /* '='='=' '@' '='='='='='='='='=' '@' '='='='='='='='='=' '@' '='='='| */
00002 /* ='='=' '@'@' '='='='='='='='=' '@'@' '='='='='='='='=' '@'@' '='='=| */
00003 /* '='=' '@':'@' '='='='='='='=' '@':'@' '='='='='='='=' '@':'@' '='='| */
00004 /* ='=' '@':':'@' '='='='='='=' '@':':'@' '='='='='='=' '@':':'@' '='=| */
00005 /* '=' '@':':':'@' '='='='='=' '@':':':'@' '='='='='=' '@':':':'@' '='| */
00006 /* =' '@':':':':'@' '='='='=' '@':':':':'@' '='='='=' '@':':':':'@' '=| */
00007 /* ' '@':'                                                       '@' '| */
00008 /*  '@'         3rd Year Project - ROY SCHESTOWITZ - 2002          @' | */
00009 /* '@                                                               @'| */
00010 /* @':':':':':':':':'@' ' '@':':':':':':':':'@' ' '@':':':':':':':':'@| */
00011 /* ':':':':':':':':':'@' '@':':':':':':':':':'@' '@':':':':':':':':':'| */
00012 /* :':':':':':':':':':'@'@':':':':':':':':':':'@'@':':':':':':':':':':| */
00013 /* ':':':': : :':':':':'@':':':':': : :':':':':'@':':':':': : :':':':'| */
00014 /*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
00015 /*              Name:           omcore.h                                */
00016 /*              Version:        0.6.6                                   */
00017 /*              Date:           12/2/2003                               */
00018 /*                                                                      */
00019 /*              Datastructures for the main procedures and calls of     */
00020 /*              the application                                         */
00021 /*                                                                      */
00022 /*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
00023 
00024 /************************************************************************/
00025 /**********************  INCLUDES  **************************************/
00026 /************************************************************************/
00027 
00028 #include <GL/glut.h>            /* GLUT library for interaction         */
00029 #include <math.h>               /* Mathmatical operations - tan,PI etc. */
00030 #include <stdio.h>              /* For testing & exit notice            */
00031 #include <stdlib.h>
00032 #include <string.h>             /* String comparison etc.               */
00033 
00034 /************************************************************************/
00035 /**********************  DEFINES  ***************************************/
00036 /************************************************************************/
00037 
00038 #define PACKAGE "Othello Master"
00039 #define VERSION "0.7.8"
00040 #define DATE "17/06/03"
00041 #define YEAR 2003
00042 
00043 #define FALSE 1==0              /* for platform independence             */
00044 #define TRUE 0==0               /* for platform independence             */
00045 #define NONE 2                  /* meaning no stones                     */
00046 #define BLACK 1
00047 #define RED 0                   /* all defined as integers to simplify   */
00048                                 /* switch statements                     */
00049 #define CLEAR "\E[2J"           /* Clear screen sequence                 */
00050 
00051 /************************************************************************/
00052 /**********************  DATA STRUCTURES  *******************************/
00053 /************************************************************************/
00054 
00055 
00056 typedef enum
00057 {                               /* Holds a view identifier */
00058   VIEW0,                        /* The various views of the game */
00059   VIEW1,
00060   VIEW2,
00061   VIEW3,
00062   VIEW4,
00063   VIEW5,
00064   VIEW6,
00065   VIEW7,
00066   VIEW8,
00067   VIEW9,
00068   HELP,                         /* The help screen */
00069   START,                        /* Opening screen  */
00070   BLACK_WINS,                   /* View of Black winning */
00071   RED_WINS,                     /* View of Black winning */
00072   DRAW,                         /* Draw View */
00073   BEGINNER_VIEW,
00074   NOVICE_VIEW,
00075   EXPERT_VIEW,
00076   PREMASTER_VIEW,
00077   MASTER_VIEW,                  /* View for difficulty annotation   */
00078   BOARD                         /* Overview on board - default view */
00079 }
00080 view_type;
00081 
00082 
00083 typedef enum
00084 {                               /* Holds a difficulty level */
00085   BEGINNER,
00086   NOVICE,
00087   EXPERT,
00088   PRE_MASTER,
00089   MASTER
00090 }
00091 difficulty_level;
00092 
00093 
00094 typedef struct
00095 {
00096   int slot[10][10];
00097 }
00098 board_map;
00099 
00100 difficulty_level difficulty = BEGINNER;
00101 
00102                                  /* A variable to hold the current  */
00103                                  /* difficulty level                */
00104 
00105 difficulty_level stat_mode_difficulty = BEGINNER;
00106 
00107                                  /* A variable to hold the current  */
00108                                  /* difficulty level of the second  */
00109                                  /* second CPU player when in       */
00110                                  /* mode of gathering statistics    */
00111 
00112 
00113 GLfloat eyex,
00114   eyey,
00115   eyez;                         /* Eye point                            */
00116 GLfloat centerx,
00117   centery,
00118   centerz;                      /* Look point                           */
00119 GLfloat upx,
00120   upy,
00121   upz;                          /* View up vector                       */
00122 
00123 int VERBOSE = FALSE;            /* Program is verbose or not            */
00124 
00125 int ang = 0;                    /* Keeps the angle of the torus         */
00126 view_type view = VIEW0;         /* Current view identifier              */
00127 
00128 int movecount,
00129   redscore,
00130   blackscore;
00131 
00132                            /* Counts the number of stones and the score */
00133 
00134 int red_mobility,
00135   black_mobility;               /* counts the number of moves available */
00136 
00137 int enable_edit = FALSE;        /* flag indicating if in editing mode   */
00138 int edit_element = NONE;        /* The current type of placemnt in      */
00139                                 /* editing mode                         */
00140 
00141 int illum_val=10;               /* the illumination coefficient value   */
00142 
00143 int debugging = FALSE;          /* indicates debugging mode             */
00144 
00145 int turn;                       /* Indicates whose turn it is           */
00146 int togglescore = TRUE,
00147   cpuflag;                      /* By default, display score            */
00148 
00149                                 /* CPU flag says if it is CPU's turn    */
00150 int display_grid = TRUE;        /* By Default, display grid             */
00151 int playing_against_cpu = TRUE; /* Indicates if the game is player      */
00152 
00153                                 /* versus player or player versus cpu   */
00154 int toggle_meters = TRUE;       /* whether meters should be displayed   */
00155 int exit_game_when_finished;    /* indicates if the program should      */
00156 
00157                                 /* quit when the game has finished      */
00158 
00159 int keyboard_number = 1;        /* to allow keyboard interaction        */
00160 
00161                                 /* stores the 1-8 number coordinate     */
00162 int keyboard_letter = 1;        /* to allow keyboard interaction        */
00163 
00164                                 /* stores the A-H letter coordinate     */
00165 
00166 char *player_name = "PLAYER";   /* stores the name of the player        */
00167 
00168 FILE *log_file;                 /* file pointer to file that retains    */
00169 
00170                                 /* full log of game events and info.    */
00171 
00172 int keep_log_file = FALSE;      /* boolean for keeping a log file       */
00173 board_map board;                /* Represents the boards surrounded by  */
00174 
00175 FILE *report_file;              /* file pointer to report of multiple games */
00176 int add_to_report_file = FALSE; /* indicates whether a report is kept   */
00177 
00178 int gather_statistics = FALSE;  /* flag indicating if the game is       */
00179 
00180                                 /* to be played by CPU only             */
00181 
00182 int game_on = FALSE;            /* indicates if the game is on i.e. if  */
00183 
00184                                 /* playing a move is now legal          */
00185 
00186 int non_determinism = FALSE;    /* flag indicating if the program will  */
00187 
00188                                 /* currently use some randomisation     */
00189                                 /* for non-determinism                  */
00190 int use_opening_library = FALSE;        /* flag indicating if opening moves     */
00191 
00192                                 /* library is to be used                */
00193 int load_flag = FALSE;          /* indicates if a game is loaded in     */
00194 
00195                                 /* this session                         */
00196 
00197 int enable_line_eval = TRUE;    /* evaluation components flags          */
00198 int enable_score_eval = TRUE;
00199 int enable_mobility_eval = TRUE;
00200 int enable_position_eval = TRUE;
00201 
00202 GLint width = 500,
00203   height = 500;                 /* Size of window                       */
00204 
00205 /************************************************************************/
00206 /**********************  PROTOTYPES  ************************************/
00207 /************************************************************************/
00208 
00209 /******************************/
00211 /******************************/
00212 
00213 void adjust_look_at_center ( void );
00214 void draw_objects ( void );
00215 
00216 /******************************/
00218 /******************************/
00219 
00220 void initboard ( void );
00221 void initmenu ( void );
00222 void init ( int );
00223 
00224 /****************************/
00226 /****************************/
00227 
00228 void display_debugging_instructions ( void );
00229 void display_help ( void );
00230 void process_command_line ( int argc, char *argv[] );
00231 void set_difficulty ( char *diff );
00232 void set_up_stat_mode_difficulty ( char *diff );
00233 
00234 /********************************/
00236 /********************************/
00237 
00238 int main ( int argc, char **argv );
00239 void quit_game ( void );
00240 
00241 /**********************************/
00243 /**********************************/
00244 
00245 void annotate_help ( void );
00246 void annotate_difficulty ( void );
00247 void annotate_board ( void );
00248 void annotate ( void );
00249 void set_name_of_player ( char *name );
00250 void draw_ascii_board ( board_map board );
00251 
00252 /*                                                                      */
00253 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
00254 /*                     end of omcore.h                                  */
00255 /************************************************************************/

Generated on Mon May 23 01:16:01 2005 by doxygen 1.3.2