mirror of
https://github.com/sockspls/badfish
synced 2025-07-12 03:59:15 +00:00
Another round of spelling fixes
And also renamed a loop variable while there. No functional change.
This commit is contained in:
parent
13a73f67c0
commit
a8af78c833
11 changed files with 24 additions and 24 deletions
|
@ -198,9 +198,9 @@ void Bitboards::init() {
|
||||||
for (Color c = WHITE; c <= BLACK; ++c)
|
for (Color c = WHITE; c <= BLACK; ++c)
|
||||||
for (PieceType pt = PAWN; pt <= KING; ++pt)
|
for (PieceType pt = PAWN; pt <= KING; ++pt)
|
||||||
for (Square s = SQ_A1; s <= SQ_H8; ++s)
|
for (Square s = SQ_A1; s <= SQ_H8; ++s)
|
||||||
for (int k = 0; steps[pt][k]; ++k)
|
for (int i = 0; steps[pt][i]; ++i)
|
||||||
{
|
{
|
||||||
Square to = s + Square(c == WHITE ? steps[pt][k] : -steps[pt][k]);
|
Square to = s + Square(c == WHITE ? steps[pt][i] : -steps[pt][i]);
|
||||||
|
|
||||||
if (is_ok(to) && square_distance(s, to) < 3)
|
if (is_ok(to) && square_distance(s, to) < 3)
|
||||||
StepAttacksBB[make_piece(c, pt)][s] |= to;
|
StepAttacksBB[make_piece(c, pt)][s] |= to;
|
||||||
|
@ -256,7 +256,7 @@ namespace {
|
||||||
Bitboard pick_random(RKISS& rk, int booster) {
|
Bitboard pick_random(RKISS& rk, int booster) {
|
||||||
|
|
||||||
// Values s1 and s2 are used to rotate the candidate magic of a
|
// Values s1 and s2 are used to rotate the candidate magic of a
|
||||||
// quantity known to be the optimal to quickly find the magics.
|
// quantity known to be optimal to quickly find the magics.
|
||||||
int s1 = booster & 63, s2 = (booster >> 6) & 63;
|
int s1 = booster & 63, s2 = (booster >> 6) & 63;
|
||||||
|
|
||||||
Bitboard m = rk.rand<Bitboard>();
|
Bitboard m = rk.rand<Bitboard>();
|
||||||
|
|
|
@ -127,8 +127,8 @@ namespace {
|
||||||
S( 25, 41), S( 25, 41), S(25, 41), S(25, 41) }
|
S( 25, 41), S( 25, 41), S(25, 41), S(25, 41) }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Outpost[PieceType][Square] contains bonuses of knights and bishops, indexed
|
// Outpost[PieceType][Square] contains bonuses for knights and bishops outposts,
|
||||||
// by piece type and square (from white's point of view).
|
// indexed by piece type and square (from white's point of view).
|
||||||
const Value Outpost[][SQUARE_NB] = {
|
const Value Outpost[][SQUARE_NB] = {
|
||||||
{
|
{
|
||||||
// A B C D E F G H
|
// A B C D E F G H
|
||||||
|
@ -445,7 +445,7 @@ Value do_evaluate(const Position& pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// evaluate_outposts() evaluates bishop and knight outposts squares
|
// evaluate_outposts() evaluates bishop and knight outpost squares
|
||||||
|
|
||||||
template<PieceType Piece, Color Us>
|
template<PieceType Piece, Color Us>
|
||||||
Score evaluate_outposts(const Position& pos, EvalInfo& ei, Square s) {
|
Score evaluate_outposts(const Position& pos, EvalInfo& ei, Square s) {
|
||||||
|
@ -764,7 +764,7 @@ Value do_evaluate(const Position& pos) {
|
||||||
|
|
||||||
// Add bonus according to type of attacked enemy piece and to the
|
// Add bonus according to type of attacked enemy piece and to the
|
||||||
// type of attacking piece, from knights to queens. Kings are not
|
// type of attacking piece, from knights to queens. Kings are not
|
||||||
// considered because are already handled in king evaluation.
|
// considered because they are already handled in king evaluation.
|
||||||
if (weakEnemies)
|
if (weakEnemies)
|
||||||
for (PieceType pt1 = KNIGHT; pt1 < KING; ++pt1)
|
for (PieceType pt1 = KNIGHT; pt1 < KING; ++pt1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -284,7 +284,7 @@ void MovePicker::generate_next() {
|
||||||
|
|
||||||
|
|
||||||
/// next_move() is the most important method of the MovePicker class. It returns
|
/// next_move() is the most important method of the MovePicker class. It returns
|
||||||
/// a new pseudo legal move every time is called, until there are no more moves
|
/// a new pseudo legal move every time it is called, until there are no more moves
|
||||||
/// left. It picks the move with the biggest score from a list of generated moves
|
/// left. It picks the move with the biggest score from a list of generated moves
|
||||||
/// taking care not returning the ttMove if has already been searched previously.
|
/// taking care not returning the ttMove if has already been searched previously.
|
||||||
template<>
|
template<>
|
||||||
|
|
|
@ -188,7 +188,7 @@ namespace {
|
||||||
|
|
||||||
namespace Pawns {
|
namespace Pawns {
|
||||||
|
|
||||||
/// init() initializes some tables by formula instead of hard-code their values
|
/// init() initializes some tables by formula instead of hard-coding their values
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ Key Position::exclusion_key() const { return st->key ^ Zobrist::exclusion;}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// min_attacker() is an helper function used by see() to locate the least
|
// min_attacker() is a helper function used by see() to locate the least
|
||||||
// valuable attacker for the side to move, remove the attacker we just found
|
// valuable attacker for the side to move, remove the attacker we just found
|
||||||
// from the bitboards and scan for new X-ray attacks behind it.
|
// from the bitboards and scan for new X-ray attacks behind it.
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ void Position::set(const string& fenStr, bool isChess960, Thread* th) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Position::set_castling_flag() is an helper function used to set castling
|
/// Position::set_castling_flag() is a helper function used to set castling
|
||||||
/// flags given the corresponding color and the rook starting square.
|
/// flags given the corresponding color and the rook starting square.
|
||||||
|
|
||||||
void Position::set_castling_flag(Color c, Square rfrom) {
|
void Position::set_castling_flag(Color c, Square rfrom) {
|
||||||
|
@ -415,9 +415,9 @@ const string Position::pretty(Move move) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Position:hidden_checkers() returns a bitboard of all pinned / discovery check
|
/// Position:hidden_checkers() returns a bitboard of all pinned / discovered check
|
||||||
/// pieces, according to the call parameters. Pinned pieces protect our king and
|
/// pieces, according to the call parameters. Pinned pieces protect our king and
|
||||||
/// discovery check pieces attack the enemy king.
|
/// discovered check pieces attack the enemy king.
|
||||||
|
|
||||||
Bitboard Position::hidden_checkers(Square ksq, Color c, Color toMove) const {
|
Bitboard Position::hidden_checkers(Square ksq, Color c, Color toMove) const {
|
||||||
|
|
||||||
|
@ -536,7 +536,7 @@ bool Position::pseudo_legal(const Move m) const {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// We have already handled promotion moves, so destination
|
// We have already handled promotion moves, so destination
|
||||||
// cannot be on the 8/1th rank.
|
// cannot be on the 8th/1st rank.
|
||||||
if (rank_of(to) == RANK_8 || rank_of(to) == RANK_1)
|
if (rank_of(to) == RANK_8 || rank_of(to) == RANK_1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -873,7 +873,7 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI
|
||||||
if (ci.checkSq[pt] & to)
|
if (ci.checkSq[pt] & to)
|
||||||
st->checkersBB |= to;
|
st->checkersBB |= to;
|
||||||
|
|
||||||
// Discovery checks
|
// Discovered checks
|
||||||
if (ci.dcCandidates && (ci.dcCandidates & from))
|
if (ci.dcCandidates && (ci.dcCandidates & from))
|
||||||
{
|
{
|
||||||
if (pt != ROOK)
|
if (pt != ROOK)
|
||||||
|
|
|
@ -359,7 +359,7 @@ namespace {
|
||||||
RootMoves[i].insert_pv_in_tt(pos);
|
RootMoves[i].insert_pv_in_tt(pos);
|
||||||
|
|
||||||
// If search has been stopped break immediately. Sorting and
|
// If search has been stopped break immediately. Sorting and
|
||||||
// writing PV back to TT is safe becuase RootMoves is still
|
// writing PV back to TT is safe because RootMoves is still
|
||||||
// valid, although it refers to previous iteration.
|
// valid, although it refers to previous iteration.
|
||||||
if (Signals.stop)
|
if (Signals.stop)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -161,7 +161,7 @@ bool Thread::cutoff_occurred() const {
|
||||||
// thread 'master' at a split point. An obvious requirement is that thread must
|
// thread 'master' at a split point. An obvious requirement is that thread must
|
||||||
// be idle. With more than two threads, this is not sufficient: If the thread is
|
// be idle. With more than two threads, this is not sufficient: If the thread is
|
||||||
// the master of some split point, it is only available as a slave to the slaves
|
// the master of some split point, it is only available as a slave to the slaves
|
||||||
// which are busy searching the split point at the top of slaves split point
|
// which are busy searching the split point at the top of slave's split point
|
||||||
// stack (the "helpful master concept" in YBWC terminology).
|
// stack (the "helpful master concept" in YBWC terminology).
|
||||||
|
|
||||||
bool Thread::available_to(const Thread* master) const {
|
bool Thread::available_to(const Thread* master) const {
|
||||||
|
@ -181,7 +181,7 @@ bool Thread::available_to(const Thread* master) const {
|
||||||
|
|
||||||
// init() is called at startup to create and launch requested threads, that will
|
// init() is called at startup to create and launch requested threads, that will
|
||||||
// go immediately to sleep due to 'sleepWhileIdle' set to true. We cannot use
|
// go immediately to sleep due to 'sleepWhileIdle' set to true. We cannot use
|
||||||
// a c'tor becuase Threads is a static object and we need a fully initialized
|
// a c'tor because Threads is a static object and we need a fully initialized
|
||||||
// engine at this point due to allocation of Endgames in Thread c'tor.
|
// engine at this point due to allocation of Endgames in Thread c'tor.
|
||||||
|
|
||||||
void ThreadPool::init() {
|
void ThreadPool::init() {
|
||||||
|
|
|
@ -157,7 +157,7 @@ struct TimerThread : public ThreadBase {
|
||||||
struct ThreadPool : public std::vector<Thread*> {
|
struct ThreadPool : public std::vector<Thread*> {
|
||||||
|
|
||||||
void init(); // No c'tor and d'tor, threads rely on globals that should
|
void init(); // No c'tor and d'tor, threads rely on globals that should
|
||||||
void exit(); // be initialized and valid during the whole thread lifetime.
|
void exit(); // be initialized and are valid during the whole thread lifetime.
|
||||||
|
|
||||||
MainThread* main() { return static_cast<MainThread*>((*this)[0]); }
|
MainThread* main() { return static_cast<MainThread*>((*this)[0]); }
|
||||||
void read_uci_options();
|
void read_uci_options();
|
||||||
|
|
|
@ -108,7 +108,7 @@ void TimeManager::init(const Search::LimitsType& limits, int currentPly, Color u
|
||||||
int minThinkingTime = Options["Minimum Thinking Time"];
|
int minThinkingTime = Options["Minimum Thinking Time"];
|
||||||
int slowMover = Options["Slow Mover"];
|
int slowMover = Options["Slow Mover"];
|
||||||
|
|
||||||
// Initialize to maximum values but unstablePVExtraTime that is reset
|
// Initialize all to maximum values but unstablePVExtraTime that is reset
|
||||||
unstablePVExtraTime = 0;
|
unstablePVExtraTime = 0;
|
||||||
optimumSearchTime = maximumSearchTime = limits.time[us];
|
optimumSearchTime = maximumSearchTime = limits.time[us];
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#define TIMEMAN_H_INCLUDED
|
#define TIMEMAN_H_INCLUDED
|
||||||
|
|
||||||
/// The TimeManager class computes the optimal time to think depending on the
|
/// The TimeManager class computes the optimal time to think depending on the
|
||||||
/// maximum available time, the move game number and other parameters.
|
/// maximum available time, the game move number and other parameters.
|
||||||
|
|
||||||
class TimeManager {
|
class TimeManager {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -249,14 +249,14 @@ enum Score {
|
||||||
|
|
||||||
inline Score make_score(int mg, int eg) { return Score((mg << 16) + eg); }
|
inline Score make_score(int mg, int eg) { return Score((mg << 16) + eg); }
|
||||||
|
|
||||||
/// Extracting the signed lower and upper 16 bits it not so trivial because
|
/// Extracting the signed lower and upper 16 bits is not so trivial because
|
||||||
/// according to the standard a simple cast to short is implementation defined
|
/// according to the standard a simple cast to short is implementation defined
|
||||||
/// and so is a right shift of a signed integer.
|
/// and so is a right shift of a signed integer.
|
||||||
inline Value mg_value(Score s) { return Value(((s + 0x8000) & ~0xffff) / 0x10000); }
|
inline Value mg_value(Score s) { return Value(((s + 0x8000) & ~0xffff) / 0x10000); }
|
||||||
|
|
||||||
/// On Intel 64 bit we have a small speed regression with the standard conforming
|
/// On Intel 64 bit we have a small speed regression with the standard conforming
|
||||||
/// version, so use a faster code in this case that, although not 100% standard
|
/// version. Therefore, in this case we use a faster code in this case that,
|
||||||
/// compliant it seems to work for Intel and MSVC.
|
/// although not 100% standard compliant it seems to work for Intel and MSVC.
|
||||||
#if defined(IS_64BIT) && (!defined(__GNUC__) || defined(__INTEL_COMPILER))
|
#if defined(IS_64BIT) && (!defined(__GNUC__) || defined(__INTEL_COMPILER))
|
||||||
|
|
||||||
inline Value eg_value(Score s) { return Value(int16_t(s & 0xffff)); }
|
inline Value eg_value(Score s) { return Value(int16_t(s & 0xffff)); }
|
||||||
|
|
Loading…
Add table
Reference in a new issue