SzotarFeladatok/Oszto/Csomag.cs
2022-04-01 19:15:21 +02:00

58 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace Oszto
{
class Csomag
{
public static readonly string[] frszinek = { "pikk", "kőr", "káró", "treff" };
public static readonly string[] frertekek = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "D", "K", "A" };
public Kartyalap[] lapok;
public Csomag()
{
lapok = new Kartyalap[52];
int lit = 0;
for (int i = 0; i < frszinek.Length; i++)
{
for (int j = 0; j < frertekek.Length; j++)
{
lapok[lit] = new Kartyalap(frszinek[i], frertekek[j]);
lit++;
//lapok[i*13+j] = new ....
}
}
/*foreach (var item in lapok)
{
Console.WriteLine(item.szin+"-"+item.ertek);
}*/
}
public void kever()
{
Random rd = new Random();
for (int i = 0; i < 500; i++)
{
int n1 = rd.Next(0, 51);
int n2 = rd.Next(0, 51);
if(n1!=n2)
{
Kartyalap temp = lapok[n1];
lapok[n1] = lapok[n2];
lapok[n2] = temp;
}
}
foreach (var item in lapok)
{
Console.WriteLine(item.szin+"-"+item.ertek);
}
}
}
}