コード例 #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);
        }