Spaces:
Running
Running
Submission 26FSunAft 林昭廷 week02
Browse files
classroom_data/versions/26FSunAft/林昭廷/week02/1789890297384-submit-999187.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class_code": "26FSunAft",
|
| 3 |
+
"student_id": "林昭廷",
|
| 4 |
+
"display_name": "林昭廷",
|
| 5 |
+
"week_id": "week02",
|
| 6 |
+
"version_id": "1789890297384-submit-999187",
|
| 7 |
+
"kind": "submit",
|
| 8 |
+
"project_name": "校園謎案調查局",
|
| 9 |
+
"created_at": 1789890297384,
|
| 10 |
+
"files": {
|
| 11 |
+
"case_data.json": "{\n \"title\": \"消失的校徽\",\n \"intro\": \"午休結束後,校慶展示櫃裡的校徽消失了。你能找出真相嗎?\",\n \"locations\": {\n \"1\": {\n \"name\": \"六年一班教室\",\n \"scene\": \"展示櫃半開,窗戶也沒有關好。\",\n \"evidence\": {\n \"id\": \"blue_fiber\",\n \"name\": \"窗框上的藍色纖維\",\n \"detail\": \"纖維顏色和清潔推車的布套相同。\"\n }\n },\n \"2\": {\n \"name\": \"操場司令台\",\n \"scene\": \"地面剛拖過,留下一道彎向圖書館的輪痕。\",\n \"evidence\": {\n \"id\": \"wheel_track\",\n \"name\": \"沾著亮粉的推車輪痕\",\n \"detail\": \"亮粉和展示櫃內的裝飾相同。\"\n }\n },\n \"3\": {\n \"name\": \"圖書館\",\n \"scene\": \"清潔推車停在書架旁,後方似乎有東西反光。\",\n \"requires\": [\"blue_fiber\", \"wheel_track\"],\n \"locked_text\": \"你看見推車,卻還不知道該檢查哪裡。也許要先找出它的移動路線。\",\n \"evidence\": {\n \"id\": \"badge\",\n \"name\": \"卡在推車後方的校徽\",\n \"detail\": \"校徽沒有損壞,背面黏著一小段藍色纖維。\"\n }\n }\n },\n \"conclusions\": {\n \"1\": \"有同學故意把校徽藏在圖書館\",\n \"2\": \"風吹起校徽,清潔推車不小心把它帶到圖書館\",\n \"3\": \"校徽從一開始就放在圖書館\"\n },\n \"correct_answer\": \"2\",\n \"success\": \"推理正確!風把校徽吹到布套上,推車經過教室後又將它帶到圖書館。這是一場意外。\"\n}\n",
|
| 12 |
+
"main.py": "\"\"\"Week 2:校園謎案調查局 Starter。\n\n先完成 TODO 1~4。程式必須能反覆探索、收集線索、查看證物並提出推理。\n\"\"\"\n\nCASE_TITLE = \"18:35的約定\"\ncounter = 0\n\nLOCATIONS = {\n \"1\": {\n \"name\": \"雨夜咖啡館\",\n \"scene\": \"靠窗的07號桌上放著一個沒有署名的牛皮紙袋,店內已經準備打烊。\",\n \"evidence\": \"紙袋裡的小紙條寫著「不要找我,去找星期三」,旁邊還有一把刻著B-03的舊鑰匙,咖啡收據顯示18:35,但監視器紀錄中18:35沒有任何人坐在07號桌。\"\n},\n\n \"2\":{\n \"name\": \"舊圖書館\",\n \"scene\": \"07號書架上的《消失的房間》沒有借閱紀錄,書頁中夾著一張泛黃的車票。\",\n \"evidence\": \"書中被鉛筆圈起「鐘、北、三」三個字,車票日期正好是星期三,圖書館的舊平面圖上,北側曾經存在一個B-03區域,而鑰匙上的編號也正是B-03。\"\n}, \n \n \n \"3\": {\n \"name\": \"老鐘樓\",\n \"scene\": \"鐘樓的大鐘停在18:35,地下室的現有地圖只有B-01和B-02,卻找不到B-03。\",\n \"evidence\": \"根據舊平面圖,B-03其實代表地下第三層,而牆後藏著一個沒有標記的暗門,暗門後找到三封不同日期的信,三封信分別對應咖啡館、圖書館與鐘樓,最後一封揭露三個地方其實是一個人留下的三段記憶。\"\n}\n}\n\nevidence_bag = []\n\n\ndef investigate(location_id):\n \"\"\"調查地點並將新線索放入證物袋。\"\"\"\n # TODO 1:確認 location_id 是否存在於 LOCATIONS。\n if location_id not in LOCATIONS:\n print(\"錯誤編號,沒這個地點\")\n return\n # TODO 2:顯示地點名稱與現場描述。\n if location_id == \"2\":\n print(f\"你到了{LOCATIONS[location_id]['name']}\")\n print(LOCATIONS[location_id]['scene'])\n evidence_bag.append(location_id)\n elif location_id == \"1\":\n if \"3\" in location_id:\n print(f\"你到了:{LOCATIONS[location_id]['name']}\")\n print(LOCATIONS[location_id]['scene']\")\n evidence_bag.append(location_id)\n elif location_id == \"3\": \n if \"1\" in location_id:\n print(f\"你到了:{LOCATIONS[location_id]['name']}\")\n print(LOCATIONS[location_id]['scene']\")\n evidence_bag.append(location_id)\n \n \n else:\n print(\"這裡啥都沒有\") \n return\n # TODO 3:線索尚未取得時才 append 到 evidence_bag。\n if location_id == \"2\":\n if counter >= 3:\n print(f\"你到了{LOCATIONS[location_id]['name']}\")\n print(LOCATIONS[location_id]['scene'])\n evidence_bag.append(location_id)\n else:\n print(f\"你到了{LOCATIONS[location_id]['name']}\")\n print(\"這裡似乎啥都沒有\")\n counter += 1\n #print(\"這個調查功能還沒完成。\")\n\n\ndef show_evidence():\n \"\"\"列出目前取得的所有證物。\"\"\"\n # TODO 4:沒有證物時顯示提示;否則以 1 開始編號列出。\n if not evidence_bag:\n print(\"袋子裡空空如野\")\n else:\n for evidence in evidence:\n print(f\"編號{evidence}:{LOCATIONS[evidence][\"evidence\"]}\")\n\n\ndef make_deduction():\n \"\"\"取得足夠證物後,讓玩家選擇真相。\"\"\"\n if len(evidence_bag) < 3:\n print(f\"證物不足:目前 {len(evidence_bag)}/3。再去調查吧!\")\n return False\n\n print(\"\\n哪一個說法最符合所有證物?\")\nprint(\"1. 犯人利用了三個地點的監視器盲點與舊平面圖,刻意佈置了一個跨越時空的犯罪現場。\")\nprint(\"2. 這些地點與證物並非真實的犯罪現場,而是同一個人留下、象徵其三段人生記憶的載體。\")\nprint(\"3. 18:35 的咖啡收據與停擺的鐘樓證明這是一起三人共謀的連續失蹤案。\")\n answer = input(\"你的推理:\").strip()\n\n # TODO 5(Checkpoint C):判斷答案,正確時回傳 True。\n if answer == \"2\":\n print(\"恭喜破案! 你...也該醒了!\")\n return True\n else:\n print(\"你好像少了些啥 重新思考一下吧!\")\n return False\n\n\ndef show_menu():\n print(f\"\\n=== 校園謎案調查局:{CASE_TITLE} ===\")\n print(f\"1. 調查{LOCATIONS[\"1\"][\"name\"]}\")\n print(f\"2. 調查{LOCATIONS[\"2\"][\"name\"]}\")\n print(f\"3. 調查{LOCATIONS[\"3\"][\"name\"]}\")\n print(\"4. 查看證物袋\")\n print(\"5. 提出推理\")\n print(\"6. 離開\")\n\n\ndef main():\n print(\"午休結束後,校慶展示櫃裡的校徽消失了。你能找出真相嗎?\")\n\n while True:\n show_menu()\n choice = input(\"請選擇:\").strip()\n\n if choice in LOCATIONS:\n investigate(choice)\n elif choice == \"4\":\n show_evidence()\n elif choice == \"5\":\n if make_deduction():\n break\n elif choice == \"6\":\n print(\"案件暫停。證物袋已交回調查局。\")\n break\n else:\n print(\"請輸入 1~6。\")\n\n\nif __name__ == \"__main__\":\n main()\n"
|
| 13 |
+
}
|
| 14 |
+
}
|