// Used to display text for debugging the end of the game private void showGameEnd(List <BSPlayer> players, BSDealer dealer) { // Loop through each player for (int i = 0; i < players.Count; i++) { // Code for debgging the playHand function for (int x = 0; x < players[i].getHandCount(); x++) { if (!players[i].hasQuit) { if (i == blackJackGameParams.tablePosition) { System.Diagnostics.Debug.WriteLine("Player Index: " + i.ToString()); System.Diagnostics.Debug.WriteLine("Bankroll: $" + players[i].getBankroll()); System.Diagnostics.Debug.WriteLine("Initial Bet: " + players[i].getInitialBet()); System.Diagnostics.Debug.WriteLine("List Index: " + x.ToString()); System.Diagnostics.Debug.Write("Dealer: "); foreach (Card c in dealer.getHand()) { System.Diagnostics.Debug.Write(c.value.ToString() + ", "); } System.Diagnostics.Debug.Write("\nCards: "); foreach (Card c in players[i].getHand(x)) { System.Diagnostics.Debug.Write(c.value.ToString() + ", "); } System.Diagnostics.Debug.WriteLine("\nWinner: " + BlackJack.getGameResult(dealer.getHand(), players[i].getHand(x)).ToString()); System.Diagnostics.Debug.WriteLine("Winnings: $" + players[i].getHandWinnings(x).ToString()); System.Diagnostics.Debug.WriteLine("Total: " + BlackJack.getHandValue(players[i].getHand(x)).ToString() + "\n"); } } } } }
// Used by PlayTimedGame to process the players winnings public static void processPlayerWinnings(BSPlayer player, BSDealer dealer) { // If this player is playing (do they have cards?) // cant use "hasQuit", because that's set in the previous loop, and the player may still need to be processed if (player.getHand(0).Count > 0) { // Loop through each hand the player has (Split Hands) for (int j = 0; j < player.getHandCount(); j++) { BlackjackResult bjr = BlackJack.getGameResult(dealer.getHand(), player.getHand(j)); // Give player the money / take it away if (bjr == BlackjackResult.PlayerWins) { // If the player wins, has only one hand and has blackjack then pay 3:2 instead of 1:1 if ((player.getHandCount() == 1) & (BlackJack.doesHandHaveBlackjack(player.getHand(j)))) { player.winBlackJack(j); } else { player.winNormalBet(j); } } else if (bjr == BlackjackResult.Push) { player.pushBet(j); } else // Dealer Wins { player.loseBet(j); } } } }