public static void main( String[] args ) throws IOException,InterruptedException{

	BufferedReader reader =
	    new BufferedReader(new InputStreamReader(System.in));

	CLList Categories = new CLList();
	Categories.add("spouse");
	Categories.add("job");
	Categories.add("number of kids");
	Categories.add("salary");
	Categories.add("retirement age");
	Categories.add("living location");

	for (int i = 0; i < Categories.size(); i++) {
	    System.out.println("Fill in your choices for " + 
			       Categories.get(i).getName());

	    ArrayList<String> arr = new ArrayList<String>();
	    for (int a = 0; a < 3; a++) {
		
		System.out.print(a + 1 + " : ");
		String input = reader.readLine();
		arr.add(input);
		
	    }
	    Categories.set(i, arr);
	}

	System.out.println(Categories);
	//System.out.println(Categories.get(7));

	System.out.println("Spinning...");
	Random r = new Random();
	int spun = r.nextInt(8) + 2;
	System.out.println("Spinning by " + spun);
	int counter = 1;//num nodes passed
	int node = 0;
	int index = 0; 
	int catSize = 0;
	while (! Categories.isThereOne() ) {
	    catSize = Categories.ALSize(node);
	    if (catSize == 1 || index >= catSize) {		   
		node++;
		index = 0;
	    }
	    else {
		System.out.println ( "looking at: "+ Categories.get(node, index));
		if (counter % spun == 0) {
		    String removed = Categories.remove(node, index);
		    System.out.println( removed + " is not in your " 
					+ Categories.get(node).getName() + " future!");
		    catSize = Categories.ALSize(node);
		    index--;
		    Thread.sleep(1000);
		}
		
		counter++;
		index++;
	    }
	    //System.out.println(Categories);
	}
	System.out.println(Categories);

	String results = "";
	for (int i = 0; i < Categories.size(); i++) {
	    results += Categories.get(i).getValue(0) + ",";
	}
	results = results.substring(0, results.length() - 1);
	System.out.println(results);//should be stored in text file
	/*
	CLList liz = new CLList();
	
	liz.add("kenneth");
	liz.add("jack");
	liz.add("tracy");
	
	liz.add("partner"); // added partner category
	ArrayList<String> p = new ArrayList<String>();
	p.add("kenneth");
	p.add("jack");
	p.add("tracy");

	liz.set(0, p);

	liz.add("pet");
	liz.get(1).add("dog");
	System.out.println(liz);

	System.out.println("\ntesting get()...");
	for( int i = 0; i < liz._size; i++ ) {
	    System.out.println("node " + i + " contains " + liz.get(i) );
	    System.out.println(liz);
	}
	/*
	System.out.println("\ntesting set()...");
	for( int i = 0; i < liz._size; i++ ) {
	    System.out.println( liz.set( i, "rock"+i ) );
	    System.out.println(liz);
	}
	*/
    }//end main