Added extra unit tests to get code coverage close to 100%.
Added Board performance tests.
Fixed source code indentation.
Added ability to print Board and Position.
Implemented Board using bitboards, see performance improvements below.
Performance Improvements
The Bitboard implementation has resulted in a ~280x improvement† in computation time when simulating a full game (85 ply) played with a Board object, including initialization, at the cost of a ~40% increase in memory usage.
Results Comparison
Based on testBoardPerformance() performance test before and after Bitboard implementation.
Metric
Before
After
% Change
CPU Time (s)
5.299
0.019
🟢 99.6% ↘
CPU Cycles (kC)
13177592.595
46831.659
🟢 99.6% ↘
CPU Instructions (kI)
63112699.927
224032.835
🟢 99.6% ↘
Peak Memory (kB)
11002.291
15373.645
🔴 39.7% ↗
Xcode Output
Before
After
† Tested on M1 Pro 8-core CPU (2021 14" Macbook Pro)
Changes
Board
performance tests.Board
andPosition
.Board
using bitboards, see performance improvements below.Performance Improvements
The
Bitboard
implementation has resulted in a ~280x improvement† in computation time when simulating a full game (85 ply) played with aBoard
object, including initialization, at the cost of a ~40% increase in memory usage.Results Comparison
testBoardPerformance()
performance test before and afterBitboard
implementation.Xcode Output
† Tested on M1 Pro 8-core CPU (2021 14" Macbook Pro)