コード例 #1
0
        //Додати класи і методи реалізації в консолі, і запустити їх в Main
        static void Main(string[] args)
        {
            string   messageEndGame;
            string   messageMove = "White Player is moving";
            GameType typeOfGame;
            Player   currentPlayer;

            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.ForegroundColor = ConsoleColor.Black;
            Console.SetWindowSize(50, 50);

            typeOfGame = EnterTypeOfGame();
            Game game = new Game(typeOfGame);

            if (typeOfGame == GameType.SinglePlayer)
            {
                while (!game.IsExit(out messageEndGame))
                {
                    List <Point> lightPoints = new List <Point>();
                    Console.Clear();
                    lightPoints = game.WhitePlayer.LightPoints;
                    if (lightPoints != null)
                    {
                        PrintPoints(lightPoints);
                    }
                    if (messageMove.Length != 0)
                    {
                        Console.WriteLine(messageMove);
                    }
                    PrintDesk(game.GameDesk);
                    Console.WriteLine();
                    Point point = EnterPoint();
                    game.RunGameWithComputer(point, out messageMove);
                }
            }

            if (typeOfGame == GameType.MultyPlayer)
            {
                while (!game.IsExit(out messageEndGame))
                {
                    List <Point> lightPoints = new List <Point>();
                    Console.Clear();
                    currentPlayer = game.CurrentPlayer;
                    lightPoints   = currentPlayer.LightPoints;
                    if (lightPoints != null)
                    {
                        PrintPoints(lightPoints);
                    }
                    Console.WriteLine();
                    PrintDesk(game.GameDesk);
                    Console.WriteLine("{0} Player is moving", currentPlayer.Color);
                    Point point = EnterPoint();
                    game.RunGame(point);
                }
            }
        }