I am fairly new to bitboards in general and implemented magic bitboards with the help of Code Monkey Kings nice tutorial on YouTube, but as a C# engine instead. All attack tables seems to be working find after some random tests so I started implementing move generation. This is when I find some questions that I have a hard time deciding about, and which seems to be important for performance.
Question 1
Right now I loop through all piece bitboards for the given color. I the loop I have another loop going through all bits in that table (fromSquares).
If we take the pawn moves I can then get the bitboard corresponding to legal quiet (or attacking) moves for a fromSquare. How do I go from here? I could again loop through each bit in those boards (toSquares and add a move as (fromSquare, toSquare, extraInfo...). Is there a more efficient or more clever way?
Question 2
Speaking of generating/defining moves, I am not sure what the best solution will be for defining a move in C#. In Cosette which was linked to me it uses it according to this: https://github.com/Tearth/Cosette/blob/ ... es/Move.cs. However I have no idea how to understand the first init of From and To, or even how a struct works in general.
Instead I was thinking of just using a normal static class with information about fromSquare, toSquare, moveFlags etc and store all these in a list of possible moves. Will this be a huge decrease in performance, or are there other ways that are more performance friendly than that, but less complex than the struct solution in Cosette?
