| View previous topic :: View next topic |
| Author |
Message |
Gerd Isenberg
Joined: 08 Mar 2006 Posts: 1802 Location: Hattingen, Germany
|
Post subject: Re: New simple and fast bitboard move generator Posted: Mon May 07, 2007 11:22 pm |
|
|
This one with only 4KByte lookup in total is another alternative based on your bitscan idea. But it needs some more registers to keep bits[sq][dir] for a while. bits[square][dir] contains all ray bits including boarder and edges, but exclusive the square, so some empty sets for boarder squares and appropriate direction. outer[square][dir] contains exactly one boarder-bit - it may include the square itself.
| Code: |
u64 bits[64][4];
u64 outer[64][4];
u64 rookAttacks(u64 occ, u32 sq) {
u64 n = (occ & bits[sq][0]) | outer[sq][0];
u64 e = (occ & bits[sq][1]) | outer[sq][1];
u64 s = (occ & bits[sq][2]) | outer[sq][2];
u64 w = (occ & bits[sq][3]) | outer[sq][3];
_BitScanForward64((unsigned long*)&n, n);
_BitScanForward64((unsigned long*)&e, e);
_BitScanReverse64((unsigned long*)&s, s);
_BitScanReverse64((unsigned long*)&w, w);
return bits[sq][0] ^ bits[n][0]
^ bits[sq][1] ^ bits[e][1]
^ bits[sq][2] ^ bits[s][2]
^ bits[sq][3] ^ bits[w][3]
;
}
|
|
|
| Back to top |
|
 |
|
| Subject |
Author |
Date/Time |
New simple and fast bitboard move generator |
Michael Sherwin |
Sat May 05, 2007 3:52 pm |
Re: New simple and fast bitboard move generator |
Gerd Isenberg |
Sat May 05, 2007 5:43 pm |
Re: New simple and fast bitboard move generator |
Gerd Isenberg |
Sun May 06, 2007 8:52 am |
Re: New simple and fast bitboard move generator |
Michael Sherwin |
Sun May 06, 2007 10:31 am |
Re: New simple and fast bitboard move generator |
Gerd Isenberg |
Sun May 06, 2007 11:16 am |
Re: New simple and fast bitboard move generator |
Michael Sherwin |
Sun May 06, 2007 1:21 pm |
Re: New simple and fast bitboard move generator |
Gerd Isenberg |
Sun May 06, 2007 1:52 pm |
Re: New simple and fast bitboard move generator |
Michael Sherwin |
Sun May 06, 2007 3:15 pm |
Re: New simple and fast bitboard move generator |
Michael Sherwin |
Sun May 06, 2007 10:29 pm |
Re: New simple and fast bitboard move generator |
Gerd Isenberg |
Mon May 07, 2007 8:40 am |
Re: New simple and fast bitboard move generator |
Michael Sherwin |
Mon May 07, 2007 11:06 am |
Re: New simple and fast bitboard move generator |
Gerd Isenberg |
Mon May 07, 2007 8:08 pm |
Re: New simple and fast bitboard move generator |
Gerd Isenberg |
Mon May 07, 2007 11:22 pm |
Re: New simple and fast bitboard move generator |
Michael Sherwin |
Tue May 08, 2007 3:18 am |
Re: New simple and fast bitboard move generator |
Gerd Isenberg |
Tue May 08, 2007 6:11 am |
Re: New simple and fast bitboard move generator |
Michael Sherwin |
Tue May 08, 2007 9:25 pm |
Re: New simple and fast bitboard move generator |
Michael Sherwin |
Tue May 08, 2007 10:55 pm |
Re: New simple and fast bitboard move generator |
Gerd Isenberg |
Wed May 09, 2007 3:18 am |
Re: New simple and fast bitboard move generator |
Tony |
Wed May 09, 2007 6:10 am |
Re: New simple and fast bitboard move generator |
Michael Sherwin |
Wed May 09, 2007 7:47 am |
Re: New simple and fast bitboard move generator |
Tony |
Wed May 09, 2007 8:24 am |
Re: New simple and fast bitboard move generator |
Gerd Isenberg |
Wed May 09, 2007 7:31 pm |
Re: New simple and fast bitboard move generator |
Michael Sherwin |
Wed May 09, 2007 11:30 pm |
Re: New simple and fast bitboard move generator |
Tony |
Mon May 07, 2007 6:46 am |
Re: New simple and fast bitboard move generator |
Gerd Isenberg |
Mon May 07, 2007 8:51 am |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|