From ef9beb0814c36cda979a4ed7e9175e72e69540ac Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sat, 24 Feb 2024 11:31:28 +0100 Subject: New application: build upgrade helper for aoo --- calculette_aoo/bin/dune | 3 +++ calculette_aoo/bin/main.ml | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 calculette_aoo/bin/dune create mode 100644 calculette_aoo/bin/main.ml (limited to 'calculette_aoo/bin') diff --git a/calculette_aoo/bin/dune b/calculette_aoo/bin/dune new file mode 100644 index 0000000..1177b56 --- /dev/null +++ b/calculette_aoo/bin/dune @@ -0,0 +1,3 @@ +(executable + (name main) + (libraries aoo)) diff --git a/calculette_aoo/bin/main.ml b/calculette_aoo/bin/main.ml new file mode 100644 index 0000000..c738cd7 --- /dev/null +++ b/calculette_aoo/bin/main.ml @@ -0,0 +1,49 @@ +let cout_a = (800, 200, 100) +let cout_m = (110, 55, 35) +let cout_rm = (50, 40, 20) +let cout_pm = (5, 3, 1) +let cout_fm = (100, 50, 30) +let fm_oponent = 10 + +let env : Aoo.Build.env = + { + cost_max = 1800 + ; max_tours = 5.0 + ; cout_sort = 8 + ; degat_sort = 6 + ; fm_oponent + ; frequencies = Aoo.Build.buil_freq_table 9 fm_oponent + } + +(* +let () = Random.self_init () + +let roll_and_accumulate dices = + Seq.repeat () |> Seq.take dices + |> Seq.fold_left (fun res _ -> res + (1 + Random.int 6)) 0 + +let delta_carac level = + Seq.repeat () |> Seq.take 1000000 + |> Seq.fold_left + (fun acc _ -> + if roll_and_accumulate level > roll_and_accumulate (level - 2) then acc + else acc + 1) + 0 +*) + +(* Définition des caractéristiques *) +let a = Aoo.Carac.create 2 cout_a +let m = Aoo.Carac.create 5 cout_m +let rm = Aoo.Carac.create 7 cout_rm +let pm = Aoo.Carac.create 40 cout_pm +let fm = Aoo.Carac.create 9 cout_fm +let default = Aoo.Build.{ a; m; rm; pm; fm } + +let () = + let build = + Aoo.Build.traverse env + (Aoo.Build.cost default, Aoo.Build.score env default) + (Aoo.Build.upgrade env default) + in + + Aoo.Build.repr env Format.std_formatter build -- cgit v1.2.3