moveInfo.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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/state/numEffectState.h"
7 #include "osl/pieceStand.h"
8 namespace osl
9 {
10 namespace move_probability
11 {
12 struct StateInfo;
13 struct MoveInfo
14 {
15 Move move;
16 int see, plain_see;
17 bool check, open_check;
18 Player player;
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;
40 bool adhocAdjustAttackCheckmateDefender(const StateInfo&) const;
41 bool adhocAdjustKeepCheckmateDefender(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: