moving game code to a separated js file