fixed minor oversight with crates
This commit is contained in:
parent
7ee82cce86
commit
3a1f76cb01
6
again.ml
6
again.ml
|
@ -754,7 +754,8 @@ let is_a_crate_nearby (gd : game_data) (dgs : danger_map) =
|
||||||
let nx = gd.players.(pid).xy.x + o * (fst order.(dir))
|
let nx = gd.players.(pid).xy.x + o * (fst order.(dir))
|
||||||
and ny = gd.players.(pid).xy.y + o * (snd order.(dir)) in
|
and ny = gd.players.(pid).xy.y + o * (snd order.(dir)) in
|
||||||
if is_valid nx ny lines cols then begin
|
if is_valid nx ny lines cols then begin
|
||||||
if gd.laby.(nx).(ny) = 2 && not dgs.explodedCrates.(nx).(ny) then begin
|
if gd.laby.(nx).(ny) = 2 then begin
|
||||||
|
if not dgs.explodedCrates.(nx).(ny) then
|
||||||
res := true;
|
res := true;
|
||||||
halt := true
|
halt := true
|
||||||
end
|
end
|
||||||
|
@ -784,7 +785,8 @@ let sees_a_crate (gd : game_data) (dgs : danger_map) (x : int) (y : int) =
|
||||||
let nx = x + o * (fst order.(dir))
|
let nx = x + o * (fst order.(dir))
|
||||||
and ny = y + o * (snd order.(dir)) in
|
and ny = y + o * (snd order.(dir)) in
|
||||||
if is_valid nx ny lines cols then begin
|
if is_valid nx ny lines cols then begin
|
||||||
if gd.laby.(nx).(ny) = 2 && not dgs.explodedCrates.(nx).(ny) then begin
|
if gd.laby.(nx).(ny) = 2 then begin
|
||||||
|
if not dgs.explodedCrates.(nx).(ny) then
|
||||||
res := true;
|
res := true;
|
||||||
halt := true
|
halt := true
|
||||||
end
|
end
|
||||||
|
|
33
entrees.txt
33
entrees.txt
|
@ -1,23 +1,22 @@
|
||||||
180.16800000000111
|
164.0
|
||||||
2
|
2
|
||||||
13 21
|
13 21
|
||||||
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
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
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1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||||
0
|
0
|
||||||
4
|
3
|
||||||
3 6 0 0 2 5 2 2
|
3 10 0 4 3 2 3 1
|
||||||
2 3 1 1 2 4 4 3
|
5 10 2 0 2 3 1 4
|
||||||
3 8 2 3 1 1 1 1
|
7 10 3 3 4 6 2 1
|
||||||
3 9 3 1 1 6 2 1
|
|
||||||
0
|
0
|
||||||
|
|
|
@ -64,6 +64,7 @@ from tkinter import *
|
||||||
import os
|
import os
|
||||||
from playsound import playsound
|
from playsound import playsound
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
import sys
|
||||||
|
|
||||||
def attente(vitesse):
|
def attente(vitesse):
|
||||||
return TEMPS_BASE * 0.9**vitesse
|
return TEMPS_BASE * 0.9**vitesse
|
||||||
|
@ -166,6 +167,7 @@ def affiche_powerup(canvas, couleurPowerup, j, k):
|
||||||
fill="yellow")
|
fill="yellow")
|
||||||
|
|
||||||
def affiche_plateau(canvas, plateau, plateauCouleur, bombes, joueurs, powerups):
|
def affiche_plateau(canvas, plateau, plateauCouleur, bombes, joueurs, powerups):
|
||||||
|
#print('---------IN---------', file=sys.stderr)
|
||||||
canvas.delete(ALL)
|
canvas.delete(ALL)
|
||||||
|
|
||||||
for i in range(len(plateau)):
|
for i in range(len(plateau)):
|
||||||
|
@ -205,6 +207,7 @@ def affiche_plateau(canvas, plateau, plateauCouleur, bombes, joueurs, powerups):
|
||||||
couleurPowerup = COULEURS_POWERUPS[powerups[trouve_objet(i,j, powerups)][PU_NATURE]]
|
couleurPowerup = COULEURS_POWERUPS[powerups[trouve_objet(i,j, powerups)][PU_NATURE]]
|
||||||
affiche_powerup(canvas, couleurPowerup, j, i)
|
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)
|
#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):
|
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+15, y+15, x+TAILLE_TUILE-15, y+TAILLE_TUILE, 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])
|
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):
|
def affiche_infos(canvas, joueurs, plateauCouleur):
|
||||||
|
#print('---------IN2---------', file=sys.stderr)
|
||||||
canvas.delete(ALL)
|
canvas.delete(ALL)
|
||||||
scores = list(reversed((sorted(zip(compte_couleur(plateauCouleur, len(joueurs)), range(len(joueurs)))))))
|
scores = list(reversed((sorted(zip(compte_couleur(plateauCouleur, len(joueurs)), range(len(joueurs)))))))
|
||||||
for k in range(len(scores)):
|
for k in range(len(scores)):
|
||||||
|
@ -312,6 +316,7 @@ def affiche_infos(canvas, joueurs, plateauCouleur):
|
||||||
else:
|
else:
|
||||||
couleur = "gray"
|
couleur = "gray"
|
||||||
trace_bomberman(canvas, 0, HAUTEUR_JOUEUR*k,couleur)
|
trace_bomberman(canvas, 0, HAUTEUR_JOUEUR*k,couleur)
|
||||||
|
#print('---------OUT2---------', file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
def ajoute_evenement(evenements, evenement):
|
def ajoute_evenement(evenements, evenement):
|
||||||
|
@ -507,12 +512,15 @@ def simulation(strategies):
|
||||||
evenement = evenements.pop(0)
|
evenement = evenements.pop(0)
|
||||||
if evenement[0]>TEMPS_PARTIE:
|
if evenement[0]>TEMPS_PARTIE:
|
||||||
return
|
return
|
||||||
|
#print('---------', file=sys.stderr)
|
||||||
execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, joueurs, powerups, pieges)
|
execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, joueurs, powerups, pieges)
|
||||||
affiche_plateau(canvas, plateau, plateauCouleur, bombes, joueurs, powerups)
|
affiche_plateau(canvas, plateau, plateauCouleur, bombes, joueurs, powerups)
|
||||||
affiche_infos(canvasInfosJoueurs, joueurs, plateauCouleur)
|
affiche_infos(canvasInfosJoueurs, joueurs, plateauCouleur)
|
||||||
affiche_empires(canvasInfosJoueurs, joueurs, plateauCouleur) # very laggy for some reason # not anymore
|
affiche_empires(canvasInfosJoueurs, joueurs, plateauCouleur) # very laggy for some reason # not anymore
|
||||||
temps = int((evenements[0][0]-evenement[0])/3*200)
|
temps = int((evenements[0][0]-evenement[0])/3*200)
|
||||||
|
#print(temps)
|
||||||
if temps != 0:
|
if temps != 0:
|
||||||
|
#print('+++++++++', file=sys.stderr)
|
||||||
fenetre.after(temps, pas_de_jeu)
|
fenetre.after(temps, pas_de_jeu)
|
||||||
else:
|
else:
|
||||||
pas_de_jeu()
|
pas_de_jeu()
|
||||||
|
@ -520,7 +528,6 @@ def simulation(strategies):
|
||||||
dimensions = 13,21
|
dimensions = 13,21
|
||||||
positionsInitiales=[(1, 1), (dimensions[0]-2, dimensions[1]-2), (1, dimensions[1]-2), (dimensions[0]-2, 1)]
|
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)
|
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])]
|
plateauCouleur = [[-1 for j in range(dimensions[1])] for i in range(dimensions[0])]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue