added util/game.js and some abstract logic