public void HandleGain(Gain gain) { if (IsReadyForGain(gain.Card)) { IncrementProgress(gain.Card.GetSuit()); } else { SpendDeathToken(); } }
public Move Yolo() { var canBurn = game.CanBurn(); var knownRemainingCards = KnownRemainingCards(); const int goodGainValue = 30; var badGainValue = game.GetNextDeathTokenValue(); var goodBurnValue = canBurn ? game.GetNextHintTokenValue() : 0; const int badBurnValue = -10; var bestUtility = double.MinValue; Move bestMove = null; foreach (var card in cards) { var probabilities = card.CalculateProbabilityOfSafePlays(knownRemainingCards, game.Progress); var safeGainProbability = probabilities.Item1; var safeBurnProbability = probabilities.Item2; var gainUtility = (goodGainValue * safeGainProbability) + (badGainValue * (1 - safeGainProbability)); var burnUtility = canBurn ? (goodBurnValue * safeBurnProbability) + (badBurnValue * (1 - safeGainProbability)) : int.MinValue; if (gainUtility > bestUtility) { bestMove = new Gain(card); bestUtility = gainUtility; } if (burnUtility > bestUtility) { bestMove = new Burn(card); bestUtility = burnUtility; } } return(bestMove); }
public Move Yolo() { var canBurn = game.CanBurn(); var knownRemainingCards = KnownRemainingCards(); const int goodGainValue = 30; var badGainValue = game.GetNextDeathTokenValue(); var goodBurnValue = canBurn ? game.GetNextHintTokenValue() : 0; const int badBurnValue = -10; var bestUtility = double.MinValue; Move bestMove = null; foreach (var card in cards) { var probabilities = card.CalculateProbabilityOfSafePlays(knownRemainingCards, game.Progress); var safeGainProbability = probabilities.Item1; var safeBurnProbability = probabilities.Item2; var gainUtility = (goodGainValue * safeGainProbability) + (badGainValue * (1 - safeGainProbability)); var burnUtility = canBurn ? (goodBurnValue * safeBurnProbability) + (badBurnValue * (1 - safeGainProbability)) : int.MinValue; if (gainUtility > bestUtility) { bestMove = new Gain(card); bestUtility = gainUtility; } if (burnUtility > bestUtility) { bestMove = new Burn(card); bestUtility = burnUtility; } } return bestMove; }