Overview: Classic binary search game where your bot guesses your number based on user hints.
Use Case: Voice-activated gaming, logic training, or demo for AI club.
Working Code:
low, high = 1, 100
while low <= high:
mid = (low + high) // 2
print(f"Is your number {mid}?")
feedback = input("Enter 'low', 'high', or 'correct': ")
if feedback == 'correct':
print("Yay! Guessed it!")
break
elif feedback == 'low':
high = mid - 1
else:
low = mid + 1
Integration Tip: Add TTS/STT to make it fully voice-driven.
Try Online: Play in Replit