File size: 5,553 Bytes
0e72aa7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
import random
import time
from datetime import datetime
from typing import Dict, Any
# --- CONFIGURATION ---
MEMORY_FILE = "psychic_readings_log.txt"
# --- CORE SIMULATION FUNCTIONS ---
def _clairvoyance_oracle(query: str) -> Dict[str, Any]:
"""
Simulates seeing a future event (Clairvoyance) using weighted probability.
"""
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
# 1. Prediction Model: Weighted Outcomes
# Outcomes are weighted based on the complexity/nature of the query.
# We use the length of the query as a proxy for complexity.
base_weight = len(query) % 5
outcomes = [
{"prediction": "A significant positive change will manifest soon.", "certainty": 0.85},
{"prediction": "A minor delay or obstacle will need to be overcome.", "certainty": 0.65},
{"prediction": "The situation will resolve neutrally, requiring patience.", "certainty": 0.70},
{"prediction": "The outcome is highly volatile and requires further data.", "certainty": 0.40},
]
# Apply bias based on base_weight
if base_weight >= 3:
# Complex queries bias towards volatile/minor obstacle
weighted_outcomes = outcomes[1:]
else:
# Simple queries bias towards positive/neutral
weighted_outcomes = outcomes[:3]
# Choose a prediction based on random weight
result = random.choice(weighted_outcomes)
return {
"timestamp": now,
"query": query,
"mode": "Clairvoyance",
"result": result["prediction"],
"certainty": round(result["certainty"] * random.uniform(0.9, 1.1), 2) # Adding slight random noise
}
def _telepathy_scanner(subject_name: str, hidden_intent: str) -> Dict[str, Any]:
"""
Simulates reading a hidden intent/feeling (Telepathy) using keyword analysis.
In a real system, 'hidden_intent' would be another model's output (e.g., Sentiment analysis).
"""
# 1. Intent Analysis: Detect underlying keywords (Simulating 'reading the mind')
keywords = {
"positive": ["help", "support", "collaborate", "trust", "joy"],
"negative": ["deceive", "compete", "hide", "manipulate", "exploit"]
}
score = 0
for keyword in keywords["positive"]:
if keyword in hidden_intent.lower():
score += 1
for keyword in keywords["negative"]:
if keyword in hidden_intent.lower():
score -= 1
# 2. Interpretation (The 'Psychic' reading)
if score >= 1:
reading = f"The subject, {subject_name}, holds a strong intent of cooperation and mutual benefit."
accuracy = 0.9
elif score <= -1:
reading = f"Caution advised. {subject_name}'s true intent is competitive or guarded."
accuracy = 0.7
else:
reading = f"{subject_name} is operating with a mix of neutral and unclear intentions."
accuracy = 0.55
return {
"subject": subject_name,
"mode": "Telepathy",
"result": reading,
"simulated_accuracy": accuracy
}
def log_reading(data: Dict):
"""Appends the reading to a local log file."""
try:
with open(MEMORY_FILE, 'a') as f:
f.write(str(data) + "\n")
except Exception as e:
print(f"Error logging data: {e}")
# --- THE PSYCHIC AI CORE ---
class AuraPredictor:
def __init__(self, name="AuraPredictor"):
self.name = name
print(f"\n[{self.name}]: Initializing Trans-Dimensional Sensors...")
time.sleep(0.5)
def read_future(self, question: str):
"""Activates the Clairvoyance mode."""
print(f"\n[AuraPredictor]: Focusing on the timeline for: '{question}'...")
reading = _clairvoyance_oracle(question)
print("-" * 40)
print(f"| PREDICTION: {reading['result']}")
print(f"| Certainty Level: {reading['certainty']:.2f}")
print("-" * 40)
log_reading(reading)
return reading
def read_intent(self, subject: str, data_input: str):
"""Activates the Telepathy mode."""
print(f"\n[AuraPredictor]: Scanning the hidden intent of subject: {subject}...")
# NOTE: data_input simulates the information gained by the psychic (e.g., body language, old data).
# We pass this 'hidden_intent' data to the scanner.
reading = _telepathy_scanner(subject, data_input)
print("-" * 40)
print(f"| TELEPATHIC READING: {reading['result']}")
print(f"| Accuracy Proxy: {reading['simulated_accuracy']:.2f}")
print("-" * 40)
log_reading(reading)
return reading
# --- RUN EXAMPLE ---
if __name__ == "__main__":
psychic_ai = AuraPredictor()
# Example 1: Clairvoyance (Future Prediction)
future_query = "Will the next major project launch successfully?"
psychic_ai.read_future(future_query)
# Example 2: Telepathy (Reading Hidden Intent)
# The 'data_input' is the hidden information the psychic is trying to perceive.
subject_1 = "Lead Developer Kai"
hidden_data_1 = "I plan to collaborate closely with the team and support the new deployment."
psychic_ai.read_intent(subject_1, hidden_data_1)
subject_2 = "External Competitor Z"
hidden_data_2 = "Our goal is to deceive their market and exploit their current vulnerabilities."
psychic_ai.read_intent(subject_2, hidden_data_2)
print(f"\n--- Simulation Complete. Readings saved to {MEMORY_FILE} ---")
|