summaryrefslogtreecommitdiffstats
path: root/CLI/ruby/lib/game_of_life
diff options
context:
space:
mode:
Diffstat (limited to 'CLI/ruby/lib/game_of_life')
-rw-r--r--CLI/ruby/lib/game_of_life/cell.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/CLI/ruby/lib/game_of_life/cell.rb b/CLI/ruby/lib/game_of_life/cell.rb
new file mode 100644
index 0000000..fe52263
--- /dev/null
+++ b/CLI/ruby/lib/game_of_life/cell.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+module GameOfLife
+ class Cell
+ attr_accessor :alive
+
+ # Initialize a cell in the game of life universe
+ # @param alive [True|False] boolean indicating if the cell is considered alive
+ def initialize(alive:)
+ @alive = alive
+ end
+
+ # Representation of a cell
+ # @return [String] if a cell is alive or an empty space
+ def to_s
+ return @alive ? "\u2588" : "\s"
+ end
+ end
+end