예제 #1
0
 public void addPiece(Piece p)
 {
     if (p.getColor() == PieceColor.BLACK)
     {
         this.blackPieces++;
     }
     else
     {
         this.redPieces++;
     }
     board.addPieceToCell(p);
 }
예제 #2
0
 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;
 }
예제 #3
0
        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);
        }