Compare commits

...

2 Commits

Author SHA1 Message Date
Ben Harris a1f701ddf6 day3big
continuous-integration/drone/push Build is failing Details
2020-12-03 15:13:18 -05:00
Ben Harris fcd1bfb5e5 day3big
continuous-integration/drone/push Build is failing Details
2020-12-03 15:03:11 -05:00
1 changed files with 9 additions and 11 deletions

View File

@ -1,4 +1,6 @@
using System.IO;
using System.Linq;
using System.Numerics;
namespace aoc2020
{
@ -9,7 +11,7 @@ namespace aoc2020
public Day3()
{
_grid = Input.ToArray();
_grid = File.ReadLines("input/day3big.in").ToArray();
_width = _grid[0].Length;
}
@ -32,18 +34,14 @@ namespace aoc2020
public override string Part2()
{
var slopes = new[]
{
(1, 1),
(3, 1),
(5, 1),
(7, 1),
(1, 2)
};
var xSlops = new[] {2, 3, 4, 5, 8, 9, 12, 16, 18, 24, 32, 36, 48, 54, 65};
var ySlops = new[] {1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 25, 37, 41, 47};
return slopes
return xSlops
.SelectMany(x => ySlops, (x, y) => (x, y))
.Select(s => CountSlope(s.Item1, s.Item2))
.Aggregate((acc, i) => acc * i)
.Select(s => new BigInteger(s))
.Aggregate(BigInteger.Multiply)
.ToString();
}
}