summaryrefslogtreecommitdiffstats
path: root/CLI
diff options
context:
space:
mode:
Diffstat (limited to 'CLI')
-rw-r--r--CLI/ruby/lib/game_of_life.rb1
-rw-r--r--CLI/ruby/lib/game_of_life/cell.rb19
2 files changed, 20 insertions, 0 deletions
diff --git a/CLI/ruby/lib/game_of_life.rb b/CLI/ruby/lib/game_of_life.rb
index c2e6845..7f70933 100644
--- a/CLI/ruby/lib/game_of_life.rb
+++ b/CLI/ruby/lib/game_of_life.rb
@@ -2,6 +2,7 @@
require "game_of_life/version"
require "game_of_life/universe"
+require "game_of_life/cell"
module GameOfLife
class Error < StandardError; end
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