var tickWave = require('./tickWave')

module.exports = function (state, dt) {
  // Parameters
  //   state
  //   dt
  //     simulation time, seconds
  //

  // To avoid huge wave of particles when the page gains focus after a while,
  // the particles are created only if dt is close to given framerate.
  if (dt > 0.5) {
    return
  }

  // Remove dead waves
  state.waves = state.waves.filter(function (wave) {
    return wave.alive
  })

  // Simulate each wave. Each wave has its own options.
  state.waves.forEach(function (wave) {
    tickWave(state, wave, dt)
  })
}

@@ -333,16 +333,89 @@
 rn%0A  %7D%0A%0A
+  // DEBUG TOOL%0A  // console.log('number of waves', state.waves.length)%0A%0A
   // Rem

Add debug tool to count waves