And also renamed a loop variable while there.
No functional change.
for (Color c = WHITE; c <= BLACK; ++c)
for (PieceType pt = PAWN; pt <= KING; ++pt)
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)
StepAttacksBB[make_piece(c, pt)][s] |= to;
Bitboard pick_random(RKISS& rk, int booster) {
// 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;
Bitboard m = rk.rand<Bitboard>();
S( 25, 41), S( 25, 41), S(25, 41), S(25, 41) }
};
- // Outpost[PieceType][Square] contains bonuses of knights and bishops, indexed
- // by piece type and square (from white's point of view).
+ // Outpost[PieceType][Square] contains bonuses for knights and bishops outposts,
+ // indexed by piece type and square (from white's point of view).
const Value Outpost[][SQUARE_NB] = {
{
// A B C D E F G H
}
- // evaluate_outposts() evaluates bishop and knight outposts squares
+ // evaluate_outposts() evaluates bishop and knight outpost squares
template<PieceType Piece, Color Us>
Score evaluate_outposts(const Position& pos, EvalInfo& ei, Square s) {
// Add bonus according to type of attacked enemy piece and to the
// 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)
for (PieceType pt1 = KNIGHT; pt1 < KING; ++pt1)
{
/// 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
/// taking care not returning the ttMove if has already been searched previously.
template<>
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() {
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
// from the bitboards and scan for new X-ray attacks behind it.
}
-/// 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.
void Position::set_castling_flag(Color c, Square rfrom) {
}
-/// 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
-/// 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 {
return false;
// 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)
return false;
if (ci.checkSq[pt] & to)
st->checkersBB |= to;
- // Discovery checks
+ // Discovered checks
if (ci.dcCandidates && (ci.dcCandidates & from))
{
if (pt != ROOK)
RootMoves[i].insert_pv_in_tt(pos);
// 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.
if (Signals.stop)
break;
// 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
// 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).
bool Thread::available_to(const Thread* master) const {
// 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
-// 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.
void ThreadPool::init() {
struct ThreadPool : public std::vector<Thread*> {
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]); }
void read_uci_options();
int minThinkingTime = Options["Minimum Thinking Time"];
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;
optimumSearchTime = maximumSearchTime = limits.time[us];
#define TIMEMAN_H_INCLUDED
/// 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 {
public:
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
/// and so is a right shift of a signed integer.
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
-/// version, so use a faster code in this case that, although not 100% standard
-/// compliant it seems to work for Intel and MSVC.
+/// version. Therefore, in this case we use a faster code in this case that,
+/// although not 100% standard compliant it seems to work for Intel and MSVC.
#if defined(IS_64BIT) && (!defined(__GNUC__) || defined(__INTEL_COMPILER))
inline Value eg_value(Score s) { return Value(int16_t(s & 0xffff)); }