This file is indexed.

/usr/include/osl/move_classifier/pawnDropCheckmate.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
/* pawnDropCheckmate.h
 */
#ifndef OSL_MOVE_CLASSIFIER_PAWNDROPCHECKMATE_H
#define OSL_MOVE_CLASSIFIER_PAWNDROPCHECKMATE_H

#include "osl/state/numEffectState.h"
#include "osl/effect_util/effectUtil.h"
#include "osl/checkmate/king8Info.h"
namespace osl
{
  namespace move_classifier
  {
    /**
     * 打歩詰の判定.
     * @param P 指手(攻撃)側
     */
    template <Player P>
    struct PawnDropCheckmate
    {
      /**
       * kingSquare に居る alt(P)の玉が dir 方向に逃げられるか.
       */
      static bool canEscape(const NumEffectState& state, Square kingSquare, 
			    Direction dir, Square dropAt);
      /** 王が前以外に移動可能か */
      static bool escape7(const NumEffectState& state, 
			  Square kingSquare, Square to);
      static bool isMember(const NumEffectState& state, 
			   Ptype ptype,Square from,Square to)
      {
	// 打歩
	if (! from.isPieceStand())
	  return false;
	if (ptype != PAWN)
	  return false;
	const Player Opponent = PlayerTraits<P>::opponent;
	const Piece king = state.template kingPiece<Opponent>();
	const Square king_position = king.square();
	// DirectionPlayerTraits?
	// 玉頭
        if (king_position != (to + DirectionPlayerTraits<U,P>::offset()))
	  return false;
	// 玉で取れない
	if (! state.hasEffectAt(P, to))
	  return false;
	if (King8Info(state.Iking8Info(Opponent)).liberty() != 0)
	  return false;
	// 玉以外の駒で取れない
	if (EffectUtil::template safeCaptureNotByKing<Opponent>
	    (state, to, king)
	    != Piece::EMPTY())
	  return false;
	// どこにも逃げられない
	return escape7(state, king_position, to);
      }
    };
  } // namespace move_classifier
} // namespace osl

template <osl::Player P>
bool
#ifdef __GNUC__
	__attribute__ ((pure))
#endif
 osl::move_classifier::PawnDropCheckmate<P>::
canEscape(const NumEffectState& state, Square kingSquare, 
	  Direction dir, Square dropAt) 
{
  const Player Opponent = PlayerTraits<P>::opponent;
  const Square target 
    = kingSquare + Board_Table.getOffset(Opponent, dir);
  const Piece p = state.pieceAt(target);
  if (p.isOnBoardByOwner<Opponent>())
    return false;		// 自分の駒がいたら移動不能
  if (target.isEdge())
    return false;
  Piece attacker;
  if (! state.template hasEffectAt<P>(target, attacker))
    return true;		// 利きがない
  if (attacker == Piece::EMPTY())
    return false;		// 攻撃側に複数の利き
  assert(attacker.owner() == P);
  // drop によりふさがれた利きなら逃げられる
  //    -OU
  // XXX+FU+HI
  // の場合のXXXなど.
  const Offset shortOffset
    = Board_Table.getShortOffsetNotKnight(Offset32(target,dropAt));
  if (shortOffset.zero())
    return false;
  const Square attackFrom = attacker.square();
  return shortOffset
    == Board_Table.getShortOffsetNotKnight(Offset32(dropAt,attackFrom));
}

template <osl::Player P>
bool
#ifdef __GNUC__
	__attribute__ ((pure))
#endif
 osl::move_classifier::PawnDropCheckmate<P>::
escape7(const NumEffectState& state, Square king_position, Square to)
{
  // U は歩
  if (canEscape(state, king_position, UL, to))
    return false;
  if (canEscape(state, king_position, UR, to))
    return false;
  if (canEscape(state, king_position, L, to))
    return false;
  if (canEscape(state, king_position, R, to))
    return false;
  if (canEscape(state, king_position, DL, to))
    return false;
  if (canEscape(state, king_position, D, to))
    return false;
  if (canEscape(state, king_position, DR, to))
    return false;
  return true;
}
      

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