| 1 |
/* twinEntry.h |
| 2 |
*/ |
| 3 |
#ifndef _TWINENTRY_H |
| 4 |
#define _TWINENTRY_H |
| 5 |
|
| 6 |
#include "checkMove.h" |
| 7 |
#include "osl/pathEncoding.h" |
| 8 |
|
| 9 |
namespace osl |
| 10 |
{ |
| 11 |
namespace checkmate |
| 12 |
{ |
| 13 |
class CheckHashRecord; |
| 14 |
struct TwinEntry |
| 15 |
{ |
| 16 |
PathEncoding path; |
| 17 |
CheckMoveCore move; |
| 18 |
/** |
| 19 |
* 一番浅いloop先のアドレス,複数あれば0. |
| 20 |
* LoopDetection を NoCheckmate に切り替えるために使用 |
| 21 |
*/ |
| 22 |
const CheckHashRecord *loopTo; |
| 23 |
TwinEntry(const PathEncoding& p, const CheckMoveCore& m, |
| 24 |
const CheckHashRecord *l=0) |
| 25 |
: path(p), move(m), loopTo(l) |
| 26 |
{ |
| 27 |
} |
| 28 |
}; |
| 29 |
|
| 30 |
/** |
| 31 |
* 同じシミュレーションを2度行なわないための記録と,TwinEntryを同時に表に格納するためのクラス. |
| 32 |
* - LoopDetection発見時 -> TwinEntry を使用 |
| 33 |
* - LoopDetection未発見時 -> TwinEntry::path と age を使用 |
| 34 |
*/ |
| 35 |
struct TwinAgeEntry |
| 36 |
{ |
| 37 |
TwinEntry entry; |
| 38 |
/** |
| 39 |
* 前回シミュレーションした時のtwinsの長さ |
| 40 |
*/ |
| 41 |
int age; |
| 42 |
/** |
| 43 |
* TwinEntry を作成 |
| 44 |
*/ |
| 45 |
TwinAgeEntry(const PathEncoding& p, const CheckMoveCore& m, |
| 46 |
const CheckHashRecord *l=0) |
| 47 |
: entry(p, m, l), age(-1) |
| 48 |
{ |
| 49 |
} |
| 50 |
/** |
| 51 |
* age メモを作成 |
| 52 |
*/ |
| 53 |
TwinAgeEntry(const PathEncoding& path) : entry(path, CheckMoveCore()), age(0) |
| 54 |
{ |
| 55 |
} |
| 56 |
bool hasTwinEntry() const { return age < 0; } |
| 57 |
void setTwinEntry(const TwinEntry& e) |
| 58 |
{ |
| 59 |
assert(entry.path == e.path); |
| 60 |
entry.move = e.move; |
| 61 |
age = -1; |
| 62 |
} |
| 63 |
}; |
| 64 |
|
| 65 |
} // namespace checkmate |
| 66 |
} // namespace osl |
| 67 |
|
| 68 |
|
| 69 |
#endif /* _TWINENTRY_H */ |
| 70 |
// ;;; Local Variables: |
| 71 |
// ;;; mode:c++ |
| 72 |
// ;;; c-basic-offset:2 |
| 73 |
// ;;; End: |