Skip to content

Commit

Permalink
got it
Browse files Browse the repository at this point in the history
  • Loading branch information
deckelmouck committed Dec 7, 2023
1 parent 2874814 commit d54f5f7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions 2023/Day05/solution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public void SolvePart1()
Console.WriteLine("part 1");

solutionBase sb = new();
var input = sb.getInputLines(@"2023/Day05/test").ToArray();
//var input = sb.getInputLines(@"2023/Day05/input").ToArray();
//var input = sb.getInputLines(@"2023/Day05/test").ToArray();
var input = sb.getInputLines(@"2023/Day05/input").ToArray();

var firstLine = input[0].Split(' ', StringSplitOptions.RemoveEmptyEntries);

Expand All @@ -24,10 +24,13 @@ public void SolvePart1()
{
Console.WriteLine($"seed: {seed} will be calculated");
var s = Convert.ToInt64(seed);
var mapped = false;

for (int i = 2; i < input.Length; i++)
{
if(!input[i].Contains(':') && input[i] != "")
if(input[i] == "") mapped = false;

if(!input[i].Contains(':') && input[i] != "" && !mapped)
{
var inputLine = input[i].Split(' ', StringSplitOptions.RemoveEmptyEntries);

Expand All @@ -38,6 +41,7 @@ public void SolvePart1()
if(SeedInRange(s, source, range))
{
s = destination + (s - source);
mapped = true;
}

Console.WriteLine($"destination: {destination} source: {source} range: {range}");
Expand All @@ -53,6 +57,8 @@ public void SolvePart1()
{
Console.WriteLine($"seed: {seed.Key} - {seed.Value}");
}

Console.WriteLine($"min is: {seedlist.Min(s => s.Value)}");

Console.WriteLine($"still not the right result");
}
Expand Down

0 comments on commit d54f5f7

Please sign in to comment.