public static void Main(string[] args) { std.WriteLine("Enter path for puzzle file"); var user_input = std.ReadLine(); int[] output; if(File.Exists(user_input)){ var lines = ReadFile(user_input); if(lines == null) return; RunMultiplePuzzles(lines); }else{ std.WriteLine("File does not appear to exist, trying to parse input"); output = ParseInput(user_input); if(output == null)return; var algo = AlgorithmFactory(WriteOutputForAlgorithm(), output ); if(algo == null)return; var p = new Puzzle(algo); p.Begin(); Console.Read(); } }
///<summary> ///If the user selects to read a file, the program can be ran for each entry in the file ///this method handles such a scenario ///</summary> public static void RunMultiplePuzzles(List<int[]> InitialStates) { string algo_input = WriteOutputForAlgorithm(); if(algo_input == null)return; foreach(var item in InitialStates){ var algo = AlgorithmFactory(algo_input,item); var p = new Puzzle(algo); p.Begin(); } }