Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Updating strange attack boards

Author: Peter Fendrich

Date: 04:49:39 03/20/03

Go up one level in this thread


On March 19, 2003 at 06:33:01, Matthias Gemuh wrote:

>I decided to stop chess programming but even the latest version of my program
>sucks. How can I quit in peace?
>It calculates this attack information (bitboards of attackers to 64 squares)
>    BITBOARD AttacksTo[64]
>from scratch at each node. I tried to do this incremementally and it quickly got
>messy and buggy because of sliding pieces, castle, en passant.
>How do you attack attack boards (even the conventional type)?
>
>/Matthias.

I used to update incrementally before I changed to rotaded bitboards ala Crafty
and DeepThought. Basically you'll need four functions:
For the moving piece:
 DeleteAttacksFrom(square)
 AddAttacksFrom(square)
For the affected pieces:
 ExtendAttacksTo(square)
 CutAttacksTo(square)

If you for instance move a Knight from f3 to e5 you would do:
-Make the move
-DeleteAttacksFrom(f3) //set bit f3 to 0 in AttacksTo[g1], AttacksTo[e1] etc
-AddAttacksFrom(e5)    //set bit e5 to 1 in AttacksTo[f3], AttacksTo[g4] etc
-ExtendAttacksTo(f3)   //all sliding pieces attacking f3 are extended from f3
-CutAttacksTo(e5)      //all sliding pieces attacking e5 are cut off at e5

Regards,
Peter



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.