Example #1
0
 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;
 }
Example #2
0
        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);
        }
Example #3
0
 public Payoff(DiscretePayoff payoff)
 {
     Reward  = payoff.Reward;
     IsHash  = payoff.Outcome.OutcomeString is null;
     Outcome = payoff.Outcome.ToString();
 }