There are many places in the code where some operation is applied to a piece, but what exactly happens depends on whether it's a knight, bishop, queen, etc. For that reason, I'd suggest that a better approach may be to create a base Piece
class and derive Knight
, Bishop
, etc. This would allow you to keep thingthings better organized and reduce a great deal of repetition from the code. The board could contain pointers to Piece
and then invoking actions on each would automatically route to the correct routine, whether for evaluating value or determining legal moves.