1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
flag = False
test3=0
DATA =[
['a8','b8','c8','d8','e8','f8','g8','h8'],
['a7','b7','c7','d7','e7','f7','g7','h7'],
['a6','b6','c6','d6','e6','f6','g6','h6'],
['a5','b5','c5','d5','e5','f5','g5','h5'],
['a4','b4','c4','d4','e4','f4','g4','h4'],
['a3','b3','c3','d3','e3','f3','g3','h3'],
['a2','b2','c2','d2','e2','f2','g2','h2'],
['a1','b1','c1','d1','e1','f1','g1','h1'],]
while 1: #Pas encore mis de condition ici..
for i in range(0,8):
for j in range(0,8):
flag = True
DATA[i][j]='1'
for test in range(0,8): #Test Colonne
if DATA[i][test]=='1' and test!= j:
DATA[i][j]='0'
for test2 in range(0,8):#Test Ligne
if DATA[test2][j]=='1' and test2!= i:
DATA[i][j]='0'
while i+test3!=7 and j+test3!=7 and flag == True: #Test Diago Bas/Droite
test3 += 1
if DATA[i+test3][j+test3]=='1':
DATA[i][j]='0'
test3=0
flag = False
test3=0
while i+test3!=0 and j+test3!=0 and flag == True :#Test Diago Haut/Gauche
test3 -= 1
if DATA[i+test3][j+test3]=='1':
DATA[i][j]='0'
flag = False
test3=0
print(DATA) #La il me faudrait une condition qui affiche que les solutions avec 8 Pions présents sur la grille. |
Partager