Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Are there new ideas to make movegeneration faster ?

Author: stefan

Date: 04:04:50 09/08/99

Go up one level in this thread


On September 01, 1999 at 09:57:10, Bas Hamstra wrote:

>On September 01, 1999 at 09:13:04, Ricardo Gibert wrote:
>
>>On September 01, 1999 at 09:02:34, Bas Hamstra wrote:
>>
>>>On September 01, 1999 at 08:26:48, stefan wrote:
>>>
>>>>Where can I read about it?
>>>>
>>>>Thank you.
>>>
>>>If you want to go fast, you shouldn't only look at the movegenerator.
>>>What is critital is:
>>>
>>>- fast capture generation (non captures are generated far less often)
>>>- fast attack generation
>>>- fast make/unmake
>>>
>>>If you are going to make a fast searcher above things are important. If you make
>>>a smart (more evaluation, but slower) program, they become less important,
>>>because most of the time will be spent in the eval anyway.
>>>
>>>So I wouldn't focus too much on move generation alone. For instance captures are
>>>generated 10x as often as non-captures.
>>>
>>>Ways of generating captures and attacks fast (in my opinion):
>>>
>>>- 0x88
>>>- Bitboards
>>>- Incremental attackmap (IE attackmap is updated at make/unmake time)
>>
>>Where can I find information on "incremental attackmap" on the internet? Thanks
>>in advance.
>>
>>>
>>>All these methods can see if a piece is attacked by another piece very fast,
>>>without scanning the board.
>
>You can download the source of KnightCap. I have no idea how complicated that
>source is. KnightCap keeps a "real" attackmap, which is harder (and I think
>slower) than keeping a "pseudo" attackmap. Here is how I do it:
>
>Suppose your want to "know" at any moment by which pieces a square is
>pseudo-attacked. Pseudo attacks are simply blocked AND non blocked attacks by
>sliding pieces and attacks by non sliding pieces.
>
>You give each piece a unique number from 1 to 32. WhiteKing = 1
>WhiteQueen=2...BlackKing=17 etc. Now the attackmap is an array of 64 positions.
>Each position is a 32 bit number. Each bit represents by which unique pieces the
>square is pseudoattacked.
>
>Suppose a move e2e4 is made. Suppose the unique number of this moving pawn is
>13. Now you have to unset bit (1ul << 13) for squares d3 and f3 because that
>squares are no longer attacked by this e-pawn. Then you set bit (1ul << 13) for
>squares d5 and f5, because they are now attacked.
>
>If you want to pop out all attacks to a square, and there is a sliding attack,
>you have to check for blocks. Just scan the squares between the attacker and the
>victim. The time spent doing this appears to be no big factor at all.
>
>If you want to do SEE you have all attackers neatly sorted already at any time
>and can just pop em out with lastone(). You HAVE to have a fast lastone of
>course, preferably one that relies on a single CPU instruction (intel has that).
>
>Critical: a fast lastone and a fast way to update (sliding) attacks.
>
>Most moves being made are captures so you have to do the following scheme very
>often at make time:
>
>- delete CapturedAttacks
>- delete FromAttacks
>- insert ToAttacks
>
>And reverse it *all* at unmake time. That may seem a lot of work, but in return
>you get Capturegeneration, attackinfo and SEE practically for free.
>
>I hope this all made sense. Disclaimer: I have not seen many other programs do
>this. So draw your own conclusions.
>
>
>Regards,
>Bas Hamstra.



Where can I download the source of KnightCap ?

Thank You
Stefan Plenkner



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.