#include "board.h"#include "settings.h"#include "util.h"#include "stats.h"#include <stdbool.h>#include <stdio.h>Go to the source code of this file.
Classes | |
| struct | HashData |
| struct | Hash |
| struct | HashLock |
| struct | HashTable |
Typedefs | |
| typedef struct HashData | HashData |
| typedef struct Hash | Hash |
| typedef struct HashLock | HashLock |
| typedef struct HashTable | HashTable |
Functions | |
| void | hash_code_init (void) |
| Initialize global hash code data. More... | |
| void | hash_move_init (void) |
| Initialize global hash move data. More... | |
| void | hash_init (HashTable *, const unsigned long long) |
| Initialise the hashtable. More... | |
| void | hash_cleanup (HashTable *) |
| Clear the hashtable. More... | |
| void | hash_clear (HashTable *) |
| Clear the hashtable. More... | |
| void | hash_free (HashTable *) |
| Free the hashtable. More... | |
| void | hash_store (HashTable *, const Board *, const unsigned long long, const int, const int, const int, const int, const int, const int, const int) |
| Store an hashtable item. More... | |
| void | hash_force (HashTable *, const Board *, const unsigned long long, const int, const int, const int, const int, const int, const int, const int) |
| Store an hashtable item. More... | |
| bool | hash_get (HashTable *, const Board *, const unsigned long long, HashData *) |
| Find an hash table entry according to the evaluated board hash codes. More... | |
| void | hash_copy (const HashTable *, HashTable *) |
| Copy an hastable to another one. More... | |
| void | hash_print (const HashData *, FILE *) |
| print HashData content. More... | |
| void | hash_feed (HashTable *, const Board *, const unsigned long long, const int, const int, const int, const int, const int) |
| feed hash table (from Cassio). More... | |
| void | hash_exclude_move (HashTable *, const Board *, const unsigned long long, const int) |
| unsigned int | writeable_level (HashData *data) |
| make a level from date, cost, depth & selectivity. More... | |
Variables | |
| const HashData | HASH_DATA_INIT |
| unsigned long long | hash_rank [16][256] |
| unsigned long long | hash_move [64][60] |
| void hash_cleanup | ( | HashTable * | hash_table | ) |
| void hash_clear | ( | HashTable * | hash_table | ) |
| void hash_code_init | ( | void | ) |
Initialize global hash code data.
Copy an hastable to another one.
| src | Source hash table to copy. |
| dest | Destination hash table. |
| void hash_feed | ( | HashTable * | hash_table, |
| const Board * | board, | ||
| const unsigned long long | hash_code, | ||
| const int | depth, | ||
| const int | selectivity, | ||
| const int | lower, | ||
| const int | upper, | ||
| const int | move | ||
| ) |
feed hash table (from Cassio).
| hash_table | Hash Table. |
| hash_code | Hash code. |
| depth | Search depth. |
| selectivity | Selectivity level. |
| lower | Alpha bound. |
| upper | Beta bound. |
| move | best move. |
| void hash_force | ( | HashTable * | hash_table, |
| const Board * | board, | ||
| const unsigned long long | hash_code, | ||
| const int | depth, | ||
| const int | selectivity, | ||
| const int | cost, | ||
| const int | alpha, | ||
| const int | beta, | ||
| const int | score, | ||
| const int | move | ||
| ) |
Store an hashtable item.
Does the same as hash_store() except it always store the current search state
| hash_table | Hash table to update. |
| hash_code | Hash code of an othello board. |
| alpha | Alpha bound when calling the alphabeta function. |
| depth | Search depth. |
| selectivity | Search selectivity. |
| cost | Search cost (i.e. log2(node count)). |
| beta | Beta bound when calling the alphabeta function. |
| score | Best score found. |
| move | Best move found. |
| void hash_free | ( | HashTable * | hash_table | ) |
Free the hashtable.
Free the memory allocated by the hash table entries
| hash_table | hash_table to free. |
| bool hash_get | ( | HashTable * | hash_table, |
| const Board * | board, | ||
| const unsigned long long | hash_code, | ||
| HashData * | data | ||
| ) |
Find an hash table entry according to the evaluated board hash codes.
Erase an hash table entry.
Copy an hastable to another one.
| src | Source hash table to copy. |
| dest | Destination hash table. |
print HashData content.
| data | Hash Data |
| f | Output stream |
| void hash_init | ( | HashTable * | hash_table, |
| const unsigned long long | size | ||
| ) |
Initialise the hashtable.
Allocate the hash table entries and initialise the hash masks.
| hash_table | Hash table to setup. |
| size | Requested size for the hash table in number of entries. |
| void hash_move_init | ( | void | ) |
Initialize global hash move data.
| void hash_print | ( | const HashData * | data, |
| FILE * | f | ||
| ) |
| void hash_store | ( | HashTable * | hash_table, |
| const Board * | board, | ||
| const unsigned long long | hash_code, | ||
| const int | depth, | ||
| const int | selectivity, | ||
| const int | cost, | ||
| const int | alpha, | ||
| const int | beta, | ||
| const int | score, | ||
| const int | move | ||
| ) |
Store an hashtable item.
Find an hash table entry according to the evaluated board hash codes. Then update the entry if it already exists otherwise create a new one. Collisions are managed in such a way that better existing entries are always preserved and the new evaluated data is always added. Lower and upper score bounds are then updated/set from the alpha, beta and score values according to the following alphabeta property (where alpha < beta): -if (score >= beta) score is a lower bound of the real score -if (score <= alpha) score is an upper bound of the real score -if (alpha < score && score < beta) score equals the real score So: -if (score < beta) update the upper bound of the hash entry -if (score > alpha) update the lower bound of the hash entry The best move is also stored, but only if score >= alpha. In case the entry already exists with better data, nothing is stored.
| hash_table | Hash table to update. |
| hash_code | Hash code of an othello board. |
| alpha | Alpha bound when calling the alphabeta function. |
| depth | Search depth. |
| selectivity | Search selectivity. |
| cost | Search cost (i.e. log2(node count)). |
| beta | Beta bound when calling the alphabeta function. |
| score | Best score found. |
| move | Best move found. |
|
inline |
| unsigned long long hash_move[64][60] |
hashing global data
| unsigned long long hash_rank[16][256] |
hashing global data
1.8.14