Skip to content
Snippets Groups Projects
Commit 998c0ee1 authored by Boujerfaoui Yassine's avatar Boujerfaoui Yassine
Browse files

Merge branch 'master' of...

Merge branch 'master' of gitlab-student.centralesupelec.fr:2018boujerfay/coding-week-gol-dolleans-boujerfaoui
parents 32637e40 2f51008a
No related branches found
No related tags found
No related merge requests found
......@@ -3,12 +3,12 @@ from game_of_life.generate_universe import *
from game_of_life.generation import *
from game_of_life.survival import *
from game_of_life.add_seed import *
from game_of_life.Affichage_universe import *
import random as rd
fenetre = Tk()
game_of_life = Toplevel(fenetre)
game_of_life.grid()
universe = generate_universe((100,100))
canvas = Canvas(game_of_life)
canvas.pack()
......@@ -18,6 +18,9 @@ ligne_texte.pack()
def create_a_grid():
"""create the grid for the graphic interface"""
global universe
print("création de la grille")
universe = generate_universe((100,100))
width = game_of_life.winfo_width()
height = game_of_life.winfo_height()
global zones #contient l'ensemble des zones representant des cellules
......@@ -31,19 +34,19 @@ def create_a_grid():
zones[x].append(canvas.create_rectangle(x*width/100,(x+1)*width/100,y*width/100,(y+1)*width/100, fill="white"))
def update_grid():
"""mets la grille a jours """
"""met la grille a jours """
global universe
for x in range(len(universe)):
for y in range (len(universe[0])):
if universe[x][y] == 0:
if naissance(universe[x][y]) == 1:
if naissance(universe,(x,y)) == 1:
"colorier la case zones[x][y] en vert"
canvas.itemconfig(zones[x][y], fill="green")
else:
"colorier la case zones[x][y] en blanc"
canvas.itemconfig(zones[x][y], fill="white")
else:
if survival(universe[x][y]) == 0:
if survival(universe,(x,y)) == 0:
"colorier la case zones[x][y] en rouge"
canvas.itemconfig(zones[x][y], fill="red")
else:
......@@ -82,6 +85,4 @@ create_a_grid()
canvas.bind("<Button-1>", create_cell_on_click)
fenetre.mainloop()
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