mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Better interface to get the current move type
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
a3477af2a1
commit
bbf7a94d76
3 changed files with 15 additions and 11 deletions
|
@ -38,7 +38,6 @@ namespace {
|
|||
|
||||
/// Variables
|
||||
|
||||
MovePicker::MovegenPhase PhaseTable[32];
|
||||
int MainSearchPhaseIndex;
|
||||
int EvasionsPhaseIndex;
|
||||
int QsearchWithChecksPhaseIndex;
|
||||
|
@ -46,6 +45,9 @@ namespace {
|
|||
|
||||
}
|
||||
|
||||
// Static array definition
|
||||
MovePicker::MovegenPhase MovePicker::PhaseTable[32];
|
||||
|
||||
|
||||
////
|
||||
//// Functions
|
||||
|
@ -92,7 +94,7 @@ MovePicker::MovePicker(Position &p, bool pvnode, Move ttm, Move mk,
|
|||
/// class. It returns a new legal move every time it is called, until there
|
||||
/// are no more moves left of the types we are interested in.
|
||||
|
||||
Move MovePicker::get_next_move(MovegenPhase* moveType) {
|
||||
Move MovePicker::get_next_move() {
|
||||
Move move;
|
||||
|
||||
while(true) {
|
||||
|
@ -106,9 +108,6 @@ Move MovePicker::get_next_move(MovegenPhase* moveType) {
|
|||
|
||||
// Next phase:
|
||||
phaseIndex++;
|
||||
if (moveType)
|
||||
*moveType = PhaseTable[phaseIndex];
|
||||
|
||||
switch(PhaseTable[phaseIndex]) {
|
||||
|
||||
case PH_TT_MOVE:
|
||||
|
|
|
@ -61,11 +61,12 @@ public:
|
|||
|
||||
MovePicker(Position &p, bool pvnode, Move ttm, Move mk, Move k1, Move k2,
|
||||
Depth dpth);
|
||||
Move get_next_move(MovegenPhase* moveType = NULL);
|
||||
Move get_next_move();
|
||||
Move get_next_move(Lock &lock);
|
||||
int number_of_moves() const;
|
||||
int current_move_score() const;
|
||||
Bitboard discovered_check_candidates();
|
||||
MovegenPhase current_move_type() const;
|
||||
Bitboard discovered_check_candidates() const;
|
||||
|
||||
static void init_phase_table();
|
||||
|
||||
|
@ -80,6 +81,7 @@ private:
|
|||
Move ttMove, mateKiller, killer1, killer2;
|
||||
Bitboard pinned, dc;
|
||||
MoveStack moves[256], badCaptures[64];
|
||||
static MovegenPhase PhaseTable[32];
|
||||
bool pvNode;
|
||||
Depth depth;
|
||||
int phaseIndex;
|
||||
|
@ -97,7 +99,11 @@ private:
|
|||
/// all pieces which can possibly give discovered check. This bitboard is
|
||||
/// computed by the constructor function.
|
||||
|
||||
inline Bitboard MovePicker::discovered_check_candidates() {
|
||||
inline MovePicker::MovegenPhase MovePicker::current_move_type() const {
|
||||
return PhaseTable[phaseIndex];
|
||||
}
|
||||
|
||||
inline Bitboard MovePicker::discovered_check_candidates() const {
|
||||
return dc;
|
||||
}
|
||||
|
||||
|
|
|
@ -1147,7 +1147,6 @@ namespace {
|
|||
Value value, bestValue = -VALUE_INFINITE;
|
||||
Bitboard dcCandidates = mp.discovered_check_candidates();
|
||||
Value futilityValue = VALUE_NONE;
|
||||
MovePicker::MovegenPhase moveType;
|
||||
bool isCheck = pos.is_check();
|
||||
bool useFutilityPruning = UseFutilityPruning
|
||||
&& depth < SelectiveDepth
|
||||
|
@ -1156,14 +1155,14 @@ namespace {
|
|||
// Loop through all legal moves until no moves remain or a beta cutoff
|
||||
// occurs.
|
||||
while ( bestValue < beta
|
||||
&& (move = mp.get_next_move(&moveType)) != MOVE_NONE
|
||||
&& (move = mp.get_next_move()) != MOVE_NONE
|
||||
&& !thread_should_stop(threadID))
|
||||
{
|
||||
assert(move_is_ok(move));
|
||||
|
||||
bool singleReply = (isCheck && mp.number_of_moves() == 1);
|
||||
bool moveIsCheck = pos.move_is_check(move, dcCandidates);
|
||||
bool moveIsGoodCapture = (moveType == MovePicker::PH_GOOD_CAPTURES);
|
||||
bool moveIsGoodCapture = (mp.current_move_type() == MovePicker::PH_GOOD_CAPTURES);
|
||||
bool moveIsPassedPawnPush = pos.move_is_passed_pawn_push(move);
|
||||
|
||||
movesSearched[moveCount++] = ss[ply].currentMove = move;
|
||||
|
|
Loading…
Add table
Reference in a new issue