private void ReportOutcomes() { if (!bool.Parse(ConfigurationManager.AppSettings["WriteOutcomesToDisk"])) { return; } var sb = new StringBuilder(); sb.AppendLine("Dealer has: " + _dealerHand.CardNames()); _players.ForEach(a => sb.AppendLine("Player " + a.Name + " has: " + _playerCards[a].CardNames())); sb.AppendLine("Dealer total: " + _dealerHand.Value()); _players.ForEach(a => sb.AppendLine(PrintOutcomesToConsole(a))); _players.ForEach(a => sb.AppendLine(string.Format("Player {0} began with {1} and ended with {2}", a.Name, _beginningBalances[a], a.BankRoll))); sb.AppendLine("----"); File.AppendAllText(ConfigurationManager.AppSettings["DiskSaveLocation"], sb.ToString()); // Console.Write(sb); }
public void AddHandOutcome(PlayerHand playerCards, DealerHand dealerCards) { var outcome = new HandOutcome() { DealerShowCard = dealerCards.GetShowCard(), PlayerCardOne = playerCards.Cards[0], PlayerCardTwo = playerCards.Cards[1], DealerTotal = dealerCards.Value(), PlayerTotal = playerCards.Value(), WinAmount = playerCards.HandWinAmount() }; HandOutcomes.Add(outcome); }