val color : t -> char * char * char
end
+(* TODO: infinite board *)
+type 't board = 't * 't array array
+
+let initial (type t) (m : (module Automaton with type t = t)) =
+ let module M = (val m) in
+ (M.default, Array.make_matrix 64 64 M.default)
+
+let get x y (d, board) = if x < 0 || 63 < x || y < 0 || 63 < y then d else board.(x).(y)
+
+let set x y c (_, board) = if x < 0 || 63 < x || y < 0 || 63 < y then () else board.(x).(y) <- c
+
+let update (type t) (m : (module Automaton with type t = t)) ((d, cells) as board) =
+ let module M = (val m) in
+ ( M.transition (List.map (Fun.const d) M.neighbours) d,
+ Array.init 64 (fun x ->
+ Array.init 64 (fun y ->
+ M.transition (List.map (fun (dx, dy) -> get (x + dx) (y + dy) board) M.neighbours) cells.(x).(y))) )
+
let automata = [(module Life : Automaton); (module Wireworld : Automaton)]
val color : t -> char * char * char
end
+type 't board
+
+val initial : (module Automaton with type t = 't) -> 't board
+
+val get : int -> int -> 't board -> 't
+
+val set : int -> int -> 't -> 't board -> unit
+
+val update : (module Automaton with type t = 't) -> 't board -> 't board
+
val automata : (module Automaton) list