From: Amélia Coutard-Sander <git@ameliathe1st.gay>
Date: Fri, 13 Dec 2024 14:51:32 +0000 (+0100)
Subject: Ordre plus intuitif pour les cellules du Cerveau
X-Git-Url: https://git.ameliathe1st.gay/?a=commitdiff_plain;h=c784f50963a3086e10d028a27849c1ee7a08e75a;p=cells.git

Ordre plus intuitif pour les cellules du Cerveau
---

diff --git a/automata/automata/brain.ml b/automata/automata/brain.ml
index fbd5efc..0429a70 100644
--- a/automata/automata/brain.ml
+++ b/automata/automata/brain.ml
@@ -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')