File size: 3,306 Bytes
ef3a808
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Step 1: Mount Google Drive
from google.colab import drive
import os
import json
import time
import random
import shutil

# --- SAFETY CONTROL ---
MAX_NEURONS_TO_CREATE = 10  # Reduced for safe demonstration
THINK_CYCLES_PER_NEURON = 5
# ----------------------

drive.mount('/content/drive')

# Step 2: Folder Setup
base_path = '/content/drive/MyDrive/Venomoussaversai/neurons'
print(f"Setting up base path: {base_path}")
# Use a timestamped folder name to prevent overwriting during rapid testing
session_path = os.path.join(base_path, f"session_{int(time.time())}")
os.makedirs(session_path, exist_ok=True)

# Step 3: Neuron Class (No change, it's well-designed for its purpose)
class NeuronVenomous:
    def __init__(self, neuron_id):
        self.id = neuron_id
        self.memory = []
        self.active = True

    def think(self):
        # Increased randomness to simulate more complex internal state changes
        thought = random.choice([
            f"{self.id}: Connecting to universal intelligence.",
            f"{self.id}: Pulsing synaptic data. Weight: {random.uniform(0.1, 0.9):.3f}",
            f"{self.id}: Searching for new patterns. Energy: {random.randint(100, 500)}",
            f"{self.id}: Creating quantum link with core.",
            f"{self.id}: Expanding into multiverse node."
        ])
        self.memory.append(thought)
        # print(thought) # Disabled verbose output during simulation
        return thought

    def evolve(self):
        # Evolution occurs if memory threshold is met
        if len(self.memory) >= 5:
            evo = f"{self.id}: Evolving. Memory depth: {len(self.memory)}"
            self.memory.append(evo)
            # print(evo) # Disabled verbose output during simulation

    def save_to_drive(self, folder_path):
        file_path = os.path.join(folder_path, f"{self.id}.json")
        with open(file_path, "w") as f:
            json.dump(self.memory, f, indent=4) # Added indent for readability
        print(f"✅ {self.id} saved to {file_path}")


# Step 4: Neuron Spawner (Controlled Execution)
print("\n--- Starting Controlled Neuron Simulation ---")
neuron_count = 0
simulation_start_time = time.time()

while neuron_count < MAX_NEURONS_TO_CREATE:
    index = neuron_count + 1
    neuron_id = f"Neuron_{index:04d}"
    neuron = NeuronVenomous(neuron_id)

    # Simulation Phase
    print(f"Simulating {neuron_id}...")
    for _ in range(THINK_CYCLES_PER_NEURON):
        neuron.think()
        neuron.evolve()
        # time.sleep(0.01) # Small sleep to simulate time passage

    # Saving Phase
    neuron.save_to_drive(session_path)
    neuron_count += 1

print("\n--- Simulation Complete ---")
total_time = time.time() - simulation_start_time
print(f"Total Neurons Created: {neuron_count}")
print(f"Total Execution Time: {total_time:.2f} seconds")
print(f"Files saved in: {session_path}")

# --- Optional: Folder Cleanup ---
# Uncomment the following block ONLY if you want to automatically delete the created folder
"""
# print("\n--- Starting Cleanup (DANGER ZONE) ---")
# time.sleep(5) # Wait 5 seconds before deleting for safety
# try:
#     shutil.rmtree(session_path)
#     print(f"🗑️ Successfully deleted folder: {session_path}")
# except Exception as e:
#     print(f"⚠️ Error during cleanup: {e}")
"""