Exemplo n.º 1
0
        public card Shuffle()//发牌
        {
            if (CardList.Count <= 0)
            {
                return(null);
            }
            card c = null;
            int  i = (int)(CardList.Count * r.NextDouble()); //随机产生索引号

            c = CardList[i];                                 //获取索引号为i的牌
            CardList.RemoveAt(i);                            //从列表中删除此张牌
            return(c);                                       //返回抽取索引号为i的牌
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Poke Poke1 = new Poke();//Poke实例Poke1

            for (int i = 1; i <= 4; i++)
            {
                Console.WriteLine("{0}号牌手:", i);
                for (int j = 1; j <= 13; j++)
                {
                    card card1 = Poke1.Shuffle();//获取一张牌
                    if (card1 != null)
                    {
                        Console.Write(" {0}", card1.ToString());
                        //Console.Write(":{0}", card1.pic_order());
                    }
                }
                Console.WriteLine();
            }
            Console.ReadKey();
        }