This commit is contained in:
Digi 2025-03-05 21:58:03 +01:00
parent 9be4cba137
commit 9969d17bcc
18 changed files with 236 additions and 54 deletions

View File

@ -9,10 +9,6 @@
{
"AbsoluteMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\jatekos.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|solutionrelative:jatekos.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\idopont.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|solutionrelative:idopont.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
@ -22,7 +18,7 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 2,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
@ -32,24 +28,11 @@
"RelativeDocumentMoniker": "Jatekos.cs",
"ToolTip": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Jatekos.cs",
"RelativeToolTip": "Jatekos.cs",
"ViewState": "AgIAAAEAAAAAAAAAAAAiwBQAAAAAAAAAAAAAAA==",
"ViewState": "AgIAAAQAAAAAAAAAAAAiwCcAAAAvAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-03-05T17:40:39.379Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "Idopont.cs",
"DocumentMoniker": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Idopont.cs",
"RelativeDocumentMoniker": "Idopont.cs",
"ToolTip": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Idopont.cs",
"RelativeToolTip": "Idopont.cs",
"ViewState": "AgIAAAIAAAAAAAAAAAAAwC4AAAAJAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-03-05T11:46:26.985Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
@ -58,7 +41,7 @@
"RelativeDocumentMoniker": "Program.cs",
"ToolTip": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Program.cs",
"RelativeToolTip": "Program.cs",
"ViewState": "AgIAADoAAAAAAAAAAAAAAGgAAAAAAAAAAAAAAA==",
"ViewState": "AgIAAM8AAAAAAAAAAAAAAOcAAABHAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-03-05T11:40:10.358Z",
"EditorCaption": ""

View File

@ -6,10 +6,6 @@
"AbsoluteMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|e:\\h\u00E1zi\\13.oszt\u00E1ly\\neumann_verseny\\fordulo_2\\program\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\idopont.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|solutionrelative:idopont.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\jatekos.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|solutionrelative:jatekos.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
@ -22,34 +18,21 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 2,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
"DocumentIndex": 2,
"DocumentIndex": 1,
"Title": "Jatekos.cs",
"DocumentMoniker": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Jatekos.cs",
"RelativeDocumentMoniker": "Jatekos.cs",
"ToolTip": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Jatekos.cs",
"RelativeToolTip": "Jatekos.cs",
"ViewState": "AgIAAAEAAAAAAAAAAAAiwBQAAAAAAAAAAAAAAA==",
"ViewState": "AgIAAAQAAAAAAAAAAAAiwCcAAAAvAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-03-05T17:40:39.379Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "Idopont.cs",
"DocumentMoniker": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Idopont.cs",
"RelativeDocumentMoniker": "Idopont.cs",
"ToolTip": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Idopont.cs",
"RelativeToolTip": "Idopont.cs",
"ViewState": "AgIAAAgAAAAAAAAAAAAAwC4AAAAJAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-03-05T11:46:26.985Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
@ -58,7 +41,7 @@
"RelativeDocumentMoniker": "Program.cs",
"ToolTip": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Program.cs",
"RelativeToolTip": "Program.cs",
"ViewState": "AgIAAEMAAAAAAAAAAAAAAGkAAAANAAAAAAAAAA==",
"ViewState": "AgIAAOoAAAAAAAAAAADwv/UAAAAQAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-03-05T11:40:10.358Z",
"EditorCaption": ""

View File

@ -10,7 +10,24 @@ namespace Program
{
public string Nev { get; set; }
public int Pontszam { get; set; }
public Minta Minta = new Minta();
}
class Minta
{
public bool Nagysor { get; set; }
public bool Kissor { get; set; }
public bool Poker { get; set; }
public bool Full { get; set; }
public bool Terc { get; set; }
public bool KetPar { get; set; }
public bool EgyPar { get; set; }
public bool AllTrue()
{
return Nagysor && Kissor && Poker && Full && Terc && KetPar && EgyPar;
}
}
class Kor
@ -18,5 +35,8 @@ namespace Program
public Jatekos jatekos { get; set; }
public int[] dobasok { get; set; }
public int[] dobasokFull { get; set; }
public int[] dontesekFull { get; set; }
}
}

View File

