weird behavior with bonuses
This commit is contained in:
parent
2cc0bfa70a
commit
d09422f280
23
again.ml
23
again.ml
|
@ -538,6 +538,20 @@ let min_dist_from_player (gd : game_data) (x : int) (y : int) =
|
|||
)
|
||||
) ;;
|
||||
|
||||
let min_dist_with_dash (gd : game_data) (x : int) (y : int) =
|
||||
Array.fold_left min 999999 (Array.init
|
||||
(Array.length gd.players)
|
||||
(fun i ->
|
||||
if gd.player_id = gd.players.(i).id then
|
||||
999999
|
||||
else begin
|
||||
let d = tile_distance gd x y (gd.players.(i).xy.x) (gd.players.(i).xy.y) in
|
||||
if d = 0 then 0 else
|
||||
if d = -1 then 999999 else max 1 (d - 3*gd.players.(i).ndash)
|
||||
end
|
||||
)
|
||||
) ;;
|
||||
|
||||
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
|
||||
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
|
||||
|
||||
|
@ -589,7 +603,7 @@ let generate_dead_end_map (gd : game_data) =
|
|||
end
|
||||
end
|
||||
in
|
||||
dfs gd.players.(pid).xy.x gd.players.(pid).xy.y [] 4 ;
|
||||
dfs gd.players.(pid).xy.x gd.players.(pid).xy.y [] 4;
|
||||
|
||||
(* fills remaining spaces with BFS *)
|
||||
let bfs (x0 : int) (y0 : int) =
|
||||
|
@ -617,7 +631,7 @@ let generate_dead_end_map (gd : game_data) =
|
|||
done;
|
||||
()
|
||||
with
|
||||
| ReturnInt k -> res.(x0).(y0) <- k
|
||||
| ReturnInt k -> res.(x0).(y0) <- k
|
||||
in
|
||||
for l = 0 to lines -1 do
|
||||
for c = 0 to cols -1 do
|
||||
|
@ -793,7 +807,7 @@ let bfs_for_crate (gd : game_data) (dgs : danger_map) (x0 : int) (y0 : int) (sti
|
|||
let pid = gd.player_id in
|
||||
|
||||
let needs_gtfo = not (is_empty_lst dgs.explosionTimes.(x0).(y0)) in
|
||||
let nearest_player = min_dist_from_player gd gd.players.(pid).xy.x gd.players.(pid).xy.y in
|
||||
let nearest_player = min_dist_with_dash gd gd.players.(pid).xy.x gd.players.(pid).xy.y in
|
||||
|
||||
let undead_end_tiles = generate_dead_end_map gd in
|
||||
|
||||
|
@ -829,7 +843,7 @@ let bfs_for_crate (gd : game_data) (dgs : danger_map) (x0 : int) (y0 : int) (sti
|
|||
not (Array.fold_left (fun acc (b : bomb) -> acc || (b.xy.x = x && b.xy.y = y)) false gd.bombs) &&
|
||||
polar <= 4
|
||||
then begin (* is not lethal *)
|
||||
if ct = stime+. interval then begin
|
||||
if ct = stime +. interval then begin
|
||||
Printf.fprintf stderr "%b %b %b %b %b\n"
|
||||
(ct >= stime +. (float_of_int minDist) *. interval) (* not too deep *)
|
||||
(is_empty_lst dgs.explosionTimes.(x).(y)) (* safe *)
|
||||
|
@ -909,6 +923,7 @@ let move_crate (gd : game_data) (dgs : danger_map) =
|
|||
raise (ReturnInt 4)
|
||||
end;
|
||||
end;
|
||||
if logg then Printf.fprintf stderr "bonusing...\n" ;
|
||||
let bonusres = bfs_for_crate gd dgs cxi cyi gd.dt false true false 0 false 7 in
|
||||
if bonusres <> 4 then begin
|
||||
if logg then Printf.fprintf stderr "bonus spotted\n" ;
|
||||
|
|
44
entrees.txt
44
entrees.txt
|
@ -1,25 +1,29 @@
|
|||
224.90000000000097
|
||||
155.0
|
||||
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 3 3 0 3 0 3 0 0 4 4 4 4 3 3 3 3 1
|
||||
1 3 1 3 1 3 1 3 1 3 1 0 1 4 1 3 1 3 1 5 1
|
||||
1 3 3 3 3 3 3 3 3 3 3 3 3 4 3 3 3 3 3 3 1
|
||||
1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 5 1
|
||||
1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1
|
||||
1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 0 1
|
||||
1 3 3 3 3 3 3 3 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||||
11 8 0
|
||||
11 12 0
|
||||
10 7 1
|
||||
7 9 2
|
||||
1 9 4
|
||||
|
|
|
@ -427,8 +427,8 @@ def execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, jo
|
|||
indiceJoueur = trouve_objet(i,j,joueurs)
|
||||
while indiceJoueur != None:
|
||||
joueurs[indiceJoueur] = None
|
||||
print("DEATH :", indiceJoueur)
|
||||
assert(false)
|
||||
print("\n\nDEATH :", indiceJoueur, "\n\n")
|
||||
#assert(false)
|
||||
indiceJoueur = trouve_objet(i,j,joueurs)
|
||||
|
||||
# On fait exploser la bombe s'il y en a une
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
4 0
|
Loading…
Reference in New Issue