namespace AoC24.Common; using AoCLevelInputProvider; using Parsing; using Parsing.Schema; using Parsing.Data; using Parsing.Tokenization; public abstract class FragmentLevelSolverBase { public abstract int LevelNumber { get; } private int Year = 2024; private LevelInputProvider inputProvider = new LevelInputProvider(); protected string GetLevelInput() { return inputProvider.WithYear(this.Year).WithLevel(this.LevelNumber).Provide(); } public abstract string SolveFirstStar(); public abstract string SolveSecondStar(); protected abstract FragmentSchemaBuilder DefineInputSchema(FragmentSchemaBuilder schemaBuilder); public TokenConverter GetData() { FragmentSchemaBuilder schemaBuilder = new FragmentSchemaBuilder(); var schema = this.DefineInputSchema(schemaBuilder).Build(); var parser = TextParser.Create(schema); var data = parser .SetInputText(this.GetLevelInput()) .Parse(); return data; } }