- writes = 0;
-}
-
-
-/// TranspositionTable::insert_pv() is called at the end of a search
-/// iteration, and inserts the PV back into the PV. This makes sure the
-/// old PV moves are searched first, even if the old TT entries have been
-/// overwritten.
-
-void TranspositionTable::insert_pv(const Position &pos, Move pv[]) {
- UndoInfo u;
- Position p(pos);
-
- for(int i = 0; pv[i] != MOVE_NONE; i++) {
- this->store(p, VALUE_NONE, Depth(0), pv[i], VALUE_TYPE_NONE);
- p.do_move(pv[i], u);
- }
-}
-
-
-/// TranspositionTable::full() returns the permill of all transposition table
-/// entries which have received at least one write during the current search.
-/// It is used to display the "info hashfull ..." information in UCI.
-
-int TranspositionTable::full() {
- double N = double(size) * 4.0;
- return int(1000 * (1 - exp(writes * log(1.0 - 1.0/N))));
-}
-
-
-/// Constructors
-
-TTEntry::TTEntry() {
-}
-
-TTEntry::TTEntry(Key k, Value v, ValueType t, Depth d, Move m,
- int generation) {
- key_ = k;
- data = (m & 0x7FFFF) | (t << 20) | (generation << 23);
- value_ = v;
- depth_ = int16_t(d);
-}
-
-
-/// Functions for extracting data from TTEntry objects.
-
-Key TTEntry::key() const {
- return key_;
-}
-
-Depth TTEntry::depth() const {
- return Depth(depth_);
-}
-
-Move TTEntry::move() const {
- return Move(data & 0x7FFFF);
-}
-
-Value TTEntry::value() const {
- return Value(value_);
-}
-
-ValueType TTEntry::type() const {
- return ValueType((data >> 20) & 3);
-}
-
-int TTEntry::generation() const {
- return (data >> 23);