private static void DisplayMachine(IPayTable payTable, Player player, decimal bet, string message, IList <DrawnCard> cards, int?coins = null) { var renderedCards = cards.Select(c => RenderCard(c)).ToList(); var coinDisplay = coins.HasValue ? $"{coins.Value} coin{(coins.Value > 1 ? "s" : string.Empty)}" : string.Empty; var betDisplay = $"${bet:0.##}"; var playerDisplay = $"{player.Name}: ${player.Money:0.00}"; Console.Clear(); DisplayLine(); DisplayLine($" ╔═════════════════════════════════════════════════════════╗"); DisplayLine($" ║{AlignText.AlignAndFit(payTable.Description, Alignment.Center, payTableDisplayWidth)}║"); DisplayLine($"╔═══╩════════════════════════╤══════╤══════╤══════╤══════╤════╩═╤═╗"); DisplayLine($"║ Combination │ 1 │ 2 │ 3 │ 4 │ 5 │ ║"); DisplayLine($"╟────────────────────────────┼──────┼──────┼──────┼──────┼──────┼─╢"); foreach (var winCombo in payTable.WinCombinations) { DisplayLine($"║ {AlignText.AlignAndFit(winCombo.Description, Alignment.Left, combinationDisplayWidth)} │" + $" {AlignText.AlignAndFit(winCombo.OneCreditPayout, Alignment.Right, payoutDisplayWidth)} │" + $" {AlignText.AlignAndFit(winCombo.TwoCreditPayout, Alignment.Right, payoutDisplayWidth)} │" + $" {AlignText.AlignAndFit(winCombo.ThreeCreditPayout, Alignment.Right, payoutDisplayWidth)} │" + $" {AlignText.AlignAndFit(winCombo.FourCreditPayout, Alignment.Right, payoutDisplayWidth)} │" + $" {AlignText.AlignAndFit(winCombo.FiveCreditPayout, Alignment.Right, payoutDisplayWidth)} │ ║"); } DisplayLine($"╟────────────────────────────┴──────┴──────┴──────┴──────┴──────┴─╢"); DisplayLine($"║ ║"); DisplayLine($"║ {renderedCards[0][0]} {renderedCards[1][0]} {renderedCards[2][0]} {renderedCards[3][0]} {renderedCards[4][0]} ║"); DisplayLine($"║ {renderedCards[0][1]} {renderedCards[1][1]} {renderedCards[2][1]} {renderedCards[3][1]} {renderedCards[4][1]} ║"); DisplayLine($"║ {renderedCards[0][2]} {renderedCards[1][2]} {renderedCards[2][2]} {renderedCards[3][2]} {renderedCards[4][2]} ║"); DisplayLine($"║ {renderedCards[0][3]} {renderedCards[1][3]} {renderedCards[2][3]} {renderedCards[3][3]} {renderedCards[4][3]} ║"); DisplayLine($"║ {renderedCards[0][4]} {renderedCards[1][4]} {renderedCards[2][4]} {renderedCards[3][4]} {renderedCards[4][4]} ║"); DisplayLine($"║ 1 2 3 4 5 ║"); DisplayLine($"╟─────────────────────────────────────────────────────────────────╢"); DisplayLine($"║ ┌─────────╥───────────────────────────────────────────╥───────┐ ║"); DisplayLine($"║ │ {AlignText.AlignAndFit(coinDisplay, Alignment.Center, coinDisplayWidth)} ║ {AlignText.AlignAndFit(message, Alignment.Center, messageDisplayWidth)} ║ {AlignText.AlignAndFit(betDisplay, Alignment.Right, betDisplayWidth)} │ ║"); DisplayLine($"║ └─────────╨───────────────────────────────────────────╨───────┘ ║"); DisplayLine($"╚═════════════════════════════════════════════════════════════════╝"); DisplayLine(); DisplayLine($"{AlignText.AlignAndFit(playerDisplay, Alignment.Center, machineWidthNeeded)}"); }
public Game(Player player, IPayTable payTable) { deck = new Deck(); this.Player = player; this.PayTable = payTable; }