change rooms into an object and improve endTurn function