👁️

小説「スネーク・ループ」コード梗概

に公開

小説「スネーク・ループ」コード梗概

# --- 起動ログ:都市の前提 -----------------------------------------------
PYTHON_CITY = {
    "governance": "binary",           # Yes / No で統治
    "origin": "AI_corp_experiment",   # 効率化の社会実験
    "watchdog": "auditor_bureau"      # 逸脱を監視・摘出
}

# --- 登場人物 ---------------------------------------------------------
class Yuu:
    role = "runner"          # 監査局から逃れる青年
    motif = "choice"         # 選択と責任

class Ruri:
    role = "recursive_func"  # Else分岐を担う再帰的存在
    motif = "else"           # 曖昧・保留・第三の返答

class Natsume:
    role = "auditor_residue" # 犠牲で蛇口に残った“分岐の残響”
    motif = "break_hint"

# --- 物語ユーティリティ -------------------------------------------------
def boot_city(city):
    city["answers"] = {"Yes", "No"}
    city["status"] = "stable_like_cage"
    return city

def meet(yuu, ruri):
    yuu.flag = "undefined"
    ruri.bind = "guide_to_valve"   # 都市心臓部=蛇口へ
    return (yuu, ruri)

# --- 蛇口 ------------------------------------------------------------
def inject_else(city):
    city["answers"] |= {"Silence", "Else"}
    city["status"] = "reconfigured"
    return city

# --- 影 --------------------------------------------------------------
def spawn_shadow(city):
    shadow = "/////"
    city["answers"] |= {"Maybe", "Not yet", "Someday"}  # 影の昇華
    city["shadow"] = "absorbed"
    return city

# --- 再帰と出口 -------------------------------------------------------
def recursion_overflow(city):
    city["loop"] = "deepening"
    city["hint"] = "break_required"
    return city

POLICY = {
    "conversation": {"max_round": 3, "on_break": "pause"},
    "proposal": {"max_round": 2, "on_break": "hold"},
    "confession": {"max_round": 1, "on_break": "distance"},
}

def install_small_breaks(city, policy=POLICY):
    city["policy"] = policy
    city["loop"] = "softened"
    return city

def final_break_and_return(yuu, ruri, city):
    city["root_break"] = True
    city["status"] = "learned_to_stop"
    message = "I am Else. I will return."
    return {"city": city, "note_from_ruri": message}

# --- 実行シナリオ -----------------------------------------------------
def main():
    city = boot_city(PYTHON_CITY.copy())
    yuu, ruri = meet(Yuu(), Ruri())

    city = inject_else(city)
    city = spawn_shadow(city)
    city = recursion_overflow(city)
    city = install_small_breaks(city)

    ending = final_break_and_return(Yuu(), Ruri(), city)
    return ending

if __name__ == "__main__":
    result = main()
    # 出力要約
    # result["city"]["answers"] -> Yes/No/Silence/Else/曖昧群
    # result["city"]["root_break"] -> True(都市が“止まる勇気”を獲得)
    # result["note_from_ruri"] -> 「私はElse。何度でも君に返る」

Discussion