This commit is contained in:
Alexandre 2024-11-09 16:17:36 +01:00
parent 0767b46821
commit 5994546629
9 changed files with 50 additions and 27 deletions

View File

@ -1 +1,2 @@
ocamlc main.ml -o main ocamlc main.ml -o main
./main

View File

@ -1,22 +1,32 @@
11.0 88.00000000000014
3 0
13 21 13 21
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 3 3 2 2 2 2 2 0 2 2 0 2 2 2 2 2 2 5 5 1 1 3 3 3 3 0 0 2 2 2 2 2 2 0 0 5 5 5 5 5 1
1 3 1 2 1 2 1 2 1 0 1 2 1 2 1 0 1 2 1 5 1 1 3 1 3 1 0 1 0 1 2 1 0 1 0 1 0 1 5 1 5 1
1 0 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 0 2 1 1 3 3 3 3 0 2 2 2 2 0 0 0 2 2 2 0 5 5 5 1
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 3 1 3 1 2 1 2 1 2 1 2 1 2 1 2 1 0 1 5 1
1 2 0 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 1 1 0 0 3 0 2 2 2 2 2 0 2 2 2 2 0 2 2 0 5 1
1 2 1 2 1 2 1 0 1 2 1 2 1 2 1 2 1 2 1 2 1 1 6 1 0 1 2 1 2 1 2 1 2 1 0 1 2 1 2 1 0 1
1 2 2 2 0 0 2 2 2 0 2 2 2 2 2 2 2 2 2 2 1 1 6 0 0 2 0 2 2 2 2 2 2 2 0 0 2 2 2 2 0 1
1 2 1 2 1 2 1 0 1 2 1 2 1 2 1 2 1 2 1 2 1 1 6 1 0 1 2 1 2 1 2 1 2 1 2 1 2 1 0 1 4 1
1 2 2 2 2 2 2 2 2 2 2 0 2 0 2 2 0 2 0 2 1 1 6 6 6 0 2 2 2 2 2 2 2 0 2 2 2 0 4 4 4 1
1 0 1 2 1 0 1 2 1 0 1 2 1 2 1 2 1 2 1 0 1 1 6 1 6 1 2 1 0 1 2 1 2 1 2 1 0 1 4 1 4 1
1 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 0 1 1 6 6 6 0 2 2 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 3
11 19 1 11.5 11 4 1 89.5
2 3 5 3 89.90000000000012
11 19 1 0 1 1 0 0 8 17 3 90.5
11 1 3 0 1 1 0 0 4
0 1 6 0 1 1 3 0 1
9 17 1 0 1 3 1 1
3 17 2 1 1 2 1 1
9 3 3 0 1 1 3 1
6
7 19 2
5 18 0
5 4 0
9 4 3
10 15 2
11 14 0

View File

@ -339,7 +339,7 @@ def simulation(strategies):
execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, joueurs, powerups, pieges) execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, joueurs, powerups, pieges)
affiche_plateau(canvas, plateau, plateauCouleur, bombes, joueurs, powerups) affiche_plateau(canvas, plateau, plateauCouleur, bombes, joueurs, powerups)
affiche_infos(canvasInfosJoueurs, joueurs, plateauCouleur) affiche_infos(canvasInfosJoueurs, joueurs, plateauCouleur)
temps = int((evenements[0][0]-evenement[0])/3*1000) temps = int((evenements[0][0]-evenement[0])/3*500)
if temps != 0: if temps != 0:
fenetre.after(temps, pas_de_jeu) fenetre.after(temps, pas_de_jeu)
else: else:
@ -379,4 +379,4 @@ def simulation(strategies):
return return
from importlib import import_module from importlib import import_module
simulation(["./main.ml", "./main.ml","./main.ml", "./main.ml"]) simulation(["./main", "./main","./main", "./main"])

BIN
main

Binary file not shown.

BIN
main.cmi

Binary file not shown.

BIN
main.cmo Normal file

Binary file not shown.

18
main.ml
View File

@ -1,4 +1,4 @@
#! /home/alexandre/.opam/myswitch/bin/ocaml (*#! /home/alexandre/.opam/myswitch/bin/ocaml *)
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *) (* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *) (* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
@ -127,6 +127,10 @@ let level_of_danger = function
let delta i j = let delta i j =
if i = j then 1 else 0 ;; if i = j then 1 else 0 ;;
let overwrite_file (filename : string) =
let ptr = open_out filename in
close_out ptr ;;
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *) (* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *) (* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
@ -556,7 +560,7 @@ let move_explore (gd: game_data) (dgs : danger array array) =
res res
end end
else begin else begin
if exit then if false && exit then
current_status := ClaimLand ; current_status := ClaimLand ;
4 4
end end
@ -640,9 +644,15 @@ let update_strat (gd : game_data) (dgs : danger array array) = match dgs.(gd.pla
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *) (* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *) (* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
let debug_game_data (gd : game_data) =
Printf.fprintf stderr "[player %d]\n" gd.player_id ;;
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
(* ---------------------------------------------------------------------------------------------------------------------------------------------------- *)
get_meta_info () ;; get_meta_info () ;;
let game_d = parse_input "input_test.txt" ;; let game_d = parse_input "entrees.txt" ;;
let dangers = evaluate_dangers game_d ;; let dangers = evaluate_dangers game_d ;;
let gains = cell_values game_d ;; let gains = cell_values game_d ;;
@ -672,4 +682,6 @@ let main_actions () = match !current_status with
main_actions () ; main_actions () ;
Printf.printf "%d" !action ; Printf.printf "%d" !action ;
debug_game_data game_d ;;
set_meta_info () ;; set_meta_info () ;;

View File

@ -1 +1 @@
1 0

View File

@ -1 +1 @@
4 0 4 1