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 
6 #include "osl/numEffectState.h"
7 
8 namespace osl
9 {
10  namespace move_probability
11  {
12  struct StateInfo;
13  struct MoveInfo
14  {
16  int see, plain_see;
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) {
25  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:
bool adhocAdjustBishopFork(const StateInfo &) const
Definition: moveInfo.cc:47
int countPiecesOnStand(Player pl, Ptype ptype) const
持駒の枚数を数える
Definition: simpleState.h:182
Ptype
駒の種類を4ビットでコード化する
Definition: basic_type.h:83
Ptype ptype() const
Definition: basic_type.h:1155
bool adhocAdjustSlider(const StateInfo &) const
Definition: moveInfo.cc:35
圧縮していない moveの表現 .
Definition: basic_type.h:1051
int standIndex(const NumEffectState &state) const
Definition: moveInfo.h:22
bool adhocAdjustKeepCheckmateDefender(const StateInfo &) const
Definition: moveInfo.cc:94
bool adhocAdjustAttackCheckmateDefender(const StateInfo &) const
Definition: moveInfo.cc:81
利きを持つ局面
bool isDrop() const
Definition: basic_type.h:1150
MoveInfo(const StateInfo &, Move)
Definition: moveInfo.cc:12
static const CArray< Ptype, 7 > order
持駒の表示で良く使われる順番.
Player
Definition: basic_type.h:8
bool adhocAdjustBreakThreatmate(const StateInfo &) const
Definition: moveInfo.cc:66
static size_t size()
Definition: container.h:76