Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ryanhs/chess.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhs committed Aug 25, 2017
2 parents 3ec0052 + f421e94 commit 1efbef4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Chess.php
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ protected function generateMoves($options = [])
if ($this->board[$square]['color'] === $them) {
$addMove($us, $this->board, $moves, $i, $square, self::BITS['CAPTURE']);
}
} else if ($square == $this->epSquare) { // get epSquare from enemy
} else if ($square === $this->epSquare) { // get epSquare from enemy
$addMove($us, $this->board, $moves, $i, $this->epSquare, self::BITS['EP_CAPTURE']);
}
}
Expand Down
6 changes: 6 additions & 0 deletions test/PerftTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@ public function test6()
//~ $this->assertSame($chess->perft(3), 89890);
}

// Tests that square '0' cannot be confused for the EP square when EP square is null
public function test7()
{
$chess = new ChessPublicator('8/RPP5/8/3k4/5Bp1/6Pp/P4P1P/5K2 w - - 1 42');
$this->assertSame($chess->perft(1), 26);
}
}

0 comments on commit 1efbef4

Please sign in to comment.