Avoid misuse of StepAttacksBB for pawns

Make it explicit that first index of StepAttacksBB is a piece, not a piece type.

No functional change

Closes #1083
This commit is contained in:
snicolet
2017-04-25 17:57:30 -07:00
committed by Joona Kiiski
parent d06a8d0c18
commit 49a9d4cf99
2 changed files with 3 additions and 2 deletions

View File

@@ -117,7 +117,7 @@ namespace {
if ( distance(ksq[WHITE], ksq[BLACK]) <= 1
|| ksq[WHITE] == psq
|| ksq[BLACK] == psq
|| (us == WHITE && (StepAttacksBB[PAWN][psq] & ksq[BLACK])))
|| (us == WHITE && (StepAttacksBB[W_PAWN][psq] & ksq[BLACK])))
result = INVALID;
// Immediate win if a pawn can be promoted without getting captured
@@ -130,7 +130,7 @@ namespace {
// Immediate draw if it is a stalemate or a king captures undefended pawn
else if ( us == BLACK
&& ( !(StepAttacksBB[KING][ksq[us]] & ~(StepAttacksBB[KING][ksq[~us]] | StepAttacksBB[PAWN][psq]))
&& ( !(StepAttacksBB[KING][ksq[us]] & ~(StepAttacksBB[KING][ksq[~us]] | StepAttacksBB[W_PAWN][psq]))
|| (StepAttacksBB[KING][ksq[us]] & psq & ~StepAttacksBB[KING][ksq[~us]])))
result = DRAW;