Update game_manager.js

Using nested loops instead of function