Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: 0x88 offset table

Author: David B Weller

Date: 06:23:44 10/10/04

Go up one level in this thread


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];
	  }
	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.