private bool ProcessBlockForPawn(int x, int y) { Block b = cb.GetBlockByChessPosition(new Point(x, y)); if (b != null) { if (b.GetPiece() == null) { return(false); } else { if (b.GetPiece().GetPieceColor() == OrigBlock.GetPiece().GetPieceColor()) { return(false); } else { ValidBlocks.Add(b); return(true); } } } return(false); }
protected new bool ProcessBlockInclusive(int x, int y) { Block b = cb.GetBlockByChessPosition(new Point(x, y)); if (b != null) { ValidBlocks.Add(b); return(false); } return(false); }
private bool ProcessBlockForPawnInclusive(int x, int y) { Block b = cb.GetBlockByChessPosition(new Point(x, y)); if (b != null) { ValidBlocks.Add(b); return(true); } return(false); }
private bool ProceedIfNoPiece(int x, int y) { Block b = cb.GetBlockByChessPosition(new Point(x, y)); if (b != null) { if (b.GetPiece() == null) { ValidBlocks.Add(b); return(true); } } return(false); }
protected new bool ProcessBlock(int x, int y) { Block b = cb.GetBlockByChessPosition(new Point(x, y)); if (b != null) { Piece piece = b.GetPiece(); if (piece != null) { if (piece.GetPieceColor() == OrigBlock.GetPiece().GetPieceColor()) { return(false); } } ValidBlocks.Add(b); return(false); } return(false); }
private void CastlePositions() { if (OrigBlock == null) { return; } Piece piece = OrigBlock.GetPiece(); if (piece == null) { return; } // It must be KING if (piece.GetPieceType() != PieceType.KING) { return; } // Must be able to castle if (!piece.GetCanCastle()) { return; } Point point = OrigBlock.GetChessPosition(); bool GotPiece = false; if (CanCastle(new Point(0, point.Y))) { for (int i = point.X - 1; i > 0; i--) { Block b = cb.GetBlockByChessPosition(new Point(i, point.Y)); if (b.GetPiece() != null) { GotPiece = true; } } if (!GotPiece) { ValidBlocks.Add(cb.GetBlockByChessPosition(new Point(point.X - 2, point.Y))); } } GotPiece = false; if (CanCastle(new Point(7, point.Y))) { for (int i = point.X + 1; i < 7; i++) { Block b = cb.GetBlockByChessPosition(new Point(i, point.Y)); if (b.GetPiece() != null) { GotPiece = true; } } if (!GotPiece) { ValidBlocks.Add(cb.GetBlockByChessPosition(new Point(point.X + 2, point.Y))); } } }