Class: Seed
- Inherits:
-
Object
- Object
- Seed
- Defined in:
- lib/seed.rb
Class Method Summary collapse
Class Method Details
.render_to_grid(grid, pattern_name, x, y) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/seed.rb', line 5 def self.render_to_grid(grid, pattern_name, x, y) require_relative("./seeds/#{pattern_name}.rb") pattern = eval("#{pattern_name.to_s.split('_').map(&:capitalize).join}::PATTERN") pattern.map.with_index do |pattern_row, pri| pattern_row.map.with_index do |pattern_col, pci| grid[y+pci][x+pri] = Cell.new(pattern_col, x+pri, y+pci) end end return grid end |