private void Winner_Click(object sender, EventArgs e) { //Controls["label" + 10].Text = winner.Compare(); if (allplayers[8].Count != 5) { } else { PlayerRatings FinalCards = new PlayerRatings((Deste.allcards()), allplayers); bestoffive = FinalCards.PlayerCardswithTable(); bestoffive = FinalCards.sortdic(bestoffive); WinningRules winnigrules = new WinningRules(); if (bestoffive.ElementAt(0).Value != bestoffive.ElementAt(1).Value) { string a = winnigrules.getwinnerlevel(bestoffive.ElementAt(0).Value); Controls["winreason"].Text = "Player " + (allplayers.IndexOf(bestoffive.ElementAt(0).Key) + 1) + " wins " + a; } else { Dictionary <string, List <string> > compare = new Dictionary <string, List <string> >(); int high = bestoffive.ElementAt(0).Value; int equalplayers = bestoffive.Values.Count(highest => highest == bestoffive.ElementAt(0).Value); for (int i = 0; i < equalplayers; i++) { compare.Add(("Player" + (allplayers.IndexOf(bestoffive.ElementAt(i).Key) + 1)), bestoffive.ElementAt(i).Key); } Controls["winreason"].Text = FinalCards.Compare(compare) + " wins " + winnigrules.getwinnerlevel(high); } } }
public Dealer() { string kupa; //Heart string karo; //Diamonds string sinek; //Clubs string maca; //Spades for (int i = 2; i < 15; i++) { if (i == 10) { kupa = "10H"; //Heart karo = "10D"; //Diamonds sinek = "10C"; //Clubs maca = "10S"; //Spades full.Add(kupa, i); full.Add(karo, i); full.Add(sinek, i); full.Add(maca, i); } if (i == 11) { kupa = "JH"; //Heart karo = "JD"; //Diamonds sinek = "JC"; //Clubs maca = "JS"; //Spades full.Add(kupa, i); full.Add(karo, i); full.Add(sinek, i); full.Add(maca, i); } if (i == 12) { kupa = "QH"; //Heart karo = "QD"; //Diamonds sinek = "QC"; //Clubs maca = "QS"; //Spades full.Add(kupa, i); full.Add(karo, i); full.Add(sinek, i); full.Add(maca, i); } if (i == 13) { kupa = "KH"; //Heart karo = "KD"; //Diamonds sinek = "KC"; //Clubs maca = "KS"; //Spades full.Add(kupa, i); full.Add(karo, i); full.Add(sinek, i); full.Add(maca, i); } if (i == 14) { kupa = "AH"; //Heart karo = "AD"; //Diamonds sinek = "AC"; //Clubs maca = "AS"; //Spades full.Add(kupa, i); full.Add(karo, i); full.Add(sinek, i); full.Add(maca, i); } if (i < 10) { kupa = i + "H"; //Heart karo = i + "D"; //Diamonds sinek = i + "C"; //Clubs maca = i + "S"; //Spades full.Add(kupa, i); full.Add(karo, i); full.Add(sinek, i); full.Add(maca, i); } } WinningRules carddict = new WinningRules(full); for (int i = 0; i < full.Count; i++) { left.Add(full.Keys.ElementAt(i), full.Values.ElementAt(i)); } }
public PlayerRatings(Dictionary <string, int> cards52, List <List <string> > allplayers) { this.allplayers = allplayers; this.cards52 = cards52; status = new WinningRules(this.cards52); }