All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ntesukiSimulationSearcher.h
Go to the documentation of this file.
1 /* ntesukiSimulationSearcher.h
2  */
3 #ifndef __NTESUKI_SIMULATION_SEARCHER_H
4 #define __NTESUKI_SIMULATION_SEARCHER_H
7 #include "ntesukiExceptions.h"
8 
10 
11 namespace osl
12 {
13  namespace ntesuki
14  {
15  class
17  {
19  unsigned int node_count;
21  bool verbose;
22 
24  unsigned int proof_count;
25  unsigned int proof_success_count;
27  unsigned int disproof_count;
28  unsigned int disproof_success_count;
29  public:
30  bool debug;
31  private:
38 
39  /*
40  * helpers
41  */
42  template <class Searcher, Player P> class AttackHelperProof;
43  template <class Searcher, Player P> class DefenseHelperProof;
44  template <class Searcher, Player P> class AttackHelperDisproof;
45  template <class Searcher, Player P> class DefenseHelperDisproof;
46 
47  /* Utilities
48  */
49  template<Player P>
50  bool
51  isSafeMove(const Move move,
52  int pass_left);
53 
54  template <Player P>
55  Move
56  adjustMove(Move candidate) const
57  {
58  assert(candidate.isValid());
59  if (! candidate.isDrop())
60  {
61  const Piece p=state.pieceOnBoard(candidate.to());
62  candidate=setCapture(candidate,p);
63  }
64  return candidate;
65  }
66 
70  template <Player P>
71  void attackForProof(NtesukiRecord* record,
72  const NtesukiRecord* record_orig,
73  const unsigned int passLeft,
74  const Move last_move);
78  template <Player P>
79  void defenseForProof(NtesukiRecord* record,
80  const NtesukiRecord* record_orig,
81  const unsigned int passLeft,
82  const Move last_move);
86  template <Player P>
87  void attackForDisproof(NtesukiRecord* record,
88  const NtesukiRecord* record_orig,
89  const unsigned int passLeft,
90  const Move last_move);
94  template <Player P>
95  void defenseForDisproof(NtesukiRecord* record,
96  const NtesukiRecord* record_orig,
97  const unsigned int passLeft,
98  const Move last_move);
99 
100  public:
103  PathEncoding& path,
104  NtesukiTable& table,
105  NtesukiRecord::ISScheme isscheme,
106  bool verbose = false);
108 
113  template <Player P>
114  bool
115  startFromAttackProof(NtesukiRecord* record,
116  const NtesukiRecord* record_orig,
117  const unsigned int passLeft,
118  const Move last_move);
119 
124  template <Player P>
125  bool
126  startFromDefenseProof(NtesukiRecord* record,
127  const NtesukiRecord* record_orig,
128  const unsigned int passLeft,
129  const Move last_move);
130 
135  template <Player P>
136  bool
137  startFromAttackDisproof(NtesukiRecord* record,
138  const NtesukiRecord* record_orig,
139  const unsigned int passLeft,
140  const Move last_move);
141 
146  template <Player P>
147  bool
148  startFromDefenseDisproof(NtesukiRecord* record,
149  const NtesukiRecord* record_orig,
150  const unsigned int passLeft,
151  const Move last_move);
152 
153  unsigned int nodeCount() const { return node_count; }
154  };
155  } //ntesuki
156 } //osl
157 #endif /* _NTESUKI_SIMULATION_SEARCHER_H */
158 
159 // ;;; Local Variables:
160 // ;;; mode:c++
161 // ;;; c-basic-offset:2
162 // ;;; End: