My Project
stateInfo.h
Go to the documentation of this file.
1/* stateInfo.h
2 */
3#ifndef OSL_MOVE_PROBABILITY_STATEINFO_H
4#define OSL_MOVE_PROBABILITY_STATEINFO_H
5
9#include "osl/progress.h"
10#include "osl/container.h"
13#include <vector>
14#include <algorithm>
15
16namespace osl
17{
18 namespace move_probability
19 {
20 struct StateInfo
21 {
24 Progress16 progress16;
45 bool dirty;
46
47 StateInfo() : state(0), history(0), progress16(0), dirty(true)
48 {
49 }
50 StateInfo(const NumEffectState& s, Progress16 p, const MoveStack& h,
51 Move t=Move())
52 : state(&s), history(&h), progress16(p), dirty(true)
53 {
57 }
58 void reset0(const NumEffectState& s, Progress16 p)
59 {
60 dirty = true;
61 state = &s;
62 progress16 = p;
67 }
68 void reset1(const MoveStack& h)
69 {
70 history = &h;
71 }
72 void finishUpdate();
73 void reset(const NumEffectState& s, Progress16 p,
75 {
76 reset0(s, p);
77 reset1(h);
80 }
81 void setThreatmate(Move move) { threatmate_move = move; }
82
89 {
90 return King8Info(state->Iking8Info(pl));
91 }
92 int progress8() const { return progress16.value()/2; }
93 static std::pair<Piece,Square> findCheckmateDefender(const NumEffectState& state, Player king);
94 static Move findShortThreatmate(const NumEffectState&, Move last_move);
95 private:
96 void clearOldCache();
100 void updatePinnedGenerals(Player owner);
101 };
102 bool operator==(const StateInfo& l, const StateInfo& r);
103 }
104}
105
106#endif /* OSL_MOVE_PROBABILITY_STATEINFO_H */
107// ;;; Local Variables:
108// ;;; mode:c++
109// ;;; c-basic-offset:2
110// ;;; End:
圧縮していない moveの表現 .
利きを持つ局面
uint64_t Iking8Info(Player king) const
駒番号のビットセット.
Definition pieceMask.h:21
敵玉の8近傍の状態を表す.
Definition king8Info.h:29
bool operator==(const PinnedGeneral &l, const PinnedGeneral &r)
Ptype
駒の種類を4ビットでコード化する
Definition basic_type.h:84
Player
Definition basic_type.h:8
FixedCapacityVector< PinnedGeneral, 64 > pinned_gs_t
Definition stateInfo.h:37
void updatePinnedGenerals(Player owner)
Definition stateInfo.cc:185
static std::pair< Piece, Square > findCheckmateDefender(const NumEffectState &state, Player king)
Definition stateInfo.cc:160
CArray< Piece, 2 > threatened
Definition stateInfo.h:26
void reset(const NumEffectState &s, Progress16 p, const MoveStack &h, Move threatmate_move=Move())
Definition stateInfo.h:73
unsigned int possible_threatmate_ptype
Definition stateInfo.h:43
const NumEffectState * state
Definition stateInfo.h:22
CArray2d< bool, 40, 2 > attack_shadow
Definition stateInfo.h:31
static Move findShortThreatmate(const NumEffectState &, Move last_move)
Definition stateInfo.cc:222
void reset0(const NumEffectState &s, Progress16 p)
Definition stateInfo.h:58
void reset1(const MoveStack &h)
Definition stateInfo.h:68
CArray< int, 16 > pattern_square_t
Definition stateInfo.h:29
CArray< bool, 2 > move_candidate_exists
Definition stateInfo.h:39
CArray< pinned_gs_t, 2 > exchange_pins
Definition stateInfo.h:38
StateInfo(const NumEffectState &s, Progress16 p, const MoveStack &h, Move t=Move())
Definition stateInfo.h:50
FixedCapacityVector< int, 8 > long_attack_t
Definition stateInfo.h:27
bool pinByOpposingSliders(Piece p) const
Definition stateInfo.h:83
CArray< std::pair< Piece, Square >, 2 > checkmate_defender
Definition stateInfo.h:42
CArray< pattern_square_t, Square::SIZE > pattern_cache
Definition stateInfo.h:30
King8Info king8Info(Player pl) const
Definition stateInfo.h:88
CArray< PieceMask, 2 > pin
Definition stateInfo.h:34
CArray2d< long_attack_t, 40, 8 > long_attack_cache
Definition stateInfo.h:28