Skip to content

Collision handling for hash table #1

@PaMeirelles

Description

@PaMeirelles
void storeHashEntry(const Board &b, const Move &m, const int score, const int depth, const char flag, HashTable * hashTable){
    if(m.from < 0){
        throw runtime_error("Invalid move");
    }
    const U64 key = hashBoard(b);
    const U64 index = key % hashTable->numEntries;
    if(hashTable->pTable[index].hashKey == 0){
        hashTable->newWrite++;
    }
    else{
        hashTable->overWrite++;
    }
    hashTable->pTable[index].depth = depth;
    hashTable->pTable[index].score = score;
    hashTable->pTable[index].flag = flag;
    hashTable->pTable[index].move = m;
    hashTable->pTable[index].hashKey = key;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions