refactoring our game solution into object oriented JS