This file is indexed.

/usr/include/osl/progress/ml/newProgress.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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
/* newProgress.h */
#ifndef PROGRESS_EXPERIMENTAL_NEW_PROGRESS_H
#define PROGRESS_EXPERIMENTAL_NEW_PROGRESS_H

#include "osl/state/numEffectState.h"
#include "osl/progress/progress16.h"
#include "osl/eval/ml/midgame.h"
#include "osl/centering5x3.h"
#include "osl/misc/carray.h"
namespace osl
{
  namespace progress
  {
    namespace ml
    {
      struct NewProgressDebugInfo
      {
        enum Feature
        {
          ATTACK_5X3,
          DEFENSE_5X3,
          ATTACK5X5,
          STAND,
          EFFECT5X5,
          KING_RELATIVE_ATTACK,
          KING_RELATIVE_DEFENSE,
          NON_PAWN_ATTACKED_PAIR,
          FEATURE_LIMIT
        };
        CArray<int, FEATURE_LIMIT> black_values;
        CArray<int, FEATURE_LIMIT> white_values;
      };

      struct NewProgressData
      {
	CArray<MultiInt,2> non_pawn_ptype_attacked_pair_eval;
	MultiInt promotion37_eval;
	CArray<int, 2> progresses, attack5x5_progresses, stand_progresses,
	  effect_progresses, defenses;
	CArray<int, 2> rook, bishop, gold, silver, promoted,
	  king_relative_attack, king_relative_defense, non_pawn_ptype_attacked_pair;
	int pawn_facing, promotion37, piecestand7;
      };
      class NewProgress : private NewProgressData
      {
      public:
	enum { ProgressScale = 2 };
      private:
	static bool initialized_flag;
	static CArray<int, Piece::SIZE> stand_weight;
	static CArray<int, 1125> attack5x5_weight;
	static CArray<int, 5625> attack5x5_x_weight;
	static CArray<int, 10125> attack5x5_y_weight;
	static CArray<int, 75> effectstate_weight;
	static CArray<int, 81*15*10> attack_relative;
	static CArray<int, 81*15*10> defense_relative;
	static CArray<int, 4284> king_relative_weight;
	static CArray<int, 262144> attacked_ptype_pair_weight;
	static CArray<int, 10> pawn_facing_weight;
	static CArray<int, 16> promotion37_weight;
	static CArray<int, 56> piecestand7_weight;
	static int max_progress;
	void updatePieceKingRelativeBonus(const NumEffectState &state);
	void updateNonPawnAttackedPtypePair(const NumEffectState& state);
	template <Player Owner>
	void updateNonPawnAttackedPtypePairOne(const NumEffectState& state);
	void updatePawnFacing(const NumEffectState& state);
	template <Player Attack>	
	void promotion37One(const NumEffectState& state, int rank);
	void updatePromotion37(const NumEffectState& state);
	void updatePieceStand7(const NumEffectState& state);
	template <Player P>
	static void progressOne(const NumEffectState &state,
				int &attack, int &defense);
	template <Player P>
	void updateAttack5x5PiecesAndState(const NumEffectState &state);
	template <Player P>
	void updateAttack5x5Pieces(PieceMask, const NumEffectState&);
	template <Player P>
	int attack5x5Value(const NumEffectState &state) const;
	template <Player P>
	static int index(Square king, Square target)
	{
	  const int x_diff = std::abs(king.x() - target.x()); // [0, 4]
	  const int y_diff = (P == BLACK ? king.y() - target.y() :
			      target.y() - king.y()) + 2; // [-2, 2] + 2
	  return x_diff * 5 + y_diff;
	}
	template <Player P>
	static int indexX(Square king, Square target)
	{
	  int target_x = (king.x() > 5 ? 10 - king.x() : king.x()); // [1, 5]
	  int x_diff = king.x() - target.x(); // [-4, 4]
	  if (P == BLACK && king.x() >= 6)
	  {
	    x_diff = -x_diff;
	  }
	  else if (P == WHITE && king.x() >= 5)
	  {
	    x_diff = -x_diff;
	  }
	  const int y_diff = (P == BLACK ? king.y() - target.y() :
			      target.y() - king.y()) + 2; // [-2, 2] + 2
	  return ((x_diff + 4) * 5 + y_diff) * 5 + target_x - 1;
	}
	template <Player P>
	static int indexY(Square king, Square target)
	{
	  const int x_diff = std::abs(king.x() - target.x()); // [0, 4]
	  const int y_diff = (P == BLACK ? king.y() - target.y() :
			      target.y() - king.y()) + 2; // [-2, 2] + 2
	  const int king_y = (P == BLACK ? king.y() : 10 - king.y()); // [1, 9]
	  return (x_diff * 5 + y_diff) * 9 + king_y - 1;
	}
	static int index5x5(int rook, int bishop, int gold, int silver,
			    int promoted)
	{
	  assert(0 <= promoted && promoted <= 4);
	  return promoted + 5 * (silver + 5 * (gold + 5 * (bishop + 3 * rook)));
	}
	static int index5x5x(int rook, int bishop, int gold, int silver,
			     int promoted, int king_x)
	{
	  assert(0 <= promoted && promoted <= 4);
	  return king_x - 1 +
	    5 * (promoted + 5 * (silver + 5 * (gold + 5 * (bishop + 3 * rook))));
	}
	static int index5x5y(int rook, int bishop, int gold, int silver,
			     int promoted, int king_y)
	{
	  assert(0 <= promoted && promoted <= 4);
	  return king_y - 1 +
	    9 * (promoted + 5 * (silver + 5 * (gold + 5 * (bishop + 3 * rook))));
	}
	template <Player P>
	static int indexPerEffect(Square king, Square target,
				  int count)
	{
	  const int x_diff = std::abs(king.x() - target.x()); // [0, 4]
	  const int y_diff = (P == BLACK ? king.y() - target.y() :
			      target.y() - king.y()) + 2; // [-2, 2] + 2
	  return x_diff * 5 + y_diff + std::min(8, count) * 25;
	}

