endgame: 记录到残局库时打印更详细的信息包括地址偏移和必然胜负的一方是谁
This commit is contained in:
parent
1ae1c9b584
commit
cbad48290d
|
@ -994,7 +994,6 @@ const char* AIAlgorithm::bestMove()
|
|||
ENDGAME_PLAYER_WHITE_WIN : ENDGAME_PLAYER_BLACK_WIN;
|
||||
hash_t endgameHash = this->game.getHash(); // TODO: 减少重复计算哈希
|
||||
recordEndgameHash(endgameHash, endgame);
|
||||
loggerDebug("Record 0x%08I32x to Endgame Hashmap\n", endgameHash);
|
||||
}
|
||||
}
|
||||
#endif /* ENDGAME_LEARNING */
|
||||
|
@ -1088,9 +1087,12 @@ bool AIAlgorithm::findEndgameHash(hash_t hash, Endgame &endgame)
|
|||
int AIAlgorithm::recordEndgameHash(hash_t hash, const Endgame &endgame)
|
||||
{
|
||||
//hashMapMutex.lock();
|
||||
endgameHashMap.insert(hash, endgame);
|
||||
hash_t hashValue = endgameHashMap.insert(hash, endgame);
|
||||
unsigned addr = hashValue * (sizeof(hash) + sizeof(endgame));
|
||||
//hashMapMutex.unlock();
|
||||
|
||||
loggerDebug("[endgame] Record 0x%08I32x (%d) to Endgame Hash map, HashValue: 0x%08I32x, Address: 0x%08I32x\n", hash, endgame.type, hashValue, addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace CTSL //Concurrent Thread Safe Library
|
|||
|
||||
//Function to insert into the hash map.
|
||||
//If key already exists, update the value, else insert a new node in the bucket with the <key, value> pair.
|
||||
void insert(const K &key, const V &value)
|
||||
K insert(const K &key, const V &value)
|
||||
{
|
||||
K hashValue = hashFn(key) & (hashSize - 1);
|
||||
#ifdef DISABLE_HASHBUCKET
|
||||
|
@ -90,6 +90,7 @@ namespace CTSL //Concurrent Thread Safe Library
|
|||
#else
|
||||
hashTable[hashValue].insert(key, value);
|
||||
#endif
|
||||
return hashValue;
|
||||
}
|
||||
|
||||
//Function to remove an entry from the bucket, if found
|
||||
|
|
Loading…
Reference in New Issue