/usr/include/osl/rating/feature/escape.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 | /* escape.h
*/
#ifndef _ESCAPE_H
#define _ESCAPE_H
#include "osl/rating/feature.h"
#include "osl/rating/feature/countEffect2.h"
namespace osl
{
namespace rating
{
/** 移動元へのきき。attack defense は言葉の意味と逆で自分がattack */
class FromEffect : public Feature, CountEffect2
{
public:
FromEffect(int attack, int defense)
: Feature("FE"+CountEffect2::name(attack, defense)), CountEffect2(attack, defense) {}
bool match(const NumEffectState& state, Move move, const RatingEnv& env) const
{
return ! move.isDrop() && CountEffect2::match(state, move.from(), env);
}
};
class PtypeAttacked : public Feature
{
Ptype self, attack;
public:
PtypeAttacked(Ptype s, Ptype a)
: Feature(std::string(Ptype_Table.getCsaName(s))+"<"+Ptype_Table.getCsaName(a)),
self(s), attack(a)
{
}
bool match(const NumEffectState& state, Move move, const RatingEnv&) const
{
return move.oldPtype() == self
&& ! move.isDrop()
&& state.findCheapAttack(alt(move.player()), move.from()).ptype()== attack;
}
};
class ToSupported : public Feature
{
public:
ToSupported() : Feature("TS") {}
bool match(const NumEffectState& state, Move move, const RatingEnv&) const
{
return state.hasEffectAt(move.player(), move.to());
}
};
class ImmediateEscape : public Feature
{
Ptype self, attack;
public:
ImmediateEscape(Ptype s, Ptype a)
: Feature(std::string(Ptype_Table.getCsaName(s))+"<"+Ptype_Table.getCsaName(a)),
self(s), attack(a)
{
}
bool match(const NumEffectState& state, Move move, const RatingEnv& env) const
{
if (move.isDrop())
return false;
if (move.ptype() != self)
return false;
const Move last_move = env.history.lastMove();
if (! last_move.isNormal() || last_move.ptype() != attack)
return false;
return state.hasEffectIf(last_move.ptypeO(), last_move.to(), move.from());
}
};
class KingEscape : public Feature
{
Ptype ptype;
public:
KingEscape(Ptype s)
: Feature(std::string(Ptype_Table.getCsaName(s))), ptype(s)
{
}
bool match(const NumEffectState& state, Move move, const RatingEnv&) const
{
return state.inCheck()
&& move.ptype() == ptype;
}
bool effectiveInCheck() const { return true; }
};
}
}
#endif /* _ESCAPE_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|