I'd stick with the counter and have 2 variables to hold the high & low which would also be used for random range, ex:
low = 1;
high = 100;
count = 0;
# in game loop ...
count += 1;
attempt = random_range(low, high);
# print attempt, get answer from user
if(answer == "higher")
low = answer;
else if(answer == "lower")
high = answer;
else if(answer == "correct")
# break from game loop
else
# unknown answer, make user try again
# out of loop ...
# found number "answer" in "count" tries.
works in my head, didn't really test anything. also sorry if gives away too much, just can't explain shit with words.
I would also shorten input so user doesn't have to type out those words on every try, use style:
[H]igher, [L]ower, [C]orrect