Optimisation
logopolop
-
logopolop -
logopolop -
Bonjour,
je poste ce message car je me retrouve bloquer car je n'arrive pas a construire une boucle... oui ca peut sembler simplet et pourtant..
voila un peu le genre de boucle que je voudrais, en fait je cherche dans une grille les cases adjacente a un pion ou il n'ay a pas d'autres pions, une cases libre quoi
mais sur toute la ligne. Et la ca coince. voila mn code pour la fonction : (code juste pour montrer la logique de la recherche)
je poste ce message car je me retrouve bloquer car je n'arrive pas a construire une boucle... oui ca peut sembler simplet et pourtant..
voila un peu le genre de boucle que je voudrais, en fait je cherche dans une grille les cases adjacente a un pion ou il n'ay a pas d'autres pions, une cases libre quoi
mais sur toute la ligne. Et la ca coince. voila mn code pour la fonction : (code juste pour montrer la logique de la recherche)
def checkCase(i,j):
global coordPossibleCoup
coordPossibleCoup = []
test = i-1
if test in range(nb) and (test,j) != citadelle:
if (test,j) not in coordJoueurBlanc:
if (test,j) not in coordJoueurNoir:
can.create_rectangle(x0+c*test,y0+c*j, x0+c*(test+1), y0+c*(j+1),outline="green", width=5)
coordPossibleCoup += [(test,j),]
test = test-1
if test in range(nb) and (test,j) != citadelle:
if (test,j) not in coordJoueurBlanc:
if (test,j) not in coordJoueurNoir:
can.create_rectangle(x0+c*test,y0+c*j, x0+c*(test+1), y0+c*(j+1),outline="green", width=5)
coordPossibleCoup += [(test,j),]
test = i+1
if test in range(nb) and (test,j) != citadelle:
if (test,j) not in coordJoueurBlanc:
if (test,j) not in coordJoueurNoir:
can.create_rectangle(x0+c*test,y0+c*j, x0+c*(test+1), y0+c*(j+1),outline="green", width=5)
coordPossibleCoup += [(test,j),]
test = j-1
if test in range(nb) and (i,test) != citadelle:
if (i,test) not in coordJoueurBlanc:
if (i,test) not in coordJoueurNoir:
can.create_rectangle(x0+c*i,y0+c*test, x0+c*(i+1), y0+c*(test+1),outline="green", width=5)
coordPossibleCoup += [(i,test),]
test = j+1
if test in range(nb) and (i,test) != citadelle:
if (i,test) not in coordJoueurBlanc:
if (i,test) not in coordJoueurNoir:
can.create_rectangle(x0+c*i,y0+c*test, x0+c*(i+1), y0+c*(test+1),outline="green", width=5)
coordPossibleCoup += [(i,test),]
if coordPossibleCoup == []:
affichage.delete("0.0",END)
affichage.insert(END,"Ce pion ne peut pas bouger.")
return False
return True
A voir également:
- Optimisation
- Optimisation pc - Accueil - Utilitaires
- Optimisation découpe panneau gratuit - Télécharger - Outils professionnels
- Optimisation windows 10 - Guide
- Logiciel optimisation tournée livraison - Forum iPhone
- Optimisation de livraison - Forum Windows 10
1 réponse
Resolu !
la reponse si jmais ca interesse :
la reponse si jmais ca interesse :
test = i-1
for count in range(i):
if test in range(nb) and (test,j) != citadelle:
if (test,j) not in coordJoueurBlanc:
if (test,j) not in coordJoueurNoir:
can.create_rectangle(x0+c*test,y0+c*j, x0+c*(test+1), y0+c*(j+1),outline="green", width=5)
coordPossibleCoup += [(test,j),]
test = test-1