static async void MainAsync(string[] args) { bool Success = false; List <int> arr = new List <int> { 1, 1, 1, 1, 1, 1, 1, 1, 1 }; List <int> inputs = new List <int> { 1, 2 }; while (!Success) { arr = MagicNumberGenerator.Cartesian(arr, inputs, null); if (arr.Distinct().Count() == 1 && arr[0] == inputs[inputs.Count - 1]) { Success = true; //Stop processing } Console.WriteLine("Attempting with with " + string.Join(",", arr)); var res = await MagicNumberGenerator.GetMagicNums(arr); if (res.Success) { Success = true; Console.WriteLine("Success with " + string.Join(",", res.MagicSquareNumbers)); logger.Log(new LogEventInfo(LogLevel.Info, "Success", string.Join(",", res.MagicSquareNumbers))); } } }
public MagicNumberGeneratorActionController() { this.display = new Display(); this.magicNumberGenerator = new MagicNumberGenerator(this.display.Product); this.display.AllMagicNumbers = this.magicNumberGenerator.GenerateAllMagicNumbers(); this.display.PrintAll(); }