Skip to content

Commit

Permalink
Big assorted spelling fixes
Browse files Browse the repository at this point in the history
No functional change.
  • Loading branch information
rklrkl authored and mcostalba committed Dec 2, 2013
1 parent 500b9b0 commit 13a73f6
Show file tree
Hide file tree
Showing 30 changed files with 265 additions and 249 deletions.
4 changes: 2 additions & 2 deletions Readme.md
Expand Up @@ -8,7 +8,7 @@ documentation for your GUI of choice for information about how to use
Stockfish with it.

This version of Stockfish supports up to 64 CPUs. The engine defaults
to one search thread it is therefore recommended to inspect the value of
to one search thread, so it is therefore recommended to inspect the value of
the *Threads* UCI parameter, and to make sure it equals the number of CPU
cores on your computer.

Expand Down Expand Up @@ -46,7 +46,7 @@ Stockfish has support for 32 or 64-bit CPUs, the hardware POPCNT
instruction, big-endian machines such as Power PC, and other platforms.

In general it is recommended to run `make help` to see a list of make
targets with corresponding descriptions. When not using Makefile to
targets with corresponding descriptions. When not using the Makefile to
compile (for instance with Microsoft MSVC) you need to manually
set/unset some switches in the compiler command line; see file *types.h*
for a quick reference.
Expand Down
4 changes: 2 additions & 2 deletions src/benchmark.cpp
Expand Up @@ -66,7 +66,7 @@ static const char* Defaults[] = {


/// benchmark() runs a simple benchmark by letting Stockfish analyze a set
/// of positions for a given limit each. There are five parameters; the
/// of positions for a given limit each. There are five parameters, the
/// transposition table size, the number of search threads that should
/// be used, the limit value spent for each position (optional, default is
/// depth 12), an optional file name where to look for positions in fen
Expand Down Expand Up @@ -150,7 +150,7 @@ void benchmark(const Position& current, istream& is) {
}
}

elapsed = Time::now() - elapsed + 1; // Assure positive to avoid a 'divide by zero'
elapsed = Time::now() - elapsed + 1; // Ensure positivity to avoid a 'divide by zero'

cerr << "\n==========================="
<< "\nTotal time (ms) : " << elapsed
Expand Down
4 changes: 2 additions & 2 deletions src/bitboard.cpp
Expand Up @@ -80,8 +80,8 @@ namespace {
}
}

/// lsb()/msb() finds the least/most significant bit in a nonzero bitboard.
/// pop_lsb() finds and clears the least significant bit in a nonzero bitboard.
/// lsb()/msb() finds the least/most significant bit in a non-zero bitboard.
/// pop_lsb() finds and clears the least significant bit in a non-zero bitboard.

#ifndef USE_BSFQ

Expand Down
4 changes: 2 additions & 2 deletions src/bitboard.h
Expand Up @@ -265,8 +265,8 @@ inline Bitboard attacks_bb(Piece p, Square s, Bitboard occ) {
}
}

/// lsb()/msb() finds the least/most significant bit in a nonzero bitboard.
/// pop_lsb() finds and clears the least significant bit in a nonzero bitboard.
/// lsb()/msb() finds the least/most significant bit in a non-zero bitboard.
/// pop_lsb() finds and clears the least significant bit in a non-zero bitboard.

#ifdef USE_BSFQ

Expand Down
8 changes: 4 additions & 4 deletions src/bitcount.h
Expand Up @@ -32,14 +32,14 @@ enum BitCountType {
CNT_HW_POPCNT
};

/// Determine at compile time the best popcount<> specialization according if
/// platform is 32 or 64 bits, to the maximum number of nonzero bits to count
/// and if hardware popcnt instruction is available.
/// Determine at compile time the best popcount<> specialization according to
/// whether the platform is 32 or 64 bits, to the maximum number of non-zero
/// bits to count and if the hardware popcnt instruction is available.
const BitCountType Full = HasPopCnt ? CNT_HW_POPCNT : Is64Bit ? CNT_64 : CNT_32;
const BitCountType Max15 = HasPopCnt ? CNT_HW_POPCNT : Is64Bit ? CNT_64_MAX15 : CNT_32_MAX15;


/// popcount() counts the number of nonzero bits in a bitboard
/// popcount() counts the number of non-zero bits in a bitboard
template<BitCountType> inline int popcount(Bitboard);

template<>
Expand Down
17 changes: 9 additions & 8 deletions src/book.cpp
Expand Up @@ -354,7 +354,7 @@ PolyglotBook::~PolyglotBook() { if (is_open()) close(); }


