seal classes
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
9958bed832
commit
00c3b51b89
2
Day1.cs
2
Day1.cs
|
@ -3,7 +3,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
public class Day1 : Day
|
internal sealed class Day1 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 1;
|
public override int DayNumber => 1;
|
||||||
|
|
||||||
|
|
2
Day10.cs
2
Day10.cs
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day10 : Day
|
internal sealed class Day10 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 10;
|
public override int DayNumber => 10;
|
||||||
|
|
||||||
|
|
2
Day11.cs
2
Day11.cs
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day11 : Day
|
internal sealed class Day11 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 11;
|
public override int DayNumber => 11;
|
||||||
|
|
||||||
|
|
2
Day12.cs
2
Day12.cs
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day12 : Day
|
internal sealed class Day12 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 12;
|
public override int DayNumber => 12;
|
||||||
|
|
||||||
|
|
2
Day13.cs
2
Day13.cs
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day13 : Day
|
internal sealed class Day13 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 13;
|
public override int DayNumber => 13;
|
||||||
|
|
||||||
|
|
14
Day14.cs
14
Day14.cs
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day14 : Day
|
internal sealed class Day14 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 14;
|
public override int DayNumber => 14;
|
||||||
|
|
||||||
|
@ -19,10 +19,10 @@ namespace aoc2019
|
||||||
|
|
||||||
private class Reaction
|
private class Reaction
|
||||||
{
|
{
|
||||||
public Component product;
|
public readonly Component product;
|
||||||
public Component[] reactants;
|
public readonly Component[] reactants;
|
||||||
|
|
||||||
public Reaction(Component[] reactants, Component product)
|
private Reaction(Component[] reactants, Component product)
|
||||||
{
|
{
|
||||||
this.reactants = reactants;
|
this.reactants = reactants;
|
||||||
this.product = product;
|
this.product = product;
|
||||||
|
@ -39,11 +39,11 @@ namespace aoc2019
|
||||||
|
|
||||||
static Component ParseComponent(string s)
|
static Component ParseComponent(string s)
|
||||||
{
|
{
|
||||||
var i = s.IndexOf(' ');
|
var spl = s.Split(' ', 2);
|
||||||
return new Component
|
return new Component
|
||||||
{
|
{
|
||||||
Name = s[(i + 1)..],
|
Quantity = int.Parse(spl[0]),
|
||||||
Quantity = int.Parse(s.Substring(i))
|
Name = spl[1]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
Day15.cs
2
Day15.cs
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day15 : Day
|
internal sealed class Day15 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 15;
|
public override int DayNumber => 15;
|
||||||
|
|
||||||
|
|
2
Day16.cs
2
Day16.cs
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day16 : Day
|
internal sealed class Day16 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 16;
|
public override int DayNumber => 16;
|
||||||
|
|
||||||
|
|
2
Day2.cs
2
Day2.cs
|
@ -3,7 +3,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
public class Day2 : Day
|
internal sealed class Day2 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 2;
|
public override int DayNumber => 2;
|
||||||
|
|
||||||
|
|
2
Day3.cs
2
Day3.cs
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day3 : Day
|
internal sealed class Day3 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 3;
|
public override int DayNumber => 3;
|
||||||
|
|
||||||
|
|
2
Day4.cs
2
Day4.cs
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day4 : Day
|
internal sealed class Day4 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 4;
|
public override int DayNumber => 4;
|
||||||
|
|
||||||
|
|
2
Day5.cs
2
Day5.cs
|
@ -3,7 +3,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day5 : Day
|
internal sealed class Day5 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 5;
|
public override int DayNumber => 5;
|
||||||
|
|
||||||
|
|
2
Day6.cs
2
Day6.cs
|
@ -3,7 +3,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day6 : Day
|
internal sealed class Day6 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 6;
|
public override int DayNumber => 6;
|
||||||
|
|
||||||
|
|
2
Day7.cs
2
Day7.cs
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day7 : Day
|
internal sealed class Day7 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 7;
|
public override int DayNumber => 7;
|
||||||
|
|
||||||
|
|
2
Day8.cs
2
Day8.cs
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day8 : Day
|
internal sealed class Day8 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 8;
|
public override int DayNumber => 8;
|
||||||
|
|
||||||
|
|
2
Day9.cs
2
Day9.cs
|
@ -3,7 +3,7 @@ using System.Linq;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
internal class Day9 : Day
|
internal sealed class Day9 : Day
|
||||||
{
|
{
|
||||||
public override int DayNumber => 9;
|
public override int DayNumber => 9;
|
||||||
private readonly IntCodeVM vm;
|
private readonly IntCodeVM vm;
|
||||||
|
|
27
Program.cs
27
Program.cs
|
@ -5,19 +5,24 @@ using System.Reflection;
|
||||||
|
|
||||||
namespace aoc2019
|
namespace aoc2019
|
||||||
{
|
{
|
||||||
class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
private static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var days = GetDays();
|
var days =
|
||||||
|
Assembly.GetExecutingAssembly().GetTypes()
|
||||||
|
.Where(t => t.BaseType == typeof(Day))
|
||||||
|
.Select(t => (Day) Activator.CreateInstance(t))
|
||||||
|
.OrderBy(d => d.DayNumber);
|
||||||
|
|
||||||
if (args.Length == 1 && int.TryParse(args[0], out int daynum))
|
if (args.Length == 1 && int.TryParse(args[0], out var dayNum))
|
||||||
{
|
{
|
||||||
var d = days.Where(d => d.DayNumber == daynum);
|
var day = days.FirstOrDefault(d => d.DayNumber == dayNum);
|
||||||
if (d.Any())
|
|
||||||
d.First().AllParts();
|
if (day != null)
|
||||||
|
day.AllParts();
|
||||||
else
|
else
|
||||||
Console.WriteLine($"{daynum} invalid or not yet implemented");
|
Console.WriteLine($"{dayNum} invalid or not yet implemented");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -27,11 +32,5 @@ namespace aoc2019
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<Day> GetDays() =>
|
|
||||||
Assembly.GetExecutingAssembly().GetTypes()
|
|
||||||
.Where(t => t.BaseType == typeof(Day))
|
|
||||||
.Select(t => (Day)Activator.CreateInstance(t))
|
|
||||||
.OrderBy(d => d.DayNumber);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,56 +2,11 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="input\day1.in">
|
<None Update="input\day*.in">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day11.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day12.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day13.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day14.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day15.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day16.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day2.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day3.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day4.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day5.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day6.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day7.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day8.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day9.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="input\day10.in">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
Loading…
Reference in New Issue