I am become death.

This commit is contained in:
Alexandre 2025-01-03 14:32:31 +01:00
parent 97f042d693
commit ef0dcc9e5e
8 changed files with 61 additions and 28 deletions

BIN
again

Binary file not shown.

BIN
again.cmi

Binary file not shown.

BIN
again.cmx

Binary file not shown.

View File

@ -1044,11 +1044,34 @@ let print_ret (filename : string) (dir : int) (act : int) (do_esc : bool ref) =
if !do_esc then
Printf.fprintf ptr "%d %d\n" dir act
else begin
Printf.printf "%d %d" dir act ;
Printf.fprintf ptr "%d %d\n" dir act ;
do_esc := true
end ;
close_out ptr ;;
let is_bomb (dgs: danger_map) (x0 : int) (y0 : int) (dx : int) (dy : int) (dist : int) =
let lines = Array.length dgs.explosionTimes
and cols = Array.length dgs.explosionTimes.(0) in
try
for i = 1 to dist do
let nx = x0 + i*dx
and ny = y0 + i*dy in
if is_valid nx ny lines cols && not (is_empty_lst dgs.explosionTimes.(nx).(ny)) then
raise (ReturnBool true)
done;
false
with
| ReturnBool b -> b ;;
let direction_after_trap (gd : game_data) (dgs : danger_map) (x0 : int) (y0 : int) =
let interval = Float.pow (0.9) (float_of_int gd.players.(gd.player_id).nspeed) in
let ok = ref false in
let result = bfs_for_crate ~return_ok:ok gd dgs x0 y0 (gd.dt -. interval *. !remaining_dash) false false false 0 true 80 in
if !ok then
result
else
raise (ReturnBool false) ;;
let seek_player (gd : game_data) (dgs : danger_map) =
(* returns whether or not it found a target, and prints if found *)
let pid = gd.player_id in
@ -1082,7 +1105,7 @@ let seek_player (gd : game_data) (dgs : danger_map) =
if logg then Printf.fprintf stderr "(%d, %d) --[%d]--> (%d, %d)\n" !cxi !cyi directn destx desty ;
if destx = !cxi && desty = !cyi then begin
if logg then Printf.fprintf stderr " Trapping\n" ;
print_ret "again.sav" directn 3 print_escape ;
print_ret "again.sav" (direction_after_trap gd dgs !cxi !cyi) 3 print_escape ;
cxi := !cxi + fst order.(directn) ;
cyi := !cyi + snd order.(directn) ;
has_trapped := true ;
@ -1121,7 +1144,7 @@ let seek_player (gd : game_data) (dgs : danger_map) =
found := false ;
remaining_dash := max 0. (!remaining_dash -. 1.)
done ;
if logg then Printf.fprintf stderr "Success!\n" ;
if logg then Printf.fprintf stderr "[%d] Success!\n" pid ;
remaining_dash := !remaining_dash +. 1. ;
true
with
@ -1379,7 +1402,8 @@ print_dangers danger_data ;;*)
print_dangers danger_data ;;*)
if read_queue "again.sav" then begin
remaining_dash := !remaining_dash +. 1.
remaining_dash := !remaining_dash +. 1. ;
if logg then Printf.fprintf stderr "[%d] reading...\n" game_map.player_id ;
end
else begin
let direction = ref 4 in
@ -1397,6 +1421,9 @@ else begin
Printf.printf "%d %d" !direction !action ;
if logg then Printf.fprintf stderr "[player %d] %d %d (at time %f - with %d dash potential)\n" game_map.player_id !direction !action game_map.dt (int_of_float !remaining_dash);
end
else begin
ignore (read_queue "again.sav")
end
end;;
(*Printf.printf "\n4 0" ;;*)
set_rem_dash ("again"^(string_of_int game_map.player_id)^".sav") ;;

BIN
again.o

Binary file not shown.

View File

@ -1,22 +1,28 @@
107.0
0
89.0
1
13 21
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0 3 3 3 3 3 0 0 0 0 0 0 0 0 0 2 0 0 0 1
1 0 1 0 1 3 1 3 1 0 1 3 1 0 1 0 1 0 1 0 1
1 0 0 0 0 3 3 3 3 3 3 3 3 3 0 3 2 0 0 0 1
1 0 1 0 1 3 1 3 1 3 1 3 1 4 1 3 1 4 1 0 1
1 0 0 0 0 3 3 3 3 3 0 3 0 3 3 3 3 3 0 0 1
1 0 1 0 1 0 1 3 1 3 1 4 1 4 1 3 1 0 1 0 1
1 0 0 3 0 0 0 3 0 3 0 4 4 4 0 3 0 0 0 0 1
1 0 1 3 1 0 1 3 1 3 1 4 1 4 1 0 1 0 1 0 1
1 3 3 3 3 3 0 3 3 3 0 0 4 4 0 0 4 4 4 4 1
1 0 1 0 1 0 1 3 1 0 1 4 1 0 1 4 1 4 1 4 1
1 0 0 0 0 3 3 3 0 0 0 4 4 4 0 4 0 0 0 0 1
1 3 3 3 3 3 0 2 2 2 2 2 0 5 5 5 5 5 5 5 1
1 3 1 3 1 0 1 2 1 2 1 2 1 0 1 5 1 5 1 5 1
1 6 3 3 3 0 2 2 2 2 2 2 2 0 5 5 5 5 5 5 1
1 6 1 3 1 2 1 2 1 2 1 2 1 2 1 5 1 5 1 5 1
1 3 3 3 3 0 2 2 2 2 2 2 2 2 2 0 0 5 5 5 1
1 6 1 3 1 2 1 2 1 2 1 2 1 2 1 2 1 5 1 5 1
1 6 6 3 6 2 2 2 2 2 2 2 2 2 2 0 4 4 4 4 1
1 6 1 6 1 2 1 2 1 2 1 2 1 2 1 0 1 4 1 4 1
1 6 6 6 6 0 2 2 2 2 2 2 2 2 0 4 4 4 4 4 1
1 6 1 6 1 0 1 2 1 2 1 2 1 2 1 4 1 4 1 4 1
1 6 6 6 6 6 0 2 2 2 2 2 2 2 0 4 4 4 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
3 18 2 108.5
1
1 18 0 0 0 2 0 0
1
10 3 0
2
11 14 2 89.5
5 15 1 93.10000000000008
2
9 17 1 0 3 2 0 2
3 15 2 1 2 1 1 0
5
1 6 3
10 5 0
9 14 2
8 15 0
1 12 3

View File

@ -5,7 +5,7 @@ Created on Wed Sep 12 13:52:48 2018
@author: Laurent
"""
TEMPS_BASE = 1
TEMPS_PROPAGATION = 0.01
TEMPS_PROPAGATION = 0.001
TEMPS_EXPLOSION = 5.5
TEMPS_PARTIE = 1000
@ -473,7 +473,7 @@ def execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, jo
ip, jp = prochain(i,j,direction)
ajoute_evenement(evenements, [evenement[0]+TEMPS_PROPAGATION, EVENEMENT_PROPAGATION, ip, jp, direction, longueurFlammes-1, indJoueur])
NB_TROUS = 120
NB_TROUS = 0
BONUS_RANDMAX = 3
# >0
@ -595,5 +595,5 @@ def simulation(strategies):
return
#simulation(["./again"])
simulation(["./again", "./again"])
#simulation(["./again", "./again", "./again", "./again"])
#simulation(["./again", "./again"])
simulation(["./again", "./again", "./again", "./again"])

View File

@ -1 +1 @@
4 0
3 0