#define bool   int
#define FALSE  0
#define TRUE   1


/********* Definition of and operations on the abstract type 'Color' ********/


typedef   unsigned char  Color;	/* Is int faster??? */

/* Colors used in the user interface. */
#define   WHITE          0
#define   BLACK          1

/* Colors used in the thinking part of the program. */
#define   EMPTY          0	/* color of an empty square */
#define   MYCOLOR        1	/* color of the machine's pieces */
#define   YOURCOLOR      2	/* color of the human's pieces */
#define   OTHER(color)   (3 - (color))

/* A stable piece is one that can never again be turned. */
/*
#define   STABLEBIT         04
#define   STABLE(color)     (color | STABLEBIT)
#define   COLORONLY(color)  (color & ~STABLEBIT)
#define   ISSTABLE(color)   (color & STABLEBIT)
*/

/* The border is marked with a color that is both MY and YOUR */
/* since this will make more efficient searches. */
#define   BORDER     (MYCOLOR | YOURCOLOR)

/* Some special values for use in the alfa-beta search. */
#define   VERY_GOOD     100000	/* used for a winning position */
#define   VERY_BAD      -100000	/* used for a losing position */
#define   VERY_VERY_GOOD 999999	/* used as init value in searches */
#define   VERY_VERY_BAD -999999	/* used as init value in searches */


/****************************************************************************/

#include "sqlist.h"


/*************** Definition of the abstract type 'Board' *****************/


typedef Color   Board[100];


/******* Definition of and operations on the abstract type 'State' *******/


typedef struct {
    Board    board;
    Sqlist   neighbors;	     /* empty squares adjacent to occupied squares */
    Sqlist   stablepieces;   /* all stable pieces. */
    int      mystable;
    int      yourstable;
} State;


/******* Definition of and operations on the abstract type 'Move' *******/


typedef struct move_t {
    Square          sq;		/* The square the move was made to. */
    int             val;	/* The value of the resulting position. */
    State           state;	/* The state after the move. */
    Sqlist          legal_moves; /* A list of legal moves from here. */
    struct move_t   *next;
} Move;


/************* Definition of the abstract type 'Savemove' ***************/


typedef struct {
    Square   sq;
    Color    color;
} Savemove;
