Computer Chess Club Archives


Search

Terms

Messages

Subject: How to implement hash tables...

Author: Matt

Date: 07:35:23 04/22/00


Hi...

I'm a relatively lousy programmer... I've written a very basic chess engine
(around 1950 on FICS) and I would like to work on adding hash tables to it,
however I haven't found any good references to how this is done...  I know the
crafty source is available, but the crafty source scares me.  What I am looking
for is a very general overview of how hash tables work.

As I understand it, it works something like this:

1.  generate hash key for position

2.  check to see if that key is already in table.  if it is, return the score
from the hash table (eliminating the entire subtree, as its already been
searched before). if not, continue search as normal.

This is done from within your search function if I understand correctly...

I understand how to initially create and update the hash key on moves and
takebacks, but...

When are positions ADDED to the hash table?

is the depth of the search included with the position when its added?

I assume the hash table isnt cleared after every move, how does that affect the
search depth stored in the hash tables for positions found in previous searches?

I am told one does not search the hash table, it performs a 'lookup'.  how does
this work?

Any help would be most appreciated.  please use small words, this is all new to
me :)

Matt



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.