๐ค AI Project: “Mind Reader Number Guessing AI”
๐ค
AI Project: “Mind Reader Number Guessing AI”
๐ฏ Instructions for Students
1. Think of a number
between 1 and 20.
2. Do not tell
the computer your number.
3. Answer the computer’s
questions with:
o yes
o higher
o lower
The
AI will try to guess your number. ๐ง
๐ป Python Code (Small Range
Version)
print("๐ค Welcome to Mind Reader AI!")
print("Think of a number between 1 and 20.")
input("Press Enter when you are ready...")
low = 1
high = 20
while low <= high:
guess = (low + high) // 2
print("\nIs your number:", guess)
answer = input("Type 'yes', 'higher', or 'lower': ")
if answer == "yes":
print("๐ I guessed your number!")
break
elif answer == "higher":
low = guess + 1
elif answer == "lower":
high = guess - 1
else:
print("Please type yes, higher, or lower.")
๐งช Example
Student
thinks of 14
AI: Is your number 10? → higher
AI: Is your number 15? → lower
AI: Is your number 12? → higher
AI: Is your number 13? → higher
AI: Is your number 14? → yes
๐
AI
guessed correctly!
Comments
Post a Comment