Exemplo n.º 1
0
        private bool _IsCheck(int[] dx, int[] dy, Board.PieceGetter GetPiece)
        {
            for (int i = 0; i < dx.Length; i++)
            {
                Point          delta = new Point(dx[i], dy[i]);
                ImmutablePiece piece = GetPiece(king.CurrentPoint, delta);

                if (piece == null || king.IsFriendly(piece))
                {
                    continue;
                }

                if (piece.CanMoveTo(king.CurrentPoint, board))
                {
                    return(true);
                }
            }

            return(false);
        }