	template <Player P>
	static int indexPerEffectY(Square king, Square target,
				   int count)
	{
	  const int king_y = (P == BLACK ? king.y() : 10 - king.y());
	  const int x_diff = std::abs(king.x() - target.x()); // [0, 4]
	  const int y_diff = (P == BLACK ? king.y() - target.y() :
			      target.y() - king.y()) + 2; // [-2, 2] + 2
	  return king_y - 1 + 9 * (x_diff * 5 + y_diff + std::min(8, count) * 25);
	}
	template <Player P>
	static int indexPerEffectX(Square king, Square target,
				   int count)
	{
	  const int king_x = (king.x() > 5 ? 10 - king.x() : king.x());
	  int x_diff = king.x() - target.x(); // [-4, 4]
	  if ((P == BLACK && (king.x() > 5)) ||
	      (P == WHITE && (king.x() >= 5)))
	    x_diff = -x_diff;
	  const int y_diff = (P == BLACK ? king.y() - target.y() :
			      target.y() - king.y()) + 2; // [-2, 2] + 2
	  return king_x - 1 + 5 * (x_diff + 4 +
				   9 * (y_diff + 5 *  std::min(8, count)));
	}
	template <Player P>
	static int indexRelative(const Square king,
				 const Ptype ptype, const Square pos)
	{
	  const int x = std::abs(pos.x() - king.x());
	  const int y = (king.y() - pos.y()) *
	    (P == osl::BLACK ? 1 : -1) + 8;
	  return (ptype - osl::PTYPE_PIECE_MIN) * 17 * 9 + (x * 17 + y);
	}
	static int indexRelative(const Player player, const Square king,
				 const Piece piece)
	{
	  if (player == BLACK)
	  {
	    return indexRelative<BLACK>(king, piece.ptype(),
					piece.square());
	  }
	  else
	  {
	    return indexRelative<WHITE>(king, piece.ptype(),
					piece.square());
	  }
	}
      public:
	NewProgress(const NumEffectState &state);
	int progress() const
	{
	  return
	    std::max(std::min(progresses[0] + progresses[1] +
			      attack5x5_progresses[0] +
			      attack5x5_progresses[1] +
			      stand_progresses[0] + stand_progresses[1] +
			      effect_progresses[0] + effect_progresses[1] +
			      defenses[0] + defenses[1] +
			      king_relative_attack[0] +
			      king_relative_attack[1] +
			      king_relative_defense[0] +
			      king_relative_defense[1] +
			      non_pawn_ptype_attacked_pair[0] +
			      non_pawn_ptype_attacked_pair[1] +
			      pawn_facing + promotion37 + piecestand7,
			      max_progress-ProgressScale), 0) / ProgressScale;
	}
	static int maxProgress() { return max_progress / ProgressScale; }
	template<Player P>
	void updateSub(const NumEffectState &new_state, Move last_move);
	void update(const NumEffectState &new_state, Move last_move){
	  if(new_state.turn()==BLACK)
	    updateSub<WHITE>(new_state,last_move);
	  else
	    updateSub<BLACK>(new_state,last_move);
	}
        NewProgressDebugInfo debugInfo() const;
      private:
	template<Player P>
	void updateMain(const NumEffectState &new_state, Move last_move);
      public:
	const Progress16 progress16() const
	{
	  return Progress16(16 * progress() / maxProgress());
	}
	const Progress16 progress16(Player p) const
	{
	  assert(maxProgress() > 0);
	  return Progress16(
	    16 * std::max(
	      std::min(progresses[playerToIndex(alt(p))] +
		       attack5x5_progresses[playerToIndex(alt(p))] +
		       stand_progresses[playerToIndex(alt(p))] +
		       effect_progresses[playerToIndex(alt(p))] +
		       defenses[playerToIndex(alt(p))] +
		       king_relative_attack[playerToIndex(alt(p))] +
		       king_relative_defense[playerToIndex(p)] +
		       non_pawn_ptype_attacked_pair[p],
		       max_progress-ProgressScale), 0)
	    / ProgressScale / maxProgress());
	}
	// p == attack player, alt(p) == king owner
	const Progress16 progressAttack(Player p) const
	{
	  assert(maxProgress() > 0);
	  return Progress16(
	    8 * std::max(
	      std::min(progresses[alt(p)] +
		       attack5x5_progresses[alt(p)] +
		       stand_progresses[alt(p)] +
		       effect_progresses[alt(p)] +
		       king_relative_attack[alt(p)],
		       max_progress-ProgressScale), -max_progress+ProgressScale)
	    / ProgressScale / maxProgress() + 8);
	}
	// p == king owner (defense player)
	const Progress16 progressDefense(Player p) const
	{
	  assert(maxProgress() > 0);
	  return Progress16(
	    8 * std::max(
	      std::min(defenses[alt(p)] +
		       king_relative_defense[p] +
		       non_pawn_ptype_attacked_pair[p],
		       max_progress-ProgressScale),
	      -max_progress + ProgressScale)
	    / ProgressScale / maxProgress() + 8);
	}
	static bool initialized()
	{
	  return initialized_flag;
	}
	static bool setUp(const char *filename);
	static bool setUp();
	static std::string defaultFilename();
	const NewProgressData rawData() const { return *this; }
      };
      bool operator==(const NewProgressData& l, const NewProgressData& r);
      inline bool operator==(const NewProgress& l, const NewProgress& r) 
      {
	return l.rawData() == r.rawData();
      }
    }
    using ml::NewProgress;
  }
  using progress::NewProgress;
}

#endif // PROGRESS_EXPERIMENTAL_NEW_PROGRESS_H
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End: