Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Perft 5

Author: Sune Fischer

Date: 02:48:40 05/07/03

Go up one level in this thread


On May 07, 2003 at 05:01:21, Magoo wrote:

>On May 06, 2003 at 20:56:57, Zach Wegner wrote:
>
>>On May 06, 2003 at 19:24:23, Magoo wrote:
>>
>>> 66.51     42.12    42.12  5087588     0.00     0.00  move_generator
>>>  3.21     58.71     2.03  5087587     0.00     0.00  do_move
>>
>>As I said before, I think you are regenerating moves after each make/undo move.
>>I could probably help you more if you post the code for perft
>
>int perft_doit(position pos, int depth){
>  int best=-100, value=0;
>  move_list moves;
>  move mov;
>  nodes++;
>
>  moves = move_generator(pos);
>
>  if (!all_moves_legal(moves)) {
>    nodes--;
>    free_move_list(moves);
>    return INFINITY; //position is illegal
>  }
>  if (depth <= 0) {
>    free_move_list(moves);
>    return 0;
>  }

And so you generate the moves at depth 0 when you will not need them :)

This because the way you check for legal moves are by going to the next ply to
see if the king gets captured, right?

Well this is incredibly slow, believe me it is faster to see if a move leaves
the king in check. This can be done staticly quite fast, check if you move a
pinned piece or if king goes to attacked square.

Another thing, what does your free_move_list do?
You need to have minimal a clean up job, just a stack pointer that moves around,
resetting or memory freeing is forbidden.

-S.



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.