1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
/*
Sjeng - a chess variants playing program
Copyright (C) 2000 Gian-Carlo Pascutto
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
File: sjeng.h
Purpose: global definitions
*/
#ifndef SJENG_H
#define SJENG_H
#include "config.h"
#include <ctype.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#ifdef HAVE_SYS_TIMEB_H
#include <sys/timeb.h>
#endif
#define NDEBUG
#include <assert.h>
#define DIE (*(int *)(NULL) = 0)
/* GCP : my code uses WHITE=0 and BLACK=1 so reverse this */
#define WHITE 0
#define BLACK 1
#define ToMove (white_to_move ? 0 : 1)
#define NotToMove (white_to_move ? 1 : 0)
#define Hash(x,y) (hash ^= zobrist[(x)][(y)])
#define Crazyhouse 0
#define Bughouse 1
#define Normal 2
#define Suicide 3
#define Losers 4
#define Opening 0
#define Middlegame 1
#define Endgame 2
#define mindepth 2
/* define names for piece constants: */
#define frame 0
#define wpawn 1
#define bpawn 2
#define wknight 3
#define bknight 4
#define wking 5
#define bking 6
#define wrook 7
#define brook 8
#define wqueen 9
#define bqueen 10
#define wbishop 11
#define bbishop 12
#define npiece 13
/* result flags: */
#define no_result 0
#define stalemate 1
#define white_is_mated 2
#define black_is_mated 3
#define draw_by_fifty 4
#define draw_by_rep 5
/* arrays maybe ? */
#undef FASTCALC
#ifdef FASTCALC
#define rank(square) ((((square)-26)/12)+1)
#define file(square) ((((square)-26)%12)+1)
#else
#define rank(square) (rank[(square)])
#define file(square) (file[(square)])
#endif
#define diagl(square) (diagl[(square)])
#define diagr(square) (diagr[(square)])
#ifndef INPROBECODE
typedef enum {FALSE, TRUE} bool;
#endif
/* castle flags: */
#define no_castle 0
#define wck 1
#define wcq 2
#define bck 3
#define bcq 4
typedef struct {
int from;
int target;
int captured;
int promoted;
int castled;
int ep;
} move_s;
typedef struct {
int cap_num;
int was_promoted;
int epsq;
int fifty;
} move_x;
#if defined(HAVE_SYS_TIMEB_H) && (defined(HAVE_FTIME) || defined(HAVE_GETTIMEOFDAY))
typedef struct timeb rtime_t;
#else
typedef time_t rtime_t;
#endif
#define STR_BUFF 256
#define MOVE_BUFF 512
#define INF 1000000
#define PV_BUFF 300
#define AddMaterial(x) Material += material[(x)]
#define RemoveMaterial(x) Material -= material[(x)]
#define UPPER 1
#define LOWER 2
#define EXACT 3
#define HMISS 4
#define DUMMY 0
#define LOSS 0
#define WIN 1
#define DRAW 2
#define max(x, y) ((x) > (y) ? (x) : (y))
#define mix(x, y) ((x) < (y) ? (x) : (y))
#endif
|