mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Clean up comments for movepicker
Remove references to checks in MovePicker comments. Follow-up for https://github.com/official-stockfish/Stockfish/pull/5498 closes https://github.com/official-stockfish/Stockfish/pull/5516 No functional change
This commit is contained in:
parent
607c3e404f
commit
af802da65b
3 changed files with 25 additions and 27 deletions
|
@ -74,12 +74,10 @@ void partial_insertion_sort(ExtMove* begin, ExtMove* end, int limit) {
|
||||||
|
|
||||||
|
|
||||||
// Constructors of the MovePicker class. As arguments, we pass information
|
// Constructors of the MovePicker class. As arguments, we pass information
|
||||||
// to help it return the (presumably) good moves first, to decide which
|
// to decide which class of moves to emit, to help sorting the (presumably)
|
||||||
// moves to return (in the quiescence search, for instance, we only want to
|
// good moves first, and how important move ordering is at the current node.
|
||||||
// search captures, promotions, and some checks) and how important a good
|
|
||||||
// move ordering is at the current node.
|
|
||||||
|
|
||||||
// MovePicker constructor for the main search
|
// MovePicker constructor for the main search and for the quiescence search
|
||||||
MovePicker::MovePicker(const Position& p,
|
MovePicker::MovePicker(const Position& p,
|
||||||
Move ttm,
|
Move ttm,
|
||||||
Depth d,
|
Depth d,
|
||||||
|
@ -102,8 +100,8 @@ MovePicker::MovePicker(const Position& p,
|
||||||
stage = (depth > 0 ? MAIN_TT : QSEARCH_TT) + !(ttm && pos.pseudo_legal(ttm));
|
stage = (depth > 0 ? MAIN_TT : QSEARCH_TT) + !(ttm && pos.pseudo_legal(ttm));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor for ProbCut: we generate captures with SEE greater than or equal
|
// MovePicker constructor for ProbCut: we generate captures with Static Exchange
|
||||||
// to the given threshold.
|
// Evaluation (SEE) greater than or equal to the given threshold.
|
||||||
MovePicker::MovePicker(const Position& p, Move ttm, int th, const CapturePieceToHistory* cph) :
|
MovePicker::MovePicker(const Position& p, Move ttm, int th, const CapturePieceToHistory* cph) :
|
||||||
pos(p),
|
pos(p),
|
||||||
captureHistory(cph),
|
captureHistory(cph),
|
||||||
|
@ -115,9 +113,9 @@ MovePicker::MovePicker(const Position& p, Move ttm, int th, const CapturePieceTo
|
||||||
+ !(ttm && pos.capture_stage(ttm) && pos.pseudo_legal(ttm) && pos.see_ge(ttm, threshold));
|
+ !(ttm && pos.capture_stage(ttm) && pos.pseudo_legal(ttm) && pos.see_ge(ttm, threshold));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assigns a numerical value to each move in a list, used
|
// Assigns a numerical value to each move in a list, used for sorting.
|
||||||
// for sorting. Captures are ordered by Most Valuable Victim (MVV), preferring
|
// Captures are ordered by Most Valuable Victim (MVV), preferring captures
|
||||||
// captures with a good history. Quiets moves are ordered using the history tables.
|
// with a good history. Quiets moves are ordered using the history tables.
|
||||||
template<GenType Type>
|
template<GenType Type>
|
||||||
void MovePicker::score() {
|
void MovePicker::score() {
|
||||||
|
|
||||||
|
@ -191,7 +189,7 @@ void MovePicker::score() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the next move satisfying a predicate function.
|
// Returns the next move satisfying a predicate function.
|
||||||
// It never returns the TT move.
|
// This never returns the TT move, as it was emitted before.
|
||||||
template<MovePicker::PickType T, typename Pred>
|
template<MovePicker::PickType T, typename Pred>
|
||||||
Move MovePicker::select(Pred filter) {
|
Move MovePicker::select(Pred filter) {
|
||||||
|
|
||||||
|
@ -208,9 +206,9 @@ Move MovePicker::select(Pred filter) {
|
||||||
return Move::none();
|
return Move::none();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Most important method of the MovePicker class. It
|
// This is the most important method of the MovePicker class. We emit one
|
||||||
// returns a new pseudo-legal move every time it is called until there are no more
|
// new pseudo-legal move on every call until there are no more moves left,
|
||||||
// moves left, picking the move with the highest score from a list of generated moves.
|
// picking the move with the highest score from a list of generated moves.
|
||||||
Move MovePicker::next_move(bool skipQuiets) {
|
Move MovePicker::next_move(bool skipQuiets) {
|
||||||
|
|
||||||
auto quiet_threshold = [](Depth d) { return -3560 * d; };
|
auto quiet_threshold = [](Depth d) { return -3560 * d; };
|
||||||
|
|
|
@ -137,12 +137,12 @@ using PawnHistory = Stats<int16_t, 8192, PAWN_HISTORY_SIZE, PIECE_NB, SQUARE_NB>
|
||||||
using CorrectionHistory =
|
using CorrectionHistory =
|
||||||
Stats<int16_t, CORRECTION_HISTORY_LIMIT, COLOR_NB, CORRECTION_HISTORY_SIZE>;
|
Stats<int16_t, CORRECTION_HISTORY_LIMIT, COLOR_NB, CORRECTION_HISTORY_SIZE>;
|
||||||
|
|
||||||
// MovePicker class is used to pick one pseudo-legal move at a time from the
|
// The MovePicker class is used to pick one pseudo-legal move at a time from the
|
||||||
// current position. The most important method is next_move(), which returns a
|
// current position. The most important method is next_move(), which emits one
|
||||||
// new pseudo-legal move each time it is called, until there are no moves left,
|
// new pseudo-legal move on every call, until there are no moves left, when
|
||||||
// when Move::none() is returned. In order to improve the efficiency of the
|
// Move::none() is returned. In order to improve the efficiency of the alpha-beta
|
||||||
// alpha-beta algorithm, MovePicker attempts to return the moves which are most
|
// algorithm, MovePicker attempts to return the moves which are most likely to get
|
||||||
// likely to get a cut-off first.
|
// a cut-off first.
|
||||||
class MovePicker {
|
class MovePicker {
|
||||||
|
|
||||||
enum PickType {
|
enum PickType {
|
||||||
|
|
|
@ -20,18 +20,18 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <list>
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <chrono>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
#include <iostream>
|
||||||
|
#include <list>
|
||||||
|
#include <ratio>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <chrono>
|
|
||||||
#include <iostream>
|
|
||||||
#include <ratio>
|
|
||||||
|
|
||||||
#include "evaluate.h"
|
#include "evaluate.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
@ -1520,11 +1520,11 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta)
|
||||||
const PieceToHistory* contHist[] = {(ss - 1)->continuationHistory,
|
const PieceToHistory* contHist[] = {(ss - 1)->continuationHistory,
|
||||||
(ss - 2)->continuationHistory};
|
(ss - 2)->continuationHistory};
|
||||||
|
|
||||||
|
Square prevSq = ((ss - 1)->currentMove).is_ok() ? ((ss - 1)->currentMove).to_sq() : SQ_NONE;
|
||||||
|
|
||||||
// Initialize a MovePicker object for the current position, and prepare to search
|
// Initialize a MovePicker object for the current position, and prepare to search
|
||||||
// the moves. We presently use two stages of move generator in quiescence search:
|
// the moves. We presently use two stages of move generator in quiescence search:
|
||||||
// first captures+checks, then captures only (but when in check, we simply search
|
// captures, or evasions only when in check.
|
||||||
// all evasions).
|
|
||||||
Square prevSq = ((ss - 1)->currentMove).is_ok() ? ((ss - 1)->currentMove).to_sq() : SQ_NONE;
|
|
||||||
MovePicker mp(pos, ttData.move, DEPTH_QS, &thisThread->mainHistory, &thisThread->captureHistory,
|
MovePicker mp(pos, ttData.move, DEPTH_QS, &thisThread->mainHistory, &thisThread->captureHistory,
|
||||||
contHist, &thisThread->pawnHistory);
|
contHist, &thisThread->pawnHistory);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue