My Project
dualDfpn.h
Go to the documentation of this file.
1/* dualDfpn.h
2 */
3#ifndef OSL_DUALDFPN_H
4#define OSL_DUALDFPN_H
7#include "osl/hashKey.h"
8#include "osl/pathEncoding.h"
10#include <memory>
11#include <cstddef>
12#include <limits>
13
14#ifdef OSL_SMP
15# ifndef OSL_DFPN_SMP
16# define OSL_DFPN_SMP
17# endif
18#endif
19
20namespace osl
21{
22 class RepetitionCounter;
23 namespace checkmate
24 {
25 class Dfpn;
26 class DfpnTable;
29 {
30 struct Shared;
31 struct Local;
32 struct OraclePool;
33 std::shared_ptr<Shared> shared;
34 std::unique_ptr<Local> local;
35 public:
36 explicit DualDfpn(uint64_t ignored=std::numeric_limits<uint64_t>::max());
37 DualDfpn(const DualDfpn& src);
38 ~DualDfpn();
39
41 template <Player P>
42 ProofDisproof findProof(int node_limit, const NumEffectState& state,
43 const HashKey& key, const PathEncoding& path,
44 Move& best_move, Move last_move=Move::INVALID());
50 template <Player P>
51 bool isWinningState(int node_limit, const NumEffectState& state,
52 const HashKey& key, const PathEncoding& path,
53 Move& best_move, Move last_move=Move::INVALID())
54 {
55 return findProof(node_limit, state, key, path, best_move, last_move)
57 }
58 bool isWinningState(int node_limit, const NumEffectState& state,
59 const HashKey& key, const PathEncoding& path,
60 Move& best_move, Move last_move=Move::INVALID());
61 ProofDisproof findProof(int node_limit, const NumEffectState& state,
62 const HashKey& key, const PathEncoding& path,
63 Move& best_move, Move last_move=Move::INVALID());
64#ifdef OSL_DFPN_SMP
69 template <Player P>
70 bool isWinningStateParallel(int node_limit, const NumEffectState& state,
71 const HashKey& key, const PathEncoding& path,
72 Move& best_move, Move last_move=Move::INVALID());
73 bool isWinningStateParallel(int node_limit, const NumEffectState& state,
74 const HashKey& key, const PathEncoding& path,
75 Move& best_move, Move last_move=Move::INVALID());
76#endif
77 template <Player P>
78 bool isLosingState(int node_limit, const NumEffectState& state,
79 const HashKey& key, const PathEncoding& path,
80 Move last_move=Move::INVALID());
81 bool isLosingState(int node_limit, const NumEffectState& state,
82 const HashKey& key, const PathEncoding& path,
83 Move last_move=Move::INVALID());
84
85 void runGC(bool verbose=false, size_t memory_use_ratio_1000=0);
86
87 // debug
88 void setVerbose(int level=1);
89 int distance(Player attack, const HashKey& key);
90 size_t mainNodeCount() const;
91 size_t totalNodeCount() const;
92 void writeRootHistory(const RepetitionCounter& counter,
93 const MoveStack& moves,
94 const SimpleState& state, Player attack);
95 const DfpnTable& table(Player) const;
96 private:
97 Dfpn& prepareDfpn(Player attack);
99 };
100 }
101 using checkmate::DualDfpn;
102}
103
104#endif /* OSL_DUALDFPN_H */
105// ;;; Local Variables:
106// ;;; mode:c++
107// ;;; c-basic-offset:2
108// ;;; End:
圧縮していない moveの表現 .
static const Move INVALID()
利きを持つ局面
千日手の検出.
詰探索局面表 – 並列でも共有する部分
Definition dfpn.h:30
詰探索
Definition dfpn.h:107
一般用詰み探索: 先手後手の詰みを別々に管理
Definition dualDfpn.h:29
void runGC(bool verbose=false, size_t memory_use_ratio_1000=0)
Definition dualDfpn.cc:301
bool isLosingState(int node_limit, const NumEffectState &state, const HashKey &key, const PathEncoding &path, Move last_move=Move::INVALID())
Definition dualDfpn.cc:551
Dfpn & prepareDfpn(Player attack)
Definition dualDfpn.cc:281
void setVerbose(int level=1)
Definition dualDfpn.cc:609
bool isWinningState(int node_limit, const NumEffectState &state, const HashKey &key, const PathEncoding &path, Move &best_move, Move last_move=Move::INVALID())
詰みを発見.
Definition dualDfpn.h:51
size_t totalNodeCount() const
Definition dualDfpn.cc:631
Dfpn & prepareDfpnSmall(Player attack)
Definition dualDfpn.cc:293
ProofDisproof findProof(int node_limit, const NumEffectState &state, const HashKey &key, const PathEncoding &path, Move &best_move, Move last_move=Move::INVALID())
size_t mainNodeCount() const
Definition dualDfpn.cc:621
int distance(Player attack, const HashKey &key)
Definition dualDfpn.cc:614
void writeRootHistory(const RepetitionCounter &counter, const MoveStack &moves, const SimpleState &state, Player attack)
Definition dualDfpn.cc:577
std::shared_ptr< Shared > shared
Definition dualDfpn.h:33
void setRootPlayer(Player)
Definition dualDfpn.cc:602
const DfpnTable & table(Player) const
Definition dualDfpn.cc:640
std::unique_ptr< Local > local
Definition dualDfpn.h:34
証明数(proof number)と反証数(disproof number).
Player
Definition basic_type.h:8