dfpnRecord.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
dfpnRecord.h
Go to the documentation of this file.
1 /* dfpnRecord.h
2 */
3 #ifndef OSL_DFPNRECORD_H
4 #define OSL_DFPNRECORD_H
5
6 #include "osl/checkmate/proofDisproof.h"
7 #include "osl/move.h"
8 #include "osl/pieceStand.h"
9
10 #define NAGAI_DAG_TEST
11
12 namespace osl
13 {
14 namespace checkmate
15 {
16 struct DfpnRecordBase
17 {
18 ProofDisproof proof_disproof;
20 uint64_t solved;
21 #ifdef NAGAI_DAG_TEST
22
23 uint64_t dag_moves;
24 #endif
25 Move best_move;
26 PieceStand proof_pieces;
27 mutable unsigned int node_count;
28 unsigned int tried_oracle;
30 Move last_move;
32 PieceStand proof_pieces_candidate;
33 unsigned int min_pdp; // solved のmin
34 uint32_t working_threads;
35 Square last_to;
36 enum ProofPiecesType { UNSET=0, PROOF, DISPROOF };
37 int8_t proof_pieces_set;
38 char need_full_width, false_branch;
39 #ifdef NAGAI_DAG_TEST
40 bool dag_terminal;
41 #endif
42
43 DfpnRecordBase()
44 : solved(0),
45 #ifdef NAGAI_DAG_TEST
46 dag_moves(0),
47 #endif
48 node_count(0), tried_oracle(0), min_pdp(ProofDisproof::PROOF_MAX),
49 working_threads(0),
50 proof_pieces_set(UNSET), need_full_width(false), false_branch(false)
51 #ifdef NAGAI_DAG_TEST
52 , dag_terminal(0)
53 #endif
54 {
55 }
56 };
57
58 class DfpnRecord : public DfpnRecordBase
59 {
60 public:
61 CArray<PieceStand,2> stands;
62
63 DfpnRecord() {}
64 DfpnRecord(PieceStand black, PieceStand white) { stands[BLACK] = black; stands[WHITE] = white; }
65
66 void setFrom(const DfpnRecordBase& src)
67 {
68 static_cast<DfpnRecordBase*>(this)->operator=(src);
69 node_count = 1;
70 solved = 0;
71 last_to = Square();
72 last_move = Move();
73 need_full_width = false_branch = false;
74 #ifdef NAGAI_DAG_TEST
75 dag_moves = 0;
76 dag_terminal = false;
77 #endif
78 }
79 unsigned int proof() const { return proof_disproof.proof(); }
80 unsigned int disproof() const { return proof_disproof.disproof(); }
81 void setProofPieces(PieceStand a)
82 {
83 assert(proof_pieces_set == UNSET);
84 assert((stands[BLACK] == PieceStand() && stands[WHITE] == PieceStand())
85 || stands[BLACK].isSuperiorOrEqualTo(a)
86 || stands[WHITE].isSuperiorOrEqualTo(a));
87 proof_pieces_set = PROOF;
88 proof_pieces = a;
89 }
90 void setDisproofPieces(PieceStand a)
91 {
92 assert(proof_pieces_set == UNSET);
93 assert((stands[BLACK] == PieceStand() && stands[WHITE] == PieceStand())
94 || stands[BLACK].isSuperiorOrEqualTo(a)
95 || stands[WHITE].isSuperiorOrEqualTo(a));
96 proof_pieces_set = DISPROOF;
97 proof_pieces = a;
98 }
99 const PieceStand proofPieces() const
100 {
101 assert(proof_pieces_set == PROOF);
102 return proof_pieces;
103 }
104 const PieceStand disproofPieces() const
105 {
106 assert(proof_pieces_set == DISPROOF);
107 return proof_pieces;
108 }
109 };
110 }
111 }
112
113
114
115 #endif /* OSL_DFPNRECORD_H */
116 // ;;; Local Variables:
117 // ;;; mode:c++
118 // ;;; c-basic-offset:2
119 // ;;; End: