public void GetMove(string initData, string input, string expectedOutput)
        {
            var    ai       = new Ai();
            string nextMove = ai.GetNextMove(StateReader.Read(initData, input), new Countdown(50));

            Assert.That(nextMove, Is.EqualTo(expectedOutput));
        }
Beispiel #2
0
        private static void Main(string[] args)
        {
            var reader   = new StateReader();
            var initData = reader.ReadInitData();
            var ai       = new Ai();

            while (true)
            {
                var state     = reader.ReadState(initData);
                var countdown = new Countdown(45);
                var move      = ai.GetNextMove(state, countdown);
                Console.Error.WriteLine(countdown);
                Console.WriteLine(move);
            }
        }
        private static void Main(string[] args)
        {
            var reader   = new StateReader();
            var initData = reader.ReadInitData();

            var ironManAi       = new KiteAi(initData.AttackDirection, HeroType.IronMan);
            var doctorStrangeAi = new KiteAi(initData.AttackDirection, HeroType.DoctorStrange);
            var ais             = new List <AiBase>()
            {
                ironManAi, doctorStrangeAi,
            };

            while (true)
            {
                var state     = reader.ReadState(initData);
                var countdown = new Countdown(45);
                if (state.RoundType == -2)
                {
                    Console.WriteLine(CommandHelper.SelectHero(HeroType.IronMan));
                    continue;
                }

                if (state.RoundType == -1)
                {
                    Console.WriteLine(CommandHelper.SelectHero(HeroType.DoctorStrange));
                    continue;
                }

                foreach (var ai in ais)
                {
                    var move = ai.GetNextMove(state, countdown);
                    Console.Error.WriteLine(countdown);
                    Console.WriteLine(move);
                }
            }
        }
        /// <summary>
        /// Для тестов
        /// </summary>
        public static State Read(string init, string state)
        {
            var initData = new StateReader(init).ReadInitData();

            return(new StateReader(state).ReadState(initData));
        }