Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: All shortest paths & other flood-fill based algorithms

Author: Alessandro Damiani

Date: 10:50:03 09/14/02

Go up one level in this thread


On September 14, 2002 at 13:17:53, Steffan Westcott wrote:

>On September 14, 2002 at 12:41:02, Alessandro Damiani wrote:
>
>>On September 14, 2002 at 07:27:17, Steffan Westcott wrote:
>>
>>>BitBoard WhitePassedPawns(BitBoard w_pawns, BitBoard b_pawns)
>>>{
>>>    return w_pawns & ~FillDown(                 b_pawns
>>>                               | ShiftDownLeft (b_pawns)
>>>                               | ShiftDownRight(b_pawns));
>>>}
>>
>>There is just a small improvement to your method "WhitePassedPawns()": factor
>>out the "shift down" to avoid shifting down twice.
>>
>>BitBoard WhitePassedPawns(BitBoard w_pawns, BitBoard b_pawns)
>>{
>>    return   w_pawns & ~FillDown(  b_pawns
>>                                 | ShiftDown(  ShiftLeft (b_pawns)
>>                                             | ShiftRight(b_pawns));
>>}
>>
>
>Alessandro,
>
>I should have also included the following procedure definitions. Note these
>diagonal shifts are about as fast as the rank and file shifts. So my original
>code _may_ be a very narrow win over yours, or your favourite optimising
>compiler may in fact give you the same object code for both!
>
>For clarity in my posts, I'm not writing 'inline' everywhere, please assume
>their presence as appropriate :)
>

Ahh, sorry! My sense of math misled me when I saw these twice "down" in the
shifts. That's why I was talking of "factoring out".

I didn't remember how I implemented ShiftLeftDown/RightDown. Actually I use the
same like yours but as macros. So, we are on the same boat. :)

Alessandro



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.