コード例 #1
0
 public void Complete()
 {
     if (!completed)
     {
         completed = true;
         OnGoalComplete?.Invoke(this);
     }
 }
コード例 #2
0
        public void Iterate()
        {
            var agentMove = MrCat.WhereIWannaGo();

            MrCat.CurrentPosition = agentMove;
            OnMove?.Invoke(agentMove);

            if (MrCat.FoundGold && MrCat.CurrentPosition.Equals(new Position(0, 0)))
            {
                OnGoalComplete?.Invoke();
            }

            if (WumpusAt(MrCat.CurrentPosition))
            {
                OnWumpusEncountered?.Invoke();
            }
            else if (PitAt(MrCat.CurrentPosition))
            {
                OnPitEncountered?.Invoke();
            }

            var percepts = GeneratePercepts();

            if (percepts.Breeze)
            {
                OnBreezePercepted?.Invoke();
            }
            if (percepts.Stench)
            {
                OnStenchPercepted?.Invoke();
            }
            if (percepts.Glitter)
            {
                OnTreasureEncountered?.Invoke();
            }

            MrCat.PerceiveCurrentPosition(percepts);
        }
コード例 #3
0
 public static void GoalCompleted(Goal goal)
 {
     OnGoalComplete?.Invoke(goal);
 }