Newer
Older
(* Time-stamp: <modified the 08/03/2019 (at 13:54) by Erwan Jahier> *)
(* This is algo 5.3 in the book *)
open Algo
let vars = ["d",It]
let d=10
let init_vars = function _ -> I (Random.int d)
let enable_f nl e = if (e "d") <> I 0 then ["CD"] else []
let step_f nl e = function | _ -> (function "d" -> I 0 | _ -> assert false)
let () =
let algo_id = "root" in
Algo.reg_vars algo_id vars;
Algo.reg_init_vars algo_id init_vars;
Algo.reg_enable algo_id enable_f;
Algo.reg_step algo_id step_f;
()