Solving N-queens problem for N=40 + terminating when energy of best solution < ANSWER_ENERGY_THRESHOLD