Skip to content

Commit cca34e2

Browse files
committed
Drop 'is' prefix from query functions
Most but not all. No functional change.
1 parent ed95ad1 commit cca34e2

File tree

10 files changed

+116
-134
lines changed

10 files changed

+116
-134
lines changed

src/endgame.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,7 @@ ScaleFactor Endgame<KRPPKRP>::operator()(const Position& pos) const {
627627
Square bksq = pos.king_square(weakerSide);
628628

629629
// Does the stronger side have a passed pawn?
630-
if ( pos.pawn_is_passed(strongerSide, wpsq1)
631-
|| pos.pawn_is_passed(strongerSide, wpsq2))
630+
if (pos.pawn_passed(strongerSide, wpsq1) || pos.pawn_passed(strongerSide, wpsq2))
632631
return SCALE_FACTOR_NONE;
633632

634633
Rank r = std::max(relative_rank(strongerSide, wpsq1), relative_rank(strongerSide, wpsq2));

src/evaluate.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -583,9 +583,9 @@ Value do_evaluate(const Position& pos, Value& margin) {
583583
const enum Piece P = make_piece(Us, PAWN);
584584
Square d = pawn_push(Us) + (file_of(s) == FILE_A ? DELTA_E : DELTA_W);
585585
if (pos.piece_on(s + d) == P)
586-
score -= !pos.is_empty(s + d + pawn_push(Us)) ? TrappedBishopA1H1 * 4
587-
: pos.piece_on(s + d + d) == P ? TrappedBishopA1H1 * 2
588-
: TrappedBishopA1H1;
586+
score -= !pos.empty(s + d + pawn_push(Us)) ? TrappedBishopA1H1 * 4
587+
: pos.piece_on(s + d + d) == P ? TrappedBishopA1H1 * 2
588+
: TrappedBishopA1H1;
589589
}
590590
}
591591

@@ -797,7 +797,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
797797
{
798798
Square s = pop_lsb(&b);
799799

800-
assert(pos.pawn_is_passed(Us, s));
800+
assert(pos.pawn_passed(Us, s));
801801

802802
int r = int(relative_rank(Us, s) - RANK_2);
803803
int rr = r * (r - 1);
@@ -819,7 +819,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
819819
ebonus -= Value(square_distance(pos.king_square(Us), blockSq + pawn_push(Us)) * rr);
820820

821821
// If the pawn is free to advance, increase bonus
822-
if (pos.is_empty(blockSq))
822+
if (pos.empty(blockSq))
823823
{
824824
squaresToQueen = forward_bb(Us, s);
825825

src/movegen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ namespace {
6161

6262
(mlist++)->move = make<CASTLE>(kfrom, rfrom);
6363

64-
if (Checks && !pos.move_gives_check((mlist - 1)->move, CheckInfo(pos)))
64+
if (Checks && !pos.gives_check((mlist - 1)->move, CheckInfo(pos)))
6565
mlist--;
6666

6767
return mlist;
@@ -414,7 +414,7 @@ ExtMove* generate<LEGAL>(const Position& pos, ExtMove* mlist) {
414414
: generate<NON_EVASIONS>(pos, mlist);
415415
while (cur != end)
416416
if ( (pinned || from_sq(cur->move) == ksq || type_of(cur->move) == ENPASSANT)
417-
&& !pos.pl_move_is_legal(cur->move, pinned))
417+
&& !pos.legal(cur->move, pinned))
418418
cur->move = (--end)->move;
419419
else
420420
cur++;

src/movepick.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
8686
else
8787
stage = MAIN_SEARCH;
8888

89-
ttMove = (ttm && pos.is_pseudo_legal(ttm) ? ttm : MOVE_NONE);
89+
ttMove = (ttm && pos.pseudo_legal(ttm) ? ttm : MOVE_NONE);
9090
end += (ttMove != MOVE_NONE);
9191
}
9292

@@ -108,7 +108,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
108108
// Skip TT move if is not a capture or a promotion, this avoids qsearch
109109
// tree explosion due to a possible perpetual check or similar rare cases
110110
// when TT table is full.
111-
if (ttm && !pos.is_capture_or_promotion(ttm))
111+
if (ttm && !pos.capture_or_promotion(ttm))
112112
ttm = MOVE_NONE;
113113
}
114114
else
@@ -118,7 +118,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
118118
ttm = MOVE_NONE;
119119
}
120120

