Пример #1
0
        public static bool checkIfGameIsOver(bool isWhitesTurn, Board board, bool isWhiteInCheck, bool isBlackInCheck)
        {
            char playing = (isWhitesTurn) ? 'W' : 'B';

            if (!board.DoesTeamHaveMoveOptions(playing))
            {
                if ((playing == 'W') && (isWhiteInCheck == true))
                {
                    Console.WriteLine("Checkmate! Black is the WINNER!");
                    return(true);
                }
                else if ((playing == 'B') && (isBlackInCheck == true))
                {
                    Console.WriteLine("Checkmate! White is the WINNER!");
                    return(true);
                }
                else
                {
                    Console.WriteLine("Stalemate!");
                    Console.WriteLine("IT'S A TIE");
                    return(true);
                }
            }
            return(false);
        }