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 2 1 2 1 5 1 5 1 5 1 4 1 +1 3 3 3 0 2 2 2 2 2 2 2 2 5 5 5 5 5 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -4 -7 8 3 165.48950000000036 -3 11 2 166.5 -1 13 3 167.44000000000028 -9 9 3 168.7700000000004 +2 +11 14 2 110.22000000000013 +9 5 4 112.5 3 -11 9 0 4 0 3 2 2 -3 15 2 0 1 2 1 4 -4 9 3 2 2 2 2 1 -0 +8 5 0 0 2 4 1 1 +8 15 1 2 2 2 2 2 +9 15 2 1 3 2 0 0 +2 +9 11 0 +7 14 4 diff --git a/iachallenge2024_bomberman_tkinter.py b/iachallenge2024_bomberman_tkinter.py index 2e06957..14a8bfe 100644 --- a/iachallenge2024_bomberman_tkinter.py +++ b/iachallenge2024_bomberman_tkinter.py @@ -59,6 +59,7 @@ PU_NATURE = 2 from random import randrange from copy import deepcopy +import subprocess from tkinter import * import os @@ -215,7 +216,24 @@ def compte_couleur(grille, nbJoueurs): if couleur >= 0: compteurs[couleur]+=1 return compteurs - + +def ln_b(n, b): + if(n < b): + return 0 + else: + return 1 + ln_b(n/b, b) + +def affiche_empires(canvas, joueurs, plateauCouleur): + scores = compte_couleur(plateauCouleur, len(joueurs)) + canvas.create_polygon( + 0, 0, + 0 + X_LARGEUR_EMPIRES, 0, + 0 + X_LARGEUR_EMPIRES, 0 + Y_LARGEUR_EMPIRES, + 0, 0 + Y_LARGEUR_EMPIRES, + fill="black") + for k in range(len(scores)): + canvas.create_text(X_LARGEUR_EMPIRES/2, Y0_EMPIRES + k*Y_STEP_CLAIMS, text=str(scores[k]), fill=COULEURS_JOUEURS[k]) + def affiche_infos(canvas, joueurs, plateauCouleur): canvas.delete(ALL) scores = list(reversed((sorted(zip(compte_couleur(plateauCouleur, len(joueurs)), range(len(joueurs))))))) @@ -292,8 +310,8 @@ def affiche_infos(canvas, joueurs, plateauCouleur): else: couleur = "gray" trace_bomberman(canvas, 0, HAUTEUR_JOUEUR*k,couleur) - - + + def ajoute_evenement(evenements, evenement): for i in range(0,len(evenements)): if evenement[0] sortie.txt") + #subprocess.run("cat entrees.txt | "+programme+" > sortie.txt") elif os.name =="nt": os.system('type entrees.txt | python '+programme[2:]+ ' >sortie.txt') + #subprocess.run('type entrees.txt | python '+programme[2:]+ ' >sortie.txt') with open("sortie.txt", "r") as sortie: direction, b = sortie.readline().split() action = int(b) @@ -472,6 +499,7 @@ def simulation(strategies): return execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, joueurs, powerups, pieges) affiche_plateau(canvas, plateau, plateauCouleur, bombes, joueurs, powerups) + affiche_empires(canvasInfosLand, joueurs, plateauCouleur) # very laggy for some reason affiche_infos(canvasInfosJoueurs, joueurs, plateauCouleur) temps = int((evenements[0][0]-evenement[0])/3*200) if temps != 0: @@ -507,9 +535,13 @@ def simulation(strategies): canvasInfosJoueurs = Canvas(width = LARGEUR_INFOS, height=len(joueurs)*HAUTEUR_JOUEUR) canvasInfosJoueurs.pack() + canvasInfosLand = Canvas(width = X_LARGEUR_EMPIRES, height=Y_LARGEUR_EMPIRES) + canvasInfosLand.pack() + pas_de_jeu() fenetre.mainloop() return +#simulation(["./again", "./again"]) simulation(["./again", "./again", "./again", "./again"]) diff --git a/sortie.txt b/sortie.txt index e69de29..4a3b60a 100644 --- a/sortie.txt +++ b/sortie.txt @@ -0,0 +1 @@ +0 0 \ No newline at end of file