00001
00002
00003 #ifndef _ORACLEDISPROVER_H
00004 #define _ORACLEDISPROVER_H
00005
00006 #include "osl/checkmate/disproofOracle.h"
00007 #include "osl/state/numEffectState.h"
00008 #include "osl/hash/hashKey.h"
00009 #include "osl/player.h"
00010 #include "osl/pathEncoding.h"
00011 namespace osl
00012 {
00013 namespace checkmate
00014 {
00019 template <class Table>
00020 class OracleDisprover
00021 {
00022 public:
00023 typedef NumEffectState state_t;
00024 private:
00025 Table& table;
00026 state_t *state;
00027 HashKey key;
00028 PathEncoding path;
00029 Player attacker;
00030 int node_count;
00031 public:
00032 explicit OracleDisprover(Table& t)
00033 : table(t), attacker(t.getAttacker()), node_count(0)
00034 {
00035 }
00040 template <Player Attacker>
00041 bool proofNoCheckmate(state_t& state,
00042 const HashKey& key, const PathEncoding& path,
00043 const DisproofOracleAttack<Attacker>& oracle);
00050 template <Player Attacker>
00051 bool proofEscape(state_t& state,
00052 const HashKey& key, const PathEncoding& path,
00053 const DisproofOracleDefense<Attacker>& oracle,
00054 Move& best_move, Move last_move=Move::INVALID());
00055
00056 int nodeCount() const { return node_count; }
00057
00058
00059 template <Player P>
00060 void attack(CheckHashRecord *record, const DisproofOracleAttack<P>& oracle);
00061 template <Player P>
00062 void defense(CheckHashRecord *record, const DisproofOracleDefense<P>& oracle);
00063
00064
00065 bool proofNoCheckmate(state_t& state, const PathEncoding& path,
00066 const CheckHashRecord *oracle, const PathEncoding&);
00067 bool proofEscape(state_t& state, const PathEncoding& path,
00068 CheckHashRecord *oracle, const PathEncoding&,
00069 Move&, Move last_move=Move::INVALID());
00070 private:
00071 template <Player P>
00072 void confirmNoEscape(CheckHashRecord *record);
00073 };
00074
00075 }
00076 }
00077
00078 #endif
00079
00080
00081
00082