public void IlluminateCell() { if ((bool)AStarRadioButton.IsChecked) { bestPath.First.Value.GetRectangle().Fill = BEST_PATH_CELL_COLOR; } else // Q-Learning is checked { // Only illuminate the current cell after training if (!qLearningSearch.IsTraining()) { qLearningSearch.GetCurrentCell().GetRectangle().Fill = BEST_PATH_CELL_COLOR; } else // Illuminate the Q-Table { foreach (Cell cell in gridWorld.GetCells()) { if (qLearningSearch.GetSumQValue(cell) > 0) { SolidColorBrush cellBackground = BEST_PATH_CELL_COLOR; cellBackground.Opacity = (qLearningSearch.GetSumQValue(cell) / qLearningSearch.GetReward()) / 6; if (cellBackground.Opacity < 0.2) { cellBackground.Opacity = 0.2; } cell.GetRectangle().Fill = cellBackground; } } } } }