mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Another (final?) attempt at squares_delta()
This time I have removed the function alltogether ! Sorry to work above a patch of UncombedCoconut (Justin Blanchard) but I couldn't resist ;-) No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
0693ff178e
commit
deee18c758
1 changed files with 10 additions and 15 deletions
|
@ -248,7 +248,6 @@ namespace {
|
|||
void init_attacks();
|
||||
void init_between_bitboards();
|
||||
void init_pseudo_attacks();
|
||||
SquareDelta ray_direction(Square orig, Square dest);
|
||||
Bitboard index_to_bitboard(int index, Bitboard mask);
|
||||
Bitboard sliding_attacks(int sq, Bitboard block, int dirs, int deltas[][2],
|
||||
int fmin, int fmax, int rmin, int rmax);
|
||||
|
@ -288,10 +287,10 @@ void init_bitboards() {
|
|||
|
||||
init_masks();
|
||||
init_attacks();
|
||||
init_between_bitboards();
|
||||
init_sliding_attacks(RAttacks, RAttackIndex, RMask, RShift, RMult, rookDeltas);
|
||||
init_sliding_attacks(BAttacks, BAttackIndex, BMask, BShift, BMult, bishopDeltas);
|
||||
init_pseudo_attacks();
|
||||
init_between_bitboards();
|
||||
}
|
||||
|
||||
|
||||
|
@ -454,33 +453,29 @@ namespace {
|
|||
return result;
|
||||
}
|
||||
|
||||
SquareDelta ray_direction(Square orig, Square dest) {
|
||||
|
||||
int df = file_distance(orig, dest);
|
||||
int dr = rank_distance(orig, dest);
|
||||
|
||||
if (orig != dest && (!df || !dr || df == dr))
|
||||
return SquareDelta(dest - orig) / Max(df, dr);
|
||||
|
||||
return DELTA_NONE;
|
||||
}
|
||||
|
||||
void init_between_bitboards() {
|
||||
|
||||
Square s1, s2, s3;
|
||||
SquareDelta d;
|
||||
int f, r;
|
||||
|
||||
for (s1 = SQ_A1; s1 <= SQ_H8; s1++)
|
||||
for (s2 = SQ_A1; s2 <= SQ_H8; s2++)
|
||||
{
|
||||
BetweenBB[s1][s2] = EmptyBoardBB;
|
||||
d = ray_direction(s1, s2);
|
||||
|
||||
if (d != DELTA_NONE)
|
||||
if (bit_is_set(QueenPseudoAttacks[s1], s2))
|
||||
{
|
||||
f = file_distance(s1, s2);
|
||||
r = rank_distance(s1, s2);
|
||||
|
||||
d = SquareDelta(s2 - s1) / Max(f, r);
|
||||
|
||||
for (s3 = s1 + d; s3 != s2; s3 += d)
|
||||
set_bit(&(BetweenBB[s1][s2]), s3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bitboard index_to_bitboard(int index, Bitboard mask) {
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue