Beispiel #1
0
 //------------------------------------------------------------------------------------
 /// <summary>
 /// Change the value for this item
 /// </summary>
 //------------------------------------------------------------------------------------
 internal void SetValue(OddsResults odds)
 {
     _odds       = odds;
     ProfitValue = (double)odds.TotalBigBlindsWon / odds.Iterations;
     _labelText  = null;
     NotifyAllPropertiesChanged();
 }
Beispiel #2
0
        public void RoleReversalTest()
        {
            OddsResults expectedValue = OddsResults.RoleReverse;
            int         userValue     = 2;
            int         oppValue      = 1;
            int         odds          = 2;
            OddsResults actualvalue   = oddsLibrary.calculateOdds(userValue, oppValue, odds);

            Assert.AreEqual(expectedValue, actualvalue);
        }
Beispiel #3
0
        public void ReMatchTest()
        {
            OddsResults expectedValue = OddsResults.ReMatch;
            int         userValue     = 5;
            int         oppValue      = 15;
            int         odds          = 20;
            OddsResults actualvalue   = oddsLibrary.calculateOdds(userValue, oppValue, odds);

            Assert.AreEqual(expectedValue, actualvalue);
        }
Beispiel #4
0
        public static string GetExplanation(this OddsResults odds)
        {
            var output = new StringBuilder();

            output.AppendLine($"Win percentage: { (odds.WinRatio * 100.0).ToString(".0")}% ");
            output.AppendLine("\r\nHands performance:");
            var villianInfo = odds.VillianPerformance.Select(p => Tuple.Create(p.Key, p.Value)).OrderByDescending(t => t.Item2).ToArray();
            var playerInfo  = odds.PlayerPerformance.Select(p => Tuple.Create(p.Key, p.Value)).OrderByDescending(t => t.Item2).ToArray();
            var formatter   = new FixedFormatter();

            formatter.ColumnWidths.AddRange(new int[] { -8, 25, -8, 25 });
            output.AppendLine("Your Winning Hands                  Winning Opponent Hands");

            for (int i = 0; i < villianInfo.Length; i++)
            {
                output.AppendLine(formatter.Format(
                                      $"{(playerInfo[i].Item2 * 100.0 * odds.WinRatio).ToString("0.")}%",
                                      playerInfo[i].Item1.ToString(),
                                      $"{(villianInfo[i].Item2 * 100.0).ToString("0.")}%",
                                      villianInfo[i].Item1.ToString()
                                      ));
            }
            return(output.ToString());
        }