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 = 0;
00070 solved = 0;
00071 last_to = Square();
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