/// generate_non_capture_checks() generates all pseudo-legal non-captures and knight
/// underpromotions that give check. Returns a pointer to the end of the move list.
-MoveStack* generate_non_capture_checks(const Position& pos, MoveStack* mlist, Bitboard dc) {
+MoveStack* generate_non_capture_checks(const Position& pos, MoveStack* mlist) {
assert(pos.is_ok());
assert(!pos.is_check());
Color us = pos.side_to_move();
Square ksq = pos.king_square(opposite_color(us));
+ Bitboard dc = pos.discovered_check_candidates(us);
assert(pos.piece_on(ksq) == piece_of_color_and_type(opposite_color(us), KING));
extern MoveStack* generate_captures(const Position& pos, MoveStack* mlist);
extern MoveStack* generate_noncaptures(const Position& pos, MoveStack* mlist);
-extern MoveStack* generate_non_capture_checks(const Position& pos, MoveStack* mlist, Bitboard dc);
+extern MoveStack* generate_non_capture_checks(const Position& pos, MoveStack* mlist);
extern MoveStack* generate_evasions(const Position& pos, MoveStack* mlist);
extern MoveStack* generate_moves(const Position& pos, MoveStack* mlist, bool pseudoLegal = false);
extern bool move_is_legal(const Position& pos, const Move m, Bitboard pinned);
} else
ttMoves[1].move = killers[0].move = killers[1].move = MOVE_NONE;
- Color us = pos.side_to_move();
-
- dc = p.discovered_check_candidates(us);
- pinned = p.pinned_pieces(us);
+ pinned = p.pinned_pieces(pos.side_to_move());
if (p.is_check())
phasePtr = EvasionsPhaseTable;
case PH_QCHECKS:
// Perhaps we should order moves move here? FIXME
- lastMove = generate_non_capture_checks(pos, moves, dc);
+ lastMove = generate_non_capture_checks(pos, moves);
return;
case PH_STOP:
Move get_next_move();
Move get_next_move(Lock& lock);
int number_of_evasions() const;
- Bitboard discovered_check_candidates() const;
private:
void score_captures();
int phase;
const uint8_t* phasePtr;
MoveStack *curMove, *lastMove, *lastBadCapture;
- Bitboard dc, pinned;
+ Bitboard pinned;
MoveStack moves[256], badCaptures[64];
};
return int(lastMove - moves);
}
-/// MovePicker::discovered_check_candidates() returns a bitboard containing
-/// all pieces which can possibly give discovered check. This bitboard is
-/// computed by the constructor function.
-
-inline Bitboard MovePicker::discovered_check_candidates() const {
- return dc;
-}
-
#endif // !defined(MOVEPICK_H_INCLUDED)
MoveStack mlist[120];
bool result = false;
- Bitboard dc = discovered_check_candidates(sideToMove);
Bitboard pinned = pinned_pieces(sideToMove);
// Generate pseudo-legal non-capture and capture check moves
- MoveStack* last = generate_non_capture_checks(*this, mlist, dc);
+ MoveStack* last = generate_non_capture_checks(*this, mlist);
last = generate_captures(*this, last);
// Loop through the moves, and see if one of them is mate
{
Move move;
MovePicker mp = MovePicker(pos, MOVE_NONE, depth, H);
- Bitboard dcCandidates = mp.discovered_check_candidates();
+ Bitboard dcCandidates = pos.discovered_check_candidates(pos.side_to_move());
int sum = 0;
// If we are at the last ply we don't need to do and undo
bool mateThreat = pos.has_mate_threat(opposite_color(us));
MovePicker mp = MovePicker(pos, ttMove, depth, H, &ss[ply]);
- Bitboard dcCandidates = mp.discovered_check_candidates();
+ Bitboard dcCandidates = pos.discovered_check_candidates(us);
// Loop through all legal moves until no moves remain or a beta cutoff
// occurs.
Move move, movesSearched[256];
int moveCount = 0;
Value value, bestValue = -VALUE_INFINITE;
- Bitboard dcCandidates = mp.discovered_check_candidates();
+ Color us = pos.side_to_move();
+ Bitboard dcCandidates = pos.discovered_check_candidates(us);
Value futilityValue = VALUE_NONE;
bool useFutilityPruning = depth < SelectiveDepth
&& !isCheck;
MovePicker mp = MovePicker(pos, ttMove, depth, H);
Move move;
int moveCount = 0;
- Bitboard dcCandidates = mp.discovered_check_candidates();
Color us = pos.side_to_move();
+ Bitboard dcCandidates = pos.discovered_check_candidates(us);
bool enoughMaterial = pos.non_pawn_material(us) > RookValueMidgame;
// Loop through the moves until no moves remain or a beta cutoff