Пример #1
0
 public static void ApplyCardBonus(Agent agent, Board board)
 {
     if(agent.CanCashIn())
     {
         agent.ApplyCardBonus(board);
     }
 }
Пример #2
0
        public void start(Board board, Agent agent, Territory start, Territory finish)
        {
            // must create a path from start territory to finish territory
            TerritoryList territories = board.Territories;

            OpenSet.Add(new StarTile(start.Name, start));

            Dictionary<string, int> sldMap = CalculateSLD(finish.Name);

            // loop through A* steps until goal is reached
            while (!IsGoalFound)
            {
                StarTile current = GetMinFValue();

                // there are no more members of the OpenSet to examine
                if(current == null)
                {
                    break;
                }

                // current territory is finish territory
                if(current.Id == finish.Name)
                {
                    // do something?
                }

                List<StarTile> frontier = GetFrontier(current);

                // loop through frontier and calculate heuristic for current territory
                foreach(StarTile t in frontier)
                {
                    // associate frontier territory to parent tile
                    t.Parent = current; // is this really necessary since we do it below?

                    // enemy territories are considered empty tiles, available to be conquered
                    if(t.Territory.Owner != current.Territory.Owner)
                    {
                        CalculateHeuristic(t, start, finish);

                        t.Parent = current;
                    }
                    
                    // goal territory is reached
                    else if(t.Territory.Name == finish.Name)
                    {
                        t.Parent = current;

                        IsGoalFound = true;

                        Path = ConstructPath(t);
                    }

                    // self owned territory, seen as obstacle because it is already
                    else if(t.Territory.Owner == current.Territory.Owner)
                    {
                        // do not need to calculate anything, just skip
                    }
                }
            }
        }
Пример #3
0
        public static void PlaceReinforcements(Agent agent)
        {
            // add troops to territories with lowest population untill more intelligent mechanism is implemented

            // for each available troop, find a territory with the lowest number of troops, place the reinforcement until finished
            
            //foreach (Territory t in territoriesToReinforce)
            //{
            //    agent.PlaceReinforcements(t.Name);
            //}
        }
Пример #4
0
 public static void GetReinforcements(Agent agent)
 {
     if(agent.ControlledTerritories.Count <= 9)
     {
         agent.GetReinforcements(3);
         
     }
     else
     {
         agent.GetReinforcements((agent.ControlledTerritories.Count / 3));
     }
 }
Пример #5
0
 public static void ApplyContinentBonus(Agent agent, Board board)
 {
     agent.ApplyContinentBonus(board);
 }
Пример #6
0
 private static void GetReinforcements(Agent agent)
 {
     Mechanics.GetReinforcements(agent);
 }