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