public override string ToString() { string gameResults = "\n"; for (int i = 0; i < GamePlayers.Count(); i++) { gameResults += String.Format("{0}\n\n", GamePlayers[i].ToString()); } if (GameWinners.Count() > 1) { for (int i = 1; i < GamePlayers.Count(); i++) { gameResults += String.Format("{0},", GameWinners[i]); } gameResults += String.Format("{0} split the pot!", GameWinners[0].Name); } gameResults += String.Format("{0} wins and takes the pot!", GameWinners[0].Name); return(gameResults); }
private void SetGameWinners() { foreach (Player player in GamePlayers) { player.HandName = CheckHand(player); player.HandValue = CheckHandValue(player); } GameWinners.Add(GamePlayers[0]); for (int i = 1; i < GamePlayers.Count(); i++) { if ((int)GameWinners[0].HandName < (int)GamePlayers[i].HandName) { GameWinners[0] = GamePlayers[i]; } else if ((int)GameWinners[0].HandName == (int)GamePlayers[i].HandName) { GameWinners[0] = BreakTie(GameWinners[0], GamePlayers[i]); } } }