Update ARE-DYNAMIC.py
This commit is contained in:
parent
a3f161a749
commit
259b4379e6
|
@ -151,7 +151,7 @@ def partie8tours(x,y):
|
|||
"""
|
||||
for i in range (-1,2):
|
||||
for j in range (-1,2): #(i,j) sont les coordonnées de l'adversaire
|
||||
if (0 <= x+i and x+i < len(Grille)) and (0 <= y+j and y+j < len(Grille[0])) and i != 0 and j != 0:
|
||||
if (0 <= x+i and x+i < TailleGrilleX) and (0 <= y+j and y+j < TailleGrilleY) and i != 0 and j != 0:
|
||||
partie1v1(Grille[x][y], Grille[x+i][y+j])
|
||||
|
||||
def partie_globale():
|
||||
|
@ -161,8 +161,8 @@ def partie_globale():
|
|||
|
||||
global Grille
|
||||
|
||||
for i in range(len(Grille)):
|
||||
for j in range(len(Grille[0])):
|
||||
for i in range(TailleGrilleX):
|
||||
for j in range(TailleGrilleY):
|
||||
partie8tours(i,j)
|
||||
|
||||
# Changement des stratégies
|
||||
|
@ -177,14 +177,14 @@ def partie_globale():
|
|||
new_strat = copie_grille[x][y]["strategie"]
|
||||
for i in range (-1,2):
|
||||
for j in range (-1,2): #(x+i,y+j) : adversaires autour de (x,y)
|
||||
if (0 <= x+i and x+i < len(Grille)) and (0 <= y+j and y+j < len(Grille[0])) and i != 0 and j != 0:
|
||||
if (0 <= x+i and x+i < TailleGrilleX) and (0 <= y+j and y+j < TailleGrilleY) and i != 0 and j != 0:
|
||||
if min_prison > copie_grille[x+i][y+j]["annees_de_prison"]:
|
||||
new_strat = copie_grille[x+i][y+j]["strategie"]
|
||||
Grille[x][y]["strategie"] = new_strat # on modifie la stratégie du joueur dans la Grille et pas dans la copie
|
||||
|
||||
# Réinitialisation du nb d'années de prison
|
||||
for i in range(len(Grille)):
|
||||
for j in range(len(Grille[0])):
|
||||
for i in range(TailleGrilleX):
|
||||
for j in range(TailleGrilleY):
|
||||
Grille[i][j]['annees_de_prison'] = 0
|
||||
|
||||
return Grille
|
||||
|
|
Loading…
Reference in New Issue