internal static MagicSquare[] CreateMatrices(int n) { MagicSquare[] squares = new MagicSquare[n * n]; for (int i = 0; i < n * n; i++) { int[] initialValues = new int[n * n]; initialValues[0] = i + 1; squares[i] = new MagicSquare(n, initialValues, 1); } return(squares); }
private static void Run1() { int solutionCount = 0; Stopwatch stopWatch = Stopwatch.StartNew(); using (SolutionFile solutionFile = new SolutionFile()) { MagicSquare magicSquare = new MagicSquare(4); magicSquare.SolutionFound += (sender, e) => { solutionCount++; solutionFile.AddSolution(e.Solution); }; magicSquare.Calculate(); solutionFile.WriteStatistics(solutionCount, stopWatch.Elapsed); } }