along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
-////
-//// Includes
-////
-
#include <cassert>
#include "bitboard.h"
-#include "square.h"
-
-
-////
-//// Local definitions
-////
+#include "types.h"
namespace {
bool is_legal() const;
bool is_immediate_draw() const;
bool is_immediate_win() const;
- Bitboard wk_attacks() const { return StepAttackBB[WK][whiteKingSquare]; }
- Bitboard bk_attacks() const { return StepAttackBB[BK][blackKingSquare]; }
- Bitboard pawn_attacks() const { return StepAttackBB[WP][pawnSquare]; }
+ Bitboard wk_attacks() const { return StepAttacksBB[WK][whiteKingSquare]; }
+ Bitboard bk_attacks() const { return StepAttacksBB[BK][blackKingSquare]; }
+ Bitboard pawn_attacks() const { return StepAttacksBB[WP][pawnSquare]; }
Square whiteKingSquare, blackKingSquare, pawnSquare;
Color sideToMove;
}
-////
-//// Functions
-////
-
void generate_kpk_bitbase(uint8_t bitbase[]) {
bool repeat;
&& pawnSquare == SQ_A7
&& (blackKingSquare == SQ_C7 || blackKingSquare == SQ_C8))
return true;
+
+ if ( whiteKingSquare == SQ_H8
+ && pawnSquare == SQ_H7
+ && (blackKingSquare == SQ_F7 || blackKingSquare == SQ_F8))
+ return true;
}
return false;
}
// white pawn can be promoted without getting captured.
return sideToMove == WHITE
&& square_rank(pawnSquare) == RANK_7
+ && whiteKingSquare != pawnSquare + DELTA_N
&& ( square_distance(blackKingSquare, pawnSquare + DELTA_N) > 1
|| bit_is_set(wk_attacks(), pawnSquare + DELTA_N));
}