00001
00002
00003 #ifndef _CHECKSTACK_H
00004 #define _CHECKSTACK_H
00005
00006 #include "osl/checkmate/checkMove.h"
00007 #include "osl/hash/hashKey.h"
00008 #include "osl/misc/fixedCapacityVector.h"
00009 #include "osl/pathEncoding.h"
00010 #include <iosfwd>
00011 namespace osl
00012 {
00013 namespace checkmate
00014 {
00015 class CheckHashRecord;
00016 class CheckMove;
00017 struct CheckStackEntry
00018 {
00019 CheckMove move;
00020 const char *name;
00021 const CheckHashRecord *record;
00022 HashKey hash;
00023 PathEncoding path;
00024 unsigned int proofLimit, disproofLimit;
00025 CheckStackEntry(const CheckMove *nextMove,
00026 const char *name,
00027 const CheckHashRecord *record,
00028 const HashKey&, const PathEncoding&,
00029 unsigned int proofLimit=0,
00030 unsigned int disproofLimit=0);
00031 CheckStackEntry() : move(Move::INVALID()), name(""), record(0),
00032 proofLimit(0), disproofLimit(0)
00033 {
00034 }
00035 };
00036 class CheckStack : public FixedCapacityVector<CheckStackEntry,512>
00037 {
00038 public:
00039 ~CheckStack();
00040 const_iterator findLoop(const CheckHashRecord *record) const;
00042 const_iterator findCover(Player attacker,
00043 const HashKey& hash,
00044 const CheckHashRecord *record) const;
00048 bool findNotLast(const CheckHashRecord *record) const
00049 {
00050 const_iterator pos = findLoop(record);
00051 return (pos - begin()) < (int)size()-1;
00052 }
00053 };
00054
00055 std::ostream& operator<<(std::ostream& os, const CheckStack& s);
00056 std::ostream& operator<<(std::ostream& os, const CheckStackEntry& e);
00057 }
00058 }
00059
00060 #endif
00061
00062
00063
00064