Ok so a few things to get out of the way:
- The class TranspositionTable should only have one object, thus the constructor is private.
- The table itself should be a user-defined length if possible, default size is 1024 currently.
- The table holds pointers to hash key objects.
Is there a good way of doing this?
My code:
//HEADER FILE
class ZobristKey {
public:
uint64_t key;
static uint64_t ZobristHashTable[66][2];
static bool hashTableInitialized;
bool compareKeys(ZobristKey& otherKey);
void copyData(ZobristKey& otherKey);
void updateHash(Move move);
void initializeRandomHash();
ZobristKey();
ZobristKey(ZobristKey& otherKey, Move move);
};
//Only one object of type TranspositionTable should exist at one time
class TranspositionTable {
public:
static ZobristKey* table[];
bool posExists(ZobristKey* key);
bool isFull();
void clearTable();
private:
TranspositionTable() = delete;
};
//MAIN FILE
#include "boardrep.h"
#include <iostream>
int main() {
TranspositionTable::table[DEFAULT_HASH_SIZE];
ZobristKey key;
ZobristKey* keyPtr = &key;
TranspositionTable::table[0] = keyPtr;
return 0;
}