Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: move_generation + hash

Author: Tom Kerrigan

Date: 10:09:09 05/31/00

Go up one level in this thread


On May 31, 2000 at 10:52:41, Robert Hyatt wrote:

>I am trying to understand what the question is supposed to be.  It is clearly
>better to generate captures and non-captures separately, because in the
>q-search, non-captures are not needed.  For captures, I generate and sort.  For
>non-captures I do no sorting at all.
>
>It would seem we have to reach some sort of common point before I can write
>something that compares to whatever you are doing...

It's really not that hard to understand.

Make a function called gen_moves() that makes a list of all pseudolegal moves.
Or legal moves, whatever.

Instead of generating moves in stages during search(), just call this function
and order the moves appropriately as you search them.

Here's how I do it:
I have a struct for the stuff that my move generator generates:

typedef struct {
  int move;  // the move
  int score;  // the score, to determine the search order
} gen_t;

In my move generator, I assign .scores to captures. Then, in my search function,
I have the following code:

if (follow_pv)
  score_pv();
if (hash_move)
  score_hash_move(hash_move);

These functions go through my list of moves and assign high scores to the PV and
hash table moves. Then, to get a move to search, I call sort(), which does one
step of an insertion sort. I also have a function called sort_history(), which
is called if I run out of captures. That finds the best looking killer/history
move in the list.

-Tom



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.