Exemple #1
0
        public static int CardToRank(string card)
        {
            int rank = ALL_CARDS.IndexOf(card[0]);

            if (card.Length != 1 || rank == -1)
            {
                throw new ApplicationException("Unknown card: " + card);
            }
            return(rank + 1);
        }
Exemple #2
0
 public void Showdown(GameDefinition gameDefinition, int[][] hands, UInt32[] ranks)
 {
     lock (_thisLock)
     {
         for (int p = 0; p < ranks.Length; ++p)
         {
             if (hands[p] == null)
             {
                 continue;
             }
             string card = gameDefinition.DeckDescr.GetCardNames(hands[p]);
             int    rank = ALL_CARDS.IndexOf(card[0]);
             if (card.Length != 1 || rank == -1)
             {
                 throw new ApplicationException("Unknown card: " + card);
             }
             ranks[p] = (UInt32)(rank + 1);
         }
     }
 }