players now cannot walk on bombs
This commit is contained in:
parent
523a9c78f7
commit
c6dcd8cfd2
42
again.ml
42
again.ml
|
@ -372,25 +372,27 @@ let build_danger_map (gd : game_data) =
|
||||||
and by = gd.players.(p).xy.y in
|
and by = gd.players.(p).xy.y in
|
||||||
let bsize = gd.players.(p).bomb_radius
|
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
|
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
|
||||||
for dir = 0 to 3 do
|
if dtime <> gd.dt +. 5.5 then begin
|
||||||
for w = 0 to bsize do
|
for dir = 0 to 3 do
|
||||||
if (not !halt) && (w > 0 || dir = 0) then begin
|
for w = 0 to bsize do
|
||||||
let nx = bx + w * (fst order.(dir))
|
if (not !halt) && (w > 0 || dir = 0) then begin
|
||||||
and ny = by + w * (snd order.(dir)) in
|
let nx = bx + w * (fst order.(dir))
|
||||||
if is_valid nx ny lines cols then begin
|
and ny = by + w * (snd order.(dir)) in
|
||||||
if (gd.laby.(nx).(ny) = 0 || gd.laby.(nx).(ny) >= 3) || (gd.laby.(nx).(ny) = 2 && res.explodedCrates.(nx).(ny)) then
|
if is_valid nx ny lines cols then begin
|
||||||
res.playersTimes.(nx).(ny) <- (dtime)::(res.playersTimes.(nx).(ny))
|
if (gd.laby.(nx).(ny) = 0 || gd.laby.(nx).(ny) >= 3) || (gd.laby.(nx).(ny) = 2 && res.explodedCrates.(nx).(ny)) then
|
||||||
else if gd.laby.(nx).(ny) = 1 then
|
res.playersTimes.(nx).(ny) <- (dtime)::(res.playersTimes.(nx).(ny))
|
||||||
halt := true
|
else if gd.laby.(nx).(ny) = 1 then
|
||||||
else if gd.laby.(nx).(ny) = 2 then begin
|
halt := true
|
||||||
halt := true ;
|
else if gd.laby.(nx).(ny) = 2 then begin
|
||||||
res.explodedCrates.(nx).(ny) <- true ;
|
halt := true ;
|
||||||
|
res.explodedCrates.(nx).(ny) <- true ;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
done;
|
||||||
done;
|
halt := false ;
|
||||||
halt := false ;
|
done
|
||||||
done
|
end
|
||||||
end
|
end
|
||||||
done;
|
done;
|
||||||
|
|
||||||
|
@ -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 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 *)
|
if Hashtbl.find_opt visited (x, y, polar) = None then begin (* has not been visited yet *)
|
||||||
Hashtbl.add visited (x, y, polar) 1 ;
|
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
|
if
|
||||||
(ct >= stime +. (float_of_int minDist) *. interval) &&
|
(ct >= stime +. (float_of_int minDist) *. interval) &&
|
||||||
(is_empty_lst dgs.explosionTimes.(x).(y)) && (* safe *)
|
(is_empty_lst dgs.explosionTimes.(x).(y)) && (* safe *)
|
||||||
|
|
41
entrees.txt
41
entrees.txt
|
@ -1,24 +1,23 @@
|
||||||
85.0
|
157.4200000000005
|
||||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