예제 #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);
            }
        }