So what do we want to do with the Board-class?
- Making a move - We want to be able to take a Move-object and make that move on the board. We will have to change where the pieces stand after the move, and also keep track of en passant and castling right changes.
- Unmaking a move - This might not sound that important, but trust me you will need it. It's important in the search algorithm later on. Just taking a Move-object and undoing it on the board is not as easy at it sounds.
Let's say you're white and moved your king, hence removing all possibilities to castle. The Board-object after making the king-move would state that white has no possibilities to castle. But if you're going to unmake that move now, sending the king-move to the Board-object, how will the board know you were able to castle before the move?
This is a tricky thing, and we will have to keep track of earlier castling posibilites (as well as en passant) somehow.
If someone has a good way of doing this, please let me know. I have a feeling my solution will get real messy real fast. :)
- Generating possible moves - Later on when we're trying to find the best move in a position we need to be able to find the possible moves in the position. This method will be called millions of times (every time a new position arises in the search) so we want it to be very effective.
- FEN-strings(in- and output) - FEN is short for Forsyth-Edwards Notation and is a way of representing a chess position with a single string. There are hundreds of chess programs out there that handles FEN-strings, and I'm going to use one of them (probably Blitzin 2.5) to easily input test-positions and also for a graphical view of the current position during the development of the engine (instead of making some ASCII-drawing of the board).
- Draw and mate detection - The draw and mate detection is not a very hard feature to implement, but it can drain a whole lot of speed if done wrong. Checking if the position is mate for example requires you to find the king, see if it is in check, and if there are any possible moves to get out of the check. This can be done right, and it can be done wrong. Let's make it right. :)
I've not yet decided if this should be placed here or in the search, or even in the main class (Mediocre-class). We'll see where it ends up eventually.
Now on to implementing the FEN-strings, and explaining what they do.