262 lines
9.7 KiB
Python
262 lines
9.7 KiB
Python
from copy import deepcopy
|
|
|
|
MARK_DEFINITIONS = [
|
|
{"code": "prime_margin", "name": "素数页边注", "domain": "number_theory"},
|
|
{"code": "one_to_hundred", "name": "1到100的两行", "domain": "number_theory"},
|
|
{
|
|
"code": "compass_straightedge",
|
|
"name": "圆规与直尺",
|
|
"domain": "number_theory",
|
|
},
|
|
{
|
|
"code": "seventeen_gon_night",
|
|
"name": "正十七边形的夜",
|
|
"domain": "number_theory",
|
|
},
|
|
{
|
|
"code": "fundamental_arithmetic",
|
|
"name": "算术基本定理",
|
|
"domain": "number_theory",
|
|
},
|
|
{
|
|
"code": "skipped_lemma",
|
|
"name": "跳步的引理",
|
|
"domain": "algebraic_geometry",
|
|
},
|
|
{
|
|
"code": "shadow_of_sheaf",
|
|
"name": "层的影子",
|
|
"domain": "algebraic_geometry",
|
|
},
|
|
{
|
|
"code": "denied_cubic",
|
|
"name": "被否定的三次",
|
|
"domain": "algebraic_geometry",
|
|
},
|
|
{
|
|
"code": "fourth_continue",
|
|
"name": "第四次继续",
|
|
"domain": "algebraic_geometry",
|
|
},
|
|
{
|
|
"code": "ideal_and_ring",
|
|
"name": "理想与环",
|
|
"domain": "algebraic_geometry",
|
|
},
|
|
{"code": "late_draft", "name": "深夜的草稿", "domain": "analysis"},
|
|
{"code": "epsilon_promise", "name": "ε-δ 的承诺", "domain": "analysis"},
|
|
{"code": "counting_rod", "name": "一根算筹", "domain": "analysis"},
|
|
{"code": "pi_seventh_digit", "name": "π 的第七位", "domain": "analysis"},
|
|
{"code": "limit_definition", "name": "极限的定义", "domain": "analysis"},
|
|
{
|
|
"code": "first_model",
|
|
"name": "第一次建模",
|
|
"domain": "applied_mathematics",
|
|
},
|
|
{
|
|
"code": "cafeteria_queue",
|
|
"name": "食堂排队模型",
|
|
"domain": "applied_mathematics",
|
|
},
|
|
{
|
|
"code": "five_constants",
|
|
"name": "五个常数",
|
|
"domain": "applied_mathematics",
|
|
},
|
|
{
|
|
"code": "beauty_in_time",
|
|
"name": "美在时间中",
|
|
"domain": "applied_mathematics",
|
|
},
|
|
{
|
|
"code": "optimal_solution",
|
|
"name": "最优解",
|
|
"domain": "applied_mathematics",
|
|
},
|
|
]
|
|
|
|
MARK_PLACEMENTS = {
|
|
("c1_notice", 0): ["prime_margin"],
|
|
("c1_notice", 1): ["compass_straightedge"],
|
|
("c1_gauss_try", 0): ["one_to_hundred"],
|
|
("c1_gauss_keep", 0): ["seventeen_gon_night"],
|
|
("c5_start", 0): ["fundamental_arithmetic"],
|
|
("c3_start", 0): ["skipped_lemma"],
|
|
("c3_start", 1): ["skipped_lemma"],
|
|
("c3_paper", 0): ["denied_cubic"],
|
|
("c3_paper", 1): ["shadow_of_sheaf"],
|
|
("c3_denied", 0): ["fourth_continue"],
|
|
("c5_start", 1): ["ideal_and_ring"],
|
|
("c1_midterm", 1): ["late_draft"],
|
|
("c1_analysis", 0): ["epsilon_promise"],
|
|
("c1_analysis", 1): ["epsilon_promise"],
|
|
("c1_zu_enter", 0): ["counting_rod"],
|
|
("c1_zu_enter", 1): ["pi_seventh_digit"],
|
|
("c4_start", 0): ["limit_definition"],
|
|
("c2_model", 0): ["first_model"],
|
|
("c2_model_yes", 0): ["cafeteria_queue"],
|
|
("c4_sleep", 0): ["five_constants"],
|
|
("c4_boundary", 0): ["beauty_in_time"],
|
|
("c4_balance", 0): ["optimal_solution"],
|
|
}
|
|
|
|
EASTER_EGGS = [
|
|
{
|
|
"code": "gauss",
|
|
"name": "高斯草稿",
|
|
"trigger": "c1_gauss_merge",
|
|
"required_marks": ["prime_margin", "one_to_hundred"],
|
|
"node": "egg_gauss",
|
|
"return_to": "c1_report",
|
|
"scene": "你翻回录取通知书旁的页边注。两行数字首尾相加,像一座刚刚亮起的桥。高斯没有给你答案,只把铅笔推回你的手中。",
|
|
},
|
|
{
|
|
"code": "zu_chongzhi",
|
|
"name": "祖冲之草稿",
|
|
"trigger": "c1_zu_merge",
|
|
"required_marks": ["late_draft", "epsilon_promise"],
|
|
"node": "egg_zu_chongzhi",
|
|
"return_to": "c1_final",
|
|
"scene": "深夜草稿上的 ε-δ 与那根算筹叠在一起。精确不是冷冰冰的限制,而是你对下一步作出的承诺。",
|
|
},
|
|
{
|
|
"code": "euler",
|
|
"name": "欧拉草稿",
|
|
"trigger": "c2_end",
|
|
"required_marks": ["first_model", "cafeteria_queue"],
|
|
"node": "egg_euler",
|
|
"return_to": "c3_start",
|
|
"scene": "食堂队伍在草稿上变成变量、约束与目标函数。欧拉在页角写下五个常数:数学的美并不排斥现实,它能让现实获得结构。",
|
|
},
|
|
{
|
|
"code": "noether",
|
|
"name": "诺特草稿",
|
|
"trigger": "c3_cited",
|
|
"required_marks": ["skipped_lemma", "shadow_of_sheaf"],
|
|
"node": "egg_noether",
|
|
"return_to": "c4_start",
|
|
"scene": "你重新看见那个被跳过的引理,结构的影子从局部延伸到整体。诺特说:真正重要的不是补上一步,而是知道这一步为何必须存在。",
|
|
},
|
|
]
|
|
|
|
ENDING_RULES = {
|
|
"trigger_node": "c8_phd",
|
|
"tie_order": [
|
|
"number_theory",
|
|
"algebraic_geometry",
|
|
"analysis",
|
|
"applied_mathematics",
|
|
],
|
|
"domains": {
|
|
"number_theory": "ending_number_theory",
|
|
"algebraic_geometry": "ending_algebraic_geometry",
|
|
"analysis": "ending_analysis",
|
|
"applied_mathematics": "ending_applied_mathematics",
|
|
},
|
|
}
|
|
|
|
ENDING_NODES = {
|
|
"ending_number_theory": {
|
|
"character": "导师",
|
|
"scene": "你获得统一直博资格,方向选择数论。录取材料最上方,是你一路留下的素数页边注与算术结构。你没有成为第二个高斯,你开始提出自己的问题。",
|
|
"choices": [],
|
|
},
|
|
"ending_algebraic_geometry": {
|
|
"character": "导师",
|
|
"scene": "你获得统一直博资格,方向选择代数几何。讨论班里被跳过的引理,最终变成你研究理想、环与几何结构的入口。",
|
|
"choices": [],
|
|
},
|
|
"ending_analysis": {
|
|
"character": "导师",
|
|
"scene": "你获得统一直博资格,方向选择分析。深夜草稿、ε-δ 的承诺和极限定义,成为你继续逼近未知的方式。",
|
|
"choices": [],
|
|
},
|
|
"ending_applied_mathematics": {
|
|
"character": "导师",
|
|
"scene": "你获得统一直博资格,方向选择应用数学。从食堂排队到最优解,你决定继续研究数学如何在现实中承担责任。",
|
|
"choices": [],
|
|
},
|
|
}
|
|
|
|
DOMAIN_LABELS = {
|
|
"number_theory": "数论",
|
|
"algebraic_geometry": "代数几何",
|
|
"analysis": "分析",
|
|
"applied_mathematics": "应用数学",
|
|
}
|
|
|
|
V12_IDENTITY_SCORES = {
|
|
"0000": {"眼光": 88, "人文": 95, "侦探": 84, "建模": 78, "联结": 87},
|
|
"0001": {"眼光": 98, "人文": 88, "侦探": 94, "建模": 91, "联结": 99},
|
|
"0010": {"眼光": 90, "人文": 86, "侦探": 92, "建模": 88, "联结": 84},
|
|
"0011": {"眼光": 89, "人文": 94, "侦探": 94, "建模": 99, "联结": 92},
|
|
"0100": {"眼光": 91, "人文": 86, "侦探": 96, "建模": 98, "联结": 90},
|
|
"0101": {"眼光": 99, "人文": 86, "侦探": 96, "建模": 100, "联结": 100},
|
|
"0110": {"眼光": 99, "人文": 82, "侦探": 98, "建模": 99, "联结": 100},
|
|
"0111": {"眼光": 98, "人文": 92, "侦探": 99, "建模": 100, "联结": 99},
|
|
"1000": {"眼光": 100, "人文": 80, "侦探": 100, "建模": 99, "联结": 99},
|
|
"1001": {"眼光": 99, "人文": 91, "侦探": 98, "建模": 98, "联结": 100},
|
|
"1010": {"眼光": 93, "人文": 88, "侦探": 96, "建模": 99, "联结": 91},
|
|
"1011": {"眼光": 100, "人文": 94, "侦探": 99, "建模": 82, "联结": 100},
|
|
"1100": {"眼光": 90, "人文": 96, "侦探": 84, "建模": 93, "联结": 98},
|
|
"1101": {"眼光": 98, "人文": 91, "侦探": 100, "建模": 76, "联结": 99},
|
|
"1110": {"眼光": 96, "人文": 98, "侦探": 98, "建模": 99, "联结": 95},
|
|
"1111": {"眼光": 98, "人文": 95, "侦探": 90, "建模": 94, "联结": 100},
|
|
}
|
|
|
|
|
|
def build_v12_story(source):
|
|
document = deepcopy(source)
|
|
document["title"] = "信仰者人生:从小镇到直博"
|
|
document["description"] = "用印记记录每一次数学抉择,在四个研究方向中找到自己的长期问题。"
|
|
document["system_version"] = "marks-v1"
|
|
document["mark_definitions"] = MARK_DEFINITIONS
|
|
document["domain_labels"] = DOMAIN_LABELS
|
|
document["ending_rules"] = ENDING_RULES
|
|
document["chapters"] = {
|
|
f"c{index}": {"number": index, "title": title}
|
|
for index, title in enumerate(
|
|
[
|
|
"没有竞赛奖状的夏天",
|
|
"第一次完整证明",
|
|
"被跳过的引理",
|
|
"数学之外的时间",
|
|
"选择一个长期问题",
|
|
"机器到来之后",
|
|
"把自己的问题写出来",
|
|
"统一直博的第一页",
|
|
],
|
|
start=1,
|
|
)
|
|
}
|
|
|
|
for node in document["nodes"].values():
|
|
for choice in node.get("choices", []):
|
|
choice["effects"] = {}
|
|
for (node_id, choice_index), mark_codes in MARK_PLACEMENTS.items():
|
|
choice = document["nodes"][node_id]["choices"][choice_index]
|
|
choice["effects"] = {"marks": mark_codes}
|
|
|
|
for egg in EASTER_EGGS:
|
|
document["nodes"][egg["trigger"]]["choices"].append(
|
|
{
|
|
"text": "✦ 你忽然想起那页草稿……",
|
|
"next": egg["node"],
|
|
"requires_marks": egg["required_marks"],
|
|
"effects": {"easter_eggs": [egg["code"]]},
|
|
}
|
|
)
|
|
document["nodes"][egg["node"]] = {
|
|
"character": egg["name"],
|
|
"scene": egg["scene"],
|
|
"choices": [
|
|
{
|
|
"text": "把这一页收进数学档案",
|
|
"next": egg["return_to"],
|
|
"effects": {},
|
|
}
|
|
],
|
|
}
|
|
document["nodes"].update(ENDING_NODES)
|
|
return document
|