시나리오 내용 반영
This commit is contained in:
1 parent
d9287de729
commit
350bb92bf9
270 files changed
+198867
No files matched your search
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Generator for OPS01.ipynb and OPS01_student.ipynb
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
import json
|
||||
|
||||
def load_data():
|
||||
with open('scenario_json/OPS01.json', encoding='utf-8') as f:
|
||||
scenario = json.load(f)
|
||||
|
||||
with open('scenario_md/OPS01-작전·전투 수행_적 탐지-드론 영상 공중위협 객체 탐지와 오경보 검증/OPS01_정답코드.md', encoding='utf-8') as f:
|
||||
code_md = f.read()
|
||||
|
||||
parts = re.split(r'##\s+미션\s+(\d+)\.\s*', code_md)
|
||||
missions_code = {}
|
||||
for i in range(1, len(parts), 2):
|
||||
m_num = int(parts[i])
|
||||
m_body = parts[i+1]
|
||||
lines = m_body.strip().split('\n')
|
||||
m_title = lines[0].strip()
|
||||
code_matches = re.findall(r'```python\n(.*?)\n```', m_body, re.DOTALL)
|
||||
output_matches = re.findall(r'```text\n(.*?)\n```', m_body, re.DOTALL)
|
||||
missions_code[m_num] = {
|
||||
'num': m_num,
|
||||
'title': m_title,
|
||||
'code': code_matches[0] if code_matches else '',
|
||||
'output': output_matches[0] if output_matches else ''
|
||||
}
|
||||
return scenario, missions_code
|
||||
|
||||
scenario, missions_code = load_data()
|
||||
print(f"Loaded scenario '{scenario['title']}' with {len(scenario['missions'])} missions and {len(missions_code)} code blocks.")
|
||||
Reference in new issue
Block a user