示例#1
0
        // Initialise at first step
        public void Init(IGameState state)
        {
            random       = new Random();
            currentTasks = new Dictionary <string, CurrentTask>();
            nextTasks    = new Dictionary <string, CurrentTask>();
            myHills      = new List <Location>(state.MyHills);
            theirHills   = new List <Location>();
            yummies      = new List <Location>();
            timRobbins   = new List <Location>();
            martinSheen  = new List <Location>();
            viewRadius   = (int)Math.Sqrt(state.ViewRadius2);
            heatMap      = new HeatMap(viewRadius, state);

            influenceMaps            = new LayeredInfluenceMap(state);
            influenceMaps["Enemies"] = new InfluenceMap(state, 4, 1);
            influenceMaps["Friends"] = new InfluenceMap(state, 1, 1);

            foreach (Location h in myHills)
            {
                heatMap.UpdateCell(h, -5f);

                Location tim;
                tim = h + new Location(-1, -1);
                if (state.GetIsPassable(tim))
                {
                    timRobbins.Add(tim);
                }

                tim = h + new Location(-1, 1);
                if (state.GetIsPassable(tim))
                {
                    timRobbins.Add(tim);
                }

                tim = h + new Location(1, -1);
                if (state.GetIsPassable(tim))
                {
                    timRobbins.Add(tim);
                }

                tim = h + new Location(1, 1);
                if (state.GetIsPassable(tim))
                {
                    timRobbins.Add(tim);
                }
            }
        }
示例#2
0
文件: MyBot.cs 项目: Lapixx/CS-UU-KI1
        // Initialise at first step
        public void Init(IGameState state)
        {
            random = new Random();
            currentTasks = new Dictionary<string, CurrentTask>();
            nextTasks = new Dictionary<string, CurrentTask>();
            myHills = new List<Location>(state.MyHills);
            theirHills = new List<Location>();
            yummies = new List<Location>();
            timRobbins = new List<Location>();
            martinSheen = new List<Location>();
            viewRadius = (int)Math.Sqrt(state.ViewRadius2);
            heatMap = new HeatMap(viewRadius, state);

            influenceMaps = new LayeredInfluenceMap(state);
            influenceMaps["Enemies"] = new InfluenceMap(state, 4, 1);
            influenceMaps["Friends"] = new InfluenceMap(state, 1, 1);

            foreach (Location h in myHills)
            {
                heatMap.UpdateCell(h, -5f);

                Location tim;
                tim = h + new Location(-1, -1);
                if (state.GetIsPassable(tim))
                    timRobbins.Add(tim);

                tim = h + new Location(-1, 1);
                if (state.GetIsPassable(tim))
                    timRobbins.Add(tim);

                tim = h + new Location(1, -1);
                if (state.GetIsPassable(tim))
                    timRobbins.Add(tim);

                tim = h + new Location(1, 1);
                if (state.GetIsPassable(tim))
                    timRobbins.Add(tim);
            }
        }