TheBlackPlague / StockNemo

A C# Chess Engine Finding Good Moves.
GNU Lesser General Public License v3.0
62 stars 7 forks source link

Switch to using BitBoards. #1

Closed TheBlackPlague closed 2 years ago

TheBlackPlague commented 2 years ago

BitBoards

This PR documents switching to BitBoards. BitBoards are essentially, at the lowest level, uint64s. StockNemo provides a high-level interface for BitBoards to allow seamless conversion back and forth with other types like tuples and IEnumerable for easy looping. Moreover, BitBoards have significantly improved performance across the table and reduced memory usage. With BitBoards, move generation is now using bit-shifts, lookup tables, and even black magic bitboards.

The performance difference is: Without BitBoards: 1.2M nps. With BitBoards: 22.8M nps.