public void SimulateEpisode(System.Random random, int curEpisode, bool shouldExploit) { TyTaskNode nodeToExlore = null; //exploiting: if (shouldExploit) { _sortedNodes.Sort((x, y) => y.TotalValue.CompareTo(x.TotalValue)); //exploit only 50% best nodes: int count = ((int)(_sortedNodes.Count * 0.5 + 0.5)); nodeToExlore = _sortedNodes.GetUniformRandom(random, count); } //explore: else { nodeToExlore = _explorableNodes[curEpisode % _explorableNodes.Count]; } //should not be possible: if (nodeToExlore == null) { return; } var task = nodeToExlore.Task; var result = TyStateUtility.GetSimulatedGame(_rootGame, task, _analyzer); nodeToExlore.Explore(result, random); }