/usr/include/osl/eval/ml/pin.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 101 102 103 104 105 106 107 108 109 110 111 112 113 | /* pin.h
*/
#ifndef EVAL_ML_PIN_H
#define EVAL_ML_PIN_H
#include "osl/ptype.h"
#include "osl/misc/carray.h"
#include "osl/state/numEffectState.h"
#include "osl/eval/ml/weights.h"
#include "osl/eval/ml/midgame.h"
namespace osl
{
namespace eval
{
namespace ml
{
class SimplePin
{
static CArray<int, PTYPE_SIZE> table;
public:
SimplePin() { };
static void setUp(const Weights &weights);
int eval(const NumEffectState &state,
PieceMask black_mask, PieceMask white_mask) const;
};
class Pin
{
static int index(const Square king,
const Piece piece)
{
return std::abs(piece.square().x() - king.x()) * 17 +
(piece.owner() == BLACK ? (king.y() - piece.square().y()) :
(piece.square().y() - king.y())) + 8;
}
static CArray2d<MultiInt, PTYPE_SIZE, 17 * 9> table;
public:
enum { DIM = (osl::PTYPE_MAX - osl::PTYPE_PIECE_MIN + 1) * 17 * 9};
Pin() { };
static void setUp(const Weights &weights,int stage);
static MultiInt eval(const NumEffectState &state,
PieceMask black_mask, PieceMask white_mask);
};
class PinPtypeAll
{
public:
static MultiInt eval(const NumEffectState &state);
private:
template <Player Defense>
static MultiInt evalOne(const NumEffectState &state);
template <Player Defense>
static bool pawnAttack(const NumEffectState &state, Piece piece)
{
const Square up =
piece.square() + DirectionPlayerTraits<U, Defense>::offset();
return (up.isOnBoard() &&
(state.hasEffectByPtypeStrict<PAWN>(alt(Defense), up)
|| (!state.isPawnMaskSet(alt(Defense),
piece.square().x())
&& state.pieceAt(up).isEmpty())));
}
protected:
static CArray<MultiInt, 80> table;
static CArray<MultiInt, 48> pawn_table;
static CArray<MultiInt, 560> distance_table;
};
class PinPtype : public PinPtypeAll
{
public:
enum { ONE_DIM = 80, DIM = ONE_DIM * EvalStages };
static void setUp(const Weights &weights);
};
class PinPtypeDistance : public PinPtypeAll
{
public:
enum { ONE_DIM = 560, DIM = ONE_DIM * EvalStages };
static void setUp(const Weights &weights);
};
class PinPtypePawnAttack : public PinPtypeAll
{
public:
enum { ONE_DIM = 48, DIM = ONE_DIM * EvalStages };
static void setUp(const Weights &weights);
};
class CheckShadowPtype
{
public:
enum {
// rook v, rook h, bishop u, bishop d, lance
ONE_DIM = PTYPE_SIZE * 5,
DIM = ONE_DIM * EvalStages
};
static void setUp(const Weights &weights);
static MultiInt eval(const NumEffectState &state);
template <Player King>
static MultiInt evalOne(const NumEffectState &state);
static CArray<MultiInt, ONE_DIM> table;
};
}
}
}
#endif // EVAL_ML_PIN_H
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|