private static void handleMove(Move move) { List<Piece> added = move.getAdditions(); List<Piece> removed = move.getRemovals(); foreach (Piece p in removed) { Vector co = p.getCoordinates(); delete(co.getX(), co.getY()); } foreach (Piece p in added) { Vector co = p.getCoordinates(); int col = co.getX(); int row = co.getY(); Checker c = new Checker(col, row, p.getColor() == PieceColor.BLACK ? DarkGrey : Colors.Red, p.getColor() == PieceColor.BLACK ? Colors.Black : DarkRed); spaces[col, row].setChecker(c); mainCanvas.Children.Add(spaces[col, row].getChecker().getEl2()); mainCanvas.Children.Add(spaces[col, row].getChecker().getEl1()); mainCanvas.Children.Add(spaces[col, row].getChecker().getCrown()); if (p.getType() == PieceType.KING) c.king(); } }
private void doMove(Move move) { lastPlayer = move.getPlayer(); foreach (Piece removal in move.getRemovals()) { removePiece(removal); } foreach (Piece addition in move.getAdditions()) { addPiece(addition); } }
private void doMove(Move move) { movesMade.Add(move); foreach (Piece removal in move.getRemovals()) { removePiece(removal); } foreach (Piece addition in move.getAdditions()) { addPiece(addition); } }