from itertools import permutations
import random
import pprint
import timeit
start_time = timeit.default_timer()
count = 0
def gird(board_size):
print ("\n".join('# ' * inrange + 'Q ' + '# ' * (8-inrange-1)\
for inrange in board_size) + "\n\n= = new board \n")
count+=1
coloms = range(8)
for board_size in permutations(coloms):
if 8 == len(set(board_size[inrange]+inrange for inrange in coloms)):
if 8 == len(set(board_size[inrange]-inrange for inrange in coloms)):
gird(board_size)
elapsed = timeit.default_timer() - start_time
print(elapsed)
print(count)
I want to see how many times this code has run. I have to measure the search cost (number of iterations until it hits a minimum) and percentage of solved problems. This is an 8 queen problem.