コード例 #1
0
        public RummyTile DrawTile()
        {
            try
            {
                Random randDraw = new Random();

                int       num    = randDraw.Next(poolGen.Count);
                RummyTile myTile = poolGen[num];
                poolGen.RemoveAt(num);
                return(myTile);
            }
            catch
            {
                throw new Exception("pool empty");
            }
        }
コード例 #2
0
 public void Randomize()
 {
     try
     {
         int    n   = poolGen.Count;
         Random rnd = new Random();
         while (n > 1)
         {
             int k = (rnd.Next(0, n) % n);
             n--;
             RummyTile value = poolGen[k];
             poolGen[k] = poolGen[n];
             poolGen[n] = value;
         }
     }
     catch (Exception)
     {
         throw new Exception("The pool is empyt");
     }
 }
コード例 #3
0
 public RummyTile(RummyTile RT)
 {
     _n   = RT._n;
     _clr = RT._clr;
 }