Class: Diamante::Scene::Matrix

Inherits:
Object
  • Object
show all
Defined in:
lib/diamante/scenes/matrix.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Matrix

Returns a new instance of Matrix.



10
11
12
13
14
15
16
17
18
# File 'lib/diamante/scenes/matrix.rb', line 10

def initialize(config)
  @config = config # todo: elegible_chars
  @pastel = Pastel.new
  @eligible_chars = "ª\|@·#$~%&/\¿¸^*¨;•:·_-+'.,".chars + ['.', ' ']
  @term = ANSI.new
  @height = @term.height
  @width = @term.width
  @chars = {}
end

Instance Method Details

#renderObject



20
21
22
23
24
25
26
27
28
# File 'lib/diamante/scenes/matrix.rb', line 20

def render
  @chars[rand(@width)] = 0
    
  @chars.each do |col, row|
    @chars[col] += 1
    print_random_char_at(row, col)
  end
  print_char_at_ramdom("")
end