1 /* Copyright (C) 2007-2011 Vincent Ollivier
3 * Purple Haze is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * Purple Haze is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 Square positions
[2][7][9];
29 unsigned char nb_pieces
[2][7];
30 unsigned char total
[2];
34 Square
get_position(Piece p
) const {
35 return positions
[p
.get_color()][p
.get_type()][p
.get_index()];
37 Square
get_position(Color c
, PieceType t
, int i
) const {
38 assert(0 <= i
&& i
< 9);
39 return positions
[c
][t
][i
];
41 void set_position(Piece p
, Square s
) {
42 positions
[p
.get_color()][p
.get_type()][p
.get_index()] = s
;
44 void set_position(Color c
, PieceType t
, int i
, Square s
) {
45 assert(0 <= i
&& i
< 9);
46 positions
[c
][t
][i
] = s
;
48 unsigned char count(Color c
, PieceType t
) const {
49 return nb_pieces
[c
][t
];
51 unsigned char count(Color c
) const {
55 // FIXME? No warning if nb < 0 or nb > 9
56 void inc_nb_pieces(Color c
, PieceType t
) {
60 void dec_nb_pieces(Color c
, PieceType t
) {
66 #endif /* !PIECESL_H */