+
+ let cell_of_state s =
+ { Cell.msg = s |> msg_of_state
+ ; Cell.pheno = s |> pheno_of_state
+ ; Cell.state = s |> string_of_state
+ }
+
+ let create () =
+ Random.int 2 |> state_of_int |> cell_of_state
+
+ let live_neighbors inputs =
+ inputs |> List.map ~f:int_of_msg |> List.fold_left ~init:0 ~f:(+)
+
+ let transition ~state ~inputs =
+ state
+ |> state_of_string
+ |> next ~live_neighbors:(live_neighbors inputs)
+ |> cell_of_state