5 This file is part of Arrocco, which is Copyright 2007 Thomas Plick
6 (tomplick 'at' gmail.com).
8 Arrocco is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 Arrocco is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 const int EMPTY
= 0, PAWN
= 2, KNIGHT
= 4, BISHOP
= 6,
25 ROOK
= 8, QUEEN
= 10, KING
= 12;
27 const int pieceValues
[14] = {0, 0, 10, -10, 30, -30, 30, -30, 50, -50, 90, -90,
31 #define BLACK(x) (x+1)
33 inline bool isWhite(int x
){
34 return x
&& ((~x
) & 1);
37 inline bool isBlack(int x
){
42 inline int opponent(int x
){
46 int promoteTo(int pawn
, int piece
){
47 return (pawn
& 1) | piece
;
50 bool sameColor(int x
, int y
){
51 if (x
== 0 || y
== 0){
54 return !((x
^ y
) & 1);
58 bool sameColorNotZero(int x
, int y
){
59 return !((x
^ y
) & 1);