🧬

コード短編小説「chaos_theory.py」

に公開

コード短編小説「chaos_theory.py」

# title: chaos_theory.py
# theme: カオス理論
# わずかな初期値の差が、未来を狂わせる。

import random

def butterfly_effect(seed):
    random.seed(seed)
    weather = ["sunny", "storm", "flood", "drought"]
    return random.choice(weather)

def simulate_world(seed):
    print(f"// 初期条件: {seed}")
    outcome = butterfly_effect(seed)
    print(f"// 世界の結果: {outcome}")
    return outcome

# 二つの世界を走らせる
world_a = simulate_world(42)
world_b = simulate_world(43)

if world_a != world_b:
    print("// ほんの一歩の違いが、運命を分岐させた")
else:
    print("// たまたま同じ未来に見えるが、本質は揺らいでいる")

# カオスの真理
print("print('Chaos is not disorder, but hidden order too vast to grasp')")

Discussion