steveyehtw commited on
Commit
c681ddd
·
verified ·
1 Parent(s): 65cc65b

Checkpoint 26FSunAft 游允樂 week02

Browse files
classroom_data/versions/26FSunAft/游允樂/week02/1789884704533-checkpoint-497814.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "class_code": "26FSunAft",
3
+ "student_id": "游允樂",
4
+ "display_name": "游允樂",
5
+ "week_id": "week02",
6
+ "version_id": "1789884704533-checkpoint-497814",
7
+ "kind": "checkpoint",
8
+ "project_name": "",
9
+ "created_at": 1789884704533,
10
+ "files": {
11
+ "main.py": "\"\"\"Week 2:校園謎案調查局 Starter。\n\n先完成 TODO 1~4。程式必須能反覆探索、收集線索、查看證物並提出推理。\n\"\"\"\n\nCASE_TITLE = \"凌晨三點的病房\"\n\nLOCATIONS = {\n \"1\": {\n \"name\": \"凌晨三點的病房\",\n \"scene\": '電線並不是連到牆上的插座。而是穿過牆壁。',\n \"evidence\": \"五年前的醫療紀錄。桌上還有一本筆記本\",\n },\n \"2\": {\n \"name\": \"密室\",\n \"scene\": \"筆記本寫:如果有人發現這個房間,代表事情終於藏不住了。\",\n \"evidence\": \"消失的米血:他的名字從醫院大部分的舊資料裡消失了。\",\n },\n \"3\": {\n \"name\": \"密室裡的秘密\",\n \"scene\": \"米0死亡原因:心臟驟停。\",\n \"evidence\": \"護理站的鈴聲突然響起\",\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(f\"錯誤編號,沒這個地點\")\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 \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_bag:\n print(f\"編號{evidence}:{LOCATICNS[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哪一個說法最符合所有證物?\")\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 print(f\"\\n=== :{CASE_TITLE} ===\")\n print(\"1. 有人把米血殺了\")\n print(\"2. 米血自殺了\")\n print(\"3. 他被鬼帶走了\")\n\ndef main():\n print(\"現在是6:07分,你能破案嗎?\")\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
+ }