]> git.sesse.net Git - stockfish/blobdiff - src/position.cpp
Standardize Comments
[stockfish] / src / position.cpp
index 0d7d957141f31738c70ccbaf95c950b38e5c5693..ada371eb95151e5fba81205c83b1ab2b1a9db40d 100644 (file)
@@ -61,7 +61,7 @@ constexpr Piece Pieces[] = { W_PAWN, W_KNIGHT, W_BISHOP, W_ROOK, W_QUEEN, W_KING
 } // namespace
 
 
-/// operator<<(Position) returns an ASCII representation of the position
+// operator<<(Position) returns an ASCII representation of the position
 
 std::ostream& operator<<(std::ostream& os, const Position& pos) {
 
@@ -116,7 +116,7 @@ Key cuckoo[8192];
 Move cuckooMove[8192];
 
 
-/// Position::init() initializes at startup the various arrays used to compute hash keys
+// Position::init() initializes at startup the various arrays used to compute hash keys
 
 void Position::init() {
 
@@ -160,9 +160,9 @@ void Position::init() {
 }
 
 
-/// Position::set() initializes the position object with the given FEN string.
-/// This function is not very robust - make sure that input FENs are correct,
-/// this is assumed to be the responsibility of the GUI.
+// Position::set() initializes the position object with the given FEN string.
+// This function is not very robust - make sure that input FENs are correct,
+// this is assumed to be the responsibility of the GUI.
 
 Position& Position::set(const string& fenStr, bool isChess960, StateInfo* si, Thread* th) {
 /*
@@ -297,8 +297,8 @@ Position& Position::set(const string& fenStr, bool isChess960, StateInfo* si, Th
 }
 
 
-/// Position::set_castling_right() is a helper function used to set castling
-/// rights given the corresponding color and the rook starting square.
+// Position::set_castling_right() is a helper function used to set castling
+// rights given the corresponding color and the rook starting square.
 
 void Position::set_castling_right(Color c, Square rfrom) {
 
@@ -318,7 +318,7 @@ void Position::set_castling_right(Color c, Square rfrom) {
 }
 
 
-/// Position::set_check_info() sets king attacks to detect if a move gives check
+// Position::set_check_info() sets king attacks to detect if a move gives check
 
 void Position::set_check_info() const {
 
@@ -336,9 +336,9 @@ void Position::set_check_info() const {
 }
 
 
-/// Position::set_state() computes the hash keys of the position, and other
-/// data that once computed is updated incrementally as moves are made.
-/// The function is only used when a new position is set up
+// Position::set_state() computes the hash keys of the position, and other
+// data that once computed is updated incrementally as moves are made.
+// The function is only used when a new position is set up
 
 void Position::set_state() const {
 
@@ -372,9 +372,9 @@ void Position::set_state() const {
 }
 
 
-/// Position::set() is an overload to initialize the position object with
-/// the given endgame code string like "KBPKN". It is mainly a helper to
-/// get the material key out of an endgame code.
+// Position::set() is an overload to initialize the position object with
+// the given endgame code string like "KBPKN". It is mainly a helper to
+// get the material key out of an endgame code.
 
 Position& Position::set(const string& code, Color c, StateInfo* si) {
 
@@ -395,8 +395,8 @@ Position& Position::set(const string& code, Color c, StateInfo* si) {
 }
 
 
-/// Position::fen() returns a FEN representation of the position. In case of
-/// Chess960 the Shredder-FEN notation is used. This is mainly a debugging function.
+// Position::fen() returns a FEN representation of the position. In case of
+// Chess960 the Shredder-FEN notation is used. This is mainly a debugging function.
 
 string Position::fen() const {
 
@@ -444,9 +444,9 @@ string Position::fen() const {
   return ss.str();
 }
 
-/// update_slider_blockers() calculates st->blockersForKing[c] and st->pinners[~c],
-/// which store respectively the pieces preventing king of color c from being in check
-/// and the slider pieces of color ~c pinning pieces of color c to the king.
+// update_slider_blockers() calculates st->blockersForKing[c] and st->pinners[~c],
+// which store respectively the pieces preventing king of color c from being in check
+// and the slider pieces of color ~c pinning pieces of color c to the king.
 void Position::update_slider_blockers(Color c) const {
 
   Square ksq =  square<KING>(c);
@@ -474,8 +474,8 @@ void Position::update_slider_blockers(Color c) const {
 }
 
 
-/// Position::attackers_to() computes a bitboard of all pieces which attack a
-/// given square. Slider attacks use the occupied bitboard to indicate occupancy.
+// Position::attackers_to() computes a bitboard of all pieces which attack a
+// given square. Slider attacks use the occupied bitboard to indicate occupancy.
 
 Bitboard Position::attackers_to(Square s, Bitboard occupied) const {
 
@@ -488,7 +488,7 @@ Bitboard Position::attackers_to(Square s, Bitboard occupied) const {
 }
 
 
-/// Position::legal() tests whether a pseudo-legal move is legal
+// Position::legal() tests whether a pseudo-legal move is legal
 
 bool Position::legal(Move m) const {
 
@@ -532,7 +532,7 @@ bool Position::legal(Move m) const {
           if (attackers_to(s) & pieces(~us))
               return false;
 
-      // In case of Chess960, verify if the Rook blocks some checks
+      // In case of Chess960, verify if the Rook blocks some checks.
       // For instance an enemy queen in SQ_A1 when castling rook is in SQ_B1.
       return !chess960 || !(blockers_for_king(us) & to_sq(m));
   }
@@ -549,9 +549,9 @@ bool Position::legal(Move m) const {
 }
 
 
-/// Position::pseudo_legal() takes a random move and tests whether the move is
-/// pseudo-legal. It is used to validate moves from TT that can be corrupted
-/// due to SMP concurrent access or hash position key aliasing.
+// Position::pseudo_legal() takes a random move and tests whether the move is
+// pseudo-legal. It is used to validate moves from TT that can be corrupted
+// due to SMP concurrent access or hash position key aliasing.
 
 bool Position::pseudo_legal(const Move m) const {
 
@@ -622,7 +622,7 @@ bool Position::pseudo_legal(const Move m) const {
 }
 
 
-/// Position::gives_check() tests whether a pseudo-legal move gives a check
+// Position::gives_check() tests whether a pseudo-legal move gives a check
 
 bool Position::gives_check(Move m) const {
 
@@ -672,9 +672,9 @@ bool Position::gives_check(Move m) const {
 }
 
 
-/// Position::do_move() makes a move, and saves all information necessary
-/// to a StateInfo object. The move is assumed to be legal. Pseudo-legal
-/// moves should be filtered out before this function is called.
+// Position::do_move() makes a move, and saves all information necessary
+// to a StateInfo object. The move is assumed to be legal. Pseudo-legal
+// moves should be filtered out before this function is called.
 
 void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
 
@@ -870,8 +870,8 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
 }
 
 
-/// Position::undo_move() unmakes a move. When it returns, the position should
-/// be restored to exactly the same state as before the move was made.
+// Position::undo_move() unmakes a move. When it returns, the position should
+// be restored to exactly the same state as before the move was made.
 
 void Position::undo_move(Move m) {
 
@@ -934,8 +934,8 @@ void Position::undo_move(Move m) {
 }
 
 
-/// Position::do_castling() is a helper used to do/undo a castling move. This
-/// is a bit tricky in Chess960 where from/to squares can overlap.
+// Position::do_castling() is a helper used to do/undo a castling move. This
+// is a bit tricky in Chess960 where from/to squares can overlap.
 template<bool Do>
 void Position::do_castling(Color us, Square from, Square& to, Square& rfrom, Square& rto) {
 
@@ -965,8 +965,8 @@ void Position::do_castling(Color us, Square from, Square& to, Square& rfrom, Squ
 }
 
 
-/// Position::do_null_move() is used to do a "null move": it flips
-/// the side to move without executing any move on the board.
+// Position::do_null_move() is used to do a "null move": it flips
+// the side to move without executing any move on the board.
 
 void Position::do_null_move(StateInfo& newSt) {
 
@@ -1005,7 +1005,7 @@ void Position::do_null_move(StateInfo& newSt) {
 }
 
 
-/// Position::undo_null_move() must be used to undo a "null move"
+// Position::undo_null_move() must be used to undo a "null move"
 
 void Position::undo_null_move() {
 
@@ -1016,9 +1016,9 @@ void Position::undo_null_move() {
 }
 
 
-/// Position::key_after() computes the new hash key after the given move. Needed
-/// for speculative prefetch. It doesn't recognize special moves like castling,
-/// en passant and promotions.
+// Position::key_after() computes the new hash key after the given move. Needed
+// for speculative prefetch. It doesn't recognize special moves like castling,
+// en passant and promotions.
 
 Key Position::key_after(Move m) const {
 
@@ -1038,9 +1038,9 @@ Key Position::key_after(Move m) const {
 }
 
 
-/// Position::see_ge (Static Exchange Evaluation Greater or Equal) tests if the
-/// SEE value of move is greater or equal to the given threshold. We'll use an
-/// algorithm similar to alpha-beta pruning with a null window.
+// Position::see_ge (Static Exchange Evaluation Greater or Equal) tests if the
+// SEE value of move is greater or equal to the given threshold. We'll use an
+// algorithm similar to alpha-beta pruning with a null window.
 
 bool Position::see_ge(Move m, Value threshold) const {
 
@@ -1143,8 +1143,8 @@ bool Position::see_ge(Move m, Value threshold) const {
   return bool(res);
 }
 
-/// Position::is_draw() tests whether the position is drawn by 50-move rule
-/// or by repetition. It does not detect stalemates.
+// Position::is_draw() tests whether the position is drawn by 50-move rule
+// or by repetition. It does not detect stalemates.
 
 bool Position::is_draw(int ply) const {
 
@@ -1175,8 +1175,8 @@ bool Position::has_repeated() const {
 }
 
 
-/// Position::has_game_cycle() tests if the position has a move which draws by repetition,
-/// or an earlier position has a move that directly reaches the current position.
+// Position::has_game_cycle() tests if the position has a move which draws by repetition,
+// or an earlier position has a move that directly reaches the current position.
 
 bool Position::has_game_cycle(int ply) const {
 
@@ -1224,8 +1224,8 @@ bool Position::has_game_cycle(int ply) const {
 }
 
 
-/// Position::flip() flips position with the white and black sides reversed. This
-/// is only useful for debugging e.g. for finding evaluation symmetry bugs.
+// Position::flip() flips position with the white and black sides reversed. This
+// is only useful for debugging e.g. for finding evaluation symmetry bugs.
 
 void Position::flip() {
 
@@ -1259,9 +1259,9 @@ void Position::flip() {
 }
 
 
-/// Position::pos_is_ok() performs some consistency checks for the
-/// position object and raise an assert if something wrong is detected.
-/// This is meant to be helpful when debugging.
+// Position::pos_is_ok() performs some consistency checks for the
+// position object and raise an assert if something wrong is detected.
+// This is meant to be helpful when debugging.
 
 bool Position::pos_is_ok() const {