I am in the process of building a chess engine in Java using bitboards. I know C/C++ is more optimal for this but I have no knowledge of either so I'd rather attempt to do it with Java for now. I have two questions about storing generated moves.
- With regard to the format in which the moves themselves are stored, I've read about Stockfish's 16 bit format (from square, to square, promotion piece, special move) and I've also looked through the source code of CuckooChess (written in Java, ~2600 on CCRL) that have a Move class designated to hold all characteristics of a move in an object. What are the tradeoffs between either method, or any other method not mentioned?
- I'd like to store legal moves in an array, but I wouldn't be able to just append a move to the end of the array. The logical alternative would be using an ArrayList; however I'm also worried that the larger memory requirement of ArrayList would cause some issues. Would I store legal moves in an array, arrayList, or another structure, or are these considerations insignificant?