@ -23,6 +23,10 @@ namespace Program
var dobasok = new List<int>();
var dontesek = new List<int>();
//d feladathoz
int pokermaxNum = 0;
//dobasok
var data = File.ReadAllText(path).Trim();
@ -63,11 +67,17 @@ namespace Program
int jatekosCounter = 0;
List<int> dobasokFull = new List<int>();
List<int> dontesekFull = new List<int>();
for (int i = 0; i < dobasok.Count; i++)
{
int dobas = dobasok[i];
int dontes = dontesek[i];
dobasokFull.Add(dobas);
dontesekFull.Add(dontes);
if (dontes == 1)
{
dobasokSmallerScope.Add(dobas);
@ -78,6 +88,12 @@ namespace Program
kor.dobasok = dobasokSmallerScope.ToArray();
kor.jatekos = jatekosok[jatekosCounter];
kor.dobasokFull = dobasokFull.ToArray();
kor.dontesekFull = dontesekFull.ToArray();
dobasokFull.Clear();
dontesekFull.Clear();
korok.Add(kor);
dobasokSmallerScope.Clear();
@ -89,7 +105,7 @@ namespace Program
{
jatekosCounter++;
}
continue;
}
}
@ -100,11 +116,176 @@ namespace Program
Console.WriteLine($"Teljes körök száma: {korok.Count / 3}");
// b feladat
foreach (var item in korok)
{
foreach (var kor in korok)
{
foreach (var jatekos in jatekosok)
{
if (jatekos.Nev == kor.jatekos.Nev)
{
int[] dobasokAKorben = kor.dobasok;
bool sorCondition = dobasokAKorben.Distinct().Count() == 5;
//nagysor
if (sorCondition && dobasokAKorben.Contains(6))
{
jatekos.Minta.Nagysor = true;
continue;
}
//kissor
if (sorCondition && dobasokAKorben.Contains(1))
{
jatekos.Minta.Kissor = true;
continue;
}
//poker
var pokerGroup = dobasokAKorben.GroupBy(x => x).FirstOrDefault(g => g.Count() == 4);
if (pokerGroup != null)
{
int pokerValue = pokerGroup.Key;
if (pokerValue > pokermaxNum)
{
pokermaxNum = pokerValue;
}
jatekos.Minta.Poker = true;
continue;
}
//full
if (dobasokAKorben.Count(x => x == 3) == 1 && dobasokAKorben.Count(x => x == 2) == 1)
{
jatekos.Minta.Full = true;
continue;
}
//terc
if (dobasokAKorben.Count(x => x == 3) == 1)
{
jatekos.Minta.Terc = true;
continue;
}
//ketpar
if (dobasokAKorben.Count(x => x == 2) == 2)
{
jatekos.Minta.KetPar = true;
continue;
}
//egypar
if (dobasokAKorben.Count(x => x == 2) == 1)
{
jatekos.Minta.EgyPar = true;
continue;
}
}
}
}
foreach (var jatekos in jatekosok)
{
if (jatekos.Minta.AllTrue())
{
Console.WriteLine($"{jatekos.Nev} nyerte meg a játékot");
}
}
// c feladat
int counter = 0;
foreach (var kor in korok)
{
if (kor.jatekos.Nev == "Gamma")
{
int[] dobasokAKorben = kor.dobasok;
counter++;
if (dobasokAKorben.Count(x => x == 3) == 1 && dobasokAKorben.Count(x => x == 2) == 1)
{
break;
}
}
}
Console.WriteLine($"Gamma ebbe a körbe dobott full-t: {counter + 1}");
// d feladat
Console.WriteLine($"A legnagyobb poker értéke: {pokermaxNum}");
// e feladat
foreach (var kor in korok)
{
IntArrKiir(kor.dobasokFull);
IntArrKiir(kor.dontesekFull);
Console.WriteLine("---------");
}
Console.WriteLine(CountPairs(new int[] { 2, 2, 3, 3, 4 }));
}
static int GetAllPairs(List<int> dobasok, List<int> dontesek)
{
int pairs = 0;
List<int> asztalok = new List<int>();
foreach (var dobas in dobasok)
{
}
return pairs;
}
static int CountPairs(int[] dobasok)
{
int pairs = 0;
//terc
if (dobasok.Count(x => x == 3) == 1)
{
return 0;
}
var pokerGroup = dobasok.GroupBy(x => x).FirstOrDefault(g => g.Count() == 4);
if (pokerGroup != null)
{
return 0;
}
for (int i = 0; i < dobasok.Length; i++)
{
for (int j = i + 1; j < dobasok.Length; j++)
{
if (dobasok[i] == dobasok[j])
{
pairs++;
}
}
}
return pairs;
}
static void IntArrKiir(int[] arr)
{
foreach (var item in arr)
{
Console.Write(item + " ");
}
Console.WriteLine();
}
static void Feladat1()
@ -169,25 +350,26 @@ namespace Program
int counter = 0;
int iterations = 0;
int napokCounter = 0;
int napokCounter = 1;
foreach (var item in idopontok2)
{
if (counter == anglesToLookFor.Count)
{
break;
}
if (item.Angle == anglesToLookFor[counter])
{
counter++;
}
if (counter == anglesToLookFor.Count)
{
break;
}
iterations++;
if (iterations == 1440)
{
napokCounter++;
iterations = 0;
}
}

14
gamma Normal file
View File

@ -0,0 +1,14 @@
6 6 2 5 4
4 4 4 3 4
6 1 1 6 4
3 3 4 2 5
4 4 4 2 3
4 4 6 6 6
6 3 2 4 1
4 1 2 5 5
4 5 1 2 1
2 5 6 3 6
2 4 1 5 2
3 4 1 2 1
1 2 3 5 3
1 5 3 4 6

View File

@ -23,12 +23,12 @@
### 1. feladat
- a: `3:49`
- b: `1.5`
- c: `1|15:37`
- c: `4|15:36`
### 2. feladat
- a: `14`
- b: ``
- c: ``
- b: `alfa`
- c: `1`
- d: ``
- e: ``