public void run(int turns) {
		final Pattern num_guesses_pattern = Pattern.compile("Number of guesses: ([0-9]+)");
		double avg_guesses = 0.0;
		for(int i=0; i<turns; ++i) {
			System.out.print("Turn "+(i+1)+": ");
			boolean correct = false;
			int min = 1; 
			int max = 100;
			while(!correct) {
				if(min > max) {
					System.err.println("IMPOSSIBRU! min > max");
					System.exit(-1);
				}
				int guess = min + ((max - min) / 2);
				String res = read(open(guess));
				if(res.contains("Correct")) {
					correct = true;
					Matcher m = num_guesses_pattern.matcher(res);
					if(m.find()) {
						int num_guesses = Integer.parseInt(m.group(1));
						System.out.println(num_guesses + " guesses");
						avg_guesses += num_guesses / (double)turns;
					} else {
						System.err.println("Critical error: Can't read number of guesses, pattern doesn't match");
						System.err.println("Body: "+res);
						System.exit(-1);
					}
				} else if(res.contains("Guess lower")) {
					max = guess - 1;
				} else if(res.contains("Guess higher")) {
					min = guess + 1;
				} else {
					System.err.println("Can't find state");
					System.err.println("Body: "+res);
					System.exit(-1);
				}
			}
		}
		System.out.println("Average: "+avg_guesses);
	}