bonuses are painful to deal with
This commit is contained in:
parent
d09422f280
commit
14dae2a4cb
18
again.ml
18
again.ml
|
@ -16,6 +16,7 @@ let logg = true ;;
|
||||||
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
|
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
|
||||||
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
|
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
|
||||||
|
|
||||||
|
let fodder = ref 0 ;;
|
||||||
type pt = {
|
type pt = {
|
||||||
x : int ;
|
x : int ;
|
||||||
y : int ;
|
y : int ;
|
||||||
|
@ -797,7 +798,7 @@ let sees_a_crate (gd : game_data) (dgs : danger_map) (x : int) (y : int) =
|
||||||
with
|
with
|
||||||
| ReturnBool b -> b ;;
|
| ReturnBool b -> b ;;
|
||||||
|
|
||||||
let bfs_for_crate (gd : game_data) (dgs : danger_map) (x0 : int) (y0 : int) (stime : float) (searchCrate : bool) (searchBonus : bool) (placedBomb : bool) (minDist : int) (ignorePlayers : bool) (maxDist : int) =
|
let bfs_for_crate ?return_x:(retx=fodder) ?return_y:(rety=fodder) (gd : game_data) (dgs : danger_map) (x0 : int) (y0 : int) (stime : float) (searchCrate : bool) (searchBonus : bool) (placedBomb : bool) (minDist : int) (ignorePlayers : bool) (maxDist : int) =
|
||||||
let lines = Array.length gd.laby
|
let lines = Array.length gd.laby
|
||||||
and cols = Array.length gd.laby.(0) in
|
and cols = Array.length gd.laby.(0) in
|
||||||
|
|
||||||
|
@ -858,6 +859,8 @@ let bfs_for_crate (gd : game_data) (dgs : danger_map) (x0 : int) (y0 : int) (sti
|
||||||
(not searchCrate || (sees_a_crate gd dgs x y && not dgs.explodedCrates.(x).(y))) && (* sees a crate *)
|
(not searchCrate || (sees_a_crate gd dgs x y && not dgs.explodedCrates.(x).(y))) && (* sees a crate *)
|
||||||
(not searchBonus || dgs.bonusMap.(x).(y)) (* is a bonus *)
|
(not searchBonus || dgs.bonusMap.(x).(y)) (* is a bonus *)
|
||||||
then begin
|
then begin
|
||||||
|
retx := x ;
|
||||||
|
rety := y ;
|
||||||
raise (ReturnInt direction)
|
raise (ReturnInt direction)
|
||||||
end;
|
end;
|
||||||
if not (x0 = x && y0 = y) && (needs_gtfo || undead_end_tiles.(x).(y) * 2 <= nearest_player) then begin
|
if not (x0 = x && y0 = y) && (needs_gtfo || undead_end_tiles.(x).(y) * 2 <= nearest_player) then begin
|
||||||
|
@ -904,9 +907,10 @@ let move_crate (gd : game_data) (dgs : danger_map) =
|
||||||
if gd.players.(pid).bomb_to_place > 0 then begin
|
if gd.players.(pid).bomb_to_place > 0 then begin
|
||||||
if logg then Printf.fprintf stderr "trying...\n" ;
|
if logg then Printf.fprintf stderr "trying...\n" ;
|
||||||
let saved = simulate_bomb_deconstruct dgs cxi cyi gd.players.(pid).bomb_radius (gd.dt +. 5.5) in
|
let saved = simulate_bomb_deconstruct dgs cxi cyi gd.players.(pid).bomb_radius (gd.dt +. 5.5) in
|
||||||
|
let bonus2_x = ref 0
|
||||||
let bonusres_2 = bfs_for_crate gd dgs cxi cyi gd.dt false true false 0 false 7 in
|
and bonus2_y = ref 0 in
|
||||||
if bonusres_2 <> 4 then begin
|
let bonusres_2 = bfs_for_crate ~return_x:bonus2_x ~return_y:bonus2_y gd dgs cxi cyi gd.dt false true false 0 false 7 in
|
||||||
|
if bonusres_2 <> 4 && (tile_distance gd cxi cyi !bonus2_x !bonus2_y <= min_dist_from_player gd cxi cyi) then begin
|
||||||
if logg then Printf.fprintf stderr "Bonus Spotted\n" ;
|
if logg then Printf.fprintf stderr "Bonus Spotted\n" ;
|
||||||
action := 1 ;
|
action := 1 ;
|
||||||
raise (ReturnInt bonusres_2) ;
|
raise (ReturnInt bonusres_2) ;
|
||||||
|
@ -924,8 +928,10 @@ let move_crate (gd : game_data) (dgs : danger_map) =
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if logg then Printf.fprintf stderr "bonusing...\n" ;
|
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
|
let bonus_x = ref 0
|
||||||
if bonusres <> 4 then begin
|
and bonus_y = ref 0 in
|
||||||
|
let bonusres = bfs_for_crate ~return_x:bonus_x ~return_y:bonus_y gd dgs cxi cyi gd.dt false true false 0 false 7 in
|
||||||
|
if bonusres <> 4 && (tile_distance gd cxi cyi !bonus_x !bonus_y <= min_dist_from_player gd cxi cyi) then begin
|
||||||
if logg then Printf.fprintf stderr "bonus spotted\n" ;
|
if logg then Printf.fprintf stderr "bonus spotted\n" ;
|
||||||
raise (ReturnInt bonusres) ;
|
raise (ReturnInt bonusres) ;
|
||||||
end;
|
end;
|
||||||
|
|
50
entrees.txt
50
entrees.txt
|
@ -1,29 +1,29 @@
|
||||||
155.0
|
97.00000000000013
|
||||||
2
|
0
|
||||||
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 6 6 6 6 6 0 2 2 2 0 4 5 4 4 4 4 1
|
1 3 3 3 3 0 2 2 0 2 2 0 5 5 5 5 5 5 5 5 1
|
||||||
1 3 1 3 1 6 1 6 1 2 1 2 1 2 1 5 1 4 1 5 1
|
1 3 1 3 1 2 1 2 1 2 1 2 1 0 1 2 1 5 1 5 1
|
||||||
1 3 3 6 6 6 6 6 6 6 0 2 0 5 5 5 5 5 4 4 1
|
1 3 3 3 0 2 2 2 2 2 2 2 0 2 2 0 0 5 5 5 1
|
||||||
1 0 1 3 1 6 1 6 1 2 1 2 1 2 1 5 1 4 1 0 1
|
1 6 1 3 1 0 1 2 1 2 1 2 1 2 1 0 1 5 1 5 1
|
||||||
1 3 6 6 6 6 6 6 6 6 0 2 0 4 4 4 4 4 4 4 1
|
1 6 0 2 0 2 0 2 0 0 2 2 2 2 0 4 5 5 5 5 1
|
||||||
1 6 1 3 1 6 1 6 1 2 1 2 1 2 1 4 1 4 1 0 1
|
1 6 1 0 1 2 1 2 1 2 1 0 1 2 1 4 1 5 1 0 1
|
||||||
1 6 3 3 6 6 6 6 6 0 2 0 2 0 0 4 5 5 5 4 1
|
1 6 0 2 2 2 2 2 2 2 2 2 0 2 2 4 0 5 0 0 1
|
||||||
1 6 1 3 1 6 1 6 1 2 1 2 1 2 1 4 1 4 1 4 1
|
1 6 1 0 1 2 1 2 1 0 1 2 1 0 1 4 1 5 1 4 1
|
||||||
1 6 6 3 3 3 3 6 3 0 0 2 0 4 4 4 4 4 4 4 1
|
1 6 6 6 0 0 2 2 2 2 2 0 0 4 4 4 4 5 4 4 1
|
||||||
1 6 1 6 1 3 1 0 1 2 1 2 1 2 1 4 1 4 1 4 1
|
1 6 1 6 1 2 1 2 1 2 1 2 1 0 1 4 1 5 1 4 1
|
||||||
1 6 3 3 3 3 3 3 0 2 2 2 0 4 4 4 4 4 4 4 1
|
1 6 6 6 0 2 2 2 2 2 2 2 2 0 4 4 4 5 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
|
||||||
1
|
0
|
||||||
5 10 4 156.8000000000002
|
|
||||||
4
|
4
|
||||||
2 5 0 0 2 3 0 1
|
1 3 0 1 3 1 0 0
|
||||||
6 17 1 1 1 4 1 1
|
7 17 1 0 2 2 1 2
|
||||||
6 15 2 0 1 2 2 0
|
7 19 2 1 2 5 1 0
|
||||||
7 7 3 1 2 4 5 6
|
1 4 3 0 3 1 1 0
|
||||||
5
|
6
|
||||||
11 8 0
|
1 5 3
|
||||||
11 12 0
|
9 4 3
|
||||||
10 7 1
|
7 2 2
|
||||||
7 9 2
|
9 12 3
|
||||||
1 9 4
|
7 18 4
|
||||||
|
4 15 1
|
||||||
|
|
Loading…
Reference in New Issue