public void genMaze() {
    Node current =
        nodes[(int) (Math.random() * (MazeSize - 1))][(int) (Math.random() * (MazeSize - 1))];

    while (visited.size() < MazeSize * MazeSize) {

      if (!visited.contains(current)) {
        current.setVisited(true);
        visited.add(current);
        nodeStack.push(current);

        while (!nodeStack.isEmpty()) {
          traverse(nodes);
        }
      }
    }
  }
  public Node[][] traverse(Node[][] nodes) {

    if (!nodeStack.empty()) {

      Node current = nodeStack.pop();
      current = initiateNeighbors(current);
      current.setVisited(true);
      visited.add(current);

      double randProb = Math.random();

      if (randProb <= 0.2d) {
        current.setBlocked(true);
      }

      ArrayList<Node> neighbors = current.getNeighbors();
      for (Node nbr : neighbors) {
        if (!visited.contains(nbr)) {
          nodeStack.push(nbr);
        }
      }
    }
    return nodes;
  }