Refacotoring and Add unittest of LogiOsciGame.js
Refactoring: collect detection code