コード例 #1
0
ファイル: MatchSystem.cs プロジェクト: TatianaGV/botinok.fun
        public GameStatus StartMatch(Game game, string bot1, string bot2)
        {
            //const bool ENABLE_PRINT = true;
            game.RunBots(bot1, bot2); //run bots' processes
            Random r = new Random();

            //int num_op = r.Next(0, 2); //кто первый ходит
            bool[] bools = new bool[2] {
                false, true
            };
            bool first = bools[r.Next(0, 2)]; //true, если сейчас ходит первый бот

            //if (ENABLE_PRINT) Console.WriteLine("Первым ходит Бот {0}", (first) ? 1 : 2);

            //отправляем ботам инфу, кто есть кто
            game.SendFirstInfo(first);
            game.SendSecondInfo(!first);

            while (game.Status() == GameStatus.Playing)
            {
                game.GetMove(first);
                first = !first;
            }

            game.FinishGame();
            return(game.Status());
        }