My Project
moveInfo.h
Go to the documentation of this file.
1/* moveInfo.h
2 */
3#ifndef OSL_MOVE_PROBABILITY_MOVEINFO_H
4#define OSL_MOVE_PROBABILITY_MOVEINFO_H
5
7
8namespace osl
9{
10 namespace move_probability
11 {
12 struct StateInfo;
13 struct MoveInfo
14 {
19 mutable int stand_index_cache;
20 MoveInfo(const StateInfo&, Move);
21
22 int standIndex(const NumEffectState& state) const
23 {
24 if (stand_index_cache < 0) {
26 assert(PieceStand::order[6] == PAWN);
27 for (size_t i=0; i+1<PieceStand::order.size(); ++i) {
28 Ptype ptype = PieceStand::order[i];
29 int count = state.countPiecesOnStand(player, ptype);
30 if (move.isDrop() && ptype == move.ptype())
31 --count;
32 stand_index_cache = stand_index_cache * 2 + (count > 0);
33 }
34 }
35 return stand_index_cache;
36 }
37 bool adhocAdjustSlider(const StateInfo&) const;
38 bool adhocAdjustBishopFork(const StateInfo&) const;
39 bool adhocAdjustBreakThreatmate(const StateInfo&) const;
42 };
43 }
44}
45
46#endif /* OSL_MOVE_PROBABILITY_MOVEINFO_H */
47// ;;; Local Variables:
48// ;;; mode:c++
49// ;;; c-basic-offset:2
50// ;;; End:
static size_t size()
Definition container.h:76
圧縮していない moveの表現 .
Ptype ptype() const
bool isDrop() const
利きを持つ局面
static const CArray< Ptype, 7 > order
持駒の表示で良く使われる順番.
int countPiecesOnStand(Player pl, Ptype ptype) const
持駒の枚数を数える
Ptype
駒の種類を4ビットでコード化する
Definition basic_type.h:84
@ PAWN
Definition basic_type.h:95
Player
Definition basic_type.h:8
bool adhocAdjustBreakThreatmate(const StateInfo &) const
Definition moveInfo.cc:66
bool adhocAdjustSlider(const StateInfo &) const
Definition moveInfo.cc:35
bool adhocAdjustAttackCheckmateDefender(const StateInfo &) const
Definition moveInfo.cc:81
int standIndex(const NumEffectState &state) const
Definition moveInfo.h:22
bool adhocAdjustKeepCheckmateDefender(const StateInfo &) const
Definition moveInfo.cc:94
bool adhocAdjustBishopFork(const StateInfo &) const
Definition moveInfo.cc:47