The API of this "another object" is strictly tied to the logic of the game. It will be different for chess and different for say... civilization clone.

For chess I would define something like:
Qt Code:
  1. class ChessPieceLogic {
  2. public:
  3. virtual ~ChessPieceLogic(){}
  4. virtual QList<QPoint> possibleMoves(const QPoint &from, const BoardState &state) const = 0;
  5. virtual QList<QPoint>attackedFields(const QPoint &from, const BoardState &state) const = 0;
  6. virtual isValidMove(const QPoint &from, const QPoint &to, const BoardState &state) const = 0;
  7. virtual bool isUnderAttackBy(const QPoint &source, const QPoint &target) const; // to check for check/mate
  8. virtual QList<QPair<QPoint,QPoint> > makeMove(const QPoint &from, const QPoint &to, const BoardState &state) const = 0; // to allow en passant and castles
  9. virtual void commitMove(const QPoint &from, const QPoint &to) = 0;
  10. };
To copy to clipboard, switch view to plain text mode