1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Assorted code style in movepicker.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2012-01-22 11:57:42 +01:00
parent 04ac1bcabe
commit 97e0b0a01e
2 changed files with 15 additions and 19 deletions

View file

@ -97,10 +97,10 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
if (p.in_check())
phase = EVASIONS;
else if (d >= DEPTH_QS_CHECKS)
else if (d > DEPTH_QS_NO_CHECKS)
phase = CAPTURES_AND_CHECKS;
else if (d >= DEPTH_QS_RECAPTURES)
else if (d > DEPTH_QS_RECAPTURES)
{
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,
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;
if ( ttm != MOVE_NONE
&& (!pos.is_capture(ttm) || pos.see(ttm) <= captureThreshold))
// In ProbCut we generate only captures better than parent's captured piece
captureThreshold = PieceValueMidgame[pt];
if (ttm && (!pos.is_capture(ttm) || pos.see(ttm) <= captureThreshold))
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));
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;
return;
case CAPTURES_S1: case CAPTURES_S3: case CAPTURES_S4:
case CAPTURES_S5: case CAPTURES_S6:
case CAPTURES_S1: case CAPTURES_S3: case CAPTURES_S4: case CAPTURES_S5: case CAPTURES_S6:
lastMove = generate<MV_CAPTURE>(pos, moves);
score_captures();
return;
@ -255,7 +253,6 @@ void MovePicker::next_phase() {
return;
case EVASIONS_S2:
assert(pos.in_check());
lastMove = generate<MV_EVASION>(pos, moves);
score_evasions();
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:
curMove++;
return ttMove;
break;
case CAPTURES_S1:
move = pick_best(curMove++, lastMove)->move;
@ -336,7 +332,8 @@ Move MovePicker::next_move() {
return move;
case EVASIONS_S2:
case CAPTURES_S3: case CAPTURES_S4:
case CAPTURES_S3:
case CAPTURES_S4:
move = pick_best(curMove++, lastMove)->move;
if (move != ttMove)
return move;
@ -344,8 +341,7 @@ Move MovePicker::next_move() {
case CAPTURES_S5:
move = pick_best(curMove++, lastMove)->move;
if ( move != ttMove
&& pos.see(move) > captureThreshold)
if (move != ttMove && pos.see(move) > captureThreshold)
return move;
break;

View file

@ -206,7 +206,7 @@ enum Depth {
DEPTH_ZERO = 0 * ONE_PLY,
DEPTH_QS_CHECKS = -1 * 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
};
@ -330,7 +330,7 @@ const Value RookValueEndgame = Value(0x4FE);
const Value QueenValueMidgame = Value(0x9D9);
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 int SquareDistance[64][64];