steveyehtw commited on
Commit
6dc8b96
·
verified ·
1 Parent(s): cdcd5d7

Submission L6Sat 張棨竣 week02

Browse files
classroom_data/versions/L6Sat/張棨竣/week02/1791014444055-submit-081312.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "class_code": "L6Sat",
3
+ "student_id": "張棨竣",
4
+ "display_name": "張棨竣",
5
+ "week_id": "week02",
6
+ "version_id": "1791014444055-submit-081312",
7
+ "kind": "submit",
8
+ "project_name": "校園謎案調查局",
9
+ "created_at": 1791014444055,
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 = \"消失的水壺\"\n\nLOCATIONS = {\n \"1\": {\n \"name\": \"六年13班教室\",\n \"scene\": \"凌亂的座位,窗戶也碎掉了。\",\n \"evidence\": \"玻璃碎片\",\n },\n \"2\": {\n \"name\": \"操場的空地\",\n \"scene\": \"地面有血跡,有人刻意用落葉阻擋的痕跡。\",\n \"evidence\": \" 小鳥的羽毛\" \n },\n \"3\": {\n \"name\": \"洗手台\",\n \"scene\": \"沒有關的水龍頭,後方的垃圾桶閃著光。\",\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(\"bad\")\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 location_id not in evidence_bag:\n evidence_bag.append(location_id)\n print(f\"你獲得了{LOCATIONS[location_id][\"evidence\"]}\")\n elif location_id in evidence_bag:\n print(\"這裡已經調查過了,沒有新的線索\")\n \n\ndef show_evidence():\n \"\"\"列出目前取得的所有證物。\"\"\"\n # TODO 4:沒有證物時顯示提示;否則以 1 開始編號列出。\n if not evidence_bag:\n print(\"你沒證據\")\n return\n else:\n for i in range(len(evidence_bag)):\n print(LOCATIONS[evidence_bag[i]][\"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 if answer == \"2\":\n print(\"你答對了\")\n return True\n else:\n print(\"答錯了 ㄏㄏ,你是不是還沒開智\")\n \n \n \n\n\ndef show_menu():\n print(f\"\\n=== 校園謎案調查局:{CASE_TITLE} ===\")\n print(\"1. 調查六年13班教室\")\n print(\"2. 調查操場的空地\")\n print(\"3. 調查洗手台\")\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
+ }