Skip to content

Commit

Permalink
Remove redundant condition in is_dangerous()
Browse files Browse the repository at this point in the history
A pawn on 7th is always passed so retire
this redundant condition.

No funtional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
  • Loading branch information
mcostalba committed Jul 13, 2012
1 parent 6becc81 commit 6e5a334
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/search.cpp
Expand Up @@ -171,14 +171,10 @@ namespace {
// 'dangerous' moves so that we avoid to prune it.
FORCE_INLINE bool is_dangerous(const Position& pos, Move m, bool captureOrPromotion) {

// Test for a pawn pushed to 7th or a passed pawn move
if (type_of(pos.piece_moved(m)) == PAWN)
{
Color c = pos.side_to_move();
if ( relative_rank(c, to_sq(m)) == RANK_7
|| pos.pawn_is_passed(c, to_sq(m)))
return true;
}
// Test for a passed pawn move
if ( type_of(pos.piece_moved(m)) == PAWN
&& pos.pawn_is_passed(pos.side_to_move(), to_sq(m)))
return true;

// Test for a capture that triggers a pawn endgame
if ( captureOrPromotion
Expand Down

0 comments on commit 6e5a334

Please sign in to comment.