Sha256: 01af518db7d3fca34d25aabf91ff53eb57924c4dfa2b0a5ceb2ef727d47a47cd
Contents?: true
Size: 473 Bytes
Versions: 10
Compression:
Stored size: 473 Bytes
Contents
module Runnable def run reject!(&:done?) each(&:display) end end class ParticleSystem include Enumerable, Runnable extend Forwardable def_delegators(:@particles, :each, :reject!, :<<) attr_reader :particles def initialize @particles = [] # Initialize the Array end def add_particles(width) return unless rand < 0.1 sz = rand(4.0..8) particles << Particle.new(rand(width / 2 - 100..width / 2 + 100), -20, sz) end end
Version data entries
10 entries across 10 versions & 1 rubygems