Infinite Queen Problem
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams
rcParams['figure.figsize'] = 10, 10
dim=100;
coor_list = [[0,0]]
len(coor_list)
for j in np.arange(dim):
for i in np.arange(dim/2):
# print(i,j)
# length = len(coor_list) # total length of current coordinate list
flag = 1
for ele in coor_list:
flag = flag * (i-ele[0]) * (j-ele[1]) * (i+ele[0]-j-ele[1])
# print(" ", flag)
if flag != 0:
coor_list.append([i,j])
coor_list.append([j,i])
print(" ",[i,j],[j,i])
print(coor_list)
x = np.arange(dim)
points=np.transpose( coor_list )
plt.plot(points[0],points[1],'s',markersize=1)
plt.plot(x,0.618*x)
plt.plot(x,x)
plt.grid(True)
plt.show()
plt.savefig('plot.png')