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