lap és csomag félkész
This commit is contained in:
57
Oszto/Csomag.cs
Normal file
57
Oszto/Csomag.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
26
Oszto/Kartyalap.cs
Normal file
26
Oszto/Kartyalap.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Oszto
|
||||
{
|
||||
class Kartyalap
|
||||
{
|
||||
public string szin;
|
||||
public string ertek;
|
||||
|
||||
public Kartyalap()
|
||||
{
|
||||
szin = "nincs";
|
||||
ertek = "nincs";
|
||||
}
|
||||
|
||||
public Kartyalap(String szin, String ertek)
|
||||
{
|
||||
this.szin = szin;
|
||||
this.ertek = ertek;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
8
Oszto/Oszto.csproj
Normal file
8
Oszto/Oszto.csproj
Normal file
@@ -0,0 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
13
Oszto/Program.cs
Normal file
13
Oszto/Program.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace Oszto
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Csomag pakli = new Csomag();
|
||||
pakli.kever();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user