optimized game.cpp