Esempio n. 1
0
        private void TimerAgentTick(object sender, EventArgs e)
        {
            var percepts = _marsRover.GetPercepts();

            agentState.Text = "State: Thinking ...";
            agentState.Refresh();
            var action = _marsRover.Action(percepts);

            _marsRover.ExecuteAction(action, percepts);

            var beliefs    = UpdateText(beliefsList, _marsRover.Beliefs);
            var desires    = UpdateText(beliefsList, _marsRover.Desires);
            var intentions = UpdateText(beliefsList, _marsRover.Intentions);

            if (beliefs != beliefsList.Text)
            {
                beliefsList.Text = beliefs;
            }
            if (desires != desiresList.Text)
            {
                desiresList.Text = desires;
            }
            if (intentions != intentionsList.Text)
            {
                intentionsList.Text = intentions;
            }
            foreach (var wSpot in _marsRover.WaterFound)
            {
                if (!waterFoundList.Items.Contains(wSpot))
                {
                    waterFoundList.Items.Add(wSpot);
                }
            }


            Refresh();
        }