Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: move ordering and bitboards

Author: Larry Griffiths

Date: 10:16:14 06/23/00

Go up one level in this thread


On June 22, 2000 at 20:13:16, John Coffey wrote:

>On June 21, 2000 at 21:29:33, Robert Hyatt wrote:
>
>>On June 21, 2000 at 18:47:12, John Coffey wrote:
>>
>>>In follow up to Why Bitboards at all?
>>>
>>>If bitboards can be used to generate captures, then I assume that these
>>>are searched first to improve move ordering.  Is there any effort to
>>>determine which capture should be looked at first and do bitboards provide
>>>other ways to improve move ordering?
>>>
>>>John Coffey
>>
>>One answer is to do what I do.  Use bitboards to produce a move list with
>>nothing but captures.  Then sort the list of captures in any way you want.
>>Another answer is to use the "belle" approach and use MVV/LVA (most valuable
>>victim, least valuable attacker) as the ordering strategy and produce the
>>moves one at a time, as you search them.
>>
>>
>>
>>
>>
>>>
>>>Being a novice to bitboards I am trying to figure out how to generate a
>>>capture.  If I take a square and then I say take the mask for the moves of
>>>a bishop for that square, then I have a mask that covers 14 squares.  If I & it
>>>with a mask for my opponent's pieces I have a mask of potential captures
>>>assuming that no pieces were in the way.  So first I would have to come up
>>>with a mask for legal moves for the bishop before determining the captures?
>>>This I am not sure how to do, but I am going to try to read up on bitboards.
>>
>>
>>
>>
>>Just use the normal approach to produce the bit vector with 1's for _every_
>>square that a bishop attacks.  AND this with the occupied squares bitmap for
>>the opponent and you just eliminated all bishop moves except for the ones
>>that capture opponent pieces...
>
>
>The thing that I am missing is the "normal approach" or how to get the *legal*
>moves for a piece with bitboards.  A bishop can atack 14 squares, but some
>of those squares are blocked.  How to mask out the blocked squares?
>
>John Coffey

Very good question John :)

say we separate out the rank moves for the rook...

Pp..R.Pp

The attack bitmask is 11110111

Anded with where are all pieces is 11000011

Anded with a pre-computed table in my program called adjacent bits from file.

01000010

then anded with opponents pieces = 01000000

01000000 is then used as the index into another pre-computed table that has the
number of rook moves and the moves themselves.

Others may have better ways to do this, but this is how mine works :)

Larry.




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.