64 lines
1.7 KiB
C#
64 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Oszto
|
|
{
|
|
class Pakli
|
|
{
|
|
public Kartyalap[] lapok;
|
|
|
|
public Pakli()
|
|
{
|
|
string[] szinek = {"pikk","kőr","káró","treff"};
|
|
string[] ertekek = {"2","3","4","5","6","7","8","9","10","J","Q","K","A"};
|
|
//lapok készítése
|
|
lapok = new Kartyalap[52];
|
|
int lix = 0;
|
|
foreach (var sz in szinek)
|
|
{
|
|
foreach (var e in ertekek)
|
|
{
|
|
Kartyalap lap = new Kartyalap();
|
|
lap.szin = sz;
|
|
lap.ertek = e;
|
|
lapok[lix] = lap;
|
|
lix++;
|
|
}
|
|
}
|
|
//Console.WriteLine(lapok[0]);
|
|
//Console.WriteLine(lapok[51]);
|
|
kever();
|
|
}
|
|
|
|
private void kever()
|
|
{
|
|
//pakli előtte
|
|
//foreach (var item in lapok)
|
|
//{
|
|
// Console.WriteLine(item);
|
|
//}
|
|
Random rd = new Random();
|
|
for (int i = 0; i < 500; i++)
|
|
{
|
|
int egyik = rd.Next(0, 52);
|
|
int masik = rd.Next(0, 52);
|
|
if (egyik!=masik)
|
|
{
|
|
Kartyalap tmp = lapok[egyik];
|
|
lapok[egyik] = lapok[masik];
|
|
lapok[masik] = tmp;
|
|
}
|
|
}
|
|
//Console.WriteLine("pakli utána");
|
|
/* foreach (var item in lapok)
|
|
{
|
|
Console.WriteLine(item);
|
|
}*/
|
|
}
|
|
|
|
}
|
|
}
|