using System.Collections.Generic;
public static void Main(string[] args)
Console.WriteLine("Hello World!");
for (int i = 0; i < 5; i++) {
Console.WriteLine($"Hand: {hand}");
Console.WriteLine($"Score: {hand.score()}");
Hand test = new Hand("2S","2C","2H","3H","4C");
Console.WriteLine(test.score());
Hand test2 = new Hand("2S","3C","4D","AS","AD");
Console.WriteLine(test2.score());
public static IDictionary<string, int> ranks = new Dictionary<string, int>() {
public static List<char> suits = new List<char>() {
public static Random rnd = new Random();
int min_val = ranks.Values.Min();
face = ranks.ElementAt(rnd.Next(ranks.Count)).Key;
suit = suits[rnd.Next(suits.Count)];
public void getCardValue(string card_value) {
int length = card_value.Length;
face = card_value.Substring(0, length - 1);
public override string ToString() {
public IList<Card> cards = new List<Card>();
public static Random rnd = new Random();
public void generateCards() {
for (int i=0; i<5; i++) {
public Hand() => generateCards();
cards.Add(new Card(card1));
cards.Add(new Card(card2));
cards.Add(new Card(card3));
cards.Add(new Card(card4));
cards.Add(new Card(card5));
var suit_counts = info.Item1;
var rank_counts = info.Item2;
bool is_threeofakind = false;
foreach ( KeyValuePair<int, int> kvp in rank_counts ) {
score += (kvp.Key * kvp.Value);
int threeofakind_bonus = 105 * (bonus * 3);
int onepair_bonus = 43 * (bonus * 2);
if (suit_counts.Count == 1) is_flush = true;
} else if (is_threeofakind) {
score += threeofakind_bonus;
public Tuple<IDictionary<char, int>, IDictionary<int, int>> getCounts() {
IDictionary<char, int> suit_counts = new Dictionary<char, int>();
IDictionary<int, int> rank_counts = new Dictionary<int, int>();
foreach (Card card in cards) {
if (suit_counts.ContainsKey(card.suit)) {
suit_counts[card.suit] += 1;
suit_counts.Add(card.suit, 1);
if (rank_counts.ContainsKey(card.rank)) {
rank_counts[card.rank] += 1;
rank_counts.Add(card.rank, 1);
Tuple<IDictionary<char, int>, IDictionary<int, int>> results = Tuple.Create(suit_counts, rank_counts);
public override string ToString() {
return string.Join(",", cards);