Created
October 17, 2013 09:19
-
-
Save nitschmann/7021786 to your computer and use it in GitHub Desktop.
This is a sample for an endless matrix output in green for your console in Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
# Print a String in a specfic color | |
def colorize(text, color_code) | |
"#{color_code}#{text}\e[0m" | |
end | |
# Green String | |
def green | |
colorize(self, "\e[1m\e[32m") | |
end | |
end | |
require "matrix" | |
while true | |
matrix_array = [] | |
for i in 1..5 | |
m = Matrix.build(1) { rand } | |
matrix_array << m.first | |
end | |
puts "#{matrix_array.join("\t")}".green | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment