summaryrefslogtreecommitdiffstats
path: root/CLI/ruby/lib
diff options
context:
space:
mode:
Diffstat (limited to 'CLI/ruby/lib')
-rw-r--r--CLI/ruby/lib/game_of_life.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/CLI/ruby/lib/game_of_life.rb b/CLI/ruby/lib/game_of_life.rb
index a2ce27a..2ff548c 100644
--- a/CLI/ruby/lib/game_of_life.rb
+++ b/CLI/ruby/lib/game_of_life.rb
@@ -43,6 +43,14 @@ module GameOfLife
"must be between 1 and #{max_height} (current terminal height)"
end
+ fail GameOfLife::Error, "Invalid --live-cell value. must be a single character" if options["live-cell"].length > 1
+
+ fail GameOfLife::Error, "Invalid --dead-cell value. must be a single character" if options["dead-cell"].length > 1
+
+ if options["dead-cell"] == options["live-cell"]
+ fail GameOfLife::Error, "Invalid --dead-cell value. must be a different character than --live-cell"
+ end
+
{
# Defaults the hight to less then the height of the terminal to allow banner info
# and an extra emtpy line to avoid triggering terminal scroll while flushing