From: Siraaj Khandkar Date: Sun, 29 Sep 2013 16:38:20 +0000 (-0400) Subject: Colorize alive Life cells with white. X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=39971ff4e819b3cd49a803bfe9edba60de066e95;p=cellular-automata.git Colorize alive Life cells with white. --- diff --git a/polymorphism/001/src/polymorphism.ml b/polymorphism/001/src/polymorphism.ml index 3c90972..f132fd7 100644 --- a/polymorphism/001/src/polymorphism.ml +++ b/polymorphism/001/src/polymorphism.ml @@ -4,6 +4,7 @@ open Core.Std module Terminal : sig type color = [ `green | `red + | `white ] val string_with_color : string -> color -> string @@ -14,6 +15,7 @@ module Terminal : sig end = struct type color = [ `green | `red + | `white ] let ansi_code_clear = "\027[2J" (* Clear screen *) @@ -22,6 +24,7 @@ end = struct let string_of_color = function | `green -> "\027[0;32m" | `red -> "\027[1;31m" + | `white -> "\027[1;37m" let string_with_color s c = sprintf "%s%s\027[0m" (string_of_color c) s @@ -213,7 +216,7 @@ module Life : RULE = struct let pheno_of_state : (state -> PhenoType.t) = function | D -> PhenoType.create ' ' None - | A -> PhenoType.create 'o' None + | A -> PhenoType.create 'o' (Some `white) let int_of_msg msg = msg |> state_of_string |> int_of_state