public void UpdateAgentPosition(object sender, EventArgs e) { if ((bool)AStarRadioButton.IsChecked) { gridWorld.GetAgent().SetRowIndex(aStarSearch.GetCurrentCell().GetRowIndex()); gridWorld.GetAgent().SetColumnIndex(aStarSearch.GetCurrentCell().GetColumnIndex()); // Check if agent is on the reward cell // If so, process the reward if (aStarSearch.GetCurrentCell().GetRowIndex() == gridWorld.GetRewardPosition()[0] && aStarSearch.GetCurrentCell().GetColumnIndex() == gridWorld.GetRewardPosition()[1]) { ProcessFoundReward(); } } else // Q-Learning is checked { gridWorld.GetAgent().SetRowIndex(qLearningSearch.GetCurrentCell().GetRowIndex()); gridWorld.GetAgent().SetColumnIndex(qLearningSearch.GetCurrentCell().GetColumnIndex()); IlluminateCell(); // Check if agent is on the reward cell // If so, swap the images and stop the timer if (qLearningSearch.GetCurrentCell().GetRowIndex() == gridWorld.GetRewardPosition()[0] && qLearningSearch.GetCurrentCell().GetColumnIndex() == gridWorld.GetRewardPosition()[1]) { ProcessFoundReward(); } } gridWorld.GetAgent().UpdatePosition(); }