Signed-off-by: Marco Costalba <mcostalba@gmail.com>
- MovePicker::MovegenPhase PhaseTable[32];
int MainSearchPhaseIndex;
int EvasionsPhaseIndex;
int QsearchWithChecksPhaseIndex;
int MainSearchPhaseIndex;
int EvasionsPhaseIndex;
int QsearchWithChecksPhaseIndex;
+// Static array definition
+MovePicker::MovegenPhase MovePicker::PhaseTable[32];
+
/// class. It returns a new legal move every time it is called, until there
/// are no more moves left of the types we are interested in.
/// class. It returns a new legal move every time it is called, until there
/// are no more moves left of the types we are interested in.
-Move MovePicker::get_next_move(MovegenPhase* moveType) {
+Move MovePicker::get_next_move() {
// Next phase:
phaseIndex++;
// Next phase:
phaseIndex++;
- if (moveType)
- *moveType = PhaseTable[phaseIndex];
-
switch(PhaseTable[phaseIndex]) {
case PH_TT_MOVE:
switch(PhaseTable[phaseIndex]) {
case PH_TT_MOVE:
MovePicker(Position &p, bool pvnode, Move ttm, Move mk, Move k1, Move k2,
Depth dpth);
MovePicker(Position &p, bool pvnode, Move ttm, Move mk, Move k1, Move k2,
Depth dpth);
- Move get_next_move(MovegenPhase* moveType = NULL);
Move get_next_move(Lock &lock);
int number_of_moves() const;
int current_move_score() const;
Move get_next_move(Lock &lock);
int number_of_moves() const;
int current_move_score() const;
- Bitboard discovered_check_candidates();
+ MovegenPhase current_move_type() const;
+ Bitboard discovered_check_candidates() const;
static void init_phase_table();
static void init_phase_table();
Move ttMove, mateKiller, killer1, killer2;
Bitboard pinned, dc;
MoveStack moves[256], badCaptures[64];
Move ttMove, mateKiller, killer1, killer2;
Bitboard pinned, dc;
MoveStack moves[256], badCaptures[64];
+ static MovegenPhase PhaseTable[32];
bool pvNode;
Depth depth;
int phaseIndex;
bool pvNode;
Depth depth;
int phaseIndex;
/// all pieces which can possibly give discovered check. This bitboard is
/// computed by the constructor function.
/// all pieces which can possibly give discovered check. This bitboard is
/// computed by the constructor function.
-inline Bitboard MovePicker::discovered_check_candidates() {
+inline MovePicker::MovegenPhase MovePicker::current_move_type() const {
+ return PhaseTable[phaseIndex];
+}
+
+inline Bitboard MovePicker::discovered_check_candidates() const {
Value value, bestValue = -VALUE_INFINITE;
Bitboard dcCandidates = mp.discovered_check_candidates();
Value futilityValue = VALUE_NONE;
Value value, bestValue = -VALUE_INFINITE;
Bitboard dcCandidates = mp.discovered_check_candidates();
Value futilityValue = VALUE_NONE;
- MovePicker::MovegenPhase moveType;
bool isCheck = pos.is_check();
bool useFutilityPruning = UseFutilityPruning
&& depth < SelectiveDepth
bool isCheck = pos.is_check();
bool useFutilityPruning = UseFutilityPruning
&& depth < SelectiveDepth
// Loop through all legal moves until no moves remain or a beta cutoff
// occurs.
while ( bestValue < beta
// Loop through all legal moves until no moves remain or a beta cutoff
// occurs.
while ( bestValue < beta
- && (move = mp.get_next_move(&moveType)) != MOVE_NONE
+ && (move = mp.get_next_move()) != MOVE_NONE
&& !thread_should_stop(threadID))
{
assert(move_is_ok(move));
bool singleReply = (isCheck && mp.number_of_moves() == 1);
bool moveIsCheck = pos.move_is_check(move, dcCandidates);
&& !thread_should_stop(threadID))
{
assert(move_is_ok(move));
bool singleReply = (isCheck && mp.number_of_moves() == 1);
bool moveIsCheck = pos.move_is_check(move, dcCandidates);
- bool moveIsGoodCapture = (moveType == MovePicker::PH_GOOD_CAPTURES);
+ bool moveIsGoodCapture = (mp.current_move_type() == MovePicker::PH_GOOD_CAPTURES);
bool moveIsPassedPawnPush = pos.move_is_passed_pawn_push(move);
movesSearched[moveCount++] = ss[ply].currentMove = move;
bool moveIsPassedPawnPush = pos.move_is_passed_pawn_push(move);
movesSearched[moveCount++] = ss[ply].currentMove = move;