]> git.f4mnq.fr Git - cells.git/commitdiff
Ordre plus intuitif pour les cellules du Cerveau
authorAmélia Coutard-Sander <git@f4mnq.fr>
Wed, 7 Jan 2026 13:38:52 +0000 (14:38 +0100)
committerAmélia Coutard-Sander <git@f4mnq.fr>
Wed, 7 Jan 2026 13:53:53 +0000 (14:53 +0100)
automata/automata/brain.ml

index 1d5949018bc161755e9a7418290f9be5a332e834..9f9fd2d401ed1807b385072a5cec033c10bc297d 100644 (file)
@@ -15,7 +15,7 @@
 
 let name = "Le Cerveau de Brian"
 
-type t = Off | Dying | On
+type t = Off | On | Dying
 
 let neighbours = [(-1, -1); (-1, 0); (-1, 1); (0, -1); (0, 1); (1, -1); (1, 0); (1, 1)]
 
@@ -23,22 +23,22 @@ let transition l = function
         | Off ->
                 let n = List.length (List.filter (( = ) On) l) in
                 if n = 2 then On else Off
-        | Dying -> Off
         | On -> Dying
+        | Dying -> Off
 
 let default = Off
 
 let prev = function
-        | Off -> On
-        | Dying -> Off
-        | On -> Dying
-
-let next = function
         | Off -> Dying
-        | Dying -> On
         | On -> Off
+        | Dying -> On
+
+let next = function
+        | Off -> On
+        | On -> Dying
+        | Dying -> Off
 
 let color = function
         | Off -> ('\x00', '\x00', '\x1F')
-        | Dying -> ('\x00', '\x00', '\xFF')
         | On -> ('\xFF', '\xFF', '\xFF')
+        | Dying -> ('\x00', '\x00', '\xFF')