2 Glaurung, a UCI chess playing engine.
3 Copyright (C) 2004-2008 Tord Romstad
5 Glaurung is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 Glaurung is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #if !defined(TT_H_INCLUDED)
36 /// The TTEntry class is the class of transposition table entries.
42 TTEntry(Key k, Value v, ValueType t, Depth d, Move m, int generation);
43 Key key() const { return key_; }
44 Depth depth() const { return Depth(depth_); }
45 Move move() const { return Move(data & 0x7FFFF); }
46 Value value() const { return Value(value_); }
47 ValueType type() const { return ValueType((data >> 20) & 3); }
48 int generation() const { return (data >> 23); }
57 /// The transposition table class. This is basically just a huge array
58 /// containing TTEntry objects, and a few methods for writing new entries
59 /// and reading new ones.
61 class TranspositionTable {
64 TranspositionTable(unsigned mbSize);
65 ~TranspositionTable();
66 void set_size(unsigned mbSize);
68 void store(const Position &pos, Value v, Depth d, Move m, ValueType type);
69 const TTEntry* retrieve(const Position &pos) const;
71 void insert_pv(const Position &pos, Move pv[]);
75 inline TTEntry* first_entry(const Position &pos) const;
85 //// Constants and variables
88 // Default transposition table size, in megabytes:
89 const int TTDefaultSize = 32;
92 #endif // !defined(TT_H_INCLUDED)