diff --git a/again b/again index dbdc889..91b5cbc 100755 Binary files a/again and b/again differ diff --git a/again.cmi b/again.cmi index 62ce127..d0fb4ca 100644 Binary files a/again.cmi and b/again.cmi differ diff --git a/again.cmx b/again.cmx index 35f281e..e80fd65 100644 Binary files a/again.cmx and b/again.cmx differ diff --git a/again.ml b/again.ml index 632e4f9..fece1cd 100644 --- a/again.ml +++ b/again.ml @@ -754,8 +754,9 @@ let is_a_crate_nearby (gd : game_data) (dgs : danger_map) = let nx = gd.players.(pid).xy.x + o * (fst order.(dir)) and ny = gd.players.(pid).xy.y + o * (snd order.(dir)) in if is_valid nx ny lines cols then begin - if gd.laby.(nx).(ny) = 2 && not dgs.explodedCrates.(nx).(ny) then begin - res := true; + if gd.laby.(nx).(ny) = 2 then begin + if not dgs.explodedCrates.(nx).(ny) then + res := true; halt := true end else if gd.laby.(nx).(ny) = 1 then @@ -784,8 +785,9 @@ let sees_a_crate (gd : game_data) (dgs : danger_map) (x : int) (y : int) = let nx = x + o * (fst order.(dir)) and ny = y + o * (snd order.(dir)) in if is_valid nx ny lines cols then begin - if gd.laby.(nx).(ny) = 2 && not dgs.explodedCrates.(nx).(ny) then begin - res := true; + if gd.laby.(nx).(ny) = 2 then begin + if not dgs.explodedCrates.(nx).(ny) then + res := true; halt := true end else if gd.laby.(nx).(ny) = 1 then diff --git a/again.o b/again.o index d540821..e282706 100644 Binary files a/again.o and b/again.o differ diff --git a/entrees.txt b/entrees.txt index 563e565..87ff3b9 100644 --- a/entrees.txt +++ b/entrees.txt @@ -1,23 +1,22 @@ -180.16800000000111 +164.0 2 13 21 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 4 4 4 4 4 4 4 0 0 0 6 6 6 6 6 6 6 6 5 1 -1 3 1 3 1 4 1 4 1 3 1 5 1 6 1 5 1 5 1 5 1 -1 3 0 3 0 4 6 6 6 3 6 5 6 6 6 6 6 6 5 5 1 -1 3 1 3 1 4 1 4 1 3 1 6 1 6 1 4 1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ge2024_bomberman_tkinter.py +++ b/iachallenge2024_bomberman_tkinter.py @@ -64,6 +64,7 @@ from tkinter import * import os from playsound import playsound from threading import Thread +import sys def attente(vitesse): return TEMPS_BASE * 0.9**vitesse @@ -166,6 +167,7 @@ def affiche_powerup(canvas, couleurPowerup, j, k): fill="yellow") def affiche_plateau(canvas, plateau, plateauCouleur, bombes, joueurs, powerups): + #print('---------IN---------', file=sys.stderr) canvas.delete(ALL) for i in range(len(plateau)): @@ -205,7 +207,8 @@ def affiche_plateau(canvas, plateau, plateauCouleur, bombes, joueurs, powerups): couleurPowerup = COULEURS_POWERUPS[powerups[trouve_objet(i,j, powerups)][PU_NATURE]] affiche_powerup(canvas, couleurPowerup, j, i) #canvas.create_polygon(j*TAILLE_TUILE+TAILLE_TUILE/2, i*TAILLE_TUILE, j*TAILLE_TUILE, i*TAILLE_TUILE+TAILLE_TUILE/2, j*TAILLE_TUILE+TAILLE_TUILE/2, (i+1)*TAILLE_TUILE, (j+1)*TAILLE_TUILE, i*TAILLE_TUILE + TAILLE_TUILE/2, fill=couleurPowerup) - + #print('---------OUT---------', file=sys.stderr) + def trace_bomberman(canvas, x, y, couleur): canvas.create_oval(x+15, y+15, x+TAILLE_TUILE-15, y+TAILLE_TUILE, fill=couleur) canvas.create_oval(x+10, y, x+TAILLE_TUILE-10, y+TAILLE_TUILE-20, fill=couleur) @@ -237,6 +240,7 @@ def affiche_empires(canvas, joueurs, plateauCouleur): canvas.create_text(X0_EMPIRES + X_LARGEUR_EMPIRES/2, Y0_EMPIRES + k*Y_STEP_CLAIMS, text=str(scores[k]), fill=COULEURS_JOUEURS[k]) def affiche_infos(canvas, joueurs, plateauCouleur): + #print('---------IN2---------', file=sys.stderr) canvas.delete(ALL) scores = list(reversed((sorted(zip(compte_couleur(plateauCouleur, len(joueurs)), range(len(joueurs))))))) for k in range(len(scores)): @@ -312,6 +316,7 @@ def affiche_infos(canvas, joueurs, plateauCouleur): else: couleur = "gray" trace_bomberman(canvas, 0, HAUTEUR_JOUEUR*k,couleur) + #print('---------OUT2---------', file=sys.stderr) def ajoute_evenement(evenements, evenement): @@ -500,19 +505,22 @@ def decision(programme, indiceJoueur, plateau, plateauCouleur, bombes, joueurs, direction, b = sortie.readline().split() action = int(b) return int(direction), action - + def simulation(strategies): def pas_de_jeu(): if len(joueurs) - joueurs.count(None) > 0: evenement = evenements.pop(0) if evenement[0]>TEMPS_PARTIE: return + #print('---------', file=sys.stderr) execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, joueurs, powerups, pieges) affiche_plateau(canvas, plateau, plateauCouleur, bombes, joueurs, powerups) affiche_infos(canvasInfosJoueurs, joueurs, plateauCouleur) affiche_empires(canvasInfosJoueurs, joueurs, plateauCouleur) # very laggy for some reason # not anymore temps = int((evenements[0][0]-evenement[0])/3*200) + #print(temps) if temps != 0: + #print('+++++++++', file=sys.stderr) fenetre.after(temps, pas_de_jeu) else: pas_de_jeu() @@ -520,7 +528,6 @@ def simulation(strategies): dimensions = 13,21 positionsInitiales=[(1, 1), (dimensions[0]-2, dimensions[1]-2), (1, dimensions[1]-2), (dimensions[0]-2, 1)] - plateau = cree_plateau_initial(dimensions[0]-2, dimensions[1]-2, 20) plateauCouleur = [[-1 for j in range(dimensions[1])] for i in range(dimensions[0])]