[experimental] killing machines v1
This commit is contained in:
parent
0bedcd7378
commit
60194b5c31
48
again.ml
48
again.ml
|
@ -145,6 +145,10 @@ let is_empty_lst = function
|
||||||
| [] -> true
|
| [] -> true
|
||||||
| _ -> false ;;
|
| _ -> false ;;
|
||||||
|
|
||||||
|
let abs = function
|
||||||
|
| k when k < 0 -> -k
|
||||||
|
| k -> k ;;
|
||||||
|
|
||||||
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
|
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
|
||||||
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
|
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
|
||||||
|
|
||||||
|
@ -973,12 +977,7 @@ let path_seek (gd : game_data) (dgs : danger_map) (stime : float) (end_x : int)
|
||||||
let x0 = gd.players.(pid).xy.x
|
let x0 = gd.players.(pid).xy.x
|
||||||
and y0 = gd.players.(pid).xy.y in
|
and y0 = gd.players.(pid).xy.y in
|
||||||
|
|
||||||
Queue.add (x0, y0, stime +. interval, 4, 1) q ;
|
Queue.add (x0, y0, stime, 4, 0) q ;
|
||||||
|
|
||||||
Queue.add (x0+1, y0, stime +. interval, 2, 1) q ;
|
|
||||||
Queue.add (x0-1, y0, stime +. interval, 0, 1) q ;
|
|
||||||
Queue.add (x0, y0+1, stime +. interval, 1, 1) q ;
|
|
||||||
Queue.add (x0, y0-1, stime +. interval, 3, 1) q ;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
while not (Queue.is_empty q) do
|
while not (Queue.is_empty q) do
|
||||||
|
@ -998,10 +997,20 @@ let path_seek (gd : game_data) (dgs : danger_map) (stime : float) (end_x : int)
|
||||||
then begin
|
then begin
|
||||||
raise (ReturnInt direction)
|
raise (ReturnInt direction)
|
||||||
end;
|
end;
|
||||||
for dir = 0 to 3 do
|
if polar <> 0 then begin
|
||||||
Queue.add (x + (fst order.(dir)), y + (snd order.(dir)), ct +. interval, direction, polar) q ;
|
for dir = 0 to 3 do
|
||||||
done;
|
Queue.add (x + (fst order.(dir)), y + (snd order.(dir)), ct +. interval, direction, polar) q ;
|
||||||
Queue.add (x, y, ct +. interval, direction, polar+1) q
|
done;
|
||||||
|
Queue.add (x, y, ct +. interval, direction, polar+1) q
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
Queue.add (x0, y0, stime +. interval, 4, 1) q ;
|
||||||
|
|
||||||
|
Queue.add (x0+1, y0, stime +. interval, 2, 1) q ;
|
||||||
|
Queue.add (x0-1, y0, stime +. interval, 0, 1) q ;
|
||||||
|
Queue.add (x0, y0+1, stime +. interval, 1, 1) q ;
|
||||||
|
Queue.add (x0, y0-1, stime +. interval, 3, 1) q ;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1023,22 +1032,27 @@ let seek_player (gd : game_data) (dgs : danger_map) =
|
||||||
|
|
||||||
let player_range = 3 * gd.players.(pid).ndash in
|
let player_range = 3 * gd.players.(pid).ndash in
|
||||||
try
|
try
|
||||||
if gd.players.(pid).ntraps = 0 then begin
|
if gd.players.(pid).ntraps = 0 || (gd.players.(pid).bomb_to_place = 0 && is_empty_lst dgs.explosionTimes.(cxi).(cyi)) then begin
|
||||||
if logg then Printf.fprintf stderr "no trap\n";
|
if logg then Printf.fprintf stderr "no trap/no available bomb\n";
|
||||||
raise (ReturnBool false);
|
raise (ReturnBool false);
|
||||||
end;
|
end;
|
||||||
if logg then Printf.fprintf stderr "has trap(s)\n";
|
if logg then Printf.fprintf stderr "has trap(s)\n";
|
||||||
for pl = 0 to 3 do
|
for pl = 0 to 3 do
|
||||||
if gd.players.(pl).id <> -1 then begin (* not dead *)
|
if gd.players.(pl).id <> -1 && gd.player_id <> pl then begin (* not dead *)
|
||||||
let within_range = ref false in
|
let within_range = ref false in
|
||||||
let direct = path_seek gd dgs (gd.dt -. interval *. !remaining_dash) gd.players.(pl).xy.x gd.players.(pl).xy.y player_range within_range in
|
let direct = path_seek gd dgs (gd.dt -. interval *. !remaining_dash) gd.players.(pl).xy.x gd.players.(pl).xy.y (player_range + int_of_float !remaining_dash) within_range in
|
||||||
if !within_range then begin
|
if !within_range then begin
|
||||||
if logg then Printf.fprintf stderr "\n\nlesgo\n\n\n";
|
if logg then Printf.fprintf stderr "\n\nlesgo (at %d, %d)\n\n\n" cxi cyi;
|
||||||
if gd.players.(pl).xy.x = cxi && gd.players.(pl).xy.y = cyi then begin
|
if gd.players.(pl).xy.x = cxi && gd.players.(pl).xy.y = cyi then begin
|
||||||
|
if logg then Printf.fprintf stderr "no u\n" ;
|
||||||
act := 3
|
act := 3
|
||||||
end
|
end
|
||||||
|
else if abs (gd.players.(pl).xy.x - cxi) + abs (gd.players.(pl).xy.y - cyi) <= gd.players.(pid).bomb_radius then begin
|
||||||
|
if logg then Printf.fprintf stderr "boom\n" ;
|
||||||
|
act := 1
|
||||||
|
end
|
||||||
else begin
|
else begin
|
||||||
if !remaining_dash = 0. then begin
|
if !remaining_dash = 0. && gd.players.(pid).ndash > 0 then begin
|
||||||
remaining_dash := 3. ;
|
remaining_dash := 3. ;
|
||||||
act := 2 ;
|
act := 2 ;
|
||||||
end
|
end
|
||||||
|
@ -1278,7 +1292,7 @@ print_dangers danger_data ;;*)
|
||||||
print_dangers danger_data ;;*)
|
print_dangers danger_data ;;*)
|
||||||
let direction = ref 4 ;;
|
let direction = ref 4 ;;
|
||||||
|
|
||||||
if true || not (seek_player game_map danger_data) then begin
|
if not (seek_player game_map danger_data) then begin
|
||||||
if exists_crate game_map danger_data then begin
|
if exists_crate game_map danger_data then begin
|
||||||
if logg then Printf.fprintf stderr "Crates\n" ;
|
if logg then Printf.fprintf stderr "Crates\n" ;
|
||||||
direction := move_crate game_map danger_data
|
direction := move_crate game_map danger_data
|
||||||
|
|
45
entrees.txt
45
entrees.txt
|
@ -1,26 +1,27 @@
|
||||||
250.0
|
59.0
|
||||||
3
|
0
|
||||||
13 21
|
13 21
|
||||||
1 1 1 1 1 1 1 1 1 1 1 1 1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 3 1
|
1 0 6 6 6 6 6 6 6 6 0 0 6 6 6 4 4 4 0 0 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
|
||||||
4
|
|
||||||
3 14 4 251.5
|
|
||||||
9 12 3 252.5
|
|
||||||
8 13 3 254.5
|
|
||||||
11 10 6 255.00000000000082
|
|
||||||
3
|
3
|
||||||
11 9 0 1 2 6 1 4
|
5 9 2 59.5
|
||||||
6 13 1 0 0 3 4 2
|
9 9 2 63.5
|
||||||
6 13 3 0 1 4 2 4
|
7 7 1 63.5
|
||||||
0
|
4
|
||||||
|
7 6 0 0 1 1 0 0
|
||||||
|
11 9 1 0 1 2 1 0
|
||||||
|
7 11 2 0 0 2 1 0
|
||||||
|
3 11 3 1 1 1 1 0
|
||||||
|
1
|
||||||
|
5 10 2
|
||||||
|
|
|
@ -395,7 +395,7 @@ def execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, jo
|
||||||
piege = pieges[indicePiege]
|
piege = pieges[indicePiege]
|
||||||
if piege[P_JOUEUR] != indiceJoueur:
|
if piege[P_JOUEUR] != indiceJoueur:
|
||||||
penalite = 3
|
penalite = 3
|
||||||
piege.pop(indicePiege)
|
pieges.pop(indicePiege)
|
||||||
|
|
||||||
indicePowerup = trouve_objet(i,j,powerups)
|
indicePowerup = trouve_objet(i,j,powerups)
|
||||||
if indicePowerup != None:
|
if indicePowerup != None:
|
||||||
|
@ -466,7 +466,7 @@ def execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, jo
|
||||||
ip, jp = prochain(i,j,direction)
|
ip, jp = prochain(i,j,direction)
|
||||||
ajoute_evenement(evenements, [evenement[0]+TEMPS_PROPAGATION, EVENEMENT_PROPAGATION, ip, jp, direction, longueurFlammes-1, indJoueur])
|
ajoute_evenement(evenements, [evenement[0]+TEMPS_PROPAGATION, EVENEMENT_PROPAGATION, ip, jp, direction, longueurFlammes-1, indJoueur])
|
||||||
|
|
||||||
NB_TROUS = 0
|
NB_TROUS = 120
|
||||||
BONUS_RANDMAX = 3
|
BONUS_RANDMAX = 3
|
||||||
# >0
|
# >0
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ Y_STEP_CLAIMS = 40
|
||||||
X_LARGEUR_EMPIRES = 60
|
X_LARGEUR_EMPIRES = 60
|
||||||
Y_LARGEUR_EMPIRES = 180
|
Y_LARGEUR_EMPIRES = 180
|
||||||
|
|
||||||
TIME_FACTOR = 100
|
TIME_FACTOR = 7
|
||||||
|
|
||||||
def decision(programme, indiceJoueur, plateau, plateauCouleur, bombes, joueurs, powerups, instant):
|
def decision(programme, indiceJoueur, plateau, plateauCouleur, bombes, joueurs, powerups, instant):
|
||||||
with open("entrees.txt", "w") as entrees:
|
with open("entrees.txt", "w") as entrees:
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0
|
1
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
2 0
|
3 0
|
Loading…
Reference in New Issue