feat: solved day 6 part 1 and part 2
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
using GuardGallivant;
|
||||
|
||||
if (args.Length is 0)
|
||||
{
|
||||
Console.WriteLine("Please provide a path to the input file.");
|
||||
@@ -13,14 +15,19 @@ if (File.Exists(args[0]) is false)
|
||||
}
|
||||
|
||||
var isPart2 = args.Length is 2 && args[1] is "part2";
|
||||
var input = await File.ReadAllTextAsync(args[0]);
|
||||
var input = await File.ReadAllLinesAsync(args[0]);
|
||||
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
|
||||
// TODO: Implement solution
|
||||
var map = new Map(input);
|
||||
var result = isPart2
|
||||
? map.IdentifyNumberOfPlacementsForNewObstruction()
|
||||
: map.PredictDistinctPositionsCount();
|
||||
|
||||
var msg = isPart2
|
||||
? $"There are {result} positions for the new obstruction"
|
||||
: $"The guard will visit {result} positions";
|
||||
|
||||
stopwatch.Stop();
|
||||
|
||||
// TODO: Print result
|
||||
Console.WriteLine($". ({stopwatch.ElapsedMilliseconds}ms)");
|
||||
Console.WriteLine($"{msg}. ({stopwatch.ElapsedMilliseconds}ms)");
|
||||
Reference in New Issue
Block a user