Spaces:
Running
Running
Checkpoint 26FSunAft 王郁嘉 week02
Browse files
classroom_data/versions/26FSunAft/王郁嘉/week02/1789884734560-checkpoint-269527.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class_code": "26FSunAft",
|
| 3 |
+
"student_id": "王郁嘉",
|
| 4 |
+
"display_name": "王郁嘉",
|
| 5 |
+
"week_id": "week02",
|
| 6 |
+
"version_id": "1789884734560-checkpoint-269527",
|
| 7 |
+
"kind": "checkpoint",
|
| 8 |
+
"project_name": "",
|
| 9 |
+
"created_at": 1789884734560,
|
| 10 |
+
"files": {
|
| 11 |
+
"main.py": "\"\"\"Week 2:校園謎案調查局 Starter。 \n\n先完成 TODO 1~4。程式必須能反覆探索、收集線索、查看證物並提出推理。\n\"\"\"\n\nCASE_TITLE = \"神鞋失竊案\"\n\nLOCATIONS = {\n \"1\": {\n \"name\": \"NBA邁阿密熱火主場球員休息室\",\n \"scene\": \"LeBron的球衣展示櫃半開,後方通往球員通道的通風窗也沒有關好。\",\n \"evidence\": \"通風窗框上勾到了某件復古球衣的紅色纖維\",\n },\n \"2\": {\n \"name\": \"NBA邁阿密熱火主場球場中央\",\n \"scene\": \"木地板剛用球場洗地機拖過,卻留下一道彎向球隊戰術分析室的輪痕。\",\n \"evidence\": \"沾著中場啦啦隊表演亮粉的裝備推車輪痕\",\n },\n \"3\": {\n \"name\": \"NBA邁阿密熱火主場球隊戰術分析室\",\n \"scene\": \"一台戰術板清潔推車停在錄影帶書架旁,後方有螢光粉紅色的東西反光。\",\n \"evidence\": \"卡在推車後方的失竊 Nike 籃球鞋與 Ray Gun 的球隊胸章\",\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 print(f\"牛來到了{LOCATIONS[location_id][\"name\"]}\")\n print(f\"現場描述{LOCATIONS[location_id][\"scene\"]}\")\n # TODO 3:線索尚未取得時才 append 到 evidence_bag。\n if LOCATIONS[location_id][\"evidence\"] not in evidence_bag:\n evidence_bag.append(location_id)\n print(f\"取得了{LOCATIONS[location_id][\"evidence\"]}\")\n #print(\"這個調查功能還沒完成。\")\n\n\ndef show_evidence():\n \"\"\"列出目前取得的所有證物。\"\"\"\n # TODO 4:沒有證物時顯示提示;否則以 1 開始編號列出。\n if not evidence_bag:\n print(\"siuuuuuuuu\")\n else:\n for eveidence in evidence_bag:\n print(f\"編號{evidence}:{LOCATIONS[evidence][\"evidence\"]}\")\n \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哪一個說法最符合所有證物?\")\n print(\"1. 有同學故意把校徽藏在圖書館\")\n print(\"2. 風吹起校徽,清潔推車不小心把它帶到圖書館\")\n print(\"3. 校徽從一開始就放在圖書館\")\n answer = input(\"你的推理:\").strip()\n\n # TODO 5(Checkpoint C):判斷答案,正確時回傳 True。\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"
|
| 12 |
+
}
|
| 13 |
+
}
|