-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhashing.h
More file actions
46 lines (37 loc) · 1.08 KB
/
hashing.h
File metadata and controls
46 lines (37 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef HASHING_H
#define HASHING_H
#define EVAL_LOOKUP_FAILED -1 // A board evaluation should not be able to have this evaluation
#include <stdint.h>
#include "main.h"
#include "eval.h"
#include "moveHandler.h"
typedef uint64_t hash_t;
typedef enum evaltype_t
{
EXACT,
UPPER_BOUND,
LOWER_BOUND,
} EvalType;
typedef struct hashmap_t
{
uint64_t numBuckets;
struct bucket_t **buckets;
uint64_t size;
} Hashmap;
typedef struct bucket_t
{
hash_t hash;
evaluation_t evalScore;
EvalType evalType;
uint8_t depth;
uint8_t repeats;
struct bucket_t *p_next;
} Bucket;
void appendToHashmap(Hashmap *p_hashmap, Board *p_board, evaluation_t eval, uint8_t depth, uint8_t repeats, EvalType evalType);
uint8_t existsInHashmap(Hashmap *p_hashmap, Board *p_board);
evaluation_t getEvaluation(Hashmap *p_hashmap, Board *p_board, uint8_t depth, uint8_t repeats, int64_t alpha, int64_t beta);
Hashmap *createHashmap(uint64_t numBuckets);
void freehashmap(Hashmap *hashmap);
hash_t zobristHash(Board *p_board);
hash_t updateZobristHash(Board *p_board, Move *p_move);
#endif