mirror of
https://github.com/sockspls/badfish
synced 2025-05-07 11:49:35 +00:00
Small code style tidy up
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
fa322b3768
commit
76381cbd69
3 changed files with 20 additions and 21 deletions
|
@ -233,7 +233,7 @@ int generate_checks(const Position& pos, MoveStack* mlist, Bitboard dc) {
|
||||||
|
|
||||||
/// generate_evasions() generates all check evasions when the side to move is
|
/// generate_evasions() generates all check evasions when the side to move is
|
||||||
/// in check. Unlike the other move generation functions, this one generates
|
/// in check. Unlike the other move generation functions, this one generates
|
||||||
/// only legal moves. It returns the number of generated moves. This
|
/// only legal moves. It returns the number of generated moves. This
|
||||||
/// function is very ugly, and needs cleaning up some time later. FIXME
|
/// function is very ugly, and needs cleaning up some time later. FIXME
|
||||||
|
|
||||||
int generate_evasions(const Position& pos, MoveStack* mlist) {
|
int generate_evasions(const Position& pos, MoveStack* mlist) {
|
||||||
|
@ -384,8 +384,8 @@ int generate_evasions(const Position& pos, MoveStack* mlist) {
|
||||||
|
|
||||||
|
|
||||||
/// generate_legal_moves() computes a complete list of legal moves in the
|
/// generate_legal_moves() computes a complete list of legal moves in the
|
||||||
/// current position. This function is not very fast, and should be used
|
/// current position. This function is not very fast, and should be used
|
||||||
/// only in situations where performance is unimportant. It wouldn't be
|
/// only in situations where performance is unimportant. It wouldn't be
|
||||||
/// very hard to write an efficient legal move generator, but for the moment
|
/// very hard to write an efficient legal move generator, but for the moment
|
||||||
/// we don't need it.
|
/// we don't need it.
|
||||||
|
|
||||||
|
@ -741,10 +741,10 @@ namespace {
|
||||||
b2 = b1 & TRank8BB;
|
b2 = b1 & TRank8BB;
|
||||||
while (b2)
|
while (b2)
|
||||||
{
|
{
|
||||||
to = pop_1st_bit(&b2);
|
to = pop_1st_bit(&b2);
|
||||||
(*mlist++).move = make_promotion_move(to - TDELTA_N, to, ROOK);
|
(*mlist++).move = make_promotion_move(to - TDELTA_N, to, ROOK);
|
||||||
(*mlist++).move = make_promotion_move(to - TDELTA_N, to, BISHOP);
|
(*mlist++).move = make_promotion_move(to - TDELTA_N, to, BISHOP);
|
||||||
(*mlist++).move = make_promotion_move(to - TDELTA_N, to, KNIGHT);
|
(*mlist++).move = make_promotion_move(to - TDELTA_N, to, KNIGHT);
|
||||||
}
|
}
|
||||||
b2 = b1 & ~TRank8BB;
|
b2 = b1 & ~TRank8BB;
|
||||||
while (b2)
|
while (b2)
|
||||||
|
@ -757,8 +757,8 @@ namespace {
|
||||||
b2 = (Us == WHITE ? (b1 & TRank3BB) << 8 : (b1 & TRank3BB) >> 8) & emptySquares;
|
b2 = (Us == WHITE ? (b1 & TRank3BB) << 8 : (b1 & TRank3BB) >> 8) & emptySquares;
|
||||||
while (b2)
|
while (b2)
|
||||||
{
|
{
|
||||||
to = pop_1st_bit(&b2);
|
to = pop_1st_bit(&b2);
|
||||||
(*mlist++).move = make_move(to - TDELTA_N - TDELTA_N, to);
|
(*mlist++).move = make_move(to - TDELTA_N - TDELTA_N, to);
|
||||||
}
|
}
|
||||||
return mlist;
|
return mlist;
|
||||||
}
|
}
|
||||||
|
@ -775,8 +775,8 @@ namespace {
|
||||||
// Find all friendly pawns not on the enemy king's file
|
// Find all friendly pawns not on the enemy king's file
|
||||||
Bitboard b1 = pos.pawns(Us) & ~file_bb(ksq), b2, b3;
|
Bitboard b1 = pos.pawns(Us) & ~file_bb(ksq), b2, b3;
|
||||||
|
|
||||||
// Discovered checks, single pawn pushes
|
// Discovered checks, single pawn pushes, no promotions
|
||||||
b2 = b3 = (Us == WHITE ? (b1 & dc) << 8 : (b1 & dc) >> 8) & ~TRank8BB & empty;
|
b2 = b3 = (Us == WHITE ? (b1 & dc) << 8 : (b1 & dc) >> 8) & empty & ~TRank8BB;
|
||||||
while (b3)
|
while (b3)
|
||||||
{
|
{
|
||||||
Square to = pop_1st_bit(&b3);
|
Square to = pop_1st_bit(&b3);
|
||||||
|
@ -793,8 +793,7 @@ namespace {
|
||||||
|
|
||||||
// Direct checks. These are possible only for pawns on neighboring files
|
// Direct checks. These are possible only for pawns on neighboring files
|
||||||
// of the enemy king
|
// of the enemy king
|
||||||
|
b1 &= (~dc & neighboring_files_bb(ksq));
|
||||||
b1 &= (~dc & neighboring_files_bb(ksq)); // FIXME why ~dc ??
|
|
||||||
|
|
||||||
// Direct checks, single pawn pushes
|
// Direct checks, single pawn pushes
|
||||||
b2 = (Us == WHITE ? b1 << 8 : b1 >> 8) & empty;
|
b2 = (Us == WHITE ? b1 << 8 : b1 >> 8) & empty;
|
||||||
|
|
|
@ -60,11 +60,11 @@ static bool RequestPending = false;
|
||||||
|
|
||||||
/// Constructors
|
/// Constructors
|
||||||
|
|
||||||
Position::Position(const Position &pos) {
|
Position::Position(const Position& pos) {
|
||||||
copy(pos);
|
copy(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
Position::Position(const std::string &fen) {
|
Position::Position(const std::string& fen) {
|
||||||
from_fen(fen);
|
from_fen(fen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ Position::Position(const std::string &fen) {
|
||||||
/// string. This function is not very robust - make sure that input FENs are
|
/// string. This function is not very robust - make sure that input FENs are
|
||||||
/// correct (this is assumed to be the responsibility of the GUI).
|
/// correct (this is assumed to be the responsibility of the GUI).
|
||||||
|
|
||||||
void Position::from_fen(const std::string &fen) {
|
void Position::from_fen(const std::string& fen) {
|
||||||
|
|
||||||
static const std::string pieceLetters = "KQRBNPkqrbnp";
|
static const std::string pieceLetters = "KQRBNPkqrbnp";
|
||||||
static const Piece pieces[] = { WK, WQ, WR, WB, WN, WP, BK, BQ, BR, BB, BN, BP };
|
static const Piece pieces[] = { WK, WQ, WR, WB, WN, WP, BK, BQ, BR, BB, BN, BP };
|
||||||
|
@ -1967,7 +1967,7 @@ Value Position::compute_non_pawn_material(Color c) const {
|
||||||
/// side to move is checkmated. Note that this function is currently very
|
/// side to move is checkmated. Note that this function is currently very
|
||||||
/// slow, and shouldn't be used frequently inside the search.
|
/// slow, and shouldn't be used frequently inside the search.
|
||||||
|
|
||||||
bool Position::is_mate() {
|
bool Position::is_mate() const {
|
||||||
|
|
||||||
if (is_check())
|
if (is_check())
|
||||||
{
|
{
|
||||||
|
|
|
@ -122,11 +122,11 @@ class Position {
|
||||||
public:
|
public:
|
||||||
// Constructors
|
// Constructors
|
||||||
Position() {};
|
Position() {};
|
||||||
Position(const Position &pos);
|
Position(const Position& pos);
|
||||||
Position(const std::string &fen);
|
Position(const std::string& fen);
|
||||||
|
|
||||||
// Text input/output
|
// Text input/output
|
||||||
void from_fen(const std::string &fen);
|
void from_fen(const std::string& fen);
|
||||||
const std::string to_fen() const;
|
const std::string to_fen() const;
|
||||||
void print(Move m = MOVE_NONE) const;
|
void print(Move m = MOVE_NONE) const;
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ public:
|
||||||
Value mg_pst_delta(Move m) const;
|
Value mg_pst_delta(Move m) const;
|
||||||
|
|
||||||
// Game termination checks
|
// Game termination checks
|
||||||
bool is_mate();
|
bool is_mate() const;
|
||||||
bool is_draw() const;
|
bool is_draw() const;
|
||||||
|
|
||||||
// Check if one side threatens a mate in one
|
// Check if one side threatens a mate in one
|
||||||
|
|
Loading…
Add table
Reference in a new issue