/// operator>>() reads sizeof(T) chars from the file's binary byte stream and
/// converts them in a number of type T. A Polyglot book stores numbers in
/// converts them into a number of type T. A Polyglot book stores numbers in
/// big-endian format.

template<typename T> PolyglotBook& PolyglotBook::operator>>(T& n) {
Expand Down Expand Up @@ -382,14 +382,15 @@ bool PolyglotBook::open(const char* fName) {
ifstream::open(fName, ifstream::in | ifstream::binary);

fileName = is_open() ? fName : "";
ifstream::clear(); // Reset any error flag to allow retry ifstream::open()
ifstream::clear(); // Reset any error flag to allow a retry ifstream::open()
return !fileName.empty();
}


/// probe() tries to find a book move for the given position. If no move is
/// found returns MOVE_NONE. If pickBest is true returns always the highest
/// rated move, otherwise randomly chooses one, based on the move score.
/// found, it returns MOVE_NONE. If pickBest is true, then it always returns
/// the highest-rated move, otherwise it randomly chooses one based on the
/// move score.

Move PolyglotBook::probe(const Position& pos, const string& fName, bool pickBest) {

Expand Down Expand Up @@ -426,10 +427,10 @@ Move PolyglotBook::probe(const Position& pos, const string& fName, bool pickBest
// bit 6-11: origin square (from 0 to 63)
// bit 12-14: promotion piece (from KNIGHT == 1 to QUEEN == 4)
//
// Castling moves follow "king captures rook" representation. So in case book
// move is a promotion we have to convert to our representation, in all the
// other cases we can directly compare with a Move after having masked out
// the special Move's flags (bit 14-15) that are not supported by PolyGlot.
// Castling moves follow the "king captures rook" representation. If a book
// move is a promotion, we have to convert it to our representation and in
// all other cases, we can directly compare with a Move after having masked
// out the special Move flags (bit 14-15) that are not supported by PolyGlot.
int pt = (move >> 12) & 7;
if (pt)
move = make<PROMOTION>(from_sq(move), to_sq(move), PieceType(pt + 1));
Expand Down
35 changes: 18 additions & 17 deletions src/endgame.cpp
Expand Up @@ -145,7 +145,7 @@ void Endgames::add(const string& code) {


/// Mate with KX vs K. This function is used to evaluate positions with
/// King and plenty of material vs a lone king. It simply gives the
/// king and plenty of material vs a lone king. It simply gives the
/// attacking side a bonus for driving the defending king towards the edge
/// of the board, and for keeping the distance between the two kings small.
template<>
Expand Down Expand Up @@ -187,9 +187,9 @@ Value Endgame<KBNK>::operator()(const Position& pos) const {
Square loserKSq = pos.king_square(weakSide);
Square bishopSq = pos.list<BISHOP>(strongSide)[0];

// kbnk_mate_table() tries to drive toward corners A1 or H8,
// if we have a bishop that cannot reach the above squares we
// flip the kings so to drive enemy toward corners A8 or H1.
// kbnk_mate_table() tries to drive toward corners A1 or H8, if we have a
// bishop that cannot reach the above squares we flip the kings in order
// to drive the enemy toward corners A8 or H1.
if (opposite_colors(bishopSq, SQ_A1))
{
winnerKSq = ~winnerKSq;
Expand Down Expand Up @@ -301,9 +301,10 @@ Value Endgame<KRKN>::operator()(const Position& pos) const {
}


/// KQ vs KP. In general, a win for the stronger side, however, there are a few
/// important exceptions. Pawn on 7th rank, A,C,F or H file, with king next can
/// be a draw, so we scale down to distance between kings only.
/// KQ vs KP. In general, this is a win for the stronger side, but there are a
/// few important exceptions. A pawn on 7th rank and on the A,C,F or H files
/// with a king positioned next to it can be a draw, so in that case, we only
/// use the distance between the kings.
template<>
Value Endgame<KQKP>::operator()(const Position& pos) const {

Expand Down Expand Up @@ -405,20 +406,20 @@ ScaleFactor Endgame<KBPsK>::operator()(const Position& pos) const {
return SCALE_FACTOR_DRAW;
}

// All pawns on same B or G file? Then potential draw
// If all the pawns are on the same B or G file, then it's potentially a draw
if ( (pawnFile == FILE_B || pawnFile == FILE_G)
&& !(pos.pieces(PAWN) & ~file_bb(pawnFile))
&& pos.non_pawn_material(weakSide) == 0
&& pos.count<PAWN>(weakSide) >= 1)
{
// Get weakSide pawn that is closest to home rank
// Get weakSide pawn that is closest to the home rank
Square weakPawnSq = backmost_sq(weakSide, pos.pieces(weakSide, PAWN));

Square strongKingSq = pos.king_square(strongSide);
Square weakKingSq = pos.king_square(weakSide);
Square bishopSq = pos.list<BISHOP>(strongSide)[0];

// Potential for a draw if our pawn is blocked on the 7th rank
// There's potential for a draw if our pawn is blocked on the 7th rank
// the bishop cannot attack it or they only have one pawn left
if ( relative_rank(strongSide, weakPawnSq) == RANK_7
&& (pos.pieces(strongSide, PAWN) & (weakPawnSq + pawn_push(weakSide)))
Expand All @@ -427,7 +428,7 @@ ScaleFactor Endgame<KBPsK>::operator()(const Position& pos) const {
int strongKingDist = square_distance(weakPawnSq, strongKingSq);
int weakKingDist = square_distance(weakPawnSq, weakKingSq);

// Draw if the weak king is on it's back two ranks, within 2
// It's a draw if the weak king is on its back two ranks, within 2
// squares of the blocking pawn and the strong king is not
// closer. (I think this rule only fails in practically
// unreachable positions such as 5k1K/6p1/6P1/8/8/3B4/8/8 w
Expand Down Expand Up @@ -473,7 +474,7 @@ ScaleFactor Endgame<KQKRPs>::operator()(const Position& pos) const {
/// probably be a good idea to add more knowledge in the future.
///
/// It would also be nice to rewrite the actual code for this function,
/// which is mostly copied from Glaurung 1.x, and not very pretty.
/// which is mostly copied from Glaurung 1.x, and isn't very pretty.
template<>
ScaleFactor Endgame<KRPKR>::operator()(const Position& pos) const {

Expand Down Expand Up @@ -760,8 +761,8 @@ ScaleFactor Endgame<KBPPKB>::operator()(const Position& pos) const {
switch (file_distance(psq1, psq2))
{
case 0:
// Both pawns are on the same file. Easy draw if defender firmly controls
// some square in the frontmost pawn's path.
// Both pawns are on the same file. It's an easy draw if the defender firmly
// controls some square in the frontmost pawn's path.
if ( file_of(ksq) == file_of(blockSq1)
&& relative_rank(strongSide, ksq) >= relative_rank(strongSide, blockSq1)
&& opposite_colors(ksq, wbsq))
Expand All @@ -770,9 +771,9 @@ ScaleFactor Endgame<KBPPKB>::operator()(const Position& pos) const {
return SCALE_FACTOR_NONE;

case 1:
// Pawns on adjacent files. Draw if defender firmly controls the square
// in front of the frontmost pawn's path, and the square diagonally behind
// this square on the file of the other pawn.
// Pawns on adjacent files. It's a draw if the defender firmly controls the
// square in front of the frontmost pawn's path, and the square diagonally
// behind this square on the file of the other pawn.
if ( ksq == blockSq1
&& opposite_colors(ksq, wbsq)
&& ( bbsq == blockSq2
Expand Down
12 changes: 6 additions & 6 deletions src/endgame.h
Expand Up @@ -64,9 +64,9 @@ enum EndgameType {
};


/// Endgame functions can be of two types according if return a Value or a
/// ScaleFactor. Type eg_fun<int>::type equals to either ScaleFactor or Value
/// depending if the template parameter is 0 or 1.
/// Endgame functions can be of two types depending on whether they return a
/// Value or a ScaleFactor. Type eg_fun<int>::type returns either ScaleFactor
/// or Value depending on whether the template parameter is 0 or 1.

template<int> struct eg_fun { typedef Value type; };
template<> struct eg_fun<1> { typedef ScaleFactor type; };
Expand Down Expand Up @@ -95,9 +95,9 @@ struct Endgame : public EndgameBase<T> {
};


/// Endgames class stores in two std::map the pointers to endgame evaluation
/// and scaling base objects. Then we use polymorphism to invoke the actual
/// endgame function calling its operator() that is virtual.
/// The Endgames class stores the pointers to endgame evaluation and scaling
/// base objects in two std::map typedefs. We then use polymorphism to invoke
/// the actual endgame function by calling its virtual operator().

class Endgames {

Expand Down

0 comments on commit 13a73f6

Please sign in to comment.