using System;

namespace ConsoleApp1
{
enum CardSuit {
Club,Diamond,Heart,Spades
}
enum CardFace
{
Ace=1,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten,Jack,Queen,king
}
struct CNode
{
public CardSuit cardSuit;
public CardFace cardFace;
public override string ToString()
{
string s = string.Empty;
switch ((int)cardSuit)
{
case 0:
s += "梅花";
break;
case 1:
s += "方块";
break;
case 2:
s += "红心";
break;
case 3:
s += "黑桃";
break;
}
switch ((int)cardFace)
{
case 1:
s += "A";
break;
case 11:
s += 'J';
break;
case 12:
s += 'Q';
break;
case 13:
s+= 'K';
break;
default:
s += ((int) cardFace).ToString();
break;
}
return s;
}
}
class Card
{
//牌总数,牌数字总类
public const int CARDNUMBER=52;
public const int FACENUMBER = 13;
CNode []cnode = new CNode[CARDNUMBER];
//构造方法
public Card()
{
for(int i = 0; i < CARDNUMBER; i++)
{
cnode[i].cardFace = (CardFace)(i % FACENUMBER + 1);
cnode[i].cardSuit = (CardSuit)(i / FACENUMBER);
}
}
//发牌
public void Deliver()
{
Console.WriteLine("===========52张牌的发牌次序============");
Console.WriteLine("\t东 \t 西 \t 南 \t 北");
for (int i = 0; i < CARDNUMBER; i++)
{
Console.Write("第{0,2}张{1,3}\t", i + 1, cnode[i]);
if ((i + 1) % 4 == 0)
{
Console.WriteLine();
}
}
Console.WriteLine();
}
//洗牌
public void Shuffle()
{
Random r = new Random();
for(int i = 0; i < CARDNUMBER; i++)
{
var j = r.Next(CARDNUMBER);
var temp = cnode[i];
cnode[i] = cnode[j];
cnode[j] = temp;
}
}

}
class Program
{
static void Main(string[] args)
{
Card card = new Card();
Console.WriteLine("打牌开始");
Console.WriteLine("洗牌");
card.Shuffle();
Console.WriteLine("发牌");
card.Deliver();
Console.ReadLine();
}
}
}