end
+module Terminal : sig
+ val clear : unit -> unit
+ val reset : unit -> unit
+end = struct
+ let ansi_code_clear = "\027[2J" (* Clear screen *)
+ let ansi_code_reset = "\027[1;1H" (* Reset cursor position *)
+
+ let clear () =
+ print_string ansi_code_clear
+
+ let reset () =
+ print_string ansi_code_reset
+end
+
+
module Automaton : sig
type t
; data = Rule.create ()
}
in
+ Terminal.clear ();
{ grid = Matrix.map ~f:init (Matrix.create ~rs ~ks ())
; interval = Time.Span.of_float interval
; bar = String.make ks '-'
cell.data.Cell.pheno
let print t =
+ Terminal.reset ();
print_endline t.bar;
Matrix.print t.grid ~to_string:cell_to_string;
print_endline t.bar