home *** CD-ROM | disk | FTP | other *** search
- #include <dos.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <time.h>
- #include <alloc.h>
- #include <mem.h>
- #include <conio.h>
- #include <process.h>
-
- #define MAXCOL 6
- #define MINCOL 0
- #define MAXROW 6
- #define MINROW 0
- #define FALSE 0
- #define TRUE 1
- #define PIECEWEIGHT 2
-
- typedef enum Tsquare {EMPTYSQ=0,BLUESQ=1,GREENSQ=2} Tsquare;
-
- typedef struct Tmovelist{
- struct Tmovelist *next; // reply
- char from; // 0=top/left square 48=bot/right
- char to;
- char jump; // is a jump?
- }Tmovelist;
-
- typedef union Tboard{
- Tsquare board[7][7]; // row/col type access
- Tsquare b[49]; // 0 to 48 type access
- } Tboard;
-
- typedef struct Tcurrent // current board/score
- {
- Tsquare color; // whose turn to move
- char countblue; // number of blue pieces on board
- char counttotal; // total number of pieces on board
- Tboard board; // playing board
- } Tcurrent;
-
- typedef struct TWindow2{ // precomputed 2 square area around
- char a[50][26]; // each sqaure on board
- }TWindow2;
-
- typedef struct Window1{ // precomputed 1 square area around
- char a[50][9]; // each square on board
- }TWindow1;
-
- // ******** Function prototypes ******************
-
- void prtmove(Tmovelist *movelist);
- void printmove(Tmovelist *movelist);
- Tmovelist *allocmovelist(void);
- Tcurrent *allocTboard(void);
- char emptysquare(Tcurrent *a);
- void freeTboard(Tcurrent *aboard);
- void init_stack_count(void); // for debug
- void stack_count(void); // for debug
- void heapchk(void); // for debug
- void initwindow2(void);
- void initwindow1(void);
- void printboard(Tcurrent *a);
- void printmovelist(Tmovelist *movelist);
- void print_bestmove(Tmovelist *movelist);
- Tmovelist* findmoves(Tcurrent far *a,char level,int far *bestscore);
- Tmovelist *getmovelist(Tcurrent *a, Tsquare color);
- void initboard(Tcurrent* a);
- char scoremove(Tcurrent a,Tsquare color,char torow,char tocol,char *score);
- void makemove(Tcurrent *a,Tmovelist *movelist);
- char getsquare(void);
- Tmovelist getmove(Tcurrent* a);
- void freelist(Tmovelist* movelist);
- unsigned long getmovecount(Tmovelist* movelist);
- int getboardscore(Tcurrent *a);