public void ProcessFoundReward() { if ((bool)AStarRadioButton.IsChecked) { // Stop the search Stop(); AStarExport.Save(gridWorld.GetCells()); bestPath = aStarSearch.GetBestPath(); showBestPathTimer = new DispatcherTimer(); showBestPathTimer.Interval = TimeSpan.FromMilliseconds(BEST_PATH_UPDATE_FREQUENCY); showBestPathTimer.Tick += new EventHandler(StepThroughBestPath); showBestPathTimer.Start(); } else // Q-Learning is checked { if (qLearningSearch.IsTraining()) { qLearningSearch.RestartEpisode(null); } else { // Stop the search Stop(); toggleAgentImage(); QTableExport.Save(qLearningSearch.GetQTable()); } } }