Added replacePiece for use by the move generator.