예제 #1
0
        // Überprüft, ob sich der König in Schach befindet
        public bool IsKingInCheck(string color)
        {
            Square kings_pos = GetKingsPosition(color);

            foreach (Chessman chessman in chessman)
            {
                if (color != chessman.Color)
                {
                    if (chessman.IsMoveValid(kings_pos) && !chessman.IsMoveBlocked(kings_pos))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }