My Project
hash.h
Go to the documentation of this file.
1
11#ifndef EDAX_HASH_H
12#define EDAX_HASH_H
13
14#include "board.h"
15#include "settings.h"
16#include "util.h"
17#include "stats.h"
18
19
20#include <stdbool.h>
21#include <stdio.h>
22
24typedef struct HashData {
25 unsigned char depth;
26 unsigned char selectivity;
27 unsigned char cost;
28 unsigned char date;
29 signed char lower;
30 signed char upper;
31 unsigned char move[2];
33
35typedef struct Hash {
36 HASH_COLLISIONS(unsigned long long key;)
40
42typedef struct HashLock {
43 SpinLock spin;
45
47typedef struct HashTable {
48 void *memory;
51 unsigned long long hash_mask;
52 unsigned int lock_mask;
53 int n_hash;
54 int n_lock;
55 unsigned char date;
57
58/* declaration */
59void hash_code_init(void);
60void hash_move_init(void);
61void hash_init(HashTable*, const unsigned long long);
64void hash_free(HashTable*);
65void hash_store(HashTable*, const Board*, const unsigned long long, const int, const int, const int, const int, const int, const int, const int);
66void hash_force(HashTable*, const Board*, const unsigned long long, const int, const int, const int, const int, const int, const int, const int);
67bool hash_get(HashTable*, const Board*, const unsigned long long, HashData *);
68void hash_copy(const HashTable*, HashTable*);
69void hash_print(const HashData*, FILE*);
70void hash_feed(HashTable*, const Board*, const unsigned long long, const int, const int, const int, const int, const int);
71void hash_exclude_move(HashTable*, const Board*, const unsigned long long, const int);
72extern unsigned int writeable_level(HashData *data);
73
74extern const HashData HASH_DATA_INIT;
75extern unsigned long long hash_rank[16][256];
76extern unsigned long long hash_move[64][60];
77
78#endif
79
unsigned long long hash_rank[16][256]
Definition: hash-lock-free.c:41
void hash_copy(const HashTable *, HashTable *)
Copy an hastable to another one.
Definition: hash-lock-free.c:652
void hash_free(HashTable *)
Free the hashtable.
Definition: hash-lock-free.c:195
void hash_clear(HashTable *)
Clear the hashtable.
Definition: hash-lock-free.c:179
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.
Definition: hash.c:544
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.
Definition: hash.c:583
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).
Definition: hash.c:489
void hash_cleanup(HashTable *)
Clear the hashtable.
Definition: hash-lock-free.c:159
unsigned int writeable_level(HashData *data)
make a level from date, cost, depth & selectivity.
Definition: hash-lock-free.c:208
void hash_print(const HashData *, FILE *)
print HashData content.
Definition: hash-lock-free.c:670
void hash_move_init(void)
Initialize global hash move data.
Definition: hash-lock-free.c:70
bool hash_get(HashTable *, const Board *, const unsigned long long, HashData *)
Find an hash table entry according to the evaluated board hash codes.
Definition: hash.c:616
const HashData HASH_DATA_INIT
Definition: hash-lock-free.c:47
unsigned long long hash_move[64][60]
Definition: hash-lock-free.c:44
void hash_exclude_move(HashTable *, const Board *, const unsigned long long, const int)
void hash_init(HashTable *, const unsigned long long)
Initialise the hashtable.
Definition: hash.c:86
void hash_code_init(void)
Initialize global hash code data.
Definition: hash-lock-free.c:52
Statistics header.
#define HASH_COLLISIONS(x)
Definition: stats.h:25
Definition: board.h:26
Definition: hash.h:24
unsigned char move[2]
Definition: hash.h:31
signed char lower
Definition: hash.h:29
unsigned char cost
Definition: hash.h:27
unsigned char date
Definition: hash.h:28
signed char upper
Definition: hash.h:30
unsigned char selectivity
Definition: hash.h:26
unsigned char depth
Definition: hash.h:25
Definition: hash.h:42
SpinLock spin
Definition: hash.h:43
Definition: hash.h:47
unsigned char date
Definition: hash.h:55
int n_hash
Definition: hash.h:53
unsigned int lock_mask
Definition: hash.h:52
Hash * hash
Definition: hash.h:49
unsigned long long hash_mask
Definition: hash.h:51
HashLock * lock
Definition: hash.h:50
void * memory
Definition: hash.h:48
int n_lock
Definition: hash.h:54
Definition: hash.h:35
HashData data
Definition: hash.h:38
Board board
Definition: hash.h:37
Miscellaneous utilities header.