lap és csomag félkész

This commit is contained in:
István Priskin 2022-04-01 19:15:21 +02:00
parent 2ebc5d4a32
commit 4dc6e06c8d
5 changed files with 111 additions and 1 deletions

57
Oszto/Csomag.cs Normal file
View 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
View 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
View 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
View File

@ -0,0 +1,13 @@
using System;
namespace Oszto
{
class Program
{
static void Main(string[] args)
{
Csomag pakli = new Csomag();
pakli.kever();
}
}
}

View File

@ -5,7 +5,9 @@ VisualStudioVersion = 16.0.31624.102
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Szotar", "Szotar\Szotar.csproj", "{8465ADED-61C4-4EB2-A42C-C47B86DC42B5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Valasztasok", "Valasztasok\Valasztasok.csproj", "{F70CD600-1632-4FB5-8DC0-BDD9DDF70248}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Valasztasok", "Valasztasok\Valasztasok.csproj", "{F70CD600-1632-4FB5-8DC0-BDD9DDF70248}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Oszto", "Oszto\Oszto.csproj", "{CCBC99D9-3207-4B83-80B7-382E0CE0E748}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -21,6 +23,10 @@ Global
{F70CD600-1632-4FB5-8DC0-BDD9DDF70248}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F70CD600-1632-4FB5-8DC0-BDD9DDF70248}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F70CD600-1632-4FB5-8DC0-BDD9DDF70248}.Release|Any CPU.Build.0 = Release|Any CPU
{CCBC99D9-3207-4B83-80B7-382E0CE0E748}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCBC99D9-3207-4B83-80B7-382E0CE0E748}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCBC99D9-3207-4B83-80B7-382E0CE0E748}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCBC99D9-3207-4B83-80B7-382E0CE0E748}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE