Author: Uri Blass
Date: 03:37:47 05/07/03
Go up one level in this thread
On May 07, 2003 at 05:48:40, Sune Fischer wrote:
>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.
Yes
I practically do it in the generate move so I do not generate illegal moves in
the first place but movei is more complex and I have arrays that tell me if a
square is attacked or if a piece is pinned.
I agree that even for a simple program in most cases it is possible even to
avoid checking if the king is in check by detecting no king move and no move of
piece that is suspected to be a king but the first step for a simple program to
increase speed is simply checking after every move if the king is in check
instead of generating the list of moves.
Uri
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.