Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Single Reply Extension

Author: Robert Hyatt

Date: 10:15:57 09/20/04

Go up one level in this thread


On September 20, 2004 at 13:04:07, Uri Blass wrote:

>On September 20, 2004 at 10:38:31, Robert Hyatt wrote:
>
>>On September 20, 2004 at 07:17:17, martin fierz wrote:
>>
>>>On September 20, 2004 at 06:11:49, Renze Steenhuisen wrote:
>>>
>>>>On September 20, 2004 at 06:00:21, martin fierz wrote:
>>>>
>>>>>On September 20, 2004 at 05:28:54, Renze Steenhuisen wrote:
>>>>>
>>>>>>Hi all,
>>>>>>
>>>>>>I have to confess that this is a very said thing, but I have to ask...
>>>>>>
>>>>>>My moveGen() generates pseudo-legal moves, in a similar way as is done in
>>>>>>Crafty. I want to add the single-reply extension (of course), but I find it hard
>>>>>>to grasp how to do this efficiently (because I might need to generate more moves
>>>>>>than needed, right?)
>>>>>>
>>>>>>Or someone could please explain in words what is done in Crafty:
>>>>>>
>>>>>>        if (tree->in_check[ply] && tree->last[ply]-tree->last[ply-1] == 1) {
>>>>>>          tree->one_reply_extensions_done++;
>>>>>>          extended+=onerep_depth;
>>>>>>        }
>>>>>>
>>>>>>What is this "tree->last[]" thing doing exactly?
>>>>>>
>>>>>>Thanks!
>>>>>>
>>>>>>  Renze
>>>>>
>>>>>i never studied the crafty code very thoroughly so i might be wrong. i think
>>>>>tree->last[ply] is the move stack pointer, which means that if the condition
>>>>>tree->last[ply] - tree->last[ply-1] == 1
>>>>>is true, there is exactly one move at ply. so basically this doesn't answer your
>>>>>question how to do it efficiently - it's just part of crafty's housekeeping that
>>>>>bob is using here. the (efficient) generation of the check evasions is being
>>>>>done somewhere else (and i have no idea where!)
>>>>
>>>>Aha! Check! of course, that's it. (STUPID ME)
>>>>
>>>>So Crafty is only doing one_rep extension when in check!
>>>>
>>>>But, isn't the idea of the extension to extend all situations where there is
>>>>merely ONE LEGAL REPLY?
>>>
>>>i don't think so. in fact, it would be extremely easy to add such an extension
>>>(just remove the 'tree->in_check[ply]' part in crafty).
>>
>>would not work.  If I am not in check, I don't use the special move generator
>>that generates only legal moves...  You would never extend there in Crafty,
>>since there are never any positions where there is only one possible
>>pseudo-legal move...
>
>I am not sure about the last never
>
>How many possible pseudo legal moves are in the following position
>[D]7k/8/8/6p1/5pP1/4pPp1/4P1PN/5B1K w - - 0 1

There you go.  I should have said "almost never".  But even worse, I produce
moves in chunks and it is certainly possible that a single "chunk" has only one
move, and that would incorrectly trigger the extension for me...  So I need the
test anyway, no matter what, although your test position simply points out
another case of where one pseudo-legal move is possible even when not in
check...

I would not want to extend there, however, and current crafty would not.


>
>Uri
>>
>>
>>> but i would guess that
>>>99.999% of all situations where there is only one move are checks. i can't
>>>remember seeing any position ever in my games where there was only one reply
>>>without checks. perhaps in some kind of study it might happen, but not in normal
>>>games.
>>>
>>>so the whole point of bob's code is that it runs 0.01% faster if he first checks
>>>for in_check and only then checks the (a-b == 1) thing, because he saves the
>>>a-b. at least that's what i assume when looking at it.
>>
>>No.  in_check = 0 says use normal move generator.  in_check = 1 says use special
>>check-evasion generator so that I don't have to cull all the illegal moves as I
>>try to search them.
>>
>>
>>
>>>
>>>cheers
>>>  martin
>>>
>>>
>>>>
>>>>Can anyone tell something about his or her findings?
>>>>
>>>>Thanks!
>>>>
>>>>Renze



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.