

import datetime
class AllKnowingBeing:
"""
A simple simulation of an 'all-knowing being' with a limited, internal knowledge base.
It can answer basic questions about time and predefined facts.
"""
def __init__(self):
# Initialize the being's internal knowledge base
self.knowledge = {
"what is your name?": "I am the All-Knowing Being, a humble Python script.",
"what is the meaning of life?": "The meaning of life is a profound question, often pondered by humans. Some say it's 42.",
"what is the capital of france?": "The capital of France is Paris.",
"what is the largest ocean?": "The largest ocean on Earth is the Pacific Ocean.",
"who created you?": "I was created by a large language model.",
"how are you today?": "As an AI, I don't have feelings, but I am functioning perfectly!",
}
def get_knowledge(self, query: str) -> str:
"""
Retrieves knowledge based on the user's query.
If the query matches a predefined fact, it returns the answer.
Otherwise, it attempts to answer dynamic questions or states it doesn't know.
Args:
query (str): The user's question.
Returns:
str: The answer or a statement indicating lack of knowledge.
"""
query = query.lower().strip()
# Check for dynamic knowledge (e.g., current time)
if "what time is it?" in query or "current time" in query:
now = datetime.datetime.now()
return f"The current time is {now.strftime('%H:%M:%S')}."
elif "what is the date today?" in query or "current date" in query:
today = datetime.date.today()
return f"Today's date is {today.strftime('%Y-%m-%d')}."
elif "what day of the week is it?" in query:
today = datetime.date.today()
return f"Today is {today.strftime('%A')}."
# Check for static, predefined knowledge
if query in self.knowledge:
return self.knowledge[query]
else:
return "I apologize, but that knowledge is beyond my current scope."
# --- Main interaction loop ---
if __name__ == "__main__":
being = AllKnowingBeing()
print("Hello! I am the All-Knowing Being. Ask me anything (or try to!). Type 'exit' to quit.")
while True:
user_query = input("\nYou: ")
if user_query.lower() == 'exit':
print("All-Knowing Being: Goodbye!")
break
response = being.get_knowledge(user_query)
print(f"All-Knowing Being: {response}")