Program.cs 754 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Diagnostics;
  2. using Day18;
  3. if (args.Any(a => a == "--debug"))
  4. {
  5. Console.WriteLine("DEBUG");
  6. Console.WriteLine(Debugger.Launch());
  7. }
  8. if (args.Length < 1)
  9. {
  10. Console.WriteLine("Requires 1 args: inputFileName");
  11. return -1;
  12. }
  13. var inputFile = args[0];
  14. var parser = new Parser();
  15. var instructions = parser.Parse(inputFile).ToList();
  16. var field = new Field();
  17. field.Apply(instructions);
  18. field.Print();
  19. var volume = field.GetArea();
  20. Console.WriteLine();
  21. Console.WriteLine($"Volume: {volume}");
  22. field = new Field();
  23. field.Apply(instructions.Select(i => i.Unscramble()).ToList());
  24. field.Print();
  25. volume = field.GetArea();
  26. Console.WriteLine();
  27. Console.WriteLine($"Volume: {volume}");
  28. return 0;