Spaces:
Running
Running
Commit ·
5cacf86
1
Parent(s): 12e244e
Repair four classroom projects for Lesson 4
Browse files- classroom_data/checkpoints/26FSunAft/林昭廷/week02.json +12 -0
- classroom_data/checkpoints/26FSunAft/陳英赫/week02.json +12 -0
- classroom_data/checkpoints/L6Sat/李合盛/week02.json +12 -0
- classroom_data/checkpoints/L6Sat/王辭信/week02.json +12 -0
- classroom_data/versions/26FSunAft/林昭廷/week02/1790958870919-checkpoint-740103.json +14 -0
- classroom_data/versions/26FSunAft/陳英赫/week02/1790958870920-checkpoint-740104.json +14 -0
- classroom_data/versions/L6Sat/李合盛/week02/1790958870917-checkpoint-740101.json +14 -0
- classroom_data/versions/L6Sat/王辭信/week02/1790958870918-checkpoint-740102.json +14 -0
- classroom_service.py +13 -2
- tests/test_classroom.py +14 -0
classroom_data/checkpoints/26FSunAft/林昭廷/week02.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class_code": "26FSunAft",
|
| 3 |
+
"student_id": "林昭廷",
|
| 4 |
+
"display_name": "林昭廷",
|
| 5 |
+
"week_id": "week02",
|
| 6 |
+
"project_name": "校園謎案調查局",
|
| 7 |
+
"files": {
|
| 8 |
+
"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",
|
| 9 |
+
"main.py": "\"\"\"Week 2:校園謎案調查局 Starter。\n\n先完成 TODO 1~4。程式必須能反覆探索、收集線索、查看證物並提出推理。\n\"\"\"\n\nCASE_TITLE = \"18:35的約定\"\n\nLOCATIONS = {\n \"1\": {\n \"name\": \"雨夜咖啡館\",\n \"scene\": \"靠窗的07號桌上放著一個沒有署名的牛皮紙袋,店內已經準備打烊。\",\n \"evidence\": \"紙袋裡的小紙條寫著『不要找我,去找星期三』,旁邊還有一把刻著B-03的舊鑰匙。咖啡收據顯示18:35,但監視器紀錄中18:35沒有任何人坐在07號桌。\",\n },\n \"2\": {\n \"name\": \"舊圖書館\",\n \"scene\": \"07號書架上的《消失的房間》沒有借閱紀錄,書頁中夾著一張泛黃的車票。\",\n \"evidence\": \"書中被鉛筆圈起『鐘、北、三』三個字,車票日期正好是星期三。圖書館的舊平面圖上,北側曾經存在一個B-03區域。\",\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 if location_id not in LOCATIONS:\n print(\"錯誤編號,沒有這個地點。\")\n return\n\n required_before = {\"2\": \"1\", \"3\": \"2\"}\n required = required_before.get(location_id)\n if required and required not in evidence_bag:\n print(f\"現在還找不到前往『{LOCATIONS[location_id]['name']}』的方法。\")\n print(f\"先調查『{LOCATIONS[required]['name']}』。\")\n return\n\n location = LOCATIONS[location_id]\n print(f\"\\n你到了:{location['name']}\")\n print(location[\"scene\"])\n\n if location_id in evidence_bag:\n print(\"這裡已經調查過,沒有新的發現。\")\n return\n\n evidence_bag.append(location_id)\n print(f\"取得證物:{location['evidence']}\")\n\n\ndef show_evidence():\n \"\"\"列出目前取得的所有證物。\"\"\"\n if not evidence_bag:\n print(\"袋子裡空空如也。\")\n return\n\n print(\"\\n=== 目前收到的證物 ===\")\n for number, location_id in enumerate(evidence_bag, start=1):\n print(f\"{number}. {LOCATIONS[location_id]['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. 18:35 的咖啡收據與停擺的鐘樓證明這是一起三人共謀的連續失蹤案。\")\n answer = input(\"你的推理:\").strip()\n\n if answer == \"2\":\n print(\"恭喜破案!你……也該醒了!\")\n return True\n\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(\"一張沒有署名的紙條,把你帶到 18:35 的約定。你能找出真相嗎?\")\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"
|
| 10 |
+
},
|
| 11 |
+
"checkpoint_at": 1790958870919
|
| 12 |
+
}
|
classroom_data/checkpoints/26FSunAft/陳英赫/week02.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class_code": "26FSunAft",
|
| 3 |
+
"student_id": "陳英赫",
|
| 4 |
+
"display_name": "陳英赫",
|
| 5 |
+
"week_id": "week02",
|
| 6 |
+
"project_name": "校園謎案調查局",
|
| 7 |
+
"files": {
|
| 8 |
+
"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",
|
| 9 |
+
"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\": \"清潔推車停在書架旁,後方似乎有東西反光。\",\n \"evidence\": \"卡在推車後方的校徽\",\n },\n}\n\nevidence_bag = []\n\n\ndef investigate(location_id):\n \"\"\"調查地點並將新線索放入證物袋。\"\"\"\n if location_id not in LOCATIONS:\n print(\"錯誤編號\")\n return\n\n required_before = {\"3\": \"1\", \"2\": \"3\"}\n required = required_before.get(location_id)\n if required and required not in evidence_bag:\n print(f\"目前還不能調查這裡,先去『{LOCATIONS[required]['name']}』找線索。\")\n return\n\n location = LOCATIONS[location_id]\n print(f\"你到了:{location['name']}\")\n print(location[\"scene\"])\n\n if location_id in evidence_bag:\n print(\"這裡已經調查過,沒有新的發現。\")\n return\n\n evidence_bag.append(location_id)\n print(f\"取得證物:{location['evidence']}\")\n\n\ndef show_evidence():\n \"\"\"列出目前取得的所有證物。\"\"\"\n if not evidence_bag:\n print(\"證物袋目前是空的。\")\n return\n\n print(\"\\n=== 目前收到的證物 ===\")\n for number, location_id in enumerate(evidence_bag, start=1):\n print(f\"{number}. {LOCATIONS[location_id]['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 if answer == \"2\":\n print(\"已破案!\")\n return True\n\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"
|
| 10 |
+
},
|
| 11 |
+
"checkpoint_at": 1790958870920
|
| 12 |
+
}
|
classroom_data/checkpoints/L6Sat/李合盛/week02.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class_code": "L6Sat",
|
| 3 |
+
"student_id": "李合盛",
|
| 4 |
+
"display_name": "李合盛",
|
| 5 |
+
"week_id": "week02",
|
| 6 |
+
"project_name": "校園謎案調查局",
|
| 7 |
+
"files": {
|
| 8 |
+
"case_data.json": "{\n \"title\": \"不見dre人有67人\",\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\": \"卡在推車後方的67人\",\n \"detail\": \"校徽沒有損壞,背面黏著一小段藍色纖維。\"\n }\n }\n },\n \"conclusions\": {\n \"1\": \"有同學故意把校徽藏在圖書館\",\n \"2\": \"風吹起校徽,清潔推車不小心把它帶到圖書館\",\n \"3\": \"校徽從一開始就放在圖書館\"\n },\n \"correct_answer\": \"2\",\n \"success\": \"推理正確!風把校徽吹到布套上,推車經過教室後又將它帶到圖書館。這是一場意外。\"\n}\n",
|
| 9 |
+
"main.py": "\"\"\"Week 2:校園謎案調查局 Starter。\n\n先完成 TODO 1~4。程式必須能反覆探索、收集線索、查看證物並提出推理。\n\"\"\"\n\nCASE_TITLE = \"不見dre人有67人\"\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\": \"清潔推車停在骨架旁下有血跡,後方似乎有東西在叫。\",\n \"evidence\": \"卡在推車後方的67人\",\n },\n}\n\nevidence_bag = []\n\n\ndef investigate(location_id):\n \"\"\"調查地點並將新線索放入證物袋。\"\"\"\n if location_id not in LOCATIONS:\n print(\"here don't have you need\")\n return\n\n location = LOCATIONS[location_id]\n print(f\"\\n【調查地點:{location['name']}】\")\n print(location[\"scene\"])\n\n evidence = location[\"evidence\"]\n if evidence in evidence_bag:\n print(\"這裡已經調查過,沒有新的發現。\")\n return\n\n evidence_bag.append(evidence)\n print(f\"取得證物:{evidence}\")\n\n\ndef show_evidence():\n \"\"\"列出目前取得的所有證物。\"\"\"\n if not evidence_bag:\n print(\"證物袋目前是空的。\")\n return\n\n print(\"\\n=== 目前收到的證物 ===\")\n for number, evidence in enumerate(evidence_bag, start=1):\n print(f\"{number}. {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. 67人一開始就在圖書館\")\n answer = input(\"你的推理:\").strip()\n\n if answer == \"2\":\n print(\"推理正確,案件已經破解!\")\n return True\n\n print(\"這個推理還有疑點,再查看一次證物吧!\")\n return False\n\n\ndef show_menu():\n print(f\"\\n=== 校園謎案調查局:{CASE_TITLE} ===\")\n print(\"1. 調查六年一百班教室\")\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"
|
| 10 |
+
},
|
| 11 |
+
"checkpoint_at": 1790958870917
|
| 12 |
+
}
|
classroom_data/checkpoints/L6Sat/王辭信/week02.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class_code": "L6Sat",
|
| 3 |
+
"student_id": "王辭信",
|
| 4 |
+
"display_name": "王辭信",
|
| 5 |
+
"week_id": "week02",
|
| 6 |
+
"project_name": "校園謎案調查局",
|
| 7 |
+
"files": {
|
| 8 |
+
"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",
|
| 9 |
+
"main.py": "\"\"\"Week 2:校園謎案調查局 Starter。\n\n先完成 TODO 1~4。程式必須能反覆探索、收集線索、查看證物並提出推理。\n\"\"\"\n\nCASE_TITLE = \"消失的鑽石棍木67不知道很雷霆\"\n\nLOCATIONS = {\n \"1\": {\n \"name\": \"六七年七十八九十一班教室\",\n \"scene\": \"展示櫃半開,窗戶也沒有關好就受者。\",\n \"evidence\": \"窗框上的棍木6767色纖維\",\n },\n \"2\": {\n \"name\": \"676767這波我挺偉偉的操場\",\n \"scene\": \"地面剛拖過,留下一道彎向圖書館的痕跡。\",\n \"evidence\": \"沾著野生狗奶棍木6767的推車輪痕\",\n },\n \"3\": {\n \"name\": \"676767競爭者不好玩圖書館\",\n \"scene\": \"清潔推車停在書架旁,後方似乎有東西反光。\",\n \"evidence\": \"卡在推車後方的鑽石棍木67\",\n },\n}\n\nevidence_bag = []\n\n\ndef investigate(location_id):\n \"\"\"調查地點並將新線索放入證物袋。\"\"\"\n if location_id not in LOCATIONS:\n print(\"無效的地點!\")\n return\n\n loc = LOCATIONS[location_id]\n print(f\"\\n【調查地點:{loc['name']}】\")\n print(f\"現場狀況:{loc['scene']}\")\n\n found_evidence = loc[\"evidence\"]\n if found_evidence not in evidence_bag:\n evidence_bag.append(found_evidence)\n print(f\"取得證物:{found_evidence}\")\n else:\n print(\"這裡已經調查過了,沒有新的發現。\")\n\n\ndef show_evidence():\n \"\"\"列出目前取得的所有證物。\"\"\"\n if not evidence_bag:\n print(\"目前空空如也,趕快去調查吧!\")\n else:\n print(\"\\n=== 目前收到的證物 ===\")\n for i, evidence in enumerate(evidence_bag, start=1):\n print(f\"{i}. {evidence}\")\n print(\"=============\")\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. 有同學故意把鑽石棍木67藏在圖書館\")\n print(\"2. 風吹起鑽石棍木67,清潔推車不小心把它帶到圖書館\")\n print(\"3. 鑽石棍木67從一開始就放在圖書館\")\n answer = input(\"你的推理:\").strip()\n\n if answer == \"2\":\n print(\"\\n🎉 推理正確!窗邊的棍木6767色纖維跟推車的軌跡吻合,是一場意外!案件圓滿解決。\")\n return True\n\n print(\"\\n❌ 案情似乎沒有這麼簡單,再重新看一次證物吧!\")\n return False\n\n\ndef show_menu():\n print(f\"\\n=== 校園謎案調查局:{CASE_TITLE} ===\")\n print(\"1. 調查六七年七十八九十一班教室\")\n print(\"2. 調查676767這波我挺偉偉的操場\")\n print(\"3. 調查676767競爭者不好玩圖書館\")\n print(\"4. 查看證物袋\")\n print(\"5. 提出推理\")\n print(\"6. 離開\")\n\n\ndef main():\n print(\"午休結束後,校慶展示櫃裡的鑽石棍木67消失了。你能找出真相嗎?\")\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"
|
| 10 |
+
},
|
| 11 |
+
"checkpoint_at": 1790958870918
|
| 12 |
+
}
|
classroom_data/versions/26FSunAft/林昭廷/week02/1790958870919-checkpoint-740103.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class_code": "26FSunAft",
|
| 3 |
+
"student_id": "林昭廷",
|
| 4 |
+
"display_name": "林昭廷",
|
| 5 |
+
"week_id": "week02",
|
| 6 |
+
"project_name": "校園謎案調查局",
|
| 7 |
+
"files": {
|
| 8 |
+
"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",
|
| 9 |
+
"main.py": "\"\"\"Week 2:校園謎案調查局 Starter。\n\n先完成 TODO 1~4。程式必須能反覆探索、收集線索、查看證物並提出推理。\n\"\"\"\n\nCASE_TITLE = \"18:35的約定\"\n\nLOCATIONS = {\n \"1\": {\n \"name\": \"雨夜咖啡館\",\n \"scene\": \"靠窗的07號桌上放著一個沒有署名的牛皮紙袋,店內已經準備打烊。\",\n \"evidence\": \"紙袋裡的小紙條寫著『不要找我,去找星期三』,旁邊還有一把刻著B-03的舊鑰匙。咖啡收據顯示18:35,但監視器紀錄中18:35沒有任何人坐在07號桌。\",\n },\n \"2\": {\n \"name\": \"舊圖書館\",\n \"scene\": \"07號書架上的《消失的房間》沒有借閱紀錄,書頁中夾著一張泛黃的車票。\",\n \"evidence\": \"書中被鉛筆圈起『鐘、北、三』三個字,車票日期正好是星期三。圖書館的舊平面圖上,北側曾經存在一個B-03區域。\",\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 if location_id not in LOCATIONS:\n print(\"錯誤編號,沒有這個地點。\")\n return\n\n required_before = {\"2\": \"1\", \"3\": \"2\"}\n required = required_before.get(location_id)\n if required and required not in evidence_bag:\n print(f\"現在還找不到前往『{LOCATIONS[location_id]['name']}』的方法。\")\n print(f\"先調查『{LOCATIONS[required]['name']}』。\")\n return\n\n location = LOCATIONS[location_id]\n print(f\"\\n你到了:{location['name']}\")\n print(location[\"scene\"])\n\n if location_id in evidence_bag:\n print(\"這裡已經調查過,沒有新的發現。\")\n return\n\n evidence_bag.append(location_id)\n print(f\"取得證物:{location['evidence']}\")\n\n\ndef show_evidence():\n \"\"\"列出目前取得的所有證物。\"\"\"\n if not evidence_bag:\n print(\"袋子裡空空如也。\")\n return\n\n print(\"\\n=== 目前收到的證物 ===\")\n for number, location_id in enumerate(evidence_bag, start=1):\n print(f\"{number}. {LOCATIONS[location_id]['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. 18:35 的咖啡收據與停擺的鐘樓證明這是一起三人共謀的連續失蹤案。\")\n answer = input(\"你的推理:\").strip()\n\n if answer == \"2\":\n print(\"恭喜破案!你……也該醒了!\")\n return True\n\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(\"一張沒有署名的紙條,把你帶到 18:35 的約定。你能找出真相嗎?\")\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"
|
| 10 |
+
},
|
| 11 |
+
"version_id": "1790958870919-checkpoint-740103",
|
| 12 |
+
"kind": "checkpoint",
|
| 13 |
+
"created_at": 1790958870919
|
| 14 |
+
}
|
classroom_data/versions/26FSunAft/陳英赫/week02/1790958870920-checkpoint-740104.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class_code": "26FSunAft",
|
| 3 |
+
"student_id": "陳英赫",
|
| 4 |
+
"display_name": "陳英赫",
|
| 5 |
+
"week_id": "week02",
|
| 6 |
+
"project_name": "校園謎案調查局",
|
| 7 |
+
"files": {
|
| 8 |
+
"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",
|
| 9 |
+
"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\": \"清潔推車停在書架旁,後方似乎有東西反光。\",\n \"evidence\": \"卡在推車後方的校徽\",\n },\n}\n\nevidence_bag = []\n\n\ndef investigate(location_id):\n \"\"\"調查地點並將新線索放入證物袋。\"\"\"\n if location_id not in LOCATIONS:\n print(\"錯誤編號\")\n return\n\n required_before = {\"3\": \"1\", \"2\": \"3\"}\n required = required_before.get(location_id)\n if required and required not in evidence_bag:\n print(f\"目前還不能調查這裡,先去『{LOCATIONS[required]['name']}』找線索。\")\n return\n\n location = LOCATIONS[location_id]\n print(f\"你到了:{location['name']}\")\n print(location[\"scene\"])\n\n if location_id in evidence_bag:\n print(\"這裡已經調查過,沒有新的發現。\")\n return\n\n evidence_bag.append(location_id)\n print(f\"取得證物:{location['evidence']}\")\n\n\ndef show_evidence():\n \"\"\"列出目前取得的所有證物。\"\"\"\n if not evidence_bag:\n print(\"證物袋目前是空的。\")\n return\n\n print(\"\\n=== 目前收到的證物 ===\")\n for number, location_id in enumerate(evidence_bag, start=1):\n print(f\"{number}. {LOCATIONS[location_id]['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 if answer == \"2\":\n print(\"已破案!\")\n return True\n\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"
|
| 10 |
+
},
|
| 11 |
+
"version_id": "1790958870920-checkpoint-740104",
|
| 12 |
+
"kind": "checkpoint",
|
| 13 |
+
"created_at": 1790958870920
|
| 14 |
+
}
|
classroom_data/versions/L6Sat/李合盛/week02/1790958870917-checkpoint-740101.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class_code": "L6Sat",
|
| 3 |
+
"student_id": "李合盛",
|
| 4 |
+
"display_name": "李合盛",
|
| 5 |
+
"week_id": "week02",
|
| 6 |
+
"project_name": "校園謎案調查局",
|
| 7 |
+
"files": {
|
| 8 |
+
"case_data.json": "{\n \"title\": \"不見dre人有67人\",\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\": \"卡在推車後方的67人\",\n \"detail\": \"校徽沒有損壞,背面黏著一小段藍色纖維。\"\n }\n }\n },\n \"conclusions\": {\n \"1\": \"有同學故意把校徽藏在圖書館\",\n \"2\": \"風吹起校徽,清潔推車不小心把它帶到圖書館\",\n \"3\": \"校徽從一開始就放在圖書館\"\n },\n \"correct_answer\": \"2\",\n \"success\": \"推理正確!風把校徽吹到布套上,推車經過教室後又將它帶到圖書館。這是一場意外。\"\n}\n",
|
| 9 |
+
"main.py": "\"\"\"Week 2:校園謎案調查局 Starter。\n\n先完成 TODO 1~4。程式必須能反覆探索、收集線索、查看證物並提出推理。\n\"\"\"\n\nCASE_TITLE = \"不見dre人有67人\"\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\": \"清潔推車停在骨架旁下有血跡,後方似乎有東西在叫。\",\n \"evidence\": \"卡在推車後方的67人\",\n },\n}\n\nevidence_bag = []\n\n\ndef investigate(location_id):\n \"\"\"調查地點並將新線索放入證物袋。\"\"\"\n if location_id not in LOCATIONS:\n print(\"here don't have you need\")\n return\n\n location = LOCATIONS[location_id]\n print(f\"\\n【調查地點:{location['name']}】\")\n print(location[\"scene\"])\n\n evidence = location[\"evidence\"]\n if evidence in evidence_bag:\n print(\"這裡已經調查過,沒有新的發現。\")\n return\n\n evidence_bag.append(evidence)\n print(f\"取得證物:{evidence}\")\n\n\ndef show_evidence():\n \"\"\"列出目前取得的所有證物。\"\"\"\n if not evidence_bag:\n print(\"證物袋目前是空的。\")\n return\n\n print(\"\\n=== 目前收到的證物 ===\")\n for number, evidence in enumerate(evidence_bag, start=1):\n print(f\"{number}. {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. 67人一開始就在圖書館\")\n answer = input(\"你的推理:\").strip()\n\n if answer == \"2\":\n print(\"推理正確,案件已經破解!\")\n return True\n\n print(\"這個推理還有疑點,再查看一次證物吧!\")\n return False\n\n\ndef show_menu():\n print(f\"\\n=== 校園謎案調查局:{CASE_TITLE} ===\")\n print(\"1. 調查六年一百班教室\")\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"
|
| 10 |
+
},
|
| 11 |
+
"version_id": "1790958870917-checkpoint-740101",
|
| 12 |
+
"kind": "checkpoint",
|
| 13 |
+
"created_at": 1790958870917
|
| 14 |
+
}
|
classroom_data/versions/L6Sat/王辭信/week02/1790958870918-checkpoint-740102.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class_code": "L6Sat",
|
| 3 |
+
"student_id": "王辭信",
|
| 4 |
+
"display_name": "王辭信",
|
| 5 |
+
"week_id": "week02",
|
| 6 |
+
"project_name": "校園謎案調查局",
|
| 7 |
+
"files": {
|
| 8 |
+
"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",
|
| 9 |
+
"main.py": "\"\"\"Week 2:校園謎案調查局 Starter。\n\n先完成 TODO 1~4。程式必須能反覆探索、收集線索、查看證物並提出推理。\n\"\"\"\n\nCASE_TITLE = \"消失的鑽石棍木67不知道很雷霆\"\n\nLOCATIONS = {\n \"1\": {\n \"name\": \"六七年七十八九十一班教室\",\n \"scene\": \"展示櫃半開,窗戶也沒有關好就受者。\",\n \"evidence\": \"窗框上的棍木6767色纖維\",\n },\n \"2\": {\n \"name\": \"676767這波我挺偉偉的操場\",\n \"scene\": \"地面剛拖過,留下一道彎向圖書館的痕跡。\",\n \"evidence\": \"沾著野生狗奶棍木6767的推車輪痕\",\n },\n \"3\": {\n \"name\": \"676767競爭者不好玩圖書館\",\n \"scene\": \"清潔推車停在書架旁,後方似乎有東西反光。\",\n \"evidence\": \"卡在推車後方的鑽石棍木67\",\n },\n}\n\nevidence_bag = []\n\n\ndef investigate(location_id):\n \"\"\"調查地點並將新線索放入證物袋。\"\"\"\n if location_id not in LOCATIONS:\n print(\"無效的地點!\")\n return\n\n loc = LOCATIONS[location_id]\n print(f\"\\n【調查地點:{loc['name']}】\")\n print(f\"現場狀況:{loc['scene']}\")\n\n found_evidence = loc[\"evidence\"]\n if found_evidence not in evidence_bag:\n evidence_bag.append(found_evidence)\n print(f\"取得證物:{found_evidence}\")\n else:\n print(\"這裡已經調查過了,沒有新的發現。\")\n\n\ndef show_evidence():\n \"\"\"列出目前取得的所有證物。\"\"\"\n if not evidence_bag:\n print(\"目前空空如也,趕快去調查吧!\")\n else:\n print(\"\\n=== 目前收到的證物 ===\")\n for i, evidence in enumerate(evidence_bag, start=1):\n print(f\"{i}. {evidence}\")\n print(\"=============\")\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. 有同學故意把鑽石棍木67藏在圖書館\")\n print(\"2. 風吹起鑽石棍木67,清潔推車不小心把它帶到圖書館\")\n print(\"3. 鑽石棍木67從一開始就放在圖書館\")\n answer = input(\"你的推理:\").strip()\n\n if answer == \"2\":\n print(\"\\n🎉 推理正確!窗邊的棍木6767色纖維跟推車的軌跡吻合,是一場意外!案件圓滿解決。\")\n return True\n\n print(\"\\n❌ 案情似乎沒有這麼簡單,再重新看一次證物吧!\")\n return False\n\n\ndef show_menu():\n print(f\"\\n=== 校園謎案調查局:{CASE_TITLE} ===\")\n print(\"1. 調查六七年七十八九十一班教室\")\n print(\"2. 調查676767這波我挺偉偉的操場\")\n print(\"3. 調查676767競爭者不好玩圖書館\")\n print(\"4. 查看證物袋\")\n print(\"5. 提出推理\")\n print(\"6. 離開\")\n\n\ndef main():\n print(\"午休結束後,校慶展示櫃裡的鑽石棍木67消失了。你能找出真相嗎?\")\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"
|
| 10 |
+
},
|
| 11 |
+
"version_id": "1790958870918-checkpoint-740102",
|
| 12 |
+
"kind": "checkpoint",
|
| 13 |
+
"created_at": 1790958870918
|
| 14 |
+
}
|
classroom_service.py
CHANGED
|
@@ -86,14 +86,25 @@ def init_db():
|
|
| 86 |
c.execute("""INSERT OR IGNORE INTO classroom_projects(class_code,student_id,display_name,week_id,project_name,draft_files,final_files,active_file,output,status,needs_help,updated_at,submitted_at,checkpoint_files,checkpoint_at) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""",(code,student_id,name,week_id,project_name,encoded,encoded if kind=="submit" else None,"main.py","","idle",0,created_at,created_at if kind=="submit" else None,encoded if kind=="checkpoint" else None,created_at if kind=="checkpoint" else None))
|
| 87 |
time_column="checkpoint_at" if kind=="checkpoint" else "submitted_at";files_column="checkpoint_files" if kind=="checkpoint" else "final_files"
|
| 88 |
c.execute(f"UPDATE classroom_projects SET {files_column}=CASE WHEN ? >= COALESCE({time_column},0) THEN ? ELSE {files_column} END,{time_column}=MAX(COALESCE({time_column},0),?),draft_files=CASE WHEN ?>=updated_at THEN ? ELSE draft_files END,project_name=CASE WHEN ?>=updated_at THEN ? ELSE project_name END,updated_at=MAX(updated_at,?) WHERE class_code=? AND student_id=? AND week_id=?",(created_at,encoded,created_at,created_at,encoded,created_at,project_name,created_at,code,student_id,week_id))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
migration_id="lesson2_syntax_repair_20260916"
|
| 90 |
if not c.execute("SELECT 1 FROM classroom_migrations WHERE migration_id=?",(migration_id,)).fetchone():
|
| 91 |
for repair in REPAIRS.glob("*/*/*.py") if REPAIRS.is_dir() else []:
|
| 92 |
class_code,week_id=repair.parts[-3],repair.parts[-2];student_id=repair.stem
|
| 93 |
-
row=c.execute("SELECT draft_files,final_files FROM classroom_projects WHERE class_code=? AND student_id=? AND week_id=?",(class_code,student_id,week_id)).fetchone()
|
| 94 |
if not row:continue
|
| 95 |
draft=json.loads(row[0]);final=json.loads(row[1]) if row[1] else None;fixed=repair.read_text(encoding="utf-8")
|
| 96 |
-
draft["main.py"]=fixed
|
| 97 |
if final is not None:final["main.py"]=fixed
|
| 98 |
c.execute("UPDATE classroom_projects SET draft_files=?,final_files=?,updated_at=? WHERE class_code=? AND student_id=? AND week_id=?",(json.dumps(draft,ensure_ascii=False),json.dumps(final,ensure_ascii=False) if final is not None else None,now(),class_code,student_id,week_id))
|
| 99 |
c.execute("INSERT INTO classroom_migrations VALUES(?,?)",(migration_id,now()))
|
|
|
|
| 86 |
c.execute("""INSERT OR IGNORE INTO classroom_projects(class_code,student_id,display_name,week_id,project_name,draft_files,final_files,active_file,output,status,needs_help,updated_at,submitted_at,checkpoint_files,checkpoint_at) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""",(code,student_id,name,week_id,project_name,encoded,encoded if kind=="submit" else None,"main.py","","idle",0,created_at,created_at if kind=="submit" else None,encoded if kind=="checkpoint" else None,created_at if kind=="checkpoint" else None))
|
| 87 |
time_column="checkpoint_at" if kind=="checkpoint" else "submitted_at";files_column="checkpoint_files" if kind=="checkpoint" else "final_files"
|
| 88 |
c.execute(f"UPDATE classroom_projects SET {files_column}=CASE WHEN ? >= COALESCE({time_column},0) THEN ? ELSE {files_column} END,{time_column}=MAX(COALESCE({time_column},0),?),draft_files=CASE WHEN ?>=updated_at THEN ? ELSE draft_files END,project_name=CASE WHEN ?>=updated_at THEN ? ELSE project_name END,updated_at=MAX(updated_at,?) WHERE class_code=? AND student_id=? AND week_id=?",(created_at,encoded,created_at,created_at,encoded,created_at,project_name,created_at,code,student_id,week_id))
|
| 89 |
+
c.execute("""DELETE FROM classroom_versions AS legacy
|
| 90 |
+
WHERE legacy.version_id LIKE 'legacy-%'
|
| 91 |
+
AND EXISTS (
|
| 92 |
+
SELECT 1 FROM classroom_versions AS saved
|
| 93 |
+
WHERE saved.class_code=legacy.class_code
|
| 94 |
+
AND saved.student_id=legacy.student_id
|
| 95 |
+
AND saved.week_id=legacy.week_id
|
| 96 |
+
AND saved.kind=legacy.kind
|
| 97 |
+
AND saved.created_at=legacy.created_at
|
| 98 |
+
AND saved.version_id NOT LIKE 'legacy-%'
|
| 99 |
+
)""")
|
| 100 |
migration_id="lesson2_syntax_repair_20260916"
|
| 101 |
if not c.execute("SELECT 1 FROM classroom_migrations WHERE migration_id=?",(migration_id,)).fetchone():
|
| 102 |
for repair in REPAIRS.glob("*/*/*.py") if REPAIRS.is_dir() else []:
|
| 103 |
class_code,week_id=repair.parts[-3],repair.parts[-2];student_id=repair.stem
|
| 104 |
+
row=c.execute("SELECT draft_files,final_files,checkpoint_at,submitted_at FROM classroom_projects WHERE class_code=? AND student_id=? AND week_id=?",(class_code,student_id,week_id)).fetchone()
|
| 105 |
if not row:continue
|
| 106 |
draft=json.loads(row[0]);final=json.loads(row[1]) if row[1] else None;fixed=repair.read_text(encoding="utf-8")
|
| 107 |
+
if row[2] is None or row[2]<int(row[3] or 0):draft["main.py"]=fixed
|
| 108 |
if final is not None:final["main.py"]=fixed
|
| 109 |
c.execute("UPDATE classroom_projects SET draft_files=?,final_files=?,updated_at=? WHERE class_code=? AND student_id=? AND week_id=?",(json.dumps(draft,ensure_ascii=False),json.dumps(final,ensure_ascii=False) if final is not None else None,now(),class_code,student_id,week_id))
|
| 110 |
c.execute("INSERT INTO classroom_migrations VALUES(?,?)",(migration_id,now()))
|
tests/test_classroom.py
CHANGED
|
@@ -71,6 +71,20 @@ class ClassroomServiceTests(unittest.TestCase):
|
|
| 71 |
with zipfile.ZipFile(io.BytesIO(classroom.make_zip("L6A", "week02"))) as archive:
|
| 72 |
self.assertEqual(archive.namelist(), [])
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
def test_progress_picker_lists_every_checkpoint_and_submission_newest_first(self):
|
| 75 |
state = classroom.empty("L6A", "student-1", "Alex", "week02")
|
| 76 |
state["project_name"] = "校園謎案"
|
|
|
|
| 71 |
with zipfile.ZipFile(io.BytesIO(classroom.make_zip("L6A", "week02"))) as archive:
|
| 72 |
self.assertEqual(archive.namelist(), [])
|
| 73 |
|
| 74 |
+
def test_bootstrap_keeps_new_checkpoint_ahead_of_legacy_repair(self):
|
| 75 |
+
classroom.init_db()
|
| 76 |
+
loaded = classroom.load("L6Sat", "李合盛", "李合盛", "week02")
|
| 77 |
+
|
| 78 |
+
self.assertEqual(loaded["files"], loaded["checkpoint_files"])
|
| 79 |
+
self.assertNotEqual(loaded["files"], loaded["final_files"])
|
| 80 |
+
matching = [
|
| 81 |
+
item
|
| 82 |
+
for item in classroom.version_history("L6Sat", "李合盛")
|
| 83 |
+
if item["source"] == "checkpoint"
|
| 84 |
+
and item["submitted_at"] == loaded["checkpoint_at"]
|
| 85 |
+
]
|
| 86 |
+
self.assertEqual(len(matching), 1)
|
| 87 |
+
|
| 88 |
def test_progress_picker_lists_every_checkpoint_and_submission_newest_first(self):
|
| 89 |
state = classroom.empty("L6A", "student-1", "Alex", "week02")
|
| 90 |
state["project_name"] = "校園謎案"
|