public Payoff(DiscretePayoff payoff) { Reward = payoff.Reward; if (payoff.Outcome.OutcomeString is null) { throw new ArgumentException(message: "The outcome string should not be empty"); } Outcome = payoff.Outcome.OutcomeString; }
public static bool TryParse(string str, out DiscretePayoff?payoff) { payoff = null; str = str.Trim(); var i = str.LastIndexOf(':'); if (i == -1) { return(false); } var outcome = str.Substring(0, i); var reward = str.Substring(i + 1); if (!Money.TryParse(reward, out var btc) || btc is null) { return(false); } payoff = new DiscretePayoff(new DiscreteOutcome(outcome), reward); return(true); }
public Payoff(DiscretePayoff payoff) { Reward = payoff.Reward; IsHash = payoff.Outcome.OutcomeString is null; Outcome = payoff.Outcome.ToString(); }