This is the doxygen documentation for gtkboard.

.
Main Page   Data Structures   File List   Data Fields   Globals  

hash.c File Reference

hash table which implements transposition tables. More...

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
#include <glib.h>
#include "move.h"

Go to the source code of this file.

Data Structures

struct  hash_t

Defines

#define uint   unsigned
#define byte   gint8

Functions

void hash_init ()
uint get_hash (byte *pos, int poslen)
uint get_check (byte *pos, int poslen)
void hash_insert (byte *pos, int poslen, int num_moves, int depth, float eval, byte *move)
int hash_get_eval (byte *pos, int poslen, int num_moves, int depth, float *evalp)
byte* hash_get_move (byte *pos, int poslen, int num_moves)
void hash_clear ()
void hash_print_stats ()

Variables

int opt_verbose
int hash_table_size = 1 << 16
int hash_table_max = 3 * 1 << 14
int num_hash_coeffts = 1024
uint* hash_coeffts = NULL
hash_thash_table = NULL
int hash_filled = 0
int hash_eval_hits = 0
int hash_eval_misses = 0
int hash_move_hits = 0
int hash_move_misses = 0


Detailed Description

hash table which implements transposition tables.

A hash entry stores the following information: value of the node depth to which it has been explored verification code (secondary hash value)

if there is a collision and the table is less than (say) 75% full, search sequentially till an empty cell is found otherwise just kick out the previous entry (if depth of the current entry is smaller than the earlier entry, search sequentially till a shallower node is found and kick it out)

When used with DFID, if l levels were completed on the previous move, l-2 levels (ply) will be completed almost instantly on this move. Even if we are unable to complete level l on this move, it mattereth not, for the partial information will be there in the hash table and will be useful for the next move.

Definition in file hash.c.


Define Documentation

#define byte   gint8
 

Definition at line 53 of file hash.c.

#define uint   unsigned
 

Definition at line 49 of file hash.c.


Function Documentation

uint get_check ( byte * pos,
int poslen ) [static]
 

Definition at line 112 of file hash.c.

Referenced by hash_get_eval(), hash_get_move(), and hash_insert().

uint get_hash ( byte * pos,
int poslen ) [static]
 

Definition at line 101 of file hash.c.

Referenced by hash_get_eval(), hash_get_move(), and hash_insert().

void hash_clear ( )
 

Definition at line 212 of file hash.c.

int hash_get_eval ( byte * pos,
int poslen,
int num_moves,
int depth,
float * evalp )
 

Definition at line 161 of file hash.c.

Referenced by ab_with_tt(), and ab_with_tt_incr().

byte* hash_get_move ( byte * pos,
int poslen,
int num_moves )
 

Definition at line 190 of file hash.c.

Referenced by ab_with_tt().

void hash_init ( ) [static]
 

Definition at line 85 of file hash.c.

Referenced by get_check(), and get_hash().

void hash_insert ( byte * pos,
int poslen,
int num_moves,
int depth,
float eval,
byte * move )
 

Definition at line 126 of file hash.c.

Referenced by ab_with_tt(), and ab_with_tt_incr().

void hash_print_stats ( )
 

Definition at line 224 of file hash.c.


Variable Documentation

uint* hash_coeffts = NULL [static]
 

Definition at line 79 of file hash.c.

int hash_eval_hits = 0 [static]
 

Definition at line 82 of file hash.c.

int hash_eval_misses = 0 [static]
 

Definition at line 82 of file hash.c.

int hash_filled = 0 [static]
 

Definition at line 81 of file hash.c.

int hash_move_hits = 0 [static]
 

Definition at line 83 of file hash.c.

int hash_move_misses = 0 [static]
 

Definition at line 83 of file hash.c.

hash_t* hash_table = NULL [static]
 

Definition at line 80 of file hash.c.

int hash_table_max = 3 * 1 << 14 [static]
 

Definition at line 77 of file hash.c.

int hash_table_size = 1 << 16 [static]
 

Definition at line 76 of file hash.c.

int num_hash_coeffts = 1024 [static]
 

Definition at line 78 of file hash.c.

int opt_verbose
 

Definition at line 57 of file hash.c.