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