--- /dev/null
+(* Copyright 2024 Amélia COUTARD <https://www.ameliathe1st.gay>.
+ *
+ * This file from the program cells is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+ *
+ * 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/>.
+ *)
+
+let name = "Le Cerveau de Brian"
+
+type t = Off | Dying | On
+
+let neighbours = [(-1, -1); (-1, 0); (-1, 1); (0, -1); (0, 1); (1, -1); (1, 0); (1, 1)]
+
+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
+
+let default = Off
+
+let prev = function
+ | Off -> On
+ | Dying -> Off
+ | On -> Dying
+
+let next = function
+ | Off -> Dying
+ | Dying -> On
+ | On -> Off
+
+let color = function
+ | Off -> ('\x00', '\x00', '\x1F')
+ | Dying -> ('\x00', '\x00', '\xFF')
+ | On -> ('\xFF', '\xFF', '\xFF')