1 /*
2  * tbconfig.h
3  * (C) 2015 basil, all rights reserved,
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #ifndef TBCONFIG_H
25 #  define TBCONFIG_H
26 
27 /****************************************************************************/
28 /* BUILD CONFIG:                                                            */
29 /****************************************************************************/
30 
31 /*
32  * Define TB_NO_STDINT if you do not want to use <stdint.h> or it is not
33  * available.
34  */
35 /* #define TB_NO_STDINT */
36 
37 /*
38  * Define TB_NO_STDBOOL if you do not want to use <stdbool.h> or it is not
39  * available or unnecessary (e.g. C++).
40  */
41 /* #define TB_NO_STDBOOL */
42 
43 /*
44  * Define TB_NO_THREADS if your program is not multi-threaded.
45  */
46 /* #define TB_NO_THREADS */
47 #  define TB_HAVE_THREADS
48 
49 /*
50  * Define TB_NO_HELPER_API if you do not need the helper API.
51  */
52 /* #define TB_NO_HELPER_API */
53 
54 /***************************************************************************/
55 /* ENGINE INTEGRATION CONFIG                                               */
56 /***************************************************************************/
57 
58 /*
59  * If you are integrating tbprobe into an engine, you can replace some of
60  * tbprobe's built-in functionality with that already provided by the engine.
61  * This is OPTIONAL.  If no definition are provided then tbprobe will use its
62  * own internal defaults.  That said, for engines it is generally a good idea
63  * to avoid redundancy.
64  */
65 
66 #  include "chess.h"
67 #  include "data.h"
68 
69 /*
70  * Define TB_KING_ATTACKS(square) to return the king attacks bitboard for a
71  * king at `square'.
72  */
73 #  define TB_KING_ATTACKS(square)             KingAttacks(square)
74 
75 /*
76  * Define TB_KNIGHT_ATTACKS(square) to return the knight attacks bitboard for
77  * a knight at `square'.
78  */
79 #  define TB_KNIGHT_ATTACKS(square)           KnightAttacks(square)
80 
81 /*
82  * Define TB_ROOK_ATTACKS(square, occ) to return the rook attacks bitboard
83  * for a rook at `square' assuming the given `occ' occupancy bitboard.
84  */
85 #  define TB_ROOK_ATTACKS(square, occ)        RookAttacks(square, occ)
86 
87 /*
88  * Define TB_BISHOP_ATTACKS(square, occ) to return the bishop attacks bitboard
89  * for a bishop at `square' assuming the given `occ' occupancy bitboard.
90  */
91 #  define TB_BISHOP_ATTACKS(square, occ)      BishopAttacks(square, occ)
92 
93 /*
94  * Define TB_QUEEN_ATTACKS(square, occ) to return the queen attacks bitboard
95  * for a queen at `square' assuming the given `occ' occupancy bitboard.
96  * NOTE: If no definition is provided then tbprobe will use:
97  *       TB_ROOK_ATTACKS(square, occ) | TB_BISHOP_ATTACKS(square, occ)
98  */
99 #  define TB_QUEEN_ATTACKS(square, occ)       QueenAttacks(square, occ)
100 
101 /*
102  * Define TB_PAWN_ATTACKS(square, color) to return the pawn attacks bitboard
103  * for a `color' pawn at `square'.
104  * NOTE: This definition must work for pawns on ranks 1 and 8.  For example,
105  *       a white pawn on e1 attacks d2 and f2.  A black pawn on e1 attacks
106  *       nothing.  Etc.
107  * NOTE: This definition must not include en passant captures.
108  */
109 #  define TB_PAWN_ATTACKS(square, color)      PawnAttacks(color, square)
110 
111 #endif
112