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