mirror of
https://github.com/sockspls/badfish
synced 2025-05-02 09:39:36 +00:00
Assorted code style in movepicker.cpp
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
04ac1bcabe
commit
97e0b0a01e
2 changed files with 15 additions and 19 deletions
|
@ -97,10 +97,10 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
|
||||||
if (p.in_check())
|
if (p.in_check())
|
||||||
phase = EVASIONS;
|
phase = EVASIONS;
|
||||||
|
|
||||||
else if (d >= DEPTH_QS_CHECKS)
|
else if (d > DEPTH_QS_NO_CHECKS)
|
||||||
phase = CAPTURES_AND_CHECKS;
|
phase = CAPTURES_AND_CHECKS;
|
||||||
|
|
||||||
else if (d >= DEPTH_QS_RECAPTURES)
|
else if (d > DEPTH_QS_RECAPTURES)
|
||||||
{
|
{
|
||||||
phase = CAPTURES;
|
phase = CAPTURES;
|
||||||
|
|
||||||
|
@ -122,17 +122,16 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
|
||||||
}
|
}
|
||||||
|
|
||||||
MovePicker::MovePicker(const Position& p, Move ttm, const History& h,
|
MovePicker::MovePicker(const Position& p, Move ttm, const History& h,
|
||||||
PieceType parentCapture) : pos(p), H(h) {
|
PieceType pt) : pos(p), H(h), curMove(0), lastMove(0) {
|
||||||
|
|
||||||
assert (!pos.in_check());
|
assert(!pos.in_check());
|
||||||
|
|
||||||
// In ProbCut we consider only captures better than parent's move
|
|
||||||
captureThreshold = PieceValueMidgame[Piece(parentCapture)];
|
|
||||||
curMove = lastMove = 0;
|
|
||||||
phase = PROBCUT;
|
phase = PROBCUT;
|
||||||
|
|
||||||
if ( ttm != MOVE_NONE
|
// In ProbCut we generate only captures better than parent's captured piece
|
||||||
&& (!pos.is_capture(ttm) || pos.see(ttm) <= captureThreshold))
|
captureThreshold = PieceValueMidgame[pt];
|
||||||
|
|
||||||
|
if (ttm && (!pos.is_capture(ttm) || pos.see(ttm) <= captureThreshold))
|
||||||
ttm = MOVE_NONE;
|
ttm = MOVE_NONE;
|
||||||
|
|
||||||
ttMove = (ttm && pos.is_pseudo_legal(ttm) ? ttm : MOVE_NONE);
|
ttMove = (ttm && pos.is_pseudo_legal(ttm) ? ttm : MOVE_NONE);
|
||||||
|
@ -168,7 +167,7 @@ void MovePicker::score_captures() {
|
||||||
- type_of(pos.piece_moved(m));
|
- type_of(pos.piece_moved(m));
|
||||||
|
|
||||||
if (is_promotion(m))
|
if (is_promotion(m))
|
||||||
cur->score += PieceValueMidgame[Piece(promotion_piece_type(m))];
|
cur->score += PieceValueMidgame[promotion_piece_type(m)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,8 +221,7 @@ void MovePicker::next_phase() {
|
||||||
lastMove = curMove + 1;
|
lastMove = curMove + 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case CAPTURES_S1: case CAPTURES_S3: case CAPTURES_S4:
|
case CAPTURES_S1: case CAPTURES_S3: case CAPTURES_S4: case CAPTURES_S5: case CAPTURES_S6:
|
||||||
case CAPTURES_S5: case CAPTURES_S6:
|
|
||||||
lastMove = generate<MV_CAPTURE>(pos, moves);
|
lastMove = generate<MV_CAPTURE>(pos, moves);
|
||||||
score_captures();
|
score_captures();
|
||||||
return;
|
return;
|
||||||
|
@ -255,7 +253,6 @@ void MovePicker::next_phase() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case EVASIONS_S2:
|
case EVASIONS_S2:
|
||||||
assert(pos.in_check());
|
|
||||||
lastMove = generate<MV_EVASION>(pos, moves);
|
lastMove = generate<MV_EVASION>(pos, moves);
|
||||||
score_evasions();
|
score_evasions();
|
||||||
return;
|
return;
|
||||||
|
@ -295,7 +292,6 @@ Move MovePicker::next_move() {
|
||||||
case TT_MOVE_S1: case TT_MOVE_S2: case TT_MOVE_S3: case TT_MOVE_S4: case TT_MOVE_S5:
|
case TT_MOVE_S1: case TT_MOVE_S2: case TT_MOVE_S3: case TT_MOVE_S4: case TT_MOVE_S5:
|
||||||
curMove++;
|
curMove++;
|
||||||
return ttMove;
|
return ttMove;
|
||||||
break;
|
|
||||||
|
|
||||||
case CAPTURES_S1:
|
case CAPTURES_S1:
|
||||||
move = pick_best(curMove++, lastMove)->move;
|
move = pick_best(curMove++, lastMove)->move;
|
||||||
|
@ -336,7 +332,8 @@ Move MovePicker::next_move() {
|
||||||
return move;
|
return move;
|
||||||
|
|
||||||
case EVASIONS_S2:
|
case EVASIONS_S2:
|
||||||
case CAPTURES_S3: case CAPTURES_S4:
|
case CAPTURES_S3:
|
||||||
|
case CAPTURES_S4:
|
||||||
move = pick_best(curMove++, lastMove)->move;
|
move = pick_best(curMove++, lastMove)->move;
|
||||||
if (move != ttMove)
|
if (move != ttMove)
|
||||||
return move;
|
return move;
|
||||||
|
@ -344,8 +341,7 @@ Move MovePicker::next_move() {
|
||||||
|
|
||||||
case CAPTURES_S5:
|
case CAPTURES_S5:
|
||||||
move = pick_best(curMove++, lastMove)->move;
|
move = pick_best(curMove++, lastMove)->move;
|
||||||
if ( move != ttMove
|
if (move != ttMove && pos.see(move) > captureThreshold)
|
||||||
&& pos.see(move) > captureThreshold)
|
|
||||||
return move;
|
return move;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ enum Depth {
|
||||||
DEPTH_ZERO = 0 * ONE_PLY,
|
DEPTH_ZERO = 0 * ONE_PLY,
|
||||||
DEPTH_QS_CHECKS = -1 * ONE_PLY,
|
DEPTH_QS_CHECKS = -1 * ONE_PLY,
|
||||||
DEPTH_QS_NO_CHECKS = -2 * ONE_PLY,
|
DEPTH_QS_NO_CHECKS = -2 * ONE_PLY,
|
||||||
DEPTH_QS_RECAPTURES = -4 * ONE_PLY,
|
DEPTH_QS_RECAPTURES = -5 * ONE_PLY,
|
||||||
|
|
||||||
DEPTH_NONE = -127 * ONE_PLY
|
DEPTH_NONE = -127 * ONE_PLY
|
||||||
};
|
};
|
||||||
|
@ -330,7 +330,7 @@ const Value RookValueEndgame = Value(0x4FE);
|
||||||
const Value QueenValueMidgame = Value(0x9D9);
|
const Value QueenValueMidgame = Value(0x9D9);
|
||||||
const Value QueenValueEndgame = Value(0x9FE);
|
const Value QueenValueEndgame = Value(0x9FE);
|
||||||
|
|
||||||
extern const Value PieceValueMidgame[17];
|
extern const Value PieceValueMidgame[17]; // Indexed by Piece or PieceType
|
||||||
extern const Value PieceValueEndgame[17];
|
extern const Value PieceValueEndgame[17];
|
||||||
extern int SquareDistance[64][64];
|
extern int SquareDistance[64][64];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue