Skip to content

Commit

Permalink
Remove comment prefix & Remove unnecessary comments
Browse files Browse the repository at this point in the history
Signed-off-by: yjf2002ghty <[email protected]>
  • Loading branch information
yjf2002ghty committed Nov 29, 2024
1 parent d8b28d9 commit 289bc68
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/endgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Value Endgame<KPK>::operator()(const Position& pos) const {
Color us = strongSide == pos.side_to_move() ? WHITE : BLACK;

// Non-standard promotion, evaluation unclear
/// yjf2002ghty: Since KPK means King-Pawn vs. King Endgame, I assume the piece type is PAWN. It can cause problems if the pawn is something else (e.g. Custom pawn piece)
/// Since KPK means King-Pawn vs. King Endgame, the piece type is assumed to be PAWN. It can cause problems if the pawn is something else (e.g. Custom pawn piece)
if ( pos.promotion_zone(us, PAWN) != rank_bb(relative_rank(us, RANK_8, pos.max_rank()))
|| RANK_MAX != RANK_8
|| !(pos.promotion_piece_types(us) & QUEEN))
Expand Down Expand Up @@ -938,7 +938,7 @@ ScaleFactor Endgame<KPKP>::operator()(const Position& pos) const {

// Probe the KPK bitbase with the weakest side's pawn removed. If it's a draw,
// it's probably at least a draw even with the pawn.
/// yjf2002ghty: Since KPKP means King-Pawn vs. King-Pawn Endgame, I assume the piece type is PAWN. It can cause problems if the pawn is something else (e.g. Custom pawn piece)
/// Since KPKP means King-Pawn vs. King-Pawn Endgame, the piece type is assumed to PAWN. It can cause problems if the pawn is something else (e.g. Custom pawn piece)
if ( pos.promotion_zone(us, PAWN) != rank_bb(relative_rank(us, RANK_8, pos.max_rank()))
|| RANK_MAX != RANK_8
|| !(pos.promotion_piece_types(us) & QUEEN))
Expand Down
2 changes: 1 addition & 1 deletion src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ namespace {
bool pawnsOnly = !(pos.pieces(Us) ^ pos.pieces(Us, PAWN));

// Early exit if, for example, both queens or 6 minor pieces have been exchanged
/// yjf2002ghty: By default double step is used for pawns in enhancing opening evaluation, so I assume the piece type is PAWN. It can cause problems if the pawn is something else (e.g. Custom pawn piece)
/// By default double step is used for pawns in enhancing opening evaluation, so the piece type is assumed to be PAWN. It can cause problems if the pawn is something else (e.g. Custom pawn piece)
if (pos.non_pawn_material() < SpaceThreshold && !pawnsOnly && pos.double_step_region(Us, PAWN))
return SCORE_ZERO;

Expand Down
6 changes: 3 additions & 3 deletions src/movegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ namespace {
constexpr Direction UpRight = (Us == WHITE ? NORTH_EAST : SOUTH_WEST);
constexpr Direction UpLeft = (Us == WHITE ? NORTH_WEST : SOUTH_EAST);

/// yjf2002ghty: Since it's generate_pawn_moves, I assume the piece type is PAWN. It can cause problems if the pawn is something else (e.g. Custom pawn piece)
/// Since it's generate_pawn_moves, the piece type is assumed to be PAWN. It can cause problems if the pawn is something else (e.g. Custom pawn piece)
const Bitboard promotionZone = pos.promotion_zone(Us, PAWN);
const Bitboard standardPromotionZone = pos.sittuyin_promotion() ? Bitboard(0) : promotionZone;
/// yjf2002ghty: Since it's generate_pawn_moves, I assume the piece type is PAWN. It can cause problems if the pawn is something else (e.g. Custom pawn piece)
/// Since it's generate_pawn_moves, the piece type is assumed to be PAWN. It can cause problems if the pawn is something else (e.g. Custom pawn piece)
const Bitboard doubleStepRegion = pos.double_step_region(Us, PAWN);
/// yjf2002ghty: Since it's generate_pawn_moves, I assume the piece type is PAWN. It can cause problems if the pawn is something else (e.g. Custom pawn piece)
/// Since it's generate_pawn_moves, the piece type is assumed to be PAWN. It can cause problems if the pawn is something else (e.g. Custom pawn piece)
const Bitboard tripleStepRegion = pos.triple_step_region(Us, PAWN);

const Bitboard pawns = pos.pieces(Us, PAWN);
Expand Down
2 changes: 0 additions & 2 deletions src/movegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ namespace Stockfish {
class Position;

enum GenType {
/// yjf2002ghty: I think it's better to add some explanations here so that new developers can understand what these means, as some of the terms connot be found in chessprogramming wiki. I'm not sure if my explanations are correct. If there are anything wrong, please point it out.

//Moves that a piece is removed from the board as part of the completion of the move
CAPTURES,
//Moves which do not alter material, thus no captures nor promotions
Expand Down
1 change: 0 additions & 1 deletion src/position.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ inline Bitboard Position::promotion_zone(Piece p) const {

inline Square Position::promotion_square(Color c, Square s) const {
assert(var != nullptr);
/// yjf2002ghty: I'm not clear what Square s means, whether it refers to a square of a piece or it can refer to any square. I assume it means a square of a piece which can excute piece_on(s)
Piece p = piece_on(s);
Bitboard b = ((p == NO_PIECE) ? Bitboard(0) : promotion_zone(p)) & forward_file_bb(c, s) & board_bb();
return !b ? SQ_NONE : c == WHITE ? lsb(b) : msb(b);
Expand Down

0 comments on commit 289bc68

Please sign in to comment.