/*
 *
 * scrab.h -- constants and structures
 *
 * This code is copyright 1994 by James A. Cherry, jac@doe.carleton.ca.
 * It is not to be redistributed or modified without his permission.
 *
 */

#ifdef CURSES
#include <curses.h>
#else
#include <stdio.h>
#endif
#include <string.h>
#include <malloc.h>
#include <signal.h>
#ifdef  BSD
#include <sys/time.h>
#else   /* USG */
#define index   strchr
#define srandom srand48
#define random  lrand48
long srand48();
long lrand48();
#endif  /* USG */

#define SKILL_LEVELS	5
#define SKILL_EXPERT	( SKILL_LEVELS + 1 )

#define CH_EM			'.'
#define CH_DL			'+'
#define CH_TL			'#'
#define CH_DW			'0'
#define CH_TW			'@'
#define CH_BL			'?'
#define CH_IT			'_'

#define INFO_Y			2
#define INFO_X			0
#define TILE_RACKS_Y	2
#define TILE_RACKS_X	59
#define TILES_LEFT_Y	0
#define TILES_LEFT_X	57

#ifdef  DBLSIZE_BOARD
#define BOARD_UY		2
#define BOARD_LY		16
#define BOARD_LX		25
#define BOARD_RX		53
#else
#define BOARD_UY		2
#define BOARD_LY		16
#define BOARD_LX		32
#define BOARD_RX		46
#endif

#ifdef  COMPRESSED_DICT
#define DICT_FILE_RCMD	"compress -d < scrabbledict"
#define DICT_FILE_WCMD  "compress > scrabbledict"
#endif
#define DICT_FILE		"scrabbledict"

struct another_word {
	int startx;
	int starty;
	int dir;
	int length;
	int blankloc;
	int score;
	char letters[16];
};

struct plrlet {
	int x;
	int y;
	char letter;
	char blankchar;
	char oldlet;
	int tilepos;
};

typedef struct cm {
	struct cm *next;
	struct plrlet newlet[7];
	int placed;
	int dir;
	int score;
	int rms;
} compmove;

#define CM_SIZE		( sizeof( compmove ) )

typedef struct sc {
	struct sc *next;
	int score;
	int num;
} scoreent;

#define SC_SIZE		( sizeof( scoreent ) )

struct let_distrib {
	int tiles;
	int points;
};

typedef struct ss {
    int state;
    void (*function)();
} sstruct;

#define AWAIT_CONNECT	1
#define AWAIT_LOGIN		2
#define AWAIT_ARRIVE	3
#define IDLE_FOR_GAME	4
#define AWAIT_JOIN		5
#define AWAIT_FLIP		6
#define AWAIT_ME_JOIN	7
#define AWAIT_THEM_JOIN	8
#define START_GAME		9
#define THEIR_MOVE		10
#define CHECK_REALLY_OUT	11
#define CHECK_WORDS		12
#define INITIATE_CHALLENGE	13
#define AWAIT_PAUSE		14
#define AWAIT_RULING	15
#define AWAIT_WITHDRAW	16
#define AWAIT_ME_START_THEIR_CLOCK	17
#define MY_MOVE			18
#define AWAIT_ME_DONE_TURN	19
#define AWAIT_PASS		20
#define END_GAME		21
#define AWAIT_REMATCH	22

#define START_STATE		AWAIT_CONNECT
#define NUM_STATES		22

#define LOGFILE
