3 ms·
Solving magic squares I wrote a solver (conventional style) in Ruby that could solve squares in about 30 minutes, and I was pretty pleased with that, so I chal
by cubicle67 16y ago
Solving magic squares
I wrote a solver (conventional style) in Ruby that could solve squares in about 30 minutes, and I was pretty pleased with that, so I challenged a friend of mine to beat me.
He came back an hour later claiming he had code that could solve it in under 10s. He'd written a genetic algorithm that solved squares on my machine in about 6s and in only about 30 lines of Java (less than my Ruby). I was pretty humbled