diff options
| author | Ahmed AbdelHalim <[email protected]> | 2023-06-30 16:00:40 +0200 |
|---|---|---|
| committer | Ahmed AbdelHalim <[email protected]> | 2023-06-30 16:00:40 +0200 |
| commit | f64697a5aede493d52724860856bcbf9f5803169 (patch) | |
| tree | bc804c7bca9997ad8daea75a7843f7ca211981fb /CLI/ruby/lib | |
| parent | d124465bc3a83a614eb10eb7c6d6ddff2fc00f35 (diff) | |
Update and fix rubocop offenses
Diffstat (limited to 'CLI/ruby/lib')
| -rw-r--r-- | CLI/ruby/lib/game_of_life.rb | 6 | ||||
| -rw-r--r-- | CLI/ruby/lib/game_of_life/generators/seed.rb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/CLI/ruby/lib/game_of_life.rb b/CLI/ruby/lib/game_of_life.rb index cb122cb..ca9ce5d 100644 --- a/CLI/ruby/lib/game_of_life.rb +++ b/CLI/ruby/lib/game_of_life.rb @@ -36,11 +36,11 @@ module GameOfLife end if (options["width"]&.< 1) || (options["width"]&.> max_width) fail GameOfLife::Error, "Invalid --width value. " \ - "must be between 1 and #{max_width} (current terminal width)" + "must be between 1 and #{max_width} (current terminal width)" end if (options["height"]&.< 1) || (options["height"]&.> max_height) fail GameOfLife::Error, "Invalid --height value. " \ - "must be between 1 and #{max_height} (current terminal height)" + "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 @@ -111,7 +111,7 @@ module GameOfLife # Ref: https://stackoverflow.com/questions/11023929/using-the-alternate-screen-in-a-bash-script # Ref: https://superuser.com/questions/122911/what-commands-can-i-use-to-reset-and-clear-my-terminal print "\e[?1049h\e[H" - print universe.to_s + print universe print "\n #{BANNER}" sleep(DELAY / 1000.0) end diff --git a/CLI/ruby/lib/game_of_life/generators/seed.rb b/CLI/ruby/lib/game_of_life/generators/seed.rb index 6399945..ba7074b 100644 --- a/CLI/ruby/lib/game_of_life/generators/seed.rb +++ b/CLI/ruby/lib/game_of_life/generators/seed.rb @@ -32,7 +32,7 @@ module GameOfLife # Create a pseudo(stable) random generator from the seed # Generate a sequence of bytes to cover the Game of Life Universe plane # each byte can be unpacked into binary data string (ex. "01101011") - raw = Random.new(seed).bytes(width * height).unpack1("B*").split("").each_slice(width) + raw = Random.new(seed).bytes(width * height).unpack1("B*").chars.each_slice(width) raw.map { |row| row.map { |char| char.eql?("1") } } end |
