/*	XLeScrabble v1.00
	init.c
	initialisation routines
	By csuos@warwick.ac.uk
*/

#include "scrab.h"
#include "globals.h"

char board[BOARDSIZE][BOARDSIZE];
char bag[BAGSIZE];
int bagptr = BAGSIZE-1;

scoreStat highscores[4][NUMHIGHSCORES];

int num_players;
playerStat player[MAXPLAYERS];/* for the coloured squares, and bonues */
int curr_player = 0;

/* 0 = normal square (green)
   1 = double letter (skyblue)
   2 = triple letter (dark blue)
   3 = double word (orange)
   4 = triple word (red)
*/

int sq_col[BOARDSIZE][BOARDSIZE] =
{
        {4,0,0,1,0,0,0,4,0,0,0,1,0,0,4},
        {0,3,0,0,0,2,0,0,0,2,0,0,0,3,0},
        {0,0,3,0,0,0,1,0,1,0,0,0,3,0,0},
        {1,0,0,3,0,0,0,1,0,0,0,3,0,0,1},
        {0,0,0,0,3,0,0,0,0,0,3,0,0,0,0},
        {0,2,0,0,0,2,0,0,0,2,0,0,0,2,0},
        {0,0,1,0,0,0,1,0,1,0,0,0,1,0,0},
        {4,0,0,1,0,0,0,3,0,0,0,1,0,0,4},
        {0,0,1,0,0,0,1,0,1,0,0,0,1,0,0},
        {0,2,0,0,0,2,0,0,0,2,0,0,0,2,0},
        {0,0,0,0,3,0,0,0,0,0,3,0,0,0,0},
        {1,0,0,3,0,0,0,1,0,0,0,3,0,0,1},
        {0,0,3,0,0,0,1,0,1,0,0,0,3,0,0},
        {0,3,0,0,0,2,0,0,0,2,0,0,0,3,0},
        {4,0,0,1,0,0,0,4,0,0,0,1,0,0,4}
};

int letterscore[NUMLETTERS] = LETTER_SCORES;

/* The dictionary */ 
char dict[DICTSIZE][16];
int word_pos[15];

/* the permutation lists */
short int perms[7][5040][7];
int numperms[7];

int norms[6][7] =
{
	{0,0,0,10,0,0,0},
	{0,0,5,20,5,0,0},
	{0,0,10,20,40,5,0},
	{20,40,60,80,100,10,5},
	{20,40,60,80,100,120,5},
	{20,40,60,80,100,120,60}
};
int norms_max[6] = {9,29,74,314,424,479};
/* sum of the normal distribution values -1 */

goStat bestgos[NUMGOSCORES];
