- // move_is_killer() checks if the given move is among the killer moves
-
- bool move_is_killer(Move m, SearchStack* ss) {
-
- if (ss->killers[0] == m || ss->killers[1] == m)
- return true;
-
- return false;
- }
-
-
- // extension() decides whether a move should be searched with normal depth,
- // or with extended depth. Certain classes of moves (checking moves, in
- // particular) are searched with bigger depth than ordinary moves and in
- // any case are marked as 'dangerous'. Note that also if a move is not
- // extended, as example because the corresponding UCI option is set to zero,
- // the move is marked as 'dangerous' so, at least, we avoid to prune it.
- template <NodeType PvNode>
- Depth extension(const Position& pos, Move m, bool captureOrPromotion, bool moveIsCheck,
- bool singleEvasion, bool mateThreat, bool* dangerous) {
-
- assert(m != MOVE_NONE);
-
- Depth result = DEPTH_ZERO;
- *dangerous = moveIsCheck | singleEvasion | mateThreat;
-
- if (*dangerous)
- {
- if (moveIsCheck && pos.see_sign(m) >= 0)
- result += CheckExtension[PvNode];
-
- if (singleEvasion)
- result += SingleEvasionExtension[PvNode];
-
- if (mateThreat)
- result += MateThreatExtension[PvNode];
- }
-
- if (pos.type_of_piece_on(move_from(m)) == PAWN)
- {
- Color c = pos.side_to_move();
- if (relative_rank(c, move_to(m)) == RANK_7)
- {
- result += PawnPushTo7thExtension[PvNode];
- *dangerous = true;
- }
- if (pos.pawn_is_passed(c, move_to(m)))
- {
- result += PassedPawnExtension[PvNode];
- *dangerous = true;
- }
- }
-
- if ( captureOrPromotion
- && pos.type_of_piece_on(move_to(m)) != PAWN
- && ( pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK)
- - pos.midgame_value_of_piece_on(move_to(m)) == VALUE_ZERO)
- && !move_is_promotion(m)
- && !move_is_ep(m))
- {
- result += PawnEndgameExtension[PvNode];
- *dangerous = true;
- }
-
- if ( PvNode
- && captureOrPromotion
- && pos.type_of_piece_on(move_to(m)) != PAWN
- && pos.see_sign(m) >= 0)
- {
- result += ONE_PLY / 2;
- *dangerous = true;
- }
-
- return Min(result, ONE_PLY);
- }
-
-