| 1 |
/* simpleCheckHashTable.h |
| 2 |
*/ |
| 3 |
#ifndef _SIMPLE_CHECK_HASHTABLE_H |
| 4 |
#define _SIMPLE_CHECK_HASHTABLE_H |
| 5 |
|
| 6 |
#include "checkHashRecord.h" |
| 7 |
#include "twinTable.h" |
| 8 |
#include "visitedCounter.h" |
| 9 |
#include <boost/scoped_ptr.hpp> |
| 10 |
|
| 11 |
namespace osl |
| 12 |
{ |
| 13 |
namespace hash |
| 14 |
{ |
| 15 |
class HashKey; |
| 16 |
} |
| 17 |
|
| 18 |
namespace checkmate |
| 19 |
{ |
| 20 |
using hash::HashKey; |
| 21 |
/** |
| 22 |
* 詰将棋用のテーブル. |
| 23 |
* DominanceTable, ArrayCheckHashTable と違って類似局面の利用はできない |
| 24 |
*/ |
| 25 |
class SimpleCheckHashTable : public TwinTableHolder, public VisitedCounter |
| 26 |
{ |
| 27 |
class Table; |
| 28 |
std::unique_ptr<Table> table; |
| 29 |
const Player attacker; |
| 30 |
CheckHashRecord rootNode; |
| 31 |
public: |
| 32 |
explicit SimpleCheckHashTable(Player attacker); |
| 33 |
~SimpleCheckHashTable(); |
| 34 |
|
| 35 |
CheckHashRecord *find(const HashKey& key); |
| 36 |
CheckHashRecord *allocate(const HashKey& key, |
| 37 |
const PieceStand& white_stand, |
| 38 |
const PathEncoding&); |
| 39 |
|
| 40 |
void clear(); |
| 41 |
CheckHashRecord *root() { return &rootNode; } |
| 42 |
|
| 43 |
const CheckHashRecord *find(const HashKey& key) const; |
| 44 |
size_t size() const; |
| 45 |
Player getAttacker() const { return attacker; } |
| 46 |
void confirmNoVisitedRecords() const; |
| 47 |
}; |
| 48 |
|
| 49 |
} // namespace checkmate |
| 50 |
} // namespace osl |
| 51 |
|
| 52 |
#endif /* _SIMPLE_CHECK_HASHTABLE_H_ */ |
| 53 |
// ;;; Local Variables: |
| 54 |
// ;;; mode:c++ |
| 55 |
// ;;; c-basic-offset:2 |
| 56 |
// ;;; End: |