Skip to content

Instantly share code, notes, and snippets.

@dretax
Last active October 26, 2016 21:28
Show Gist options
  • Save dretax/5097b8d609d007a412bad0504b7b958a to your computer and use it in GitHub Desktop.
Save dretax/5097b8d609d007a412bad0504b7b958a to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
internal class Program
{
internal static int[,] Data;
internal static Random rand;
internal static int GWeek;
internal static void Main(string[] args)
{
rand = new Random();
Console.WriteLine("Írj be egy számot a sportoló bácsi gecimenő hét rögzítésére hogy bazdmeg...");
string s = Console.ReadLine();
int week = 0;
bool b = int.TryParse(s, out week);
while (!b)
{
Console.WriteLine("Ez gecire nem szám");
s = Console.ReadLine();
b = int.TryParse(s, out week);
}
GWeek = week;
TombVeletlenGeneral(GWeek);
Console.ReadKey();
}
/*
*
* – Minden héten legyen két olyan nap, amikor nem edz a futó. Azt nem tudjuk előre,
hogy melyek ezek a napok.
– A hétköznapi edzéseken 3 és 10 kilométer közötti távokat teljesít.
– A hétvégi edzéseken 8 és 30 kilométer közötti távokat fut.
x x x x
x x x x
x x x x
x x x x
x x x x
x x x x
x x x x
*/
internal static int[,] TombVeletlenGeneral(int hetekSzama)
{
int[,] asd = new int[GWeek, 7];
int r = 0, r2 = 0;
for (int pillar = 0; pillar < GWeek; pillar++)
{
for (int i = 0; i < 7; i++)
{
if (i == 0)
{
r = rand.Next(1, 8);
r2 = rand.Next(1, 8);
while (r2 == r)
{
r2 = rand.Next(1, 8);
}
}
if (i == r || i == r2)
{
asd[pillar, i] = 0;
}
else if (i == 5 || i == 6)
{
asd[pillar, i] = rand.Next(8, 31);
}
else
{
asd[pillar, i] = rand.Next(3, 11);
}
}
}
TombKiir(asd);
return asd;
}
internal static void TombKiir(int[,] lefutottTavok)
{
int rowLength = lefutottTavok.GetLength(0);
int colLength = lefutottTavok.GetLength(1);
for (int i = 0; i < rowLength; i++)
{
for (int j = 0; j < colLength; j++)
{
Console.Write(string.Format("{0},", lefutottTavok[i, j]));
}
Console.Write(Environment.NewLine + Environment.NewLine);
}
}
internal static void TombKiir(int[,] lefutottTavok)
{
int rowLength = lefutottTavok.GetLength(0);
int colLength = lefutottTavok.GetLength(1);
for (int i = 0; i < rowLength; i++)
{
for (int j = 0; j < colLength; j++)
{
Console.Write(string.Format("{0},", lefutottTavok[i, j]));
}
Console.Write(Environment.NewLine + Environment.NewLine);
}
}
// Az adott heti és adott napi edzés távját lehet módosítani a metódus segítségével.
// DE mi a gecinek, ha argumentum az a gecis tömb? kurvára nem változik az értéke majd bazdmeg.
internal void TombModosit(int hetIndex, int napIndex, int[,] lefutottTavok)
{
// ezt komplexen fogom megcsinálni csak hogy még BELEKÖTNI se lehessen
}
internal static int OsszesKilometer(int[,] lefutottTavok)
{
int dafuq = 0;
//Console.WriteLine(lefutottTavok.GetLength(0));
//Console.WriteLine(lefutottTavok.GetLength(1));
for (int i = 0; i < lefutottTavok.GetLength(0); i++)
{
for (int j = 0; j < lefutottTavok.GetLength(1); j++)
{
//Console.WriteLine(i + " - " + j);
dafuq+= lefutottTavok[i, j];
}
}
return dafuq;
}
internal static int HosszuFutasokSzama(int[,] lefutottTavok)
{
int dafuq = 0;
for (int i = 0; i < lefutottTavok.GetLength(0); i++)
{
for (int j = 0; j < lefutottTavok.GetLength(1); j++)
{
if (lefutottTavok[i, j] > 15)
{
dafuq++;
}
}
}
return dafuq;
}
internal static int[,] HetiOsszesites(int[,] lefutottTavok)
{
int[,] lol = new int[4 , 1];
// Since you officially never EVER learned dictionary, im commenting this shit out
//Dictionary<int, int> BetterShit = new Dictionary<int, int>();
int d = 0, d2 = 0, d3 = 0, d4 = 0;
for (int i = 0; i < lefutottTavok.GetLength(0); i++)
{
/*if (!BetterShit.ContainsKey(i))
{
BetterShit[i] = 0;
}*/
for (int j = 0; j < lefutottTavok.GetLength(1); j++)
{
switch (i)
{
case 0:
d += lefutottTavok[i, j];
break;
case 1:
d2 += lefutottTavok[i, j];
break;
case 2:
d3 += lefutottTavok[i, j];
break;
case 3:
d4 += lefutottTavok[i, j];
break;
}
//BetterShit[i] = BetterShit[i] + lefutottTavok[i, j];
//Console.WriteLine("--" + BetterShit[i]); // todo <- tömb feltöltése ha menő vagy és dictionary
// MAJD KAPSZ VELE EGY SOKKAL RÖVIDEBB KÓDOT AMI MÉG LOGIKUSABB IS LOL
}
switch (i)
{
case 0:
lol[i, 0] = d;
break;
case 1:
lol[i, 0] = d2;
break;
case 2:
lol[i, 0] = d3;
break;
case 3:
lol[i, 0] = d4;
break;
}
}
TombKiir(lol);
return lol;
}
internal static bool NovekszikE(int[] hetiTavok)
{
int last = 0;
foreach (var x in hetiTavok)
{
if (x > last)
{
last = x;
continue;
}
return false;
}
return true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment