/usr/include/osl/eval/ml/mobility.h is in libosl-dev 0.6.0-3.3.
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 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | /* mobility.h
*/
#ifndef EVAL_ML_MOBILITY_H
#define EVAL_ML_MOBILITY_H
#include "osl/eval/ml/weights.h"
#include "osl/eval/ml/midgame.h"
#include "osl/ptype.h"
#include "osl/misc/carray.h"
#include "osl/state/numEffectState.h"
#include "osl/container/tripleInt.h"
namespace osl
{
namespace eval
{
namespace ml
{
class RookMobilityAll
{
friend class RookMobility;
friend class RookMobilityX;
friend class RookMobilityY;
friend class RookMobilitySum;
friend class RookMobilitySumKingX;
friend class RookMobilityXKingX;
public:
template<int Sign>
static void adjust(const NumEffectState&, bool promoted,
int vertical, int horizontal,
Square pos,
MultiInt& value);
static void eval(const NumEffectState&, MultiInt& out);
private:
static int indexX(Square rook, bool promoted,
int count, bool vertical)
{
const int x = (rook.x() > 5 ?
10 - rook.x() : rook.x());
return x - 1 + 5 * ((promoted ? 1 : 0) +
2 * ((vertical ? 1 : 0) + 2 * count));
}
template <int Sign>
static int indexY(Square rook, bool promoted,
int count, bool vertical)
{
const int y = (Sign > 0 ? rook.y() : 10 - rook.y());
return y - 1 + 9 * ((promoted ? 1 : 0) +
2 * ((vertical ? 1 : 0) + 2 * count));
}
template <int Sign>
static int indexXKingX(Square rook, Square king, int count, bool vertical)
{
const Square r = (Sign > 0) ? rook : rook.rotate180();
const Square k = (Sign > 0) ? king : king.rotate180();
const bool flip = r.x() > 5;
const int x = (flip ? 10 - r.x() : r.x());
const int king_x = (flip ? 10 - k.x() : k.x());
return king_x - 1 + 9 * (x - 1 + 5 * ((vertical ? 1 : 0) + 2 * count));
}
static CArray<MultiInt, 18> rook_vertical_table;
static CArray<MultiInt, 18> rook_horizontal_table;
static CArray<MultiInt, 34> sum_table;
static CArray<MultiInt, 324> x_table;
static CArray<MultiInt, 324> y_table;
static CArray<MultiInt, 17 * 9> sumkingx_table;
static CArray<MultiInt, 9 * 2 * 5 * 9> xkingx_table;
};
class RookMobility
{
public:
enum { DIM = 36 };
static void setUp(const Weights &weights,int stage);
};
class RookMobilitySum
{
public:
enum { ONE_DIM = 34, DIM = ONE_DIM * EvalStages };
static void setUp(const Weights &weights);
};
class RookMobilityX
{
public:
enum { ONE_DIM = 180, DIM = ONE_DIM * EvalStages };
static void setUp(const Weights &weights);
};
class RookMobilityY
{
public:
enum { ONE_DIM = 324, DIM = ONE_DIM * EvalStages };
static void setUp(const Weights &weights);
};
class RookMobilitySumKingX
{
public:
enum { ONE_DIM = 17 * 9, DIM = ONE_DIM * EvalStages };
static void setUp(const Weights &weights);
};
class RookMobilityXKingX
{
public:
enum { ONE_DIM = 9 * 2 * 5 * 9, DIM = ONE_DIM * EvalStages };
static void setUp(const Weights &weights);
};
struct BishopMobilityAll
{
friend class BishopMobility;
friend class BishopMobilityEach;
public:
template<int Sign>
static void adjust(bool promoted, int mobility1, int mobility2,
MultiInt& value);
static void eval(const NumEffectState&, MultiInt& out);
private:
static CArray<MultiInt, 36> bishop_table;
static CArray<MultiInt, 18> each_table;
};
class BishopMobility
{
public:
enum { DIM = 36 };
static void setUp(const Weights &weights,int stage);
};
class BishopMobilityEach
{
public:
enum { ONE_DIM = 18, DIM = ONE_DIM * EvalStages };
static void setUp(const Weights &weights);
};
struct LanceMobilityAll
{
template<int Sign>
static void adjust(int index, MultiInt& value);
static void eval(const NumEffectState&, MultiInt& out);
};
class LanceMobility
{
static CArray<MultiInt, 9> lance_table;
friend struct LanceMobilityAll;
public:
enum { DIM = 9 };
LanceMobility() { };
static void setUp(const Weights &weights,int stage);
};
}
}
}
#endif // EVAL_ML_MOBILITY_H
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|