public double GetWeight(ParameterRandomizer rnd)
        {
            var score = rnd.Rnd.NextDouble();

            score *= (double)Elo * (double)Elo;
            return(score);
        }
示例#2
0
        public void CloneBots(ParameterRandomizer rnd)
        {
            var count = 0;
            var test  = Capacity;

            while (test >= Count)
            {
                count++;
                test >>= 1;
            }

            var highest = GetHighestElo();

            if (highest.IsStable)
            {
                Add(highest, rnd);

                if (count <= 0)
                {
                    count = 1;
                }
                for (var i = 0; i < count; i++)
                {
                    var stable = GetStable().OrderByDescending(bot => bot.GetWeight(rnd)).FirstOrDefault();
                    if (stable != null)
                    {
                        Add(stable, rnd);
                    }
                }
            }
        }
示例#3
0
        public BotData Add(BotData parent, ParameterRandomizer rnd)
        {
            var id  = GetNewId();
            var bot = new BotData(id, parent, rnd);

            TryAdd(id, bot);
            return(bot);
        }
示例#4
0
        public BattleSimulator(MT19937Generator rnd)
        {
            File        = new FileInfo("parameters.xml");
            SearchDepth = AppConfig.Data.SearchDepth;

            Rnd        = rnd;
            Randomizer = new ParameterRandomizer(rnd);

            Bots    = new Bots();
            Results = new ConcurrentQueue <BattlePairing>();
        }
 public BotData(int id, BotData parent, ParameterRandomizer rnd)
     : this(id, rnd.Randomize(parent.DefPars))
 {
     ParentId   = parent.Id;
     Generation = parent.Generation + 1;
 }