private Card Hit(Player player) { var card = _deck.DealCard(); player.Hand.Add(card); return card; }
private void DealCards(Player player, int numCards) { for (var i = 0; i < numCards; i++) { var card = _deck.DealCard(); player.Hand.Add(card); } }
private string DisplayPlayerCardAndScore(Player player, Card card) { return string.Format("{0} (Current score for {1}: {2})", card.DisplayName, player.Name, GetPlayerScore(player)); }
private int GetPlayerScore(Player player) { var score = player.Hand.Sum(card => card.NumericalValue); return score; }
// constructor private BlackjackGame(string player1Name, string player2Name) { _deck = new Deck(); You = new Player(player1Name); Them = new Player(player2Name); }
// constructor private PokerGame(string player1Name, string player2Name) { _deck = new Deck(); _handRankings = new Dictionary<int, string> { {10, "Royal Flush"}, {9, "Straight Flush"}, {8, "Four-of-a-Kind"}, {7, "Full House"}, {6, "Flush"}, {5, "Straight"}, {4, "Three-of-a-Kind"}, {3, "Two Pair"}, {2, "Pair"}, {1, "Nothing!"} }; You = new Player(player1Name); Them = new Player(player2Name); }
private static void PrintHand(Player player) { Console.WriteLine("\nCurrent hand for: {0}", player.Name); var orderedHand = player.Hand.OrderByDescending(c => c.Rank); foreach (var card in orderedHand) { Console.WriteLine(card.DisplayName); } }