aboutsummaryrefslogtreecommitdiff
path: root/calculette_aoo/bin
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2024-02-24 11:31:28 +0100
committerSébastien Dailly <sebastien@dailly.me>2024-02-24 11:31:28 +0100
commitef9beb0814c36cda979a4ed7e9175e72e69540ac (patch)
treec2852b1dd5df53f5d78e9e952f29360d50126e06 /calculette_aoo/bin
parent9e7f27c60a425e2baa67cd459d8509a43b1d123d (diff)
New application: build upgrade helper for aoo
Diffstat (limited to 'calculette_aoo/bin')
-rw-r--r--calculette_aoo/bin/dune3
-rw-r--r--calculette_aoo/bin/main.ml49
2 files changed, 52 insertions, 0 deletions
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