This file is indexed.

/usr/include/osl/checkmate/fixedDepthSearcher.h is in libosl-dev 0.4.2-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
/* fixedDepthSearcher.h
 */
#ifndef OSL_CHECKMATE_FIXED_DEPTH_SERCHER_H
#define OSL_CHECKMATE_FIXED_DEPTH_SERCHER_H
#include "osl/checkmate/proofDisproof.h"
#include "osl/state/numEffectState.h"
#include "osl/move.h"
#include "osl/pieceStand.h"

namespace osl
{
  class PieceStand;
  namespace checkmate
  {
    class CheckMoveVector;
    /**
     * 深さ固定で,その深さまで depth first searchで読む詰将棋.
     * 深さ0で詰み状態かどうか(攻め手の手番の場合),王手をかける手がないかを判定可能
     * 深さ1で通常の一手詰みを判定(攻め手の手番の場合)
     * 使うのは深さ3位まで?
     * NumEffectState専用
     */
    class FixedDepthSearcher
    {
    private:
      NumEffectState *state;
      int count;
    public:
      FixedDepthSearcher() : state(0), count(0)
      {
      }
      explicit FixedDepthSearcher(NumEffectState& s)
	: state(&s), count(0)
      {
      }
      void setState(NumEffectState& s)
      {
	state = &s;
      }
    private:
      void addCount()
      {
	count++; 
      }
    public:
      int getCount() const
      {
	return count; 
      }
      const PieceStand stand(Player P) const
      {
	return PieceStand(P, *state);
      }
    public:
      // private: Note: helper の都合
      template <Player P, bool SetPieces, bool HasGuide>
      const ProofDisproof attack(int depth, Move& best_move, PieceStand& proof_pieces);
      template <Player P, bool SetPieces, bool HasGuide>
      const ProofDisproof attackMayUnsafe(int depth, Move& best_move, PieceStand& proof_pieces);
      template <Player P, bool SetPieces>
      const ProofDisproof defense(Move last_move,int depth,
				  PieceStand& proof_pieces);
    private:
      /**
       * move を作らずに ProofDisproof の予測を計算する
       */
      template <Player P, bool SetPieces>
      const ProofDisproof defenseEstimation(Move last_move, PieceStand& proof_pieces,
					    Piece attacker_piece,
					    Square target_position) const;
    public:      
      /**
       * stateがPから詰む局面かを返す.
       * stateの手番はPと一致しているという前提
       */
      template <Player P>
      const ProofDisproof hasCheckmateMove(int depth, Move& best_move,
					   PieceStand& proof_pieces)
      {
	return attack<P,true,false>(depth, best_move, proof_pieces);
      }
      /**
       * guide を最初に試す.
       * guide.isNormal() である必要はあるが,その局面でvalid でなくても良い
       */
      template <Player P>
      const ProofDisproof hasCheckmateWithGuide(int depth, Move& guide,
						PieceStand& proof_pieces);
      template <Player P>
      const ProofDisproof hasCheckmateMove(int depth,Move& best_move)
      {
	PieceStand proof_pieces;
	return attack<P,false,false>(depth, best_move, proof_pieces);
      }
      template <Player P>
      const ProofDisproof hasCheckmateMove(int depth)
      {
	Move checkmate_move;
	return hasCheckmateMove<P>(depth, checkmate_move);
      }
      
      /**
       * stateがPによって詰んでいる局面かを返す.
       * 王手がかかっていない時には呼ばない
       * stateの手番はalt(P)と一致しているという前提
       * stateはPによって王手がかかっているという前提
       * @param last_move 打ち歩詰めの判定に必要
       */
      template <Player P>
      const ProofDisproof hasEscapeMove(Move last_move,int depth,
					PieceStand& proof_pieces)
      {
	return defense<P,true>(last_move, depth, proof_pieces);
      }
      template <Player P>
      const ProofDisproof hasEscapeMove(Move last_move,int depth)
      {
	PieceStand proof_pieces;
	return defense<P,false>(last_move, depth, proof_pieces);
      }
      /**
       * next_move を指して逃げられるかどうかを調べる
       * @param check_move 詰の場合の攻撃側の指手
       * @param depth next_move を指した後からカウント
       */
      template <Player P>
      const ProofDisproof hasEscapeByMove(Move next_move, int depth,
					  Move& check_move,
					  PieceStand& proof_pieces);
      template <Player P>
      const ProofDisproof hasEscapeByMove(Move next_move, int depth);

      const ProofDisproof hasCheckmateMoveOfTurn(int depth,Move& best_move);
      const ProofDisproof hasCheckmateMoveOfTurn(int depth,Move& best_move,
						 PieceStand& proof_pieces);
      const ProofDisproof hasCheckmateWithGuideOfTurn(int depth, Move& guide,
						      PieceStand& proof_pieces);
      const ProofDisproof hasEscapeMoveOfTurn(Move last_move,int depth);
      const ProofDisproof hasEscapeByMoveOfTurn(Move next_move, int depth,
						Move& check_move,
						PieceStand& proof_pieces);
      const ProofDisproof hasEscapeByMoveOfTurn(Move next_move, int depth);

      /**
       * 無駄合をなるべく生成しない,合駒生成
       */
      template <Player Defense>
      void generateBlockingWhenLiberty0(Piece defense_king, Square attack_from,
					CheckMoveVector& moves) const;
      template <Player Defense>
      int blockEstimation(Square attack_from, Square defense_king) const;
    };
  } // namespace checkmate
} // namespace osl

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