Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: 0x88 offset table

Author: Heiner Marxen

Date: 06:11:46 10/12/04

Go up one level in this thread


On October 10, 2004 at 09:23:44, David B Weller wrote:

>Hi Tord,
>
>Thanks for the info!
>
>I'll have to look more closely at this:
>
>void init_attack_data() {
>  int sq, piece, tosq;
>  int *ptr;
>
>  for(sq=0; sq<256; sq++)
>    AttackData_[sq].may_attack = AttackData_[sq].step = 0;
>  for(sq=A1; sq<=H8; sq++)
>    for(piece=WP; piece<=BK; piece++)
>      for(ptr = Directions[piece]; *ptr; ptr++)
>	if(SLIDER(piece))
>	  for(tosq=sq+(*ptr); Board[tosq]!=OUTSIDE; tosq+=(*ptr)) {
>	    AttackData[sq-tosq].step = *ptr;
>	    AttackData[sq-tosq].may_attack |= PieceMask[piece];
                       ^^ ^^^^
Both, sq and tosq should only be taken from the set of legal squares.
While you appear to do that for tosq with "Board[tosq]!=OUTSIDE",
for sq it is not sufficient to be between A1 and H8.

Cheers,
Heiner


>	  }
>	else {
>	  tosq = sq+(*ptr);
>	  if(Board[tosq]!=OUTSIDE) {
>	    AttackData[sq-tosq].step = *ptr;
>	    AttackData[sq-tosq].may_attack |= PieceMask[piece];
>	  }
>	}
>}
>
>except for the distinction between piece types....
>
>[I would just set AttackData[sq-tosq] = 1; // if *any* piece attacks, ie., for
>my purposes is enough]
>
>I think I was 'filling' 'AttackData[]' the same way you are, but for some
>reason, two quadrants of that array were missing??
>
>I'll have to think about it some more...
>
>Thanks,
>
>-David



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.