improved crate detection + config to python script

This commit is contained in:
Alexandre 2024-12-12 21:08:42 +01:00
parent e013ffc430
commit 689266883e
8 changed files with 58 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

@ -425,6 +425,15 @@ let generate_gain_map (gd : game_data) =
and cols = Array.length gd.laby.(0) in
let bsize = gd.players.(gd.player_id).bomb_radius in
let res = Array.make_matrix lines cols 0 in
(* aim towards center by adding a bonus *)
for i = 0 to lines -1 do
for j = 0 to cols -1 do
res.(i).(j) <- res.(i).(j) + (min (min (i) (lines -1-i)) (min (j) (cols -1-j))) ;
done
done ;
(* add potential score *)
for l = 0 to lines -1 do
for c = 0 to cols -1 do
if (gd.laby.(l).(c) >= 3) || gd.laby.(l).(c) = 0 then begin
@ -1053,9 +1062,24 @@ let move_land (gd : game_data) (dgs : danger_map) (gn : int array array) =
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
let exists_crate (gd : game_data) (dgs : danger_map) =
Array.exists
let lines = Array.length gd.laby
and cols = Array.length gd.laby.(0) in
for i = 0 to lines -1 do
for j = 0 to cols -1 do
if dgs.explodedCrates.(i).(j) then
gd.laby.(i).(j) <- -2 ;
done
done ;
let res = Array.exists
(fun line -> Array.exists (fun tile -> tile = 2) line)
gd.laby ;;
gd.laby in
for i = 0 to lines -1 do
for j = 0 to cols -1 do
if dgs.explodedCrates.(i).(j) then
gd.laby.(i).(j) <- 2 ;
done
done ;
res ;;
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)

BIN
again.o

Binary file not shown.

View File

@ -1,31 +1,31 @@
211.3700000000007
2
223.51300000000185
0
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 4 5 4 4 4 4 0 4 0 0 0 6 6 6 6 6 6 6 1
1 3 1 5 1 6 1 5 1 3 1 6 1 6 1 5 1 6 1 5 1
1 5 5 5 5 6 5 3 5 3 4 6 3 4 3 5 3 3 4 4 1
1 3 1 5 1 6 1 6 1 3 1 4 1 4 1 5 1 6 1 5 1
1 4 6 5 6 6 6 6 6 3 6 4 4 4 4 4 5 6 6 6 1
1 0 1 5 1 6 1 6 1 3 1 4 1 4 1 5 1 6 1 5 1
1 4 4 5 3 3 3 6 3 3 3 4 3 4 3 4 6 5 4 4 1
1 6 1 5 1 6 1 6 1 3 1 4 1 4 1 5 1 5 1 4 1
1 3 6 4 6 6 4 4 4 4 4 4 4 4 4 4 4 5 4 4 1
1 6 1 4 1 6 1 6 1 3 1 4 1 4 1 5 1 4 1 4 1
1 3 3 3 3 3 3 6 4 3 4 4 4 4 4 4 4 4 4 4 1
1 3 3 3 3 5 3 3 3 5 0 5 5 3 5 5 4 4 4 4 1
1 3 1 4 1 3 1 4 1 5 1 6 1 3 1 4 1 4 1 5 1
1 3 3 5 5 3 5 5 5 3 5 3 5 3 5 4 5 4 5 5 1
1 3 1 4 1 5 1 3 1 3 1 3 1 3 1 4 1 4 1 5 1
1 4 3 3 5 5 5 5 5 3 3 3 3 3 3 3 4 4 4 4 1
1 6 1 4 1 5 1 3 1 3 1 3 1 3 1 4 1 4 1 4 1
1 4 4 3 3 5 3 3 3 6 3 4 3 3 4 4 4 4 4 4 1
1 6 1 4 1 5 1 3 1 6 1 4 1 3 1 4 1 4 1 4 1
1 6 3 3 3 6 6 6 6 6 6 4 6 3 6 6 4 4 4 4 1
1 6 1 6 1 3 1 3 1 6 1 4 1 4 1 4 1 4 1 4 1
1 6 6 3 3 3 3 4 4 4 4 4 4 4 4 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
8
5 8 4 211.4600000000004
7 3 2 212.01000000000067
6 9 4 213.0800000000004
3 7 5 213.21000000000043
10 3 2 214.44000000000068
7 10 4 214.70000000000041
11 10 5 214.93000000000043
11 4 2 216.06000000000068
7
3 7 2 223.80000000000092
7 14 3 224.63900000000177
6 15 3 226.0970000000018
10 13 3 226.3940000000016
10 7 3 226.70000000000095
5 16 3 227.55500000000183
11 14 3 227.85200000000162
4
1 10 0 2 0 5 1 3
11 11 1 2 1 5 3 2
11 5 2 2 3 2 3 1
7 13 3 2 0 4 1 2
0
6 17 0 3 1 3 3 1
10 15 1 3 1 3 0 1
5 9 2 1 0 2 3 1
11 5 3 1 1 3 2 1
1
1 10 2

View File

@ -352,7 +352,7 @@ def trouve_objet(i,j, liste):
def casse(plateau, powerups, i,j):
plateau[i][j]=PLATEAU_VIDE
if randrange(0,3)==0:
if randrange(0,BONUS_RANDMAX)==0:
powerups.append([i,j, randrange(5)])
return
@ -464,7 +464,9 @@ 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 = 20
NB_TROUS = 0
BONUS_RANDMAX = 3
# >0
TAILLE_TUILE = 40
HAUTEUR_JOUEUR = TAILLE_TUILE

View File

@ -1 +1 @@
0 0
2 1