void MovePicker::score_captures() { // Winning and equal captures in the main search are ordered by MVV/LVA. // Suprisingly, this appears to perform slightly better than SEE based // move ordering. The reason is probably that in a position with a winning // capture, capturing a more valuable (but sufficiently defended) piece // first usually doesn't hurt. The opponent will have to recapture, and // the hanging piece will still be hanging (except in the unusual cases // where it is possible to recapture with the hanging piece). Exchanging // big pieces before capturing a hanging piece probably helps to reduce // the subtree size. // In main search we want to push captures with negative SEE values to // badCaptures[] array, but instead of doing it now we delay till when // the move has been picked up in pick_move_from_list(), this way we save // some SEE calls in case we get a cutoff (idea from Pablo Vazquez). Move m; for (MoveStack* it = moves; it != end; ++it) { m = it->move; it->score = PieceValue[Mg][pos.piece_on(to_sq(m))] - type_of(pos.piece_moved(m)); if (type_of(m) == PROMOTION) it->score += PieceValue[Mg][promotion_type(m)]; } }
void MovePicker::score<CAPTURES>() { // Winning and equal captures in the main search are ordered by MVV/LVA. // Suprisingly, this appears to perform slightly better than SEE based // move ordering. The reason is probably that in a position with a winning // capture, capturing a more valuable (but sufficiently defended) piece // first usually doesn't hurt. The opponent will have to recapture, and // the hanging piece will still be hanging (except in the unusual cases // where it is possible to recapture with the hanging piece). Exchanging // big pieces before capturing a hanging piece probably helps to reduce // the subtree size. // In main search we want to push captures with negative SEE values to the // badCaptures[] array, but instead of doing it now we delay until the move // has been picked up in pick_move_from_list(). This way we save some SEE // calls in case we get a cutoff. Move m; for (ExtMove* it = moves; it != end; ++it) { m = it->move; /* 評価値は取る駒の駒評価値から駒種をValueにキャストした数を引いている 引いている意味は不明 */ it->value = PieceValue[MG][pos.piece_on(to_sq(m))] - Value(type_of(pos.moved_piece(m))); /* もし指し手パターンがアンパッサンだったら PAWNの評価値を追加する (アンパッサンの時のPAWNの動きではto座標に敵の駒がいないので) */ if (type_of(m) == ENPASSANT) it->value += PieceValue[MG][PAWN]; /* 指し手パターンが成りだったら、なった駒種の駒評価値からPAWNの駒評価値を引いたもの(昇格評価値)を追加している */ else if (type_of(m) == PROMOTION) it->value += PieceValue[MG][promotion_type(m)] - PieceValue[MG][PAWN]; } }