/*
 * Copyright 1996 by Michel D. Grimminck
 *
 * All Rights Reserved
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose and without fee is hereby granted,
 * provided that the above copyright notice appear in all copies and that
 * both that copyright notice and this permission notice appear in
 * supporting documentation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

/* global variables */

#include "const.h"
#ifndef POS
#define POS
#endif

POS int lmap[10][10];
POS char next[2][93][4];
POS BTYPE board[93],blocked[93];
POS int pieces[8];
POS char promote[2][93];
POS char movelist[MAXPLY][MAXNM][MOVEL];
POS char killer [MAXPLY][MOVEL];
POS struct _movescore {
    char move[MOVEL];
    int value;
    } movescore[MAXNM];
POS struct _tpat
{
  char board[50];
  int use_succes;
  int use_fail;
  int nmoves;
  char movelist[12][32];
} tpat[NPAT];

POS int tomove;

POS int nsort,neval,ngen,ndat,nmat,nmovelist,nquiet,nquietfail,precount,dbfail,pat_try,pat_found,pat_succes;
POS char workdir[256]=WORKDIR;
POS char version[128]=VERSION;
POS char PV[MPV][MPV][MOVEL];
POS int maxpv=7;
POS int deval[MAXPLY];
POS int quiescence=true;
POS int do_order=true;
POS int do_res=true;
POS unsigned char *database[4096];
POS int db_usage[4096];
POS int use_db=true;
POS struct _hashentry {
    unsigned int hashkey;
    int min_score;
    int max_score;
    unsigned char board[18];
    char flags;
    char move[2];
    short int depth;
    } transpos[NHASH];
POS struct _evalcache {
    unsigned int hashkey;
    unsigned char board[18];
    int score;
  } evalcache[MAXEVAL];
POS int tablesize=NHASH;
POS int use_hash=true;
POS int inhash,outhash,ineval,outeval;
POS int hash_rnd[50][6];
POS int eval_type=NORMAL;
POS int pattern_use[49];
POS int default_search=800000;
POS int default_eval=0,stage=0;
POS unsigned int history[MAXPLY+1][150][20];
POS int invmap[93] ={
        -1, -1, -1, -1, -1, -1, -1,
          -1, -1, -1, -1, -1, -1,
        -1,  0,  1,  2,  3,  4, -1,
           5,  6,  7,  8,  9, -1,
        -1, 10, 11, 12, 13, 14, -1,
          15, 16, 17, 18, 19, -1,
        -1, 20, 21, 22, 23, 24, -1,
          25, 26, 27, 28, 29, -1,
        -1, 30, 31, 32, 33, 34, -1,
          35, 36, 37, 38, 39, -1,
        -1, 40, 41, 42, 43, 44, -1,
          45, 46, 47, 48, 49, -1,
        -1, -1, -1, -1, -1, -1, -1,
      -1, -1, -1, -1, -1, -1, -1,-1

      };
POS int progress[50]={
         9,   9,   9,   9,   9,
       8,   8,   8,   8,   8,
         7,   7,   7,   7,   7,
       6,   6,   6,   6,   6,
         5,   5,   5,   5,   5,
       4,   4,   4,   4,   4,
         3,   3,   3,   3,   3,
       2,   2,   2,   2,   2,
         1,   1,   1,   1,   1,
       0,   0,   0,   0,   0
       };
POS int map[50],reverse_map[50],reverse_color[16];
POS int kill_method=PROBKILL;
POS double test_nr=0,test_e=0,test_e2=0;
POS double test_t=0,test_t2=0;
POS char pdnfile[100]={""},dcpfile[100]={""};
POS int search_min,search_max;
POS float perc=1.0;
POS char ref_board[MAXREF][50];
POS char ref_move[MAXREF][MOVEL];
POS int ref_nr=0;
POS int selective=true;
POS int predeepning=300;
POS int usexv=false;
POS int usecol=true;
/* mailplay timers */
POS float time_left[2]={0,0};
POS float time_incr=0;
POS int timecontrolply=130;
POS float time_reserve=0;
POS float operator_time=5;

POS struct _game_history {
    unsigned char board[25];
    char move[MOVEL];
    char comment[MAXCOMMENT];
} game_history[200];
POS int game_history_nr=0;

POS struct _pdn_info {
    char whitepl[100];
    char blackpl[100];
    char event[100];
    char date[100];
    char site[100];
    char result[100];
} pdn_info;

#ifdef notdef
int parameters[100]={0, 3, 0, 14, 12, 30, 32, -25, 30};
int parameters[100]={0, 3, 2, 14, 16, 30, 20, -24, 59};
int parameters[100]={0,  5,  8, 14,  0, 30, 20,-31, 67, 20, 49, 80, 12, 64, 0, 0, 0}; /* inital values */
int    param_a[100]={0, 20, 10, 20, 30, 15,  6, 49, 62,  0, 87, 37,  7, 33,-16, 25,-91};
int    param_b[100]={0, 20, 10, 10, 30, 15,  6, 49, 62,  0, 87, 37,  7, 33,  4, 25,-91};
int    param_c[100]={0, 20, 10,  0, 30, 15,  6, 49, 62,  0, 87, 43,  7, 33, 30, 25,-91};
int    param_a[100]={0, 20, 10, 20, 20, 15,  6, 49, 30,  15, 87, 37,  7, 40,-16, 25,-91};
int    param_b[100]={0, 20, 10, 10, 20, 15,  6, 49, 30,  15, 87, 37,  7, 13,  4, 25,-91};
int    param_c[100]={0, 20, 10,  0, 20, 15,  6, 49, 30,  15, 87, 43,  7, 13, 40, 25,-91};
#endif
/*                   0, 22,  5,  8, 10,  0,  0,  0,  0,   0, 20, 62,  3, 20,  0, 28,  0*/
POS int    param_a[100]={0, 8,  5,  3, 10,  9, 10,  0, 10,  60, 20, 40,  3, 20, 10, 30,  2};
POS int    param_b[100]={0, 8,  5,  8, 10, 14, 10,  0, 10,  60, 20, 32,  3, 20, 34, 28,  4};
POS int    param_c[100]={0, 8,  4,  8,  2, 22, 10,  0, 10,  60, 30, 25,  3,  0, 70, 25,  8};

POS int parameters[100]={0, 70,-19,-78, 30, -1, -1, 69,-52,-23, 87,-37,  7, 33,-16, 25,-91}; /* 186/384 stage b at 5 ply */









