Ejemplo n.º 1
0
        public override LogicPart Create()
        {
            var logicPart = new LogicPart();
            var rules     = new HommRules();

            logicPart.CreateWorld           = () => new HommWorld(pids.Take(playersCount).ToArray());
            logicPart.CreateDefaultSettings = () => new Settings {
                OperationalTimeLimit = 5, TimeLimit = 90
            };

            logicPart.WorldStateType   = typeof(HommWorldState);
            logicPart.CreateWorldState = seed => new HommWorldState(int.Parse(seed));
            logicPart.PredefinedWorldStates.AddRange(Enumerable.Range(0, 5).Select(i => i.ToString()));

            var actorFactory = ActorFactory.FromRobot(new HommRobot(), rules);

            foreach (var pid in pids.Take(playersCount))
            {
                logicPart.Actors[pid] = actorFactory;
            }

            logicPart.Bots[HommRules.StandingBotName] = () =>
                                                        new Bot <HommCommand>(_ => new HommCommand {
                Movement = new Wait()
            });

            return(logicPart);
        }