void GameController::init()
{
    std::srand(std::time(NULL));
    
    // Place the enemies and Pengo all over the free spaces
    std::vector< std::pair<int,int> > freePositions = scenario.getFreeMapPositions();
    int size = freePositions.size();
    
    if (size < GAMECONTROLLER_MIN_ENEMIES + 1) {
        throw std::string("Mapa não permite criação dos elementos do jogo");
    }
    int randomPosition;
    for (int i=0; i<GAMECONTROLLER_MIN_ENEMIES + 1; i++) {
        randomPosition = std::rand() % size;
        
        std::pair<int,int> &newPosition = freePositions[randomPosition];
        
        if (i == 0) {
            this->penguin = scenario.createPenguinAt(newPosition.first, newPosition.second);
        } else {
            this->enemies.push_back(scenario.createEnemyAt(newPosition.first, newPosition.second));
        }
        
        size--;
        freePositions.erase(freePositions.begin() + randomPosition);
    }
    
    // Place the items inside random moblie blocks
    std::vector< std::pair<int,int> > mobileBlocksPos = scenario.getMobileBlockPositions();
    int sizeBlocks = mobileBlocksPos.size();
    
    if (sizeBlocks < GAMECONTROLLER_MIN_ITEMS) {
        throw std::string("Mapa não permite criação dos itens nos blocos");
    }
    for (int i=0; i<GAMECONTROLLER_MIN_ITEMS; i++) {
        randomPosition = std::rand() % sizeBlocks;
        
        std::pair<int,int> chosenBlockPos = mobileBlocksPos[randomPosition];
        
        if (i < (GAMECONTROLLER_MIN_ITEMS/2)) {
            scenario.createItemInsideBlockAt(chosenBlockPos.first, chosenBlockPos.second, ITEM_KIND_PLUS_SPEED);
        }
        else {
            scenario.createItemInsideBlockAt(chosenBlockPos.first, chosenBlockPos.second, ITEM_KIND_PLUS_CONCEPTION);
        }
        
        sizeBlocks--;
        mobileBlocksPos.erase(mobileBlocksPos.begin() + randomPosition);
    }
}