using System.Text.RegularExpressions; namespace Day17; public partial class Parser { [GeneratedRegex(@".*")] private partial Regex LineMatch(); public Map Parse(string inputFile) { var lines = File.ReadAllLines(inputFile); var width = lines[0].Length; var height = lines.Length; var map = new Tile[width, height]; for (var y = 0; y < height; y++) { for (var x = 0; x < width; x++) { map[x, y] = new Tile(x, y, int.Parse(lines[y][x].ToString())); } } return new Map(map, width, height); } }