what have I done ?

This commit is contained in:
Alexandre 2025-01-03 15:23:12 +01:00
parent ef0dcc9e5e
commit f3f26c5284
9 changed files with 37 additions and 35 deletions

BIN
again

Binary file not shown.

BIN
again.cmi

Binary file not shown.

BIN
again.cmx

Binary file not shown.

View File

@ -11,7 +11,7 @@ TODO :
Random.self_init () ;; Random.self_init () ;;
let debug_all = false ;; let debug_all = false ;;
let logg = true ;; let logg = false ;;
let remaining_dash = ref 0. ;; let remaining_dash = ref 0. ;;
@ -693,7 +693,7 @@ let reverse_simulate_bomb (dgs : danger_map) (save : (int * int, float) Hashtbl.
let is_dead (dgs : danger_map) (x : int) (y : int) (t : float) (dt : float) = let is_dead (dgs : danger_map) (x : int) (y : int) (t : float) (dt : float) =
(List.fold_left (* bombs *) (List.fold_left (* bombs *)
(fun acc expl_time -> (fun acc expl_time ->
acc || (t >= expl_time && t <= expl_time +. dt) || (t >= expl_time -. dt && t <= expl_time) acc || (t >= expl_time && t <= expl_time +. dt)(**|| (t >= expl_time -. dt && t <= expl_time)*)
) )
false false
dgs.explosionTimes.(x).(y) dgs.explosionTimes.(x).(y)
@ -708,7 +708,7 @@ let is_dead (dgs : danger_map) (x : int) (y : int) (t : float) (dt : float) =
let is_dead_2 (dgs : danger_map) (x : int) (y : int) (t : float) (dt : float) = let is_dead_2 (dgs : danger_map) (x : int) (y : int) (t : float) (dt : float) =
(List.fold_left (List.fold_left
(fun acc expl_time -> (fun acc expl_time ->
acc || (t >= expl_time && t <= expl_time +. dt) || (t >= expl_time -. dt && t <= expl_time) acc || (t >= expl_time && t <= expl_time +. dt)(* || (t >= expl_time -. dt && t <= expl_time)*)
) )
false false
dgs.explosionTimes.(x).(y) dgs.explosionTimes.(x).(y)
@ -1384,7 +1384,7 @@ let gain_map = generate_gain_map game_map danger_data ;;
get_rem_dash ("again"^(string_of_int game_map.player_id)^".sav") ;; get_rem_dash ("again"^(string_of_int game_map.player_id)^".sav") ;;
Printf.fprintf stderr "\n" ;; (*Printf.fprintf stderr "\n" ;;*)
if game_map.player_id = 4 then begin if game_map.player_id = 4 then begin
for l = 0 to Array.length gain_map -1 do for l = 0 to Array.length gain_map -1 do
for c = 0 to Array.length gain_map.(l) -1 do for c = 0 to Array.length gain_map.(l) -1 do

BIN
again.o

Binary file not shown.

View File

@ -1,28 +1,27 @@
89.0 122.20000000000016
1 1
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 3 3 3 3 3 0 2 2 2 2 2 0 5 5 5 5 5 5 5 1 1 3 3 3 3 3 0 2 2 2 2 0 5 5 5 5 5 5 5 5 1
1 3 1 3 1 0 1 2 1 2 1 2 1 0 1 5 1 5 1 5 1 1 3 1 3 1 2 1 2 1 2 1 2 1 0 1 5 1 4 1 5 1
1 6 3 3 3 0 2 2 2 2 2 2 2 0 5 5 5 5 5 5 1 1 3 3 3 3 3 0 2 2 2 2 2 0 4 4 4 4 4 5 5 1
1 6 1 3 1 2 1 2 1 2 1 2 1 2 1 5 1 5 1 5 1 1 3 1 3 1 2 1 2 1 2 1 2 1 0 1 5 1 4 1 4 1
1 3 3 3 3 0 2 2 2 2 2 2 2 2 2 0 0 5 5 5 1 1 3 3 3 3 0 2 2 2 2 2 2 2 2 2 0 0 4 4 4 1
1 6 1 3 1 2 1 2 1 2 1 2 1 2 1 2 1 5 1 5 1 1 3 1 3 1 0 1 2 1 2 1 2 1 2 1 4 1 4 1 4 1
1 6 6 3 6 2 2 2 2 2 2 2 2 2 2 0 4 4 4 4 1 1 3 3 3 6 6 0 2 2 2 2 2 2 0 4 4 4 4 4 4 1
1 6 1 6 1 2 1 2 1 2 1 2 1 2 1 0 1 4 1 4 1 1 6 1 0 1 0 1 2 1 2 1 2 1 2 1 4 1 4 1 4 1
1 6 6 6 6 0 2 2 2 2 2 2 2 2 0 4 4 4 4 4 1 1 6 6 6 6 0 2 2 2 2 2 2 0 4 4 4 4 4 4 4 1
1 6 1 6 1 0 1 2 1 2 1 2 1 2 1 4 1 4 1 4 1 1 6 1 6 1 0 1 2 1 2 1 2 1 0 1 4 1 4 1 4 1
1 6 6 6 6 6 0 2 2 2 2 2 2 2 0 4 4 4 4 4 1 1 6 6 6 6 6 0 2 2 2 0 4 4 4 4 4 4 4 4 4 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
2 1
11 14 2 89.5 5 16 4 122.30000000000013
5 15 1 93.10000000000008 1
2 7 14 1 1 3 4 0 0
9 17 1 0 3 2 0 2 6
3 15 2 1 2 1 1 0 6 5 4
5
1 6 3 1 6 3
10 5 0 9 12 4
9 14 2 10 13 2
8 15 0 7 13 0
1 12 3 2 13 4

View File

@ -294,7 +294,7 @@ int get_data(char* filename, int** board, bool* ended) {
*ended = true ; *ended = true ;
} }
fprintf(stderr, "(%d, %d, %d, %d, %d)\n", cur_t, maze_w, maze_h, nbombs, nplayers); //fprintf(stderr, "(%d, %d, %d, %d, %d)\n", cur_t, maze_w, maze_h, nbombs, nplayers);
fclose(ptr) ; fclose(ptr) ;
return cur_t ; return cur_t ;
@ -360,6 +360,9 @@ void update_graph(SDL_Renderer* renderer, int** board, int current_time) {
int yc = convex_pt(bot_y, top_y, 1.0f - ((float)(max(0, board[tmax][pl])))/((float)(max_val+1))) ; int yc = convex_pt(bot_y, top_y, 1.0f - ((float)(max(0, board[tmax][pl])))/((float)(max_val+1))) ;
drawIntegerToRenderer(renderer, mval, 2, right_x+2-20*(-1+ln_b(10, mval)), yc+14-2*2, 14, 14, 255*(pl==0)+192*(pl==3), 255*(pl==2)+192*(pl==3), 255*(pl==1), 128) ; drawIntegerToRenderer(renderer, mval, 2, right_x+2-20*(-1+ln_b(10, mval)), yc+14-2*2, 14, 14, 255*(pl==0)+192*(pl==3), 255*(pl==2)+192*(pl==3), 255*(pl==1), 128) ;
} }
drawIntegerToRenderer(renderer, current_time, 2, 375, 105/3+3, 75/3, 105/3, 0, 0, 0, SDL_ALPHA_OPAQUE);
updateRenderer(renderer) ; updateRenderer(renderer) ;
} }

BIN
graphs

Binary file not shown.

View File

@ -383,7 +383,7 @@ def execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, jo
elif joueurs[indiceJoueur][J_PIEGESRESTANTS]>0 and action == A_PIEGE: elif joueurs[indiceJoueur][J_PIEGESRESTANTS]>0 and action == A_PIEGE:
joueur[J_PIEGESRESTANTS]-=1 joueur[J_PIEGESRESTANTS]-=1
pieges.append([i,j,indiceJoueur]) pieges.append([i,j,indiceJoueur])
print("||||| trap at", i, j, "|||||") #print("||||| trap at", i, j, "|||||")
i, j = joueur[J_LIGNE], joueur[J_COLONNE] i, j = joueur[J_LIGNE], joueur[J_COLONNE]
indicePiege = trouve_objet(i,j, pieges) indicePiege = trouve_objet(i,j, pieges)
@ -392,16 +392,16 @@ def execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, jo
piege = pieges[indicePiege] piege = pieges[indicePiege]
if piege[P_JOUEUR] != indiceJoueur: if piege[P_JOUEUR] != indiceJoueur:
penalite = 3 penalite = 3
print(indiceJoueur, "|||||||| has triggered", piege[P_JOUEUR], "'s trap (at", i, j, ")||||||||") print("[CONSOLE]", indiceJoueur, "has triggered", piege[P_JOUEUR], "'s trap (at", i, j, "), time =", temps, ")")
pieges.pop(indicePiege) pieges.pop(indicePiege)
ip,jp = prochain(i,j,direction) ip,jp = prochain(i,j,direction)
if plateau[ip][jp]==PLATEAU_VIDE and trouve_objet(ip, jp, bombes)==None and penalite==0: if plateau[ip][jp]==PLATEAU_VIDE and trouve_objet(ip, jp, bombes)==None and penalite==0:
print(joueur[J_LIGNE], joueur[J_COLONNE], "--->", ip, jp) #print(joueur[J_LIGNE], joueur[J_COLONNE], "--->", ip, jp)
joueur[J_LIGNE]=ip joueur[J_LIGNE]=ip
joueur[J_COLONNE]=jp joueur[J_COLONNE]=jp
else: #else:
print("still") #print("still")
i, j = joueur[J_LIGNE], joueur[J_COLONNE] i, j = joueur[J_LIGNE], joueur[J_COLONNE]
indicePowerup = trouve_objet(i,j,powerups) indicePowerup = trouve_objet(i,j,powerups)
@ -458,7 +458,7 @@ def execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, jo
indiceJoueur = trouve_objet(i,j,joueurs) indiceJoueur = trouve_objet(i,j,joueurs)
while indiceJoueur != None: while indiceJoueur != None:
joueurs[indiceJoueur] = None joueurs[indiceJoueur] = None
print("\n--------------------------------------------------------------------------------------------------------\n\nDEATH (at time =", evenement[0], "):", indiceJoueur, "\n\n--------------------------------------------------------------------------------------------------------\n") print("[CONSOLE] DEATH (time =", evenement[0], "):", indiceJoueur, "\n")
#assert(false) #assert(false)
indiceJoueur = trouve_objet(i,j,joueurs) indiceJoueur = trouve_objet(i,j,joueurs)
@ -580,7 +580,7 @@ def simulation(strategies):
joueurs = [] joueurs = []
for i in range(len(strategies)): for i in range(len(strategies)):
joueur = [positionsInitiales[i][0], positionsInitiales[i][1], strategies[i], 0, 1, 1, 1, 1, 0, 0, 0] joueur = [positionsInitiales[i][0], positionsInitiales[i][1], strategies[i], 0, 1, 1, 1, 0, 0, 0, 0]
joueurs.append(joueur) joueurs.append(joueur)
ajoute_evenement(evenements, [0., EVENEMENT_TOUR_JOUEUR, i]) ajoute_evenement(evenements, [0., EVENEMENT_TOUR_JOUEUR, i])