players now cannot walk on bombs

This commit is contained in:
Alexandre 2024-11-15 07:58:55 +01:00
parent 523a9c78f7
commit c6dcd8cfd2
6 changed files with 45 additions and 39 deletions

BIN
again

Binary file not shown.

BIN
again.cmi

Binary file not shown.

BIN
again.cmo

Binary file not shown.

View File

@ -372,6 +372,7 @@ let build_danger_map (gd : game_data) =
and by = gd.players.(p).xy.y in
let bsize = gd.players.(p).bomb_radius
and dtime = min (gd.dt +. 5.5) (min (List.fold_left min (gd.dt +. 1000.) res.explosionTimes.(bx).(by)) (List.fold_left min (gd.dt +. 1000.) res.playersTimes.(bx).(by))) in
if dtime <> gd.dt +. 5.5 then begin
for dir = 0 to 3 do
for w = 0 to bsize do
if (not !halt) && (w > 0 || dir = 0) then begin
@ -392,6 +393,7 @@ let build_danger_map (gd : game_data) =
halt := false ;
done
end
end
done;
(* add bonuses *)
@ -563,7 +565,11 @@ let bfs_for_crate (gd : game_data) (dgs : danger_map) (x0 : int) (y0 : int) (sti
if is_valid x y lines cols && gd.laby.(x).(y) <> 1 && gd.laby.(x).(y) <> 2 then begin (* within the map *)
if Hashtbl.find_opt visited (x, y, polar) = None then begin (* has not been visited yet *)
Hashtbl.add visited (x, y, polar) 1 ;
if not (is_dead_all dgs x y ct interval ignorePlayers) && ct < stime +. (float_of_int maxDist) *. interval then begin (* is not lethal *)
if
not (is_dead_all dgs x y ct interval ignorePlayers) &&
ct < stime +. (float_of_int maxDist) *. interval &&
not (Array.fold_left (fun acc (b : bomb) -> acc || (b.xy.x = x && b.xy.y = y)) false gd.bombs)
then begin (* is not lethal *)
if
(ct >= stime +. (float_of_int minDist) *. interval) &&
(is_empty_lst dgs.explosionTimes.(x).(y)) && (* safe *)

View File

@ -1,24 +1,23 @@
85.0
3
157.4200000000005
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 3 3 3 6 6 6 0 2 2 2 2 0 5 5 5 5 5 5 5 1
1 3 1 3 1 6 1 2 1 0 1 2 1 2 1 5 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