public void generateSons(){
    int currentPlayer = state.getCurrentPlayer();
    if (currentPlayer == 0){
        sons = getSonsPacman();
    } else {
        sons = getSonsGhosts(state.findGhosts()[currentPlayer - 1]);
    }
}

private List<MCTSNode> getSonsPacman(){
    List<MCTSNode> sons = new LinkedList<>();
    for (Position position: state.findPossibleMoves()){
        sons.add(new MCTSNode(state.move(position), this));
    }
    if (sons.isEmpty()){
        sons.add(new MCTSNode(state.move(state.findPacman()), this));
    }
    return sons;
}

private List<MCTSNode> getSonsGhosts(Position positionGhost){
    List<MCTSNode> sons = new LinkedList<>();
    for (Position position: state.findPossibleMoves(positionGhost)){
        sons.add(new MCTSNode(state.moveGhost(positionGhost, position), this));
    }
    if (sons.isEmpty()){
        sons.add(new MCTSNode(state.moveGhost(positionGhost, positionGhost), this));
    }
    return sons;
}