/usr/include/osl/eval/ppair/piecePairWithStand.h is in libosl-dev 0.6.0-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | /* piecePairWithStand.h
*/
#ifndef EVAL_PPAIR_PIECEPAIRWITHSTAND_H
#define EVAL_PPAIR_PIECEPAIRWITHSTAND_H
#include "osl/eval/ppair/piecePairEval.h"
#include "osl/eval/pieceEval.h"
namespace osl
{
namespace eval
{
namespace ppair
{
/**
* 持駒の点数は表以外で管理するフレームワーク.
*
* (持駒の点数を表に書き込むと,同じ種類の駒を複数もっていると問
* 題が起こるため)
* => その後盤上の駒も管理 (点数を変更可能にするため)
*/
template <class Table>
class PiecePairWithStand
: public PiecePairEval<PiecePairWithStand<Table>,Table>
{
public:
static int standBonus(PtypeO ptypeo)
{
assert(isBasic(getPtype(ptypeo)));
if (isMajorBasic(getPtype(ptypeo)))
return Table::Piece_Value.value(newPtypeO(getOwner(ptypeo), PAWN));
return 0;
}
static int standBonus(const SimpleState& state);
typedef PiecePairEval<PiecePairWithStand<Table>, Table> base_t;
explicit PiecePairWithStand(const SimpleState& state);
protected:
~PiecePairWithStand() {}
public:
static int diffAfterDropMove(const SimpleState& state,Square to,PtypeO ptypeo)
{
const int bonus = standBonus(ptypeo);
return base_t::diffAfterDropMove(state,to,ptypeo) - bonus;
}
static int diffAfterSimpleMove(const SimpleState& state,
Square from, Square to,
int promote_mask)
{
int diff = base_t::diffAfterSimpleMove(state, from, to, promote_mask);
if (promote_mask) {
const Piece old_piece=state.pieceAt(from);
const PtypeO newPtypeO = promoteWithMask(old_piece.ptypeO(), promote_mask);
diff += Table::Piece_Value.promoteValue(newPtypeO);
}
return diff;
}
static int diffAfterCaptureMove(const SimpleState& state,
Square from, Square to,
PtypeO victim,int promote_mask)
{
const PtypeO captured = osl::captured(victim);
int bonus = standBonus(captured);
if (promote_mask) {
const Piece old_piece=state.pieceAt(from);
const PtypeO newPtypeO = promoteWithMask(old_piece.ptypeO(), promote_mask);
bonus += Table::Piece_Value.promoteValue(newPtypeO);
}
return base_t::diffAfterCaptureMove(state,from,to,victim,promote_mask)
+ Table::Piece_Value.captureValue(victim) + bonus;
}
static int diffWithUpdate(const SimpleState& new_state, Move last_move)
{
int diff = base_t::diffWithUpdate(new_state, last_move);
if (last_move.isDrop()) {
const int bonus = standBonus(last_move.ptypeO());
return diff - bonus;
}
if (last_move.isPromotion())
diff += Table::Piece_Value.promoteValue(last_move.ptypeO());
if (last_move.capturePtype() != PTYPE_EMPTY) {
const PtypeO captured = last_move.capturePtypeO();
const int bonus = standBonus(osl::captured(captured));
diff += Table::Piece_Value.captureValue(captured) + bonus;
}
return diff;
}
static void setValues(const SimpleState&, container::PieceValues&);
};
} // namespace ppair
} // namespace eval
} // namespace osl
#endif /* EVAL_PPAIR_PIECEPAIRWITHSTAND_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|