value changes

This commit is contained in:
Alexandre 2024-11-18 22:39:33 +01:00
parent b7a09d6a8a
commit 21f2b79a4b
7 changed files with 38 additions and 32 deletions

BIN
again

Binary file not shown.

BIN
again.cmi

Binary file not shown.

BIN
again.cmx

Binary file not shown.

View File

@ -233,7 +233,7 @@ let set_meta_info (pid : int) =
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
let int_of_string (str : string) =
String.fold_right (fun ch acc -> let cd = Char.code ch in if cd >= 48 || cd <= 57 then 10*acc + cd - 48 else failwith "not an integer\n") str 0 ;;
String.fold_left (fun acc ch -> let cd = Char.code ch in if cd >= 48 || cd <= 57 then 10*acc + cd - 48 else failwith "not an integer\n") 0 str ;;
let string_of_int (k0 : int) =
String.make (1) (Char.chr (k0 + 48)) ;;
@ -522,8 +522,8 @@ let amt_free_adj_spaces (gd : game_data) (x : int) (y : int) =
0
order ;;
let max_depth = 3 ;;
let max_spacing = 3 ;;
let max_depth = 4 ;;
let max_spacing = 4 ;;
let is_player_nearby (gd : game_data) (res_x : int ref) (res_y : int ref) =
let pid = gd.player_id in
let lines = Array.length gd.laby
@ -923,13 +923,13 @@ let draw_random (gd : game_data) (infx : int) (infy : int) (lines : int) (cols :
(* get a random, valid tile *)
let xres = ref (-1)
and yres = ref (-1) in
while not (is_valid !xres !yres lines cols && gd.laby.(!xres).(!yres) <> 1 && gd.laby.(!xres).(!yres) <> 2 && not (Array.fold_left (fun acc (b : bomb) -> acc || (b.xy.x = !xres && b.xy.y = !yres)) false gd.bombs)) do
while not (is_valid !xres !yres lines cols && gd.laby.(!xres).(!yres) >= 3 && gd.laby.(!xres).(!yres) <> 3 + gd.player_id && not (Array.fold_left (fun acc (b : bomb) -> acc || (b.xy.x = !xres && b.xy.y = !yres)) false gd.bombs)) do
xres := infx + Random.int (lines - infx) ;
yres := infy + Random.int (cols - infy) ;
done;
(!xres, !yres) ;;
let nloops = 40 ;;
let nloops = 70 ;;
let move_land_2 (gd : game_data) (dgs : danger_map) (gns : int array array) =
let lines = Array.length gd.laby
and cols = Array.length gd.laby.(0) in
@ -943,7 +943,11 @@ let move_land_2 (gd : game_data) (dgs : danger_map) (gns : int array array) =
let (x, y) = draw_random gd 0 0 lines cols 4 in
let result_0 = goto_tile gd dgs cxi cyi x y gd.dt in
if result_0 <> 4 then begin
if gd.players.(pid).nbomb_atonce > 0 && not (Array.fold_left (fun acc (b : bomb) -> acc || (b.xy.x = cxi && b.xy.y = cyi)) false gd.bombs) then begin
if
gd.players.(pid).nbomb_atonce > 0 &&
not (Array.fold_left (fun acc (b : bomb) -> acc || (b.xy.x = cxi && b.xy.y = cyi)) false gd.bombs) &&
(is_empty_lst dgs.explosionTimes.(cxi).(cyi))
then begin
if logg then Printf.fprintf stderr "trying...\n" ;
let _ = simulate_bomb_deconstruct dgs cxi cyi gd.players.(pid).bomb_radius (gd.dt +. 5.5) in
let result = goto_tile gd dgs cxi cyi x y gd.dt in

BIN
again.o

Binary file not shown.

View File

@ -1,29 +1,31 @@
225.80000000000052
0
457.50401999999656
3
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 6 6 5 5 5 4 5 5 5 5 5 5 5 3 3 3 3 5 1
1 3 1 6 1 0 1 4 1 5 1 5 1 5 1 3 1 3 1 5 1
1 3 3 3 4 4 4 4 4 4 5 5 5 5 5 3 5 3 5 5 1
1 3 1 3 1 3 1 4 1 4 1 5 1 5 1 3 1 3 1 5 1
1 3 3 3 4 4 4 4 4 4 4 5 3 3 3 3 3 3 3 3 1
1 3 1 3 1 3 1 4 1 4 1 5 1 5 1 3 1 3 1 5 1
1 3 3 3 3 3 3 5 5 5 5 5 5 5 5 3 3 3 3 3 1
1 0 1 3 1 3 1 4 1 4 1 5 1 3 1 3 1 3 1 4 1
1 3 3 3 3 3 3 3 3 3 3 5 3 3 3 3 3 3 3 4 1
1 6 1 3 1 3 1 4 1 5 1 5 1 3 1 3 1 3 1 4 1
1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 5 1
1 3 3 0 6 3 3 3 3 3 3 3 3 3 5 5 5 5 5 6 1
1 3 1 0 1 6 1 3 1 3 1 3 1 3 1 5 1 5 1 5 1
1 5 3 6 6 6 6 3 5 5 5 5 5 3 5 5 5 5 3 3 1
1 6 1 6 1 6 1 3 1 4 1 4 1 3 1 5 1 5 1 5 1
1 6 6 6 6 6 3 3 3 3 3 3 3 3 3 5 5 5 5 5 1
1 6 1 6 1 6 1 3 1 3 1 6 1 3 1 5 1 5 1 4 1
1 6 6 6 6 6 6 6 6 6 6 6 4 4 5 5 6 5 0 4 1
1 6 1 6 1 6 1 6 1 3 1 6 1 4 1 6 1 3 1 4 1
1 6 6 6 4 6 3 6 6 6 6 6 6 4 3 3 3 3 3 3 1
1 6 1 6 1 6 1 6 1 6 1 6 1 4 1 6 1 3 1 4 1
1 6 6 5 6 6 6 6 6 6 6 6 4 4 4 4 3 3 3 3 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
7
3 13 5 225.9000000000005
8 9 2 225.91200000000183
9 9 2 226.64100000000184
4 13 5 226.8000000000005
5 13 5 227.7000000000005
6 13 5 228.6000000000005
11 11 3 230.7100000000007
3
7 15 0 1 0 5 1 2
9 12 1 3 0 2 3 3
10 11 2 2 1 3 3 0
8
7 13 2 457.7330299999967
7 10 2 459.4610799999966
2 9 1 459.5
8 9 2 460.68547999999663
1 13 2 460.9700000000011
5 11 2 461.2325499999966
7 7 2 462.4569499999966
3 7 1 462.5
4
8 7 0 5 2 2 1 0
4 7 1 0 2 1 0 1
2 11 2 2 2 2 0 0
5 14 3 5 2 2 6 6
0

View File

@ -1 +1 @@
3 0
1 1