This file is indexed.

/usr/include/osl/checkmate/libertyEstimator.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
/* libertyEstimator.h
 */
#ifndef _LIBERTYESTIMATOR_H
#define _LIBERTYESTIMATOR_H

#include "osl/checkmate/proofNumberTable.h"
#include "osl/move.h"
namespace osl
{
  namespace checkmate
  {
    struct PureLibertyEstimator
    {
      /** @return move 後の玉のまわりの利きのないマス(の予想) */
      template <class State>
      static void attackH(Player attacker, const State& state, 
			  King8Info info, Move move, 
			  unsigned int& proof_number, 
			  unsigned int& disproof_number)
      {
	const Player defender = alt(attacker);
	const Square king_position = state.kingSquare(defender);
	proof_number = Proof_Number_Table.countLiberty
	  (state, info.libertyCount(), move, king_position, info);
	disproof_number = 1;
      }
      /** @return move 後の玉のまわりの利きのあるマス(の予想) */
      template <class State>
      static void defenseH(Player /*attacker*/, const State&, Move /*move*/, 
			   unsigned int& proof_number, 
			   unsigned int& disproof_number)
      {
	proof_number = 1;
	disproof_number = 1;
      }

    };
    /**
     * 玉の動ける場所を基本としたHの推定.
     * 駒を取る/捨てるなども多少考慮する.
     */
    struct LibertyEstimator
    {

      /** 攻撃側の move に対する proof_number と disproof_number を予想する */
      template <class State>
      static void attackH(Player attacker, const State&, King8Info, Move move, 
			  unsigned int& proof_number, unsigned int& disproof_number);
      /** 防御側の move に対する proof_number と disproof_number を予想する */
      template <class State>
      static void defenseH(Player attacker, const State&, Move move, 
			   unsigned int& proof_number, unsigned int& disproof_number);
    };

  } // namespace checkmate
} // namespace osl


template<typename State>
void osl::checkmate::LibertyEstimator::
attackH(Player attacker, const State& state, King8Info info, Move move, 
	unsigned int& proof_number, unsigned int& disproof_number)
{
  const Player defender = alt(attacker);
  PureLibertyEstimator::attackH
    (attacker, state, info, move, proof_number, disproof_number);

  // 功罪はあるが,速くなる問題の方が多そう
  if (state.hasMultipleEffectAt(defender, move.to()))
    ++proof_number;

  const Square from=move.from();
  const Square to=move.to();
  const int attack_support = state.countEffect(attacker,to);
  const int defense_support = state.countEffect(defender,to);
  if ((attack_support + (from.isPieceStand() ? 1 : 0)) > defense_support)
  {
    /** 効きが上回っていれば先にやってみる */
    disproof_number=2;
  }
  else if (move.capturePtype()!=PTYPE_EMPTY)
  {
    /** 駒を取る */
    Ptype capturePtype=unpromote(move.capturePtype());
    if ((capturePtype == SILVER)
	|| (capturePtype == GOLD))
    {
      disproof_number=2;
    }
    else
    {
      proof_number+=1;
      disproof_number=1;
    }
  }
  else
  {
    proof_number+=1;
    disproof_number=1;
  }
}

template<typename State>
void osl::checkmate::LibertyEstimator::
defenseH(Player attacker, const State& state, Move move, 
		 unsigned int& proof_number, unsigned int& disproof_number)
{
  /** captureは価値が高い */
  if (move.capturePtype()!=PTYPE_EMPTY)
  {
    proof_number=2;
    disproof_number=1;
    return;
  }
  if (move.ptype()==KING)
  {
    proof_number=1;
    disproof_number=1;
    return;
  }
  const Square to = move.to();
  if ((state.countEffect(attacker,to) + (move.isDrop() ? 1 : 0))
      <= state.countEffect(alt(attacker),to))
  {
    proof_number=2;
    disproof_number=1;
    return;
  }
  proof_number=1;
  disproof_number = 2;
}

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