-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support
printsysteminfo
UCI command.
Add PEXT Bitboards
- Loading branch information
1 parent
aa54d88
commit e622a5b
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using Lynx.Model; | ||
|
||
namespace Lynx.Benchmark; | ||
public class PEXTBenchmark : BaseBenchmark | ||
{ | ||
private readonly Position _position = new Position(Constants.TrickyTestPositionFEN); | ||
|
||
[Benchmark(Baseline = true)] | ||
public ulong MagicNumbers() | ||
{ | ||
ulong result = default; | ||
|
||
for (int i = 0; i < 64; ++i) | ||
{ | ||
result |= MagicNumbersRookAttacks(i, _position.OccupancyBitBoards[0]); | ||
result |= MagicNumbersBishopAttacks(i, _position.OccupancyBitBoards[0]); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
[Benchmark] | ||
public ulong PEXT() | ||
{ | ||
ulong result = default; | ||
|
||
for (int i = 0; i < 64; ++i) | ||
{ | ||
result |= PEXTRookAttacks(i, _position.OccupancyBitBoards[0]); | ||
result |= PEXTBishopAttacks(i, _position.OccupancyBitBoards[0]); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
private static BitBoard MagicNumbersRookAttacks(int squareIndex, BitBoard occupancy) => Attacks.MagicNumbersRookAttacks(squareIndex, occupancy); | ||
|
||
private static BitBoard PEXTRookAttacks(int squareIndex, BitBoard occupancy) => Attacks.RookAttacks(squareIndex, occupancy); | ||
|
||
private static BitBoard MagicNumbersBishopAttacks(int squareIndex, BitBoard occupancy) => Attacks.MagicNumbersBishopAttacks(squareIndex, occupancy); | ||
|
||
private static BitBoard PEXTBishopAttacks(int squareIndex, BitBoard occupancy) => Attacks.BishopAttacks(squareIndex, occupancy); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters