topical media & game development

talk show tell print

professional-program-15-GameBoard-GameBoardTest.c

? / professional-program-15-GameBoard-GameBoardTest.c


  include <GameBoard.h>
  
  class ChessPiece : public GamePiece {};
  
  void processGameBoard(const GameBoard board)
  {
    const GamePiece& pawn = board.getPieceAt(0, 0);
  
    // Doesn't compile
    //board.setPieceAt(1, 2, pawn);
  }
  
  int main(int argc, char** argv)
  {
    GameBoard chessBoard(10, 10);
    ChessPiece pawn;
  
    chessBoard.setPieceAt(0, 0, pawn);
    chessBoard.setPieceAt(0, 1, chessBoard.getPieceAt(0, 0));
  
    GameBoard board2;
    board2 = chessBoard;
  
    processGameBoard(board2);
  
    return (0);
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.