~ubuntu-branches/ubuntu/edgy/pouetchess/edgy-updates

« back to all changes in this revision

Viewing changes to src/faile/faile.h

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc (mr_pouit)
  • Date: 2006-07-15 15:45:57 UTC
  • Revision ID: james.westby@ubuntu.com-20060715154557-3paxq02hx4od0wm4
Tags: upstream-0.2.0
ImportĀ upstreamĀ versionĀ 0.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
MIT License
 
3
 
 
4
Copyright (c) 2000 Adrien M. Regimbald
 
5
 
 
6
Permission is hereby granted, free of charge, to any person obtaining a copy
 
7
of this software and associated documentation files (the "Software"), to deal
 
8
in the Software without restriction, including without limitation the rights
 
9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
10
copies of the Software, and to permit persons to whom the Software is
 
11
furnished to do so, subject to the following conditions:
 
12
 
 
13
The above copyright notice and this permission notice shall be included in
 
14
all copies or substantial portions of the Software.
 
15
 
 
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
19
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 
22
SOFTWARE.
 
23
*/
 
24
 
 
25
/**************************************************
 
26
 * Faile version 1.4                              *
 
27
 * Author: Adrien Regimbald                       *
 
28
 * E-mail: adrien@ee.ualberta.ca                  *
 
29
 * Web Page: http://www.ee.ualberta.ca/~adrien/   *
 
30
 *                                                *
 
31
 * File: faile.h                                  *
 
32
 * Purpose: holds defines & typedefs for various  *
 
33
 * parts of the program.                          *
 
34
 **************************************************/
 
35
 
 
36
#ifndef FAILE_H
 
37
#define FAILE_H
 
38
 
 
39
 
 
40
#ifdef __cplusplus
 
41
extern "C"
 
42
{
 
43
#endif
 
44
 
 
45
/* #define ANSI */
 
46
 
 
47
#include <ctype.h>
 
48
#include <stdlib.h>
 
49
#include <stdio.h>
 
50
#include <string.h>
 
51
#include <time.h>
 
52
#include <limits.h>
 
53
 
 
54
#ifndef ANSI
 
55
#include <sys/types.h>
 
56
#include <sys/timeb.h>
 
57
#endif
 
58
 
 
59
#define NDEBUG
 
60
#include <assert.h>
 
61
 
 
62
 
 
63
#define maxdepth 30
 
64
#define mindepth 3
 
65
#define null_red 2
 
66
#define FALSE 0
 
67
#define TRUE 1
 
68
 
 
69
/* define names for piece constants: */
 
70
#define frame   0
 
71
#define wpawn   1
 
72
#define bpawn   2
 
73
#define wknight 3
 
74
#define bknight 4
 
75
#define wking   5
 
76
#define bking   6
 
77
#define wrook   7
 
78
#define brook   8
 
79
#define wqueen  9
 
80
#define bqueen  10
 
81
#define wbishop 11
 
82
#define bbishop 12
 
83
#define npiece  13
 
84
 
 
85
/* castle flags: */
 
86
#define no_castle  0
 
87
#define wck        1
 
88
#define wcq        2
 
89
#define bck        3
 
90
#define bcq        4
 
91
 
 
92
/* result flags: */
 
93
#define no_result      0
 
94
#define stalemate      1
 
95
#define white_is_mated 2
 
96
#define black_is_mated 3
 
97
#define draw_by_fifty  4
 
98
#define draw_by_rep    5
 
99
 
 
100
/* hash flags: */
 
101
#define no_info    0
 
102
#define avoid_null 1
 
103
#define exact      2
 
104
#define u_bound    3
 
105
#define l_bound    4
 
106
 
 
107
#define rank(square) ((((square)-26)/12)+1)
 
108
#define file(square) ((((square)-26)%12)+1)
 
109
 
 
110
 
 
111
typedef unsigned char s_int;
 
112
 
 
113
#ifndef __cplusplus
 
114
typedef s_int bool;
 
115
#endif
 
116
 
 
117
typedef struct {
 
118
  bool ep;
 
119
  s_int from;
 
120
  s_int target;
 
121
  s_int captured;
 
122
  s_int promoted;
 
123
  s_int castled;
 
124
  s_int cap_num;
 
125
} move_s;
 
126
 
 
127
typedef struct {
 
128
  unsigned long int x1;
 
129
  unsigned long int x2;
 
130
} d_long;
 
131
 
 
132
typedef struct {
 
133
  d_long hash;
 
134
  s_int depth;
 
135
  long int score;
 
136
  move_s move;
 
137
  s_int flag;
 
138
} hash_s;
 
139
 
 
140
typedef enum {p_none, p_pawn, p_K, p_Q, p_R, p_N, p_B} piece_t;
 
141
 
 
142
#ifndef ANSI
 
143
typedef struct timeb rtime_t;
 
144
#else
 
145
typedef time_t rtime_t;
 
146
#endif
 
147
 
 
148
#define STR_BUFF 256
 
149
#define MOVE_BUFF 200
 
150
#define INF 1000000
 
151
#define PV_BUFF 1000
 
152
#define HASH_MB 8
 
153
#define MAX_B_PLY 40
 
154
 
 
155
 
 
156
 
 
157
#ifdef __cplusplus
 
158
}
 
159
#endif
 
160
 
 
161
 
 
162
#endif
 
163