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 unsigned int node_count, tried_oracle;
00029 Move last_move;
00031 PieceStand proof_pieces_candidate;
00032 unsigned int min_pdp;
00033 uint32_t working_threads;
00034 Position 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 struct DfpnRecord : public DfpnRecordBase
00058 {
00059 CArray<PieceStand,2> stands;
00060
00061 DfpnRecord() {}
00062 DfpnRecord(PieceStand black, PieceStand white) { stands[BLACK] = black; stands[WHITE] = white; }
00063
00064 void setFrom(const DfpnRecordBase& src)
00065 {
00066 static_cast<DfpnRecordBase*>(this)->operator=(src);
00067 node_count = 0;
00068 solved = 0;
00069 last_to = Position();
00070 need_full_width = false_branch = false;
00071 #ifdef NAGAI_DAG_TEST
00072 dag_moves = 0;
00073 dag_terminal = false;
00074 #endif
00075 }
00076 unsigned int proof() const { return proof_disproof.proof(); }
00077 unsigned int disproof() const { return proof_disproof.disproof(); }
00078 void setProofPieces(PieceStand a)
00079 {
00080 assert(proof_pieces_set == UNSET);
00081 assert((stands[BLACK] == PieceStand() && stands[WHITE] == PieceStand())
00082 || stands[BLACK].isSuperiorOrEqualTo(a)
00083 || stands[WHITE].isSuperiorOrEqualTo(a));
00084 proof_pieces_set = PROOF;
00085 proof_pieces = a;
00086 }
00087 void setDisproofPieces(PieceStand a)
00088 {
00089 assert(proof_pieces_set == UNSET);
00090 assert((stands[BLACK] == PieceStand() && stands[WHITE] == PieceStand())
00091 || stands[BLACK].isSuperiorOrEqualTo(a)
00092 || stands[WHITE].isSuperiorOrEqualTo(a));
00093 proof_pieces_set = DISPROOF;
00094 proof_pieces = a;
00095 }
00096 const PieceStand proofPieces() const
00097 {
00098 assert(proof_pieces_set == PROOF);
00099 return proof_pieces;
00100 }
00101 const PieceStand disproofPieces() const
00102 {
00103 assert(proof_pieces_set == DISPROOF);
00104 return proof_pieces;
00105 }
00106 };
00107 }
00108 }
00109
00110
00111
00112 #endif
00113
00114
00115
00116