| 1 |
/* checkStack.h |
| 2 |
*/ |
| 3 |
#ifndef _CHECKSTACK_H |
| 4 |
#define _CHECKSTACK_H |
| 5 |
|
| 6 |
#include "checkMove.h" |
| 7 |
#include "osl/hash/hashKey.h" |
| 8 |
#include "osl/misc/fixedCapacityVector.h" |
| 9 |
#include "osl/pathEncoding.h" |
| 10 |
#include <iosfwd> |
| 11 |
namespace osl |
| 12 |
{ |
| 13 |
namespace checkmate |
| 14 |
{ |
| 15 |
class CheckHashRecord; |
| 16 |
class CheckMove; |
| 17 |
struct CheckStackEntry |
| 18 |
{ |
| 19 |
CheckMove move; |
| 20 |
const char *name; |
| 21 |
const CheckHashRecord *record; |
| 22 |
HashKey hash; |
| 23 |
PathEncoding path; |
| 24 |
unsigned int proofLimit, disproofLimit; |
| 25 |
CheckStackEntry(const CheckMove *nextMove, |
| 26 |
const char *name, |
| 27 |
const CheckHashRecord *record, |
| 28 |
const HashKey&, const PathEncoding&, |
| 29 |
unsigned int proofLimit=0, |
| 30 |
unsigned int disproofLimit=0); |
| 31 |
CheckStackEntry() : move(Move::INVALID()), name(""), record(0), |
| 32 |
proofLimit(0), disproofLimit(0) |
| 33 |
{ |
| 34 |
} |
| 35 |
}; |
| 36 |
class CheckStack : public FixedCapacityVector<CheckStackEntry,512> |
| 37 |
{ |
| 38 |
public: |
| 39 |
~CheckStack(); |
| 40 |
const_iterator findLoop(const CheckHashRecord *record) const; |
| 41 |
/** 同一盤面で attacker の持駒が多いものが存在するか */ |
| 42 |
const_iterator findCover(Player attacker, |
| 43 |
const HashKey& hash, |
| 44 |
const CheckHashRecord *record) const; |
| 45 |
/** |
| 46 |
* 最後のエントリ以外に存在するか |
| 47 |
*/ |
| 48 |
bool findNotLast(const CheckHashRecord *record) const |
| 49 |
{ |
| 50 |
const_iterator pos = findLoop(record); |
| 51 |
return (pos - begin()) < (int)size()-1; |
| 52 |
} |
| 53 |
}; |
| 54 |
|
| 55 |
std::ostream& operator<<(std::ostream& os, const CheckStack& s); |
| 56 |
std::ostream& operator<<(std::ostream& os, const CheckStackEntry& e); |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
#endif /* _CHECKSTACK_H */ |
| 61 |
// ;;; Local Variables: |
| 62 |
// ;;; mode:c++ |
| 63 |
// ;;; c-basic-offset:2 |
| 64 |
// ;;; End: |