The most effective chessboard presentation method

I have a chess program written in Java. I am currently using a 2d char array to represent a chessboard. Uppercase characters to represent white and lowercase to represent black. Should I use an array of bytes to reduce memory usage? Or maybe an enumeration? Thanks.

+4
source share
1 answer

In short: the most effective and professional way is to use Bitrates.

Basically, there are 3 ways to represent a frequently used chessboard:

  • 8x8 2-dimensional array: Slow but easy to maintain

  • 10x12 1-dimensional array: Faster, a bit trickier

  • Bitboards: , , Stockfish Rybka. , 64- uint , . wiki google = > .

+2

Source: https://habr.com/ru/post/1613002/


All Articles