Edit Content

Est adipisci rutrum minim hat dolorum, nobis nonummy natoque dolores delectus magna turpis.

AI Game: Number Guesser Using Logic

ABC AI & Robotics Research Institute Blog 4

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

About the Author

Leave a Reply

Your email address will not be published. Required fields are marked *

You may also like these