public Direction getMove(Simulation sim){
		valid.clear();
		
		if (sim.getTime() < DrivingRange.BALL_DIST_AVG){
			return Direction.DOWN;
		}
		
		// find the max
		int max = 0;
		for (int i = 0; i < dirs.length; i++){
			int val = getAdjacentBalls(sim, dirs[i]);
			if (val > max){
				max = val;
			}
		}
		
		// find all moves with that max value
		for (int i = 0; i < dirs.length; i++){
			if (getAdjacentBalls(sim, dirs[i]) == max){
				valid.add(dirs[i]);
			}
		}
		
		// choose a random move from those available
		double randy = r.nextDouble();
		for (int i = 0; i < valid.size(); i++){
			if (randy < (i + 1.0) / valid.size()){
				return valid.get(i);
			}
		}
		return valid.get(valid.size() - 1);
		
	}