コード例 #1
0
        public void addGUIMarks(List <GameLogic.Utils.PursuerPathObservation> O_p,
                                IPolicyGUIInputProvider ui,
                                IntrusionGameState s,
                                GridGameGraph gr,
                                IntrusionGameParams prm,
                                Dictionary <Evader, Point> currentEvaderLocations)
        {
            if (ui.hasBoardGUI())
            {
                Dictionary <string, List <Point> > markedLocations = new Dictionary <string, List <Point> >();

                List <Point> tmpPointList = new List <Point>();
                foreach (var p in O_p)
                {
                    tmpPointList.AddRange(p.observedPursuerPath);
                }
                markedLocations.Add("Pursuer trail(O_p)", tmpPointList);

                tmpPointList = new List <Point>();
                foreach (var p in O_p)
                {
                    tmpPointList.Add(p.observedPursuerPath.Last());
                }
                markedLocations.Add("Pursuer last pos", tmpPointList);

                List <Point> detectionArea = new List <Point>();
                foreach (Evader e in s.ActiveEvaders)
                {
                    if (currentEvaderLocations.ContainsKey(e))
                    {
                        detectionArea.AddRange(
                            gr.getNodesWithinDistance(currentEvaderLocations[e], prm.r_es));
                    }
                }
                markedLocations.Add("Area within r_s(evaders detecting pursuers)", detectionArea);

                ui.markLocations(markedLocations.toPointFMarkings());
            }
        }
コード例 #2
0
        public override void setGameState(int currentRound,
                                          IEnumerable <GoE.GameLogic.Utils.CapturedObservation> O_d,
                                          List <GameLogic.Utils.PursuerPathObservation> O_p,
                                          IntrusionGameState s)
        {
            prevS   = s;
            prevO_p = O_p;
            prevO_d = O_d;

            foreach (var o in O_p)
            {
                accumObservationsPerEve[o.observer].Add(o);
            }

            foreach (Evader e in s.ActiveEvaders)
            {
                foreach (var obs in O_d)
                {
                    if (obs.who == e)
                    {
                        currentEvadersLocations[e] = new Location(Location.Type.Captured);
                    }
                }
            }

            Dictionary <string, List <Point> > markedLocations = new Dictionary <string, List <Point> >();

            List <Point> tmpPointList = new List <Point>();

            foreach (var p in O_p)
            {
                tmpPointList.AddRange(p.observedPursuerPath);
            }
            markedLocations.Add("Pursuer trail(O_p)", tmpPointList);

            tmpPointList = new List <Point>();
            foreach (var p in O_p)
            {
                tmpPointList.Add(p.observedPursuerPath.Last());
            }
            markedLocations.Add("Pursuer last pos", tmpPointList);

            tmpPointList = new List <Point>();
            foreach (var p in O_d)
            {
                tmpPointList.Add(p.where);
            }
            markedLocations.Add("Dead Evaders(O_d)", tmpPointList);


            List <Point> detectionArea = new List <Point>();

            foreach (Evader e in s.ActiveEvaders)
            {
                detectionArea.AddRange(
                    g.getNodesWithinDistance(currentEvadersLocations[e].nodeLocation, gm.r_es));
            }
            markedLocations.Add("Area within r_s(evaders detecting pursuers)", detectionArea);


            pgui.markLocations(markedLocations.toPointFMarkings());

            InputRequest         req = new InputRequest();
            IEnumerable <Evader> relevantEvaders;

            if (currentRound == 0)
            {
                relevantEvaders = gm.A_E;
            }
            else
            {
                relevantEvaders = s.ActiveEvaders;
            }

            foreach (Evader e in relevantEvaders)
            {
                if (currentEvadersLocations[e].locationType != Location.Type.Node ||
                    (currentEvadersLocations[e].nodeLocation.manDist(intrusionAreaCenter) > gm.r_e))
                {
                    req.addMovementOption(e, currentEvadersLocations[e], getPossibleNextLocations(currentEvadersLocations[e]));
                }

                prevChoiceKey = req.addComboChoice(e, "communicate", new string[] { "yes", "no" }, "no");
                //req.addComboChoice(e, "Noise/Data unit to transmit",
                //    s.M[s.MostUpdatedEvadersMemoryRound][e].ToList().Except(dataUnitsInSink).Union(new DataUnit[]{DataUnit.NIL, DataUnit.Flush}),
                //    DataUnit.NIL);

                //List<Point> relevantTargets = new List<Point>();
                //var relevantTargetsDummy = targets.Intersect(g.getNodesWithinDistance(currentEvadersLocations[e].nodeLocation, gm.r_e));
                //foreach (Point p in relevantTargetsDummy)
                //    relevantTargets.Add(p);

                //req.addComboChoice(e, "Target to eavesdrop (" + relevantTargets.Count.ToString() + " available)",
                //    GameLogic.Utils.pointsToLocations(relevantTargets),
                //    new Location(Location.Type.Undefined));
            }

            pgui.setInputRequest(req);
            nextEvadersToCommunicate.Clear();
        }
コード例 #3
0
 /// <summary>
 /// first method called at the begining of the round
 /// </summary>
 /// <param name="currentRound"></param>
 /// <param name="O_d">
 /// all dead evaders communicate to other evaders that they just got captured + all of their held
 /// observations until that point
 /// </param>
 /// <param name="O_p">
 /// new data observed by evaders (local observations)
 /// </param>
 /// <param name="s"></param>
 public abstract void setGameState(int currentRound,
                                   IEnumerable <GoE.GameLogic.Utils.CapturedObservation> O_d,
                                   List <GameLogic.Utils.PursuerPathObservation> O_p,
                                   IntrusionGameState s);
コード例 #4
0
 public override void setGameState(int CurrentRound,
                                   IEnumerable <GameLogic.Utils.CapturedObservation> O_d,
                                   List <GameLogic.Utils.PursuerPathObservation> O_p, IntrusionGameState s)
 {
     this.currentRound = CurrentRound;
     this.o_p          = O_p;
     this.o_d          = O_d;
 }