121-
ttMove = (ttm && pos.is_pseudo_legal(ttm) ? ttm : MOVE_NONE);
121+
ttMove = (ttm && pos.pseudo_legal(ttm) ? ttm : MOVE_NONE);
122122
end += (ttMove != MOVE_NONE);
123123
}
124124

@@ -131,9 +131,9 @@ MovePicker::MovePicker(const Position& p, Move ttm, const HistoryStats& h, Piece
131131

132132
// In ProbCut we generate only captures better than parent's captured piece
133133
captureThreshold = PieceValue[MG][pt];
134-
ttMove = (ttm && pos.is_pseudo_legal(ttm) ? ttm : MOVE_NONE);
134+
ttMove = (ttm && pos.pseudo_legal(ttm) ? ttm : MOVE_NONE);
135135

136-
if (ttMove && (!pos.is_capture(ttMove) || pos.see(ttMove) <= captureThreshold))
136+
if (ttMove && (!pos.capture(ttMove) || pos.see(ttMove) <= captureThreshold))
137137
ttMove = MOVE_NONE;
138138

139139
end += (ttMove != MOVE_NONE);
@@ -163,7 +163,7 @@ void MovePicker::score<CAPTURES>() {
163163
{
164164
m = it->move;
165165
it->score = PieceValue[MG][pos.piece_on(to_sq(m))]
166-
- type_of(pos.piece_moved(m));
166+
- type_of(pos.moved_piece(m));
167167

168168
if (type_of(m) == PROMOTION)
169169
it->score += PieceValue[MG][promotion_type(m)] - PieceValue[MG][PAWN];
@@ -181,7 +181,7 @@ void MovePicker::score<QUIETS>() {
181181
for (ExtMove* it = moves; it != end; ++it)
182182
{
183183
m = it->move;
184-
it->score = history[pos.piece_moved(m)][to_sq(m)];
184+
it->score = history[pos.moved_piece(m)][to_sq(m)];
185185
}
186186
}
187187

@@ -199,11 +199,11 @@ void MovePicker::score<EVASIONS>() {
199199
if ((seeScore = pos.see_sign(m)) < 0)
200200
it->score = seeScore - HistoryStats::Max; // At the bottom
201201

202-
else if (pos.is_capture(m))
202+
else if (pos.capture(m))
203203
it->score = PieceValue[MG][pos.piece_on(to_sq(m))]
204-
- type_of(pos.piece_moved(m)) + HistoryStats::Max;
204+
- type_of(pos.moved_piece(m)) + HistoryStats::Max;
205205
else
206-
it->score = history[pos.piece_moved(m)][to_sq(m)];
206+
it->score = history[pos.moved_piece(m)][to_sq(m)];
207207
}
208208
}
209209

@@ -317,9 +317,9 @@ Move MovePicker::next_move<false>() {
317317
case KILLERS_S1:
318318
move = (cur++)->move;
319319
if ( move != MOVE_NONE
320-
&& pos.is_pseudo_legal(move)
320+
&& pos.pseudo_legal(move)
321321
&& move != ttMove
322-
&& !pos.is_capture(move))
322+
&& !pos.capture(move))
323323
return move;
324324
break;
325325

src/notation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const string move_to_san(Position& pos, Move m) {
133133
while (b)
134134
{
135135
Move move = make_move(pop_lsb(&b), to);
136-
if (!pos.pl_move_is_legal(move, pos.pinned_pieces()))
136+
if (!pos.legal(move, pos.pinned_pieces()))
137137
others ^= from_sq(move);
138138
}
139139

@@ -149,10 +149,10 @@ const string move_to_san(Position& pos, Move m) {
149149
san += square_to_string(from);
150150
}
151151
}
152-
else if (pos.is_capture(m))
152+
else if (pos.capture(m))
153153
san = file_to_char(file_of(from));
154154

155-
if (pos.is_capture(m))
155+
if (pos.capture(m))
156156
san += 'x';
157157

158158
san += square_to_string(to);
@@ -161,7 +161,7 @@ const string move_to_san(Position& pos, Move m) {
161161
san += string("=") + PieceToChar[WHITE][promotion_type(m)];
162162
}
163163

164-
if (pos.move_gives_check(m, CheckInfo(pos)))
164+
if (pos.gives_check(m, CheckInfo(pos)))
165165
{
166166
StateInfo st;
167167
pos.do_move(m, st);

0 commit comments

Comments
 (0)