diff --git a/again b/again index 4805f31..f067460 100755 Binary files a/again and b/again differ diff --git a/again.cmi b/again.cmi index edfad43..5ae80a4 100644 Binary files a/again.cmi and b/again.cmi differ diff --git a/again.cmo b/again.cmo index 6b8dba2..c649df1 100644 Binary files a/again.cmo and b/again.cmo differ diff --git a/again.ml b/again.ml index 1cc1835..f9fc8c2 100644 --- a/again.ml +++ b/again.ml @@ -372,25 +372,27 @@ 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 - for dir = 0 to 3 do - for w = 0 to bsize do - if (not !halt) && (w > 0 || dir = 0) then begin - let nx = bx + w * (fst order.(dir)) - and ny = by + w * (snd order.(dir)) in - if is_valid nx ny lines cols then begin - if (gd.laby.(nx).(ny) = 0 || gd.laby.(nx).(ny) >= 3) || (gd.laby.(nx).(ny) = 2 && res.explodedCrates.(nx).(ny)) then - res.playersTimes.(nx).(ny) <- (dtime)::(res.playersTimes.(nx).(ny)) - else if gd.laby.(nx).(ny) = 1 then - halt := true - else if gd.laby.(nx).(ny) = 2 then begin - halt := true ; - res.explodedCrates.(nx).(ny) <- true ; + 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 + let nx = bx + w * (fst order.(dir)) + and ny = by + w * (snd order.(dir)) in + if is_valid nx ny lines cols then begin + if (gd.laby.(nx).(ny) = 0 || gd.laby.(nx).(ny) >= 3) || (gd.laby.(nx).(ny) = 2 && res.explodedCrates.(nx).(ny)) then + res.playersTimes.(nx).(ny) <- (dtime)::(res.playersTimes.(nx).(ny)) + else if gd.laby.(nx).(ny) = 1 then + halt := true + else if gd.laby.(nx).(ny) = 2 then begin + halt := true ; + res.explodedCrates.(nx).(ny) <- true ; + end end end - end - done; - halt := false ; - done + done; + halt := false ; + done + end end 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 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 *) diff --git a/entrees.txt b/entrees.txt index c46c416..6f0a0e3 100644 --- a/entrees.txt +++ b/entrees.txt @@ -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 1 5 1 5 1 -1 3 3 3 6 6 0 2 2 2 2 2 0 2 0 5 5 5 5 4 1 -1 3 1 3 1 0 1 2 1 2 1 2 1 2 1 0 1 5 1 4 1 -1 3 3 3 3 0 2 2 2 2 0 0 2 2 2 0 5 5 5 4 1 -1 3 1 3 1 2 1 2 1 2 1 2 1 2 1 2 1 5 1 4 1 -1 6 3 3 0 2 2 0 0 2 2 2 2 2 2 0 5 5 5 5 1 -1 6 1 0 1 2 1 2 1 2 1 0 1 0 1 2 1 5 1 4 1 -1 6 6 0 0 2 0 2 2 2 2 0 2 2 2 0 4 5 4 4 1 -1 6 1 0 1 2 1 2 1 2 1 2 1 0 1 2 1 4 1 4 1 -1 6 6 6 0 2 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