1
/* GNU Chess 5.0 - hung.c - hung piece evaluation code
2
Copyright (c) 1999-2002 Free Software Foundation, Inc.
4
GNU Chess is based on the two research programs
5
Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft.
7
GNU Chess is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2, or (at your option)
12
GNU Chess is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with GNU Chess; see the file COPYING. If not, write to
19
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
Boston, MA 02111-1307, USA.
24
cracraft@ai.mit.edu, cracraft@stanfordalumni.org, cracraft@earthlink.net
27
* Hung piece evaluation.
34
int EvalHung(int side)
35
/****************************************************************************
37
* Calculate the number of hung pieces for a side.
39
****************************************************************************/
41
BitBoard c, n, b, r, q;
48
n = (Ataks[xside][pawn] & board.b[side][knight]);
49
n |= (Ataks[xside][0] & board.b[side][knight] & ~Ataks[side][0]);
52
b = (Ataks[xside][pawn] & board.b[side][bishop]);
53
b |= (Ataks[xside][0] & board.b[side][bishop] & ~Ataks[side][0]);
56
r = Ataks[xside][pawn] | Ataks[xside][knight] | Ataks[xside][bishop];
57
r = (r & board.b[side][rook]);
58
r |= (Ataks[xside][0] & board.b[side][rook] & ~Ataks[side][0]);
61
q = Ataks[xside][pawn] | Ataks[xside][knight] | Ataks[xside][bishop] |
63
q = (q & board.b[side][queen]);
64
q |= (Ataks[xside][0] & board.b[side][queen] & ~Ataks[side][0]);
69
hunged[side] += nbits (c);
72
if (Ataks[xside][0] & board.b[side][king])
75
return (hunged[side]);