예제 #1
0
        public void DoesMatch_EmptyAgainstRandomEnviroment()
        {
            var env1     = new Bot.Core.Environment();
            var env2     = new Bot.Core.Environment().Random();
            var expected = true;
            var actual   = env1.DoesMatch(env2);
            var actual2  = env2.DoesMatch(env1);



            Assert.Equal(expected, actual);
            Assert.Equal(expected, actual2);
        }
예제 #2
0
        public void DoesMatch_ShouldNotMatch()
        {
            var env1 = new Bot.Core.Environment
            {
                IsDay = true
            };
            var env2 = new Bot.Core.Environment
            {
                IsDay = false
            };
            var expected = false;
            var actual   = env1.DoesMatch(env2);
            var actual2  = env2.DoesMatch(env1);



            Assert.Equal(expected, actual);
            Assert.Equal(expected, actual2);
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to trainer, name your bot");
            var name = Console.ReadLine();
            var bot  = new Bot.Core.Bot {
                Name = name
            };

            Console.WriteLine(bot);
            // give bot random actions
            bot.PopulateActions();
            var count = 0;

            while (true)
            {
                count++;
                Console.WriteLine($"giving the {count} command");
                // get env
                var currentConditions = new Bot.Core.Environment().Random();
                Console.WriteLine(currentConditions);
                // select action
                var selectAction = bot.SelectAction(currentConditions);
                Console.WriteLine($"{bot.Name} is going to do {selectAction.Action}");
                // determin is action is any good

                if (selectAction.Action == "sit")
                {
                    bot.StrengthenAction(selectAction);
                }
                else
                {
                    bot.WeakenAction(selectAction);
                }

                Console.WriteLine("removing bad actions");
                bot.RemoveBadActions();
                //Console.ReadLine();
            }

            // train
        }