]> git.f4mnq.fr Git - cells.git/commitdiff
Définition de la signature des automates
authorAmélia Coutard-Sander <git@f4mnq.fr>
Wed, 7 Jan 2026 13:38:51 +0000 (14:38 +0100)
committerAmélia Coutard-Sander <git@f4mnq.fr>
Wed, 7 Jan 2026 13:53:53 +0000 (14:53 +0100)
automata/automata.ml
automata/automata.mli
automata/dune
bin/dune
bin/main.ml
dune-project

index 3fbe032f2bc348d4b78d97204e23ee9cb48e7c14..3183f5330ed96db185b4ffc893b2965b1cd31300 100644 (file)
  * You should have received a copy of the GNU Affero General Public License along
  * with this program. If not, see <https://www.gnu.org/licenses/>.
  *)
+
+module type Automaton = sig
+  val name : string
+
+  type t
+
+  val neighbours : (int * int) list
+
+  val transition : t list -> t -> t
+
+  val default : t
+
+  val prev : t -> t
+
+  val next : t -> t
+
+  val color : t -> Graphics.color
+end
+
+let automata = []
index 3fbe032f2bc348d4b78d97204e23ee9cb48e7c14..4b129983742e2e22c0ba22be08267e02161e901e 100644 (file)
  * You should have received a copy of the GNU Affero General Public License along
  * with this program. If not, see <https://www.gnu.org/licenses/>.
  *)
+
+module type Automaton = sig
+  val name : string
+
+  type t
+
+  val neighbours : (int * int) list
+
+  val transition : t list -> t -> t
+
+  val default : t
+
+  val prev : t -> t
+
+  val next : t -> t
+
+  val color : t -> Graphics.color
+end
+
+val automata : (module Automaton) list
index 07028bf7282cc0d5c05834ab22da47bb23c93a6c..c503e3a1950079c7beaa902ebbad497b145841a9 100644 (file)
@@ -1,2 +1,5 @@
+(include_subdirs unqualified)
+
 (library
- (name automata))
+ (name automata)
+ (libraries graphics))
index 3909b043359a6b959962d51bf1924e7880d5343c..6313089927478898cb978cb7dcb740d99568bffe 100644 (file)
--- a/bin/dune
+++ b/bin/dune
@@ -1,4 +1,4 @@
 (executable
  (public_name cells)
  (name main)
- (libraries automata))
+ (libraries automata graphics))
index d2fb53028e5655a5694dc04a2fb568cf3e220265..f79aac181be28413310104f3a4ff54f53a4e3509 100644 (file)
@@ -13,4 +13,9 @@
  * with this program. If not, see <https://www.gnu.org/licenses/>.
  *)
 
-let () = Printf.printf "Hello, world !\n"
+let () =
+        List.iter
+          (fun m ->
+            let module Automaton = (val m : Automata.Automaton) in
+            Printf.printf "%s\n" Automaton.name)
+          Automata.automata
index 950fc33aab855568b3dfe8ad957cfd7870e63331..68b953cee678142257bf46d98ff219580bf8f446 100644 (file)
@@ -18,5 +18,5 @@
  (name cells)
  (synopsis "Un simulateur d'automates cellulaires.")
  (description "Un système pour simuler n'importe quel automate cellulaire en deux dimensions (à condition d'en faire un module OCaml).")
- (depends ocaml dune)
+ (depends ocaml dune graphics)
  (tags ("cellular" "automaton" "automata")))