public static Board deepCopy(Board b) { Board newB = new Board(b.getHeight(), b.getWidth()); for (int y = 0; y < newB.getHeight(); y++) { for (int x = 0; x < newB.getWidth(); x++) { Piece p = b.getCellContents(y, x); if (p != null) { newB.addPieceToCell(new Piece(p)); } } } return newB; }
public GameLogic(GameLogic g) { //does a deep copy of GameLogic this.forceJumps = g.forceJumps; this.board = g.getBoardCopy(); this.moveNumber = g.moveNumber; this.blackPieces = g.blackPieces; this.redPieces = g.redPieces; if (multiJumpLoc != null) { this.multiJumpLoc = new Vector(g.multiJumpLoc); } else { this.multiJumpLoc = null; } this.turnNumber = g.turnNumber; }
public GameLogic(int boardHeight, int boardWidth, bool forceJumps) { this.forceJumps = forceJumps; this.board = new Board(boardWidth, boardHeight); moveNumber = 0; turnNumber = 0; movesMade = new List<Move>(); successMoves = new List<MoveAttempt>(); }