Add Game::is_dangerous() for Futility Pruning
[purplehaze.git] / src / pieces.cpp
blob35353bd7a292990f1ba676b3dd82600536f6bb6f
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/>.
17 #include "pieces.h"
19 Pieces::Pieces()
22 * Unused array entries should not be expected to remain equal to OUT
23 * during the game, but rather to the position of the previous piece
24 * pointing to the entry. But currently we use an extra instruction to
25 * set it to OUT whenever a piece is removed.
27 * Great care should be taken when updating the indexes counters
28 * to remain within 0 and 9 because no verifications are done in
29 * this class.
32 for (int i = 0; i < 2; ++i) {
33 total[i] = 0;
34 for (int j = 0; j < 7; ++j) {
35 nb_pieces[i][j] = 0;
36 for (int k = 0; k < 9; ++k) {
37 positions[i][j][k] = OUT;