post new topic

Hash table: help!

Related Forum Topics:
Hash table percentages
Hash Table and Quiescence Search
shredder 8 hash table size......HELP!
Change Hash-table in CM 8000, how??
Large Chess Variants and Type 1 hash ta...
Diary Problem 27 (Advanced) Forced mate (+...


Hash table: help! - 2007/02/14 05:27 I have programmed my own chess game using:

* minimax method with alpha-beta pruning
* smart move ordering at each ply
* 2 killer moves
* principal continuation can be shown
* shorter mating paths favored over longer ones
* tree automatically shrinks in depth when forced mate path against human is found, so it moves faster and faster during a forced mate sequence
* computer shows Mate in X message when it sees a forced mate by either side
* evaluation right now is only mobility and material (material is actually calculated on the go)

I'm not much of a programmer, but somehow I was able to implement all of the above, and it works great, and I've tested it extensively. On my laptop, 5 ply trees are pretty fast (from 0 to 5 seconds), while a 6 ply tree feels a little slow.

Now I'm trying to add hash tables to speed things up, and I need help! Actually I've started to put in the code that saves positions in the hash table with either an exact or a bounded score. But when I arrive at a move and I see it in the hash table (32-bit hash code matches), when I use the score saved in the hash table (I'm just trying exact scores for now), I get weird results.

Is there anyone out there willing to review my code? Really there isn't that much code to review, just one main routine, really. If people are interested, I can post the main routine. It's actually writtin in Visual Basic (Visual Studio 2005), and requires Windows and .NET (.NET comes with Vista, or can be downloaded onto a Windows machine if it's not there).

thanks so much!
Andrew
  | | | post reply
Hash table: help! - 2007/02/14 21:40 Andrew, sorry to react without having an answer to your question, but I just wanted to say 'welcome' and hope you'll receive the necessary info soon.



  Popular posts by Dame
Links for beginners
Blogs
Moscow murderer guilty of 48 'Ches...
  | | | post reply
Re:Hash table: help! - 2007/04/16 17:12 never mind, I got it to work. I found my bug after carefully analyzing a log file that I created.
  | | | post reply
Re:Hash table: help! - 2007/04/17 22:33 OK, I'm happy it worked out in the end



  Popular posts by Dame
Links for beginners
Blogs
Moscow murderer guilty of 48 'Ches...
  | | | post reply
Re:Hash table: help! - 2007/11/15 03:06 Glad it worked out. 5 ply (or even 6) taking more than a fraction of a second is slow, and from your description of your evaluation function, I'd guess it has something to do with move ordering. And, do you have some form of Quiescent search?
  | | | post reply
Re:Hash table: help! - 2007/11/15 09:14 Paresthesias welcome to chesscircle



  Popular posts by Dame
Links for beginners
Blogs
Moscow murderer guilty of 48 'Ches...
  | | | post reply
Re:Hash table: help! - 2007/11/16 17:31 I have never really tried to figure out why my program is so slow (few seconds for a 6 ply tree search, which is presumably too slow).

With regard to move ordering, each ply is ordered like this:

(1) Killer moves
(2) Captures (in descending order of material value of captured piece) that are not already in (1)
(3) Promotions that are not already in (1) and (2)
(4) all other moves, in the order they happened to be generated

I presently am not considering (a) capture of the last moved piece, (b) Checks, (c) moves in the principal continuation, (d) best move from stored hash position - these are all promising moves which deserve to be near the top of the move list, but my move ordering does not yet take them into account.

Note that while I am using a hash table to store exact and bounded scores to speed up the search, I am not yet using a "best-move" from a hashed position for better move ordering.

I have a feeling move generation (not order) might be more my problem with regard to speed, but I'm not sure - I do realize that move ordering is critical for more efficient alpha-beta pruning. If you have any interest, I'd be happy to email the source code. It's easy to read, as it's in Visual Basic...
  | | | post reply
Re:Hash table: help! - 2007/11/20 07:12 Thanks for the welcome =)

In chess programs, move generation usually accounts for 10-15% of the work. Minimizing the branching factor is crucial. i.e., Ply 7-8 in less than a second is decent for speed. Programs with late move reductions/null pruning are even faster. The usual move ordering is something like this:

1. Hash move
2. Good/equal captures (a Static Exchange Evaluator is used for this), Queen-promotions
3. Killer moves (which are never captures)
4. Non-capturing moves
5. Losing captures

Trying captures before killers might help your branching factor, do you count the number of nodes you search to use for comparisons? And the "best-move" from the hash table should help a lot, once you get that implemented. Also, ordering your capturing based on the capturing piece's value should help (considering a pxQ capture is usually better than QxQ).

Also, with the transposition table, you'll want to store more than exact scores. For this you'll need a flag to describe the bound (alpha, beta, exact).

These sites may be helpful:
http://chessprogramming.wikispaces.com/
http://www.seanet.com/~brucemo/topics/topics.htm
http://www.talkchess.com/forum/

Hope this helps =). I'm not very VB literate, but I'll take a look at it if you'd like. My e-mail is paresthesias[at]gmail.com
  | | | post reply

Related Products:

© 2008 ChessCircle
Joomla! is Free Software released under the GNU/GPL License.