시나리오 내용 반영
This commit is contained in:
1 parent
d9287de729
commit
350bb92bf9
270 files changed
+198867
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import os
|
||||
import re
|
||||
import json
|
||||
|
||||
code_path = 'scenario_md/OPS01-작전·전투 수행_적 탐지-드론 영상 공중위협 객체 탐지와 오경보 검증/OPS01_정답코드.md'
|
||||
with open(code_path, encoding='utf-8') as f:
|
||||
text = f.read()
|
||||
|
||||
parts = re.split(r'##\s+미션\s+(\d+)\.\s*', text)
|
||||
|
||||
missions = []
|
||||
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.append({
|
||||
'num': m_num,
|
||||
'title': m_title,
|
||||
'code': code_matches[0] if code_matches else '',
|
||||
'output': output_matches[0] if output_matches else ''
|
||||
})
|
||||
|
||||
print(f"Parsed {len(missions)} missions.")
|
||||
for m in missions:
|
||||
print(f"--- Mission {m['num']}: {m['title']} ---")
|
||||
print("Code lines:", len(m['code'].split('\n')))
|
||||
print("Sample lines of code:\n" + '\n'.join(m['code'].split('\n')[:8]))
|
||||
print()
|
||||
Reference in new issue
Block a user