fixedDepthSearcher.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fixedDepthSearcher.h
Go to the documentation of this file.
1 /* fixedDepthSearcher.h
2 */
3 #ifndef OSL_CHECKMATE_FIXED_DEPTH_SERCHER_H
4 #define OSL_CHECKMATE_FIXED_DEPTH_SERCHER_H
5 #include "osl/checkmate/proofDisproof.h"
6 #include "osl/state/numEffectState.h"
7 #include "osl/move.h"
8 #include "osl/pieceStand.h"
9
10 namespace osl
11 {
12 class PieceStand;
13 namespace checkmate
14 {
15 class CheckMoveVector;
23 class FixedDepthSearcher
24 {
25 private:
26 NumEffectState *state;
27 int count;
28 public:
29 FixedDepthSearcher() : state(0), count(0)
30 {
31 }
32 explicit FixedDepthSearcher(NumEffectState& s)
33 : state(&s), count(0)
34 {
35 }
36 void setState(NumEffectState& s)
37 {
38 state = &s;
39 }
40 private:
41 void addCount()
42 {
43 count++;
44 }
45 public:
46 int getCount() const
47 {
48 return count;
49 }
50 const PieceStand stand(Player P) const
51 {
52 return PieceStand(P, *state);
53 }
54 public:
55 // private: Note: helper の都合
56 template <Player P, bool SetPieces, bool HasGuide>
57 const ProofDisproof attack(int depth, Move& best_move, PieceStand& proof_pieces);
58 template <Player P, bool SetPieces, bool HasGuide>
59 const ProofDisproof attackMayUnsafe(int depth, Move& best_move, PieceStand& proof_pieces);
60 template <Player P, bool SetPieces>
61 const ProofDisproof defense(Move last_move,int depth,
62 PieceStand& proof_pieces);
63 private:
67 template <Player P, bool SetPieces>
68 const ProofDisproof defenseEstimation(Move last_move, PieceStand& proof_pieces,
69 Piece attacker_piece,
70 Square target_position) const;
71 public:
76 template <Player P>
77 const ProofDisproof hasCheckmateMove(int depth, Move& best_move,
78 PieceStand& proof_pieces)
79 {
80 return attack<P,true,false>(depth, best_move, proof_pieces);
81 }
86 template <Player P>
87 const ProofDisproof hasCheckmateWithGuide(int depth, Move& guide,
88 PieceStand& proof_pieces);
89 template <Player P>
90 const ProofDisproof hasCheckmateMove(int depth,Move& best_move)
91 {
92 PieceStand proof_pieces;
93 return attack<P,false,false>(depth, best_move, proof_pieces);
94 }
95 template <Player P>
96 const ProofDisproof hasCheckmateMove(int depth)
97 {
98 Move checkmate_move;
99 return hasCheckmateMove<P>(depth, checkmate_move);
100 }
101
109 template <Player P>
110 const ProofDisproof hasEscapeMove(Move last_move,int depth,
111 PieceStand& proof_pieces)
112 {
113 return defense<P,true>(last_move, depth, proof_pieces);
114 }
115 template <Player P>
116 const ProofDisproof hasEscapeMove(Move last_move,int depth)
117 {
118 PieceStand proof_pieces;
119 return defense<P,false>(last_move, depth, proof_pieces);
120 }
126 template <Player P>
127 const ProofDisproof hasEscapeByMove(Move next_move, int depth,
128 Move& check_move,
129 PieceStand& proof_pieces);
130 template <Player P>
131 const ProofDisproof hasEscapeByMove(Move next_move, int depth);
132
133 const ProofDisproof hasCheckmateMoveOfTurn(int depth,Move& best_move);
134 const ProofDisproof hasCheckmateMoveOfTurn(int depth,Move& best_move,
135 PieceStand& proof_pieces);
136 const ProofDisproof hasCheckmateWithGuideOfTurn(int depth, Move& guide,
137 PieceStand& proof_pieces);
138 const ProofDisproof hasEscapeMoveOfTurn(Move last_move,int depth);
139 const ProofDisproof hasEscapeByMoveOfTurn(Move next_move, int depth,
140 Move& check_move,
141 PieceStand& proof_pieces);
142 const ProofDisproof hasEscapeByMoveOfTurn(Move next_move, int depth);
143
147 template <Player Defense>
148 void generateBlockingWhenLiberty0(Piece defense_king, Square attack_from,
149 CheckMoveVector& moves) const;
150 template <Player Defense>
151 int blockEstimation(Square attack_from, Square defense_king) const;
152 };
153 } // namespace checkmate
154 } // namespace osl
155
156 #endif /* OSL_CHECKMATE_FIXED_DEPTH_SERCHER_H */
157 // ;;; Local Variables:
158 // ;;; mode:c++
159 // ;;; c-basic-offset:2
160 // ;;; End: