public void Complete() { if (!completed) { completed = true; OnGoalComplete?.Invoke(this); } }
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); }
public static void GoalCompleted(Goal goal) { OnGoalComplete?.Invoke(goal); }