using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using MyLibrary;
namespace CardDeal
{
class Program
{
static void Main(string[] args)
{
Card card=new Card();
card.CardShuffle(card.Deck);
card.CardDeal(card.Deck);
}
}
class Card
{
public string[] Deck;
public string[] DeckD;
public Card()
{
Deck = new string[]
{
"r1","r2","r3","r4","r5","r6","r7","r8","r9","r10","rJ","rQ","rK","rA",
"b1","b2","b3","b4","b5","b6","b7","b8","b9","b10","bJ","bQ","bK","bA",
"p1","p2","p3","p4","p5","p6","p7","p8","p9","p10","pJ","pQ","pK","pA",
"s1","s2","s3","s4","s5","s6","s7","s8","s9","s10","sJ","sQ","sK" ,"sA"
};
}
public void CardShuffle(string[] Deck) {
Console.WriteLine("Shuffle card:");
Random random = new Random();
string temp ;
for (int i = 0; i < Deck.Length; i++)
{
int j = random.Next ()%(int)Deck.Length;
temp = Deck[i];
Deck[i] = Deck[j];
Deck[j] = temp;
}
for (int i = 0;i < Deck.Length; i++)
{
Console.Write(Deck[i] + " ");
if (i == 13 || i == 27 || i == 41)
Console.WriteLine();
}
Console.WriteLine("\n");
}
public void CardDeal(string[] Deck)
{
Console.WriteLine("Deal a deck card:");
string[] PartA=new string[Deck.Length/4];
string[] PartB=new string[Deck.Length/4];
string[] PartC=new string[Deck.Length/4];
string[] PartD=new string[Deck.Length/4];
for (int i = 0,j=0; i <Deck.Length; i += 4,j++) {
PartA[j] = Deck[i];
PartB[j] = Deck[i+1];
PartC[j] = Deck[i+2];
PartD[j] = Deck[i+3];
}
Console.Write("PartA[i]:" +" " +"PartB[i]: "+ " " + "PartC[i]:" + " " + "PartD[i]:" + "\n");
for (int i = 0; i < Deck.Length / 4; i++) {
Console.Write(" "+PartA[i] + " " + PartB[i] + " " + PartC[i] + " " + PartD[i] + "\n");
}
Console.WriteLine();
}
}
}