Move game logic from main.lua to game.lua