Files
AdventOfCode/2018_06/Program.cs
2018-12-16 12:18:03 +01:00

54 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
namespace _2018_06
{
class Program
{
static void Main(string[] args)
{
string[] resTab = File.ReadAllLines(@"..\..\..\Data\Adventofcode_181206\2018_06_data.txt");
List<Tuple<int, int>> koords = new List<Tuple<int, int>>();
Tuple<int, int> tuple = null;
foreach (string v in resTab)
{
string[] nums = v.Split(new char[] { ',' });
tuple = Tuple.Create(int.Parse(nums[0]), int.Parse(nums[1]));
koords.Add(tuple);
}
int points = 0;
int al = 999+999, bl = 0;
int a1=999, a2 = 999;
int b1 = 0, b2 = 0;
foreach (Tuple<int,int> tp in koords)
{
points++;
WriteLine($"point {points}, X: {tp.Item1} Y: {tp.Item2}");
if (tp.Item1 + tp.Item2 < al)
{
a1 = tp.Item1;
a2 = tp.Item2;
}
if (tp.Item1 + tp.Item2 > bl)
{
b1 = tp.Item1;
b2 = tp.Item2;
}
}
WriteLine($"low value: {a1},{a2} high value: {b1},{b2}");
ReadKey();
}
}
}