Beispiel #1
0
 // Determine global strategy
 public void Scheming(IGameState state)
 {
     if (state.MyAnts.Count < 25)
     {
         masterPlan = MasterPlan.SCOUTANDEAT;
         foodRadius = 10;
         raidRadius = 2;
     }
     else if (state.EnemyAnts.Count > state.MyAnts.Count)
     {
         masterPlan = MasterPlan.YOU_SHALLNOT_PAAAASSSS;
         foodRadius = 5;
         raidRadius = 2;
     }
     else if (state.MyAnts.Count > state.EnemyAnts.Count * 1.5)
     {
         masterPlan = MasterPlan.WORLDDOMINATION;
         foodRadius = 2;
         raidRadius = 25;
     }
     else
     {
         masterPlan = MasterPlan.SCOUTANDEAT;
         foodRadius = 10;
         raidRadius = 2;
     }
 }
 public MasterPlanDto(MasterPlan source)
 {
     Id           = source.Id;
     Name         = source.Name;
     FixedDates   = new DateRangeDto(source.FixedDates);
     Participants = source
                    .Participants
                    .Select(x => new ParticipantDto(x))
                    .ToList();
 }
        public MasterPlan GetMasterPlanById(int id, bool includeParticipants, out List <Participant> participants)
        {
            //Repository
            MasterPlan masterP = null;

            participants = null;

            var tableMp = new DataTable("MasterPlans");
            var mp      = tableMp
                          .Select($"Id = {id}")
                          .SingleOrDefault();

            if (mp != null)
            {
                masterP = new MasterPlan
                {
                    Id         = (int)mp["Id"],
                    Name       = (string)mp["Name"],
                    FixedStart = (DateTime)mp["FixedStart"],
                    FixedEnd   = (DateTime)mp["FixedEnd"],
                };

                if (includeParticipants)
                {
                    var tableParticipants = new DataTable("Participants");
                    participants = tableParticipants
                                   .Select($"OwnerId = {masterP.Id}")
                                   .Select(dataRow => new Participant
                    {
                        Id           = (int)dataRow["Id"],
                        Name         = (string)dataRow["Name"],
                        AssignedFrom = (DateTime)mp["AssignedFrom"],
                        AssignedTo   = (DateTime)mp["AssignedTo"],
                    })
                                   .ToList();
                }
            }

            return(masterP);
        }
 public MasterPlanPopUpDto(MasterPlan source)
 {
     Id         = source.Id;
     Name       = source.Name;
     FixedDates = new DateRangeDto(source.FixedDates);
 }
Beispiel #5
0
 public FixedParticipantBuilder(MasterPlan masterPlan)
 {
     fixedRange = new DateRangeDto(masterPlan.FixedDates);
 }
Beispiel #6
0
 // Determine global strategy
 public void Scheming(IGameState state)
 {
     if (state.MyAnts.Count < 25)
     {
         masterPlan = MasterPlan.SCOUTANDEAT;
         foodRadius = 10;
         raidRadius = 2;
     }
     else if (state.EnemyAnts.Count > state.MyAnts.Count)
     {
         masterPlan = MasterPlan.YOU_SHALLNOT_PAAAASSSS;
         foodRadius = 5;
         raidRadius = 2;
     }
     else if (state.MyAnts.Count > state.EnemyAnts.Count * 1.5)
     {
         masterPlan = MasterPlan.WORLDDOMINATION;
         foodRadius = 2;
         raidRadius = 25;
     }
     else
     {
         masterPlan = MasterPlan.SCOUTANDEAT;
         foodRadius = 10;
         raidRadius = 2;
     }
 }