Skip to content

Commit

Permalink
Fix pawn double-step move validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ianfab committed Aug 20, 2019
1 parent aab6f77 commit 05d1624
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/movegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ namespace {
if (dcCandidateQuiets)
{
Bitboard dc1 = shift<Up>(dcCandidateQuiets) & emptySquares & ~file_bb(ksq);
Bitboard dc2 = shift<Up>(dc1 & TRank3BB) & emptySquares;
Bitboard dc2 = pos.double_step_enabled() ? shift<Up>(dc1 & TRank3BB) & emptySquares : Bitboard(0);

b1 |= dc1;
b2 |= dc2;
Expand Down
4 changes: 2 additions & 2 deletions src/position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,8 +920,8 @@ bool Position::pseudo_legal(const Move m) const {
if ( !(attacks_from<PAWN>(us, from) & pieces(~us) & to) // Not a capture
&& !((from + pawn_push(us) == to) && empty(to)) // Not a single push
&& !( (from + 2 * pawn_push(us) == to) // Not a double push
&& (rank_of(from) == relative_rank(us, double_step_rank())
|| (first_rank_double_steps() && rank_of(from) == relative_rank(us, RANK_1)))
&& (rank_of(from) == relative_rank(us, double_step_rank(), max_rank())
|| (first_rank_double_steps() && rank_of(from) == relative_rank(us, RANK_1, max_rank())))
&& empty(to)
&& empty(to - pawn_push(us))
&& double_step_enabled()))
Expand Down

0 comments on commit 05d1624

Please sign in to comment.