説明を見る。00001
00002
00003 #ifndef OSL_DFPNRECORD_H
00004 #define OSL_DFPNRECORD_H
00005
00006 #include "osl/checkmate/proofDisproof.h"
00007 #include "osl/basic_type.h"
00008
00009 #define NAGAI_DAG_TEST
00010
00011 namespace osl
00012 {
00013 namespace checkmate
00014 {
00015 struct DfpnRecordBase
00016 {
00017 ProofDisproof proof_disproof;
00019 uint64_t solved;
00020 #ifdef NAGAI_DAG_TEST
00021
00022 uint64_t dag_moves;
00023 #endif
00024 Move best_move;
00025 PieceStand proof_pieces;
00026 mutable unsigned int node_count;
00027 unsigned int tried_oracle;
00029 Move last_move;
00031 PieceStand proof_pieces_candidate;
00032 unsigned int min_pdp;
00033 uint32_t working_threads;
00034 Square last_to;
00035 enum ProofPiecesType { UNSET=0, PROOF, DISPROOF };
00036 int8_t proof_pieces_set;
00037 char need_full_width, false_branch;
00038 #ifdef NAGAI_DAG_TEST
00039 bool dag_terminal;
00040 #endif
00041
00042 DfpnRecordBase()
00043 : solved(0),
00044 #ifdef NAGAI_DAG_TEST
00045 dag_moves(0),
00046 #endif
00047 node_count(0), tried_oracle(0), min_pdp(ProofDisproof::PROOF_MAX),
00048 working_threads(0),
00049 proof_pieces_set(UNSET), need_full_width(false), false_branch(false)
00050 #ifdef NAGAI_DAG_TEST
00051 , dag_terminal(0)
00052 #endif
00053 {
00054 }
00055 };
00056
00057 class DfpnRecord : public DfpnRecordBase
00058 {
00059 public:
00060 CArray<PieceStand,2> stands;
00061
00062 DfpnRecord() {}
00063 DfpnRecord(PieceStand black, PieceStand white) { stands[BLACK] = black; stands[WHITE] = white; }
00064
00065 void setFrom(const DfpnRecordBase& src)
00066 {
00067 static_cast<DfpnRecordBase*>(this)->operator=(src);
00068 node_count = 1;
00069 solved = 0;
00070 last_to = Square();
00071 last_move = Move();
00072 need_full_width = false_branch = false;
00073 #ifdef NAGAI_DAG_TEST
00074 dag_moves = 0;
00075 dag_terminal = false;
00076 #endif
00077 }
00078 unsigned int proof() const { return proof_disproof.proof(); }
00079 unsigned int disproof() const { return proof_disproof.disproof(); }
00080 void setProofPieces(PieceStand a)
00081 {
00082 assert(proof_pieces_set == UNSET);
00083 assert((stands[BLACK] == PieceStand() && stands[WHITE] == PieceStand())
00084 || stands[BLACK].isSuperiorOrEqualTo(a)
00085 || stands[WHITE].isSuperiorOrEqualTo(a));
00086 proof_pieces_set = PROOF;
00087 proof_pieces = a;
00088 }
00089 void setDisproofPieces(PieceStand a)
00090 {
00091 assert(proof_pieces_set == UNSET);
00092 assert((stands[BLACK] == PieceStand() && stands[WHITE] == PieceStand())
00093 || stands[BLACK].isSuperiorOrEqualTo(a)
00094 || stands[WHITE].isSuperiorOrEqualTo(a));
00095 proof_pieces_set = DISPROOF;
00096 proof_pieces = a;
00097 }
00098 const PieceStand proofPieces() const
00099 {
00100 assert(proof_pieces_set == PROOF);
00101 return proof_pieces;
00102 }
00103 const PieceStand disproofPieces() const
00104 {
00105 assert(proof_pieces_set == DISPROOF);
00106 return proof_pieces;
00107 }
00108 };
00109 }
00110 }
00111
00112
00113
00114 #endif
00115
00116
00117
00118