New RookAttacks() - possibly

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Gerd Isenberg
Posts: 2250
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: New RookAttacks() - possibly

Post by Gerd Isenberg »

Michael Sherwin wrote: Thu Feb 13, 2020 12:46 am I'm having a difficult time. :roll:

Code: Select all

u64 RookAttacks(u08 sq, bbu occ) {
  u64 bb = ss1[sq][(occ.b64 >> ((sq & 56) + 1)) & 63];
  occ.b64 >>= (sq & 7) & 0x0001010101010100;
  bb &= ss2[sq][0][occ.b08.rank1];
  bb &= ss2[sq][1][occ.b08.rank2];
  bb &= ss2[sq][2][occ.b08.rank3];
  bb &= ss2[sq][3][occ.b08.rank4];
  bb &= ss2[sq][4][occ.b08.rank5];
  bb &= ss2[sq][5][occ.b08.rank6];
  return bb;
Wow! Takes some time to understand and verify ;-)
Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: New RookAttacks() - possibly

Post by Michael Sherwin »

Gerd Isenberg wrote: Thu Feb 13, 2020 9:51 pm
Michael Sherwin wrote: Thu Feb 13, 2020 12:46 am I'm having a difficult time. :roll:

Code: Select all

u64 RookAttacks(u08 sq, bbu occ) {
  u64 bb = ss1[sq][(occ.b64 >> ((sq & 56) + 1)) & 63];
  occ.b64 >>= (sq & 7) & 0x0001010101010100;
  bb &= ss2[sq][0][occ.b08.rank1];
  bb &= ss2[sq][1][occ.b08.rank2];
  bb &= ss2[sq][2][occ.b08.rank3];
  bb &= ss2[sq][3][occ.b08.rank4];
  bb &= ss2[sq][4][occ.b08.rank5];
  bb &= ss2[sq][5][occ.b08.rank6];
  return bb;
Wow! Takes some time to understand and verify ;-)
Hi Gerd, Glad to see that you are still around! :D

I started a new thread in which I believe that I did a better job explaining.
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through