% Monte-Carlo Search Algoritm on low-autocorrelation program % BSDLicence % Rick van der Zwet - 0433373 - best_fitness = 0; while (1) % Generate a column s={-1,1}^n n = 20; s = rand(n,1); s = round(s); s = (s == 0) .- 1; % Find whether we are better than everything else fitness = SHG(s); if (fitness > best_fitness) best_array = s; best_fitness = fitness % Little hack to display output nicely disp(rot90(s,-1)); endif endwhile