Skip to content
Snippets Groups Projects
Commit f405dba3 authored by Dolleans Geoffrey's avatar Dolleans Geoffrey
Browse files

probleme

parent b3990f2d
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ import time
RED = (255, 0, 0)
GREEN = (0, 255, 255)
BLACK = (0, 0, 0)
WHITE = (0, 0, 0)
WHITE = (255, 255, 255)
#création de la classe cellule
class cell:
......@@ -52,8 +52,7 @@ def count_voisin(cell, universe):
for j in range(-1, 2):
if i !=0 and j!=0:
dx, dy = wrap_around(x+i, y+j, size)
if universe[dx][dy].etat == 1:
cell.voisin += 1
cell.voisin += universe[dx][dy].etat
def update(universe):
for x in range (len(universe)):
......@@ -62,7 +61,7 @@ def update(universe):
def decide_colour_nxt_state(cell):
"""change l'état de la cellule si nécessaire et renvoie la couleur qui la rpz"""
if cell.etat:
if cell.etat == 1:
if cell.voisin == 2 or cell.voisin == 3:
"la cellule survie, on reset le nombre de voisin vivant"
cell.voisin = 0
......@@ -93,7 +92,7 @@ def play():
mainsrf = pygame.Surface((500, 500))
mainsrf.fill(WHITE)
universe = generate(size)
#game cycle
time.sleep(5)
while 1:
#tracking quitting
for event in pygame.event.get():
......@@ -108,5 +107,6 @@ def play():
scrn.blit(mainsrf, (0, 0))
pygame.display.update()
time.sleep(1)
if __name__ == "__main__":
play()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment