
    Ij/                        d Z ddlZddlZddlmZ ej
                  j                  d e ee      j                               ddl
ZddlZddlZddlZej"                  dz  ZdZdj)                  g d      ZdZd	ed
efdZd
efdZd
efdZd
efdZdZdddiddiddddg dddZd Zdj)                  g d      ZdZ d Z!d Z"d Z#d Z$e%dk(  r e$        yy) u  s10 — 6라운드: 뿌리 v3 = 두 검증 접근의 결합 (fp 기하 앵커 × fp형 도면+입체감).

사용자 재정의(2026-07-05): 뿌리 = "전체 샷을 한꺼번에 넣은" 건물 전체(옥탑 거주부
+옥상+건물 몸체+지상 진입 마당/골목) 도면. 형태 = 실내 fp 의 도면 언어(가는 윤곽선
/플랫 색 채움/설비 기호) + 약간의 입체감(수직에서 ~30° 축측). 검증 소스 결합:
  - 기하: 실외 fp 3장 I2I 앵커 (4라운드 root_v2 검증 — s8)
  - 형태: fp 도면 언어+30° 축측 + 간결·중립(로케이션 문서) 계약 (5라운드 p1 검증 — s9)
  - 마커/범례: 원문자 12개+우측 영어 범례 (root_plan_v2 재사용 — 검증 요소/23샷 커버)
변형 3종(여러 방법 시도):
  a) 템플릿 결합 — p1 스타일 언어 + root_v2 의 참조/마커/범례 블록 (코드 저작 코어)
  b) LLM 저작 코어 — 스타일/내용 서술만 LLM(s9 패턴, EN+KO), 공통 블록은 코드 부착
  c) 2-hop 재스타일 — 검증된 root_v2.png 단일 참조로 형태 전환+기울임 (p4 패턴 응용)
사용: .venv/bin/python s10_root_v3.py [--only core|images|readback|html]
산출: out/root_v3/root_v3{a,b,c}.png, plans/root_v3b_core.json,
      plans/root_readback_v3{a,b,c}.json, round6.html
    N)Pathroot_v3abc
)zDONE technical architectural SITE PLAN drawing of a single real-worlduL   property, in the exact drafting language of a clean floor plan — thin darkuH   outlines, flat muted colour fills, simple fixture symbols — drawn withzKslight axonometric depth, viewed from high above at an oblique angle tiltedzKabout 30 degrees from vertical. NOT straight down, NOT a photograph, NOT anzHartistic ink sketch. Neutral document presentation: no mood, no weather,z'no story props, no vehicles, no people. z0Draw the WHOLE property in one coherent drawing:zG- the multi-storey BUILDING body (its roof plane and the walls the tiltz  reveals),zH- the upper-level dwelling shell on that roof with its terrace and fixeduG     rooftop fixtures (only what its plan shows — never interior rooms),zB- the exterior STAIR route connecting the ground to the top level,zH- the GROUND level around the building: the entry yard, the narrow alleyz(  approach and the street-side entrance,z-- a modest margin of neighbouring structures.zHWall heights, the stair run and the ground-to-roof level difference mustz2read clearly through the slight axonometric depth.u  실제 부지 하나의 기술적 건축 배치 도면 한 장 — 깔끔한 평면도의 도면 언어(가는 어두운 윤곽선, 플랫한 차분한 색 채움, 단순 설비 기호) 그대로, 수직에서 약 30도 기울인 높은 사선 시점의 약한 축측 깊이로 그린다. 완전 수직 부감도, 사진도, 예술적 잉크 스케치도 아님. 중립 문서 표현: 무드/날씨/이야기 소품/차량/사람 없음.

부지 전체를 하나의 정합된 도면에: 다층 건물 몸체(지붕면+기울임이 드러내는 벽), 그 지붕 위 상층 거주부 외피+테라스+고정 설비(도면에 있는 것만 — 실내 금지), 지상↔상층을 잇는 외부 계단, 지상부(진입 마당·좁은 골목 접근로·도로변 출입구), 이웃 구조물의 적당한 여백. 벽 높이/계단/지상-옥상 레벨 차가 약한 축측 깊이로 명확히 읽혀야 함.nreturnc                 |    g d}|t        |       D cg c]  }d|dz    d c}z  }dj                  |      S c c}w )N)uF   The attached images are the property's real top-down partial plans —zAcompose them into this ONE drawing, keeping each part's geometry,zFproportions and opening positions EXACTLY (do not move, resize, mirrorzor invent):z- attached image #   zX: top-down plan of one part of the property (its geometry for that part is ground truth)r	   )rangejoin)r   linesis      O/Users/manta/Documents/Projects/TheRoad-I1/scratchpad/forest_exp/s10_root_v3.py	ref_blockr   C   s^    E 
Qx!! #1q5' *G H! !E 99U!s   9c                 8    dt        j                  | d         z   S )NzTHE PLACE (production data):
members)Fmembers_block)recons    r   
data_blockr   P   s    +aooeI>N.OOO    c                 B    dj                  d | d   D              }d|z   S )Nr	   c              3   D   K   | ]  }d |d    d|d    d|d      yw)(idz) name_enu    — 	placementN .0es     r   	<genexpr>zmarker_block.<locals>.<genexpr>U   s8      4"2Q QtWIR)~U1[>:JK"2s    elementszEMark each element with a small circle containing its capital letter:
r   )planel_liness     r   marker_blockr+   T   s4    yy 4"&z"24 4H#$ %r   c                 f    dj                  d | d   D              }dj                  dd|ddd	g      S )
Nz, c              3   R   K   | ]  }|d     d|d   j                           ! yw)r   : r    N)upperr#   s     r   r&   zlegend_block.<locals>.<genexpr>\   s5      8&6 !"$y1Y<+=+=+?*@A&6s   %'r'   r	   z@On the RIGHT side, add a clean legend panel listing each circledz;letter with its English name in small neat capital letters:r
   zAThe circled letters and the legend are the ONLY text and the ONLYzFcircular marks allowed. No zone captions, no numbers, no other labels.r(   )r)   legend_liness     r   legend_blockr1   [   sJ    99 8&*:&68 8L99JE
KP  r   u  You write the CORE of one image prompt for a LOCATION SITE-PLAN
ASSET in film pre-production. The place is a scouted location: an upper rooftop
dwelling on an old multi-family building, its terrace, an exterior stair, the
building body, the ground-level entrance/yard/alley approach and immediate
surroundings. You get production data (member descriptions + full shot contents)
— extract ONLY the permanent physical anatomy of the place.

HARD STYLE RULES:
- CONCISE. 70-130 words. List what must be IN the drawing — nothing else.
- The drawing form: a technical architectural SITE PLAN in the exact drafting
  language of a clean floor plan (thin dark outlines, flat muted colour fills,
  simple fixture symbols), drawn with slight axonometric depth, viewed from high
  above at an oblique angle tilted about 30 degrees from vertical — NOT straight
  down, NOT a photograph, NOT an artistic ink sketch.
- One drawing covers the WHOLE property: the building body, the upper dwelling
  shell + terrace + fixed rooftop fixtures, the exterior stair from ground to
  top, the ground entry yard / alley approach / street-side entrance, and a
  modest margin of neighbours. Levels and wall heights must read.
- NEUTRAL location document: no storytelling, no mood, no weather, no lighting
  effects, no story props, no vehicles. Never expose interior rooms/furniture.
  No people. Do not ask for any text in the image.
- Do NOT mention attached reference images, markers, letters or legends — those
  instructions are appended separately by the pipeline.

Output the core in ENGLISH plus a faithful KOREAN translation (human review
only; the image model receives the English).objecttypestringz&what data grounded the anatomy choices)r3   description)core_encore_konotesF)r3   
propertiesrequiredadditionalPropertiesc                 x   t        j                  | d         }dj                  d t        | d   j	                               D              }d|z   dz   |z   dz   }t        j
                  dt        |t        d	
      }t        j                  d|       t        dt        |d   j                                d       |S )Nr   

c              3   N   K   | ]  \  }}t        j                  ||        y w)N)r   
shot_block)r$   kss      r   r&   zgen_b_core.<locals>.<genexpr>   s%      G'Etq!Q'Es   #%shotszPLACE MEMBERS:
z+

ALL SHOTS AT THIS PLACE (full content):

z&

Write the site-plan prompt core now.forest_r6_root_coregptmodelroot_v3b_corezb core: r6   z words)r   r   r   sorteditemsllmB_CORE_SYSTEMB_CORE_SCHEMA	save_planprintlensplit)r   r   shot_blocksuserouts        r   
gen_b_corerT      s    ooeI./G++ G'-eGn.B.B.D'EG GK(?@BMN89D %%%}dMCKK%	HSY--/01
89Jr   )zHImage edit. Redraw the attached TOP-DOWN site plan in the exact draftinguI   language of a clean architectural floor plan — thin dark outlines, flatuM   muted colour fills, simple fixture symbols — and give it slight axonometriczHdepth: tilt the view about 30 degrees from vertical so wall heights, thezHexterior stair run and the ground-to-roof level difference read clearly.r
   zDKeep EVERYTHING in the drawing exactly where it is: the same layout,zJproportions and opening positions, the same circled capital-letter markerszFat the same spots, and the same right-side legend panel with identicalz2text. Do not add, remove, move or rename anything.zGNever expose interior rooms or furniture. No people, no story props, nozvehicles, no other text.u9  이미지 편집. 첨부된 완전 수직 배치도를 깔끔한 건축 평면도의 도면 언어(가는 어두운 윤곽선, 플랫한 차분한 색 채움, 단순 설비 기호)로 다시 그리고, 약한 축측 깊이를 부여: 수직에서 약 30도 기울여 벽 높이/외부 계단/지상-옥상 레벨 차가 명확히 읽히게. 배치·비율·개구부 위치·원문자 마커 위치·우측 범례 텍스트 전부 그대로 유지(추가/제거/이동/개명 금지). 실내/가구 노출 금지, 사람/이야기 소품/차량/기타 텍스트 금지.c           	         t        j                  |       }dj                  t        t	        |            t        |       t        |      t        |      g      }t        dz   |z   |D cg c]  \  }}}|
 c}}f|d   dz   |z   |D cg c]  \  }}}|
 c}}ft        t        j                  dz  dz  gfdS c c}}w c c}}w )Nr=   r6   root_v2zroot_v2.pngr   )S8exterior_fpsr   r   rO   r   r+   r1   STYLE_CORE_AC_RESTYLE_PROMPTr   OUT)r   r)   b_corefpsshared_ps          r   build_promptsra      s    
//%
 C[[)CH-z%/@&t,l4.@B CF V#f,.DWQ1q.DEY&(61S3IS'!QAS3IJ!2]!B CD .D3Is   (B8B>
c           
          t         j                  dd       t        | ||      }t        D ]E  }||   \  }}t	        j
                  d| ||t         d| dz         t        j                          G y )NT)parentsexist_ok
r6_root_v3r   .png)refsout_path)OUTRmkdirra   VARIANTSr   img_gptr6_pagebuild)r   r)   r\   promptsvpromptrg   s          r   imagesrr      sj    JJtdJ+E40Gqz			Jqc"FGA3d"33	5	 r   c                    t         D ]  }t        d| dz  }|j                         s!dddt        j                  |      g}t        j
                  dd|t        j                  d	      }t        j                  d
| |       | d   D ch c]  }|d   	 }}t        |j                  d      xs g       }t        d| dt        ||z         dt        |       d|j                  d               t        j                          y c c}w )Nr   rf   textzThis is an architectural site plan drawn at a high oblique angle, with circled capital letters and a legend panel. List every circled capital letter, list the legend entries as written, and say whether any interior room layout or furniture is exposed.)r3   rt   forest_r6_root_readbackz#You read technical plans precisely.rD   rE   root_readback_v3r'   r   letters_foundzreadback v3r.   /z letters, interior=interior_layout_exposed)rk   ri   existsr   png_data_urlrJ   S1READBACK_SCHEMArM   setgetrN   rO   rm   rn   )r)   rp   pngrR   rbr%   wantgots           r   readbackr      s   wqc&&zz|*+ s#% UU,8++5: 	
&qc*B/!%j!12!1A$!12"&&)/R0A3bS4Z 13t9+ >66";<=? 	@# & MMO	 3s   
Dc                     t        j                         } | j                  ddg d       | j                         }t	        j
                         }t	        j                  d      }|j                  dv rt        |      }nt	        j                  d      }|j                  dv rt        |||       |j                  d	v rt        |       |j                  d
v rt        j                          t	        j                  dd|j                  d       y )Nz--onlyall)r   corerr   r   html)defaultchoicesroot_plan_v2)r   r   rG   )r   rr   )r   r   )r   r   stages10_root_v3)kindr   done)argparseArgumentParseradd_argument
parse_argsr   
load_recon	load_planonlyrT   rr   r   rm   rn   runlog)apargsr   r)   r\   s        r   mainr      s    		 	 	"BOOHeI  K==?DLLNE;;~&DyyO#E"_-yy%%udF#yy''yyO#HHgtyyIJr   __main__)&__doc__r   syspathlibr   pathinsertstr__file__parent
forest_libr   s1_rootr|   
s8_root_v2rW   rm   r[   ri   rk   r   rY   STYLE_CORE_A_KOintr   r   r+   r1   rK   rL   rT   rZ   C_RESTYLE_PROMPT_KOra   rr   r   r   __name__r"   r   r   <module>r      s7     
  3tH~,,- .    uuy yy  .8 
 
 
P P%# %
# 
08 H%H%"!IK 0!
  99    . .K( zF r   