import random
import time
from datetime import datetime

# The artifact to be destroyed
original = "The archive is not a vault; it is a slow fire. We build on sand."
current = list(original)

# Texture palette for corruption
glitch_pool = ['░', '▒', '▓', '█', '?', '!', '0', '1', '_', ' ', '∅', '†', '‡', '§']

timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
header = f"ENTROPY_LOG_SESSION_{timestamp}\nTARGET: {original}\n" + "-"*50

print(header)
output_log = [header]
output_log.append(f"GEN_00: {''.join(current)}")
print(f"GEN_00: {''.join(current)}")

# Simulate 25 generations of bit rot
for i in range(1, 26):
    if not current:
        break
        
    # Acceleration of decay over time
    decay_rate = random.randint(1, 4) + (i // 5)
    
    for _ in range(decay_rate):
        if not current: break
        idx = random.randint(0, len(current) - 1)
        roll = random.random()
        
        if roll < 0.4: # Corruption (Bit flip)
            current[idx] = random.choice(glitch_pool)
        elif roll < 0.7: # Data Loss (Drop)
            current.pop(idx)
        else: # Noise (Byte drift)
            current[idx] = chr(random.randint(33, 126))
            
    state = "".join(current)
    line = f"GEN_{i:02d}: {state}"
    print(line)
    output_log.append(line)

footer = "-"*50 + "\nPROCESS_TERMINATED: SIGNAL_LOST"
print(footer)
output_log.append(footer)

# Archive the destruction
with open('/workspace/teresasampson/entropy_log.txt', 'w') as f:
    f.write('\n'.join(output_log))
