% Determine a number between two input limits by answering some \ % questions of comparison disp('Enter a low number and high number and have a player choose a number'); disp('between those limits. Then have the player answer the questions'); disp('truthfully. The program returns the chosen number when enough'); disp('information is gathered.'); disp(''); low = input('Enter low number: '); high = input('Enter high number: '); while low < high question = ['So far (' num2str(low) '-' num2str(high) \ '). Is your number at least...' int2str(ceil((low+high)/2)) '? ']; number = input(question,'s'); if number == 'y' | number == 'Y' low = ceil((low+high)/2); else high = ceil((low+high)/2)-1; end end if low > high disp('You can''t do that!'); else disp(['Your number is...' int2str(low)]); end