[fix] site/scripts: 끼니 간격·체류 대비 이동을 규칙으로 — 섬 코스가 103분 만에 두 번째 상

사장님 지적("1시간 30분 걸려서 갔는데 짧게 머문다")을 전수로 다시 셌다.
대상은 선유도가 아니었다(150분). 섬에서 돌아오는 길의 **끼니 간격**이다 —
늦은 점심 15:47 종료, 저녁 17:30 시작으로 103분이다. 늦은 점심 창(≤15:00)과
저녁 창(≥17:30)이 둘 다 합법이라 규칙 14종을 그냥 통과했다. 창 밖에 규칙이 따로 필요했다.

- build_itinerary.py: MEAL_GAP=180. `_window_of()` 가 앞 끼니 종료 + 3시간 뒤로 다음 끼니
  창을 민다. 섬 2박3일 둘째 날이 쉼 168분으로 늘고 저녁이 18:47 로 밀렸다
- build_itinerary.py audit(): 규칙 15(끼니 간격) · 16(볼거리는 편도 이동보다 오래 머문다)
  추가. 16은 **끼니를 뺀다** — 밥집은 목적지가 아니라 돌아오는 길에 들르는 자리다
- audit_schedule.py 신설: 구워진 payload 를 표로 펴고, 만들 때 규칙이 **안 보는** 논리
  12가지(L0~L11)를 센다 → SCHEDULE.md
- README: 규칙 14종 → 16종. 장소 대장 프롬프트에 "멀리 있는 곳 근처 식당도 넣어라" 추가 —
  규칙만 고치면 다음 지역에서 또 난다
- README: 일정 프롬프트 위치 정정. shared/section-prompts.ts 가 아니라
  frontend/.../canvas/dataSpec.ts:556 이고, video·event·itinerary 셋은 **빌더에만** 있어
  서버 생성 잡이 만들 줄 모른다(daily 와 같은 사고). 그 프롬프트가 모델에게 시각 계산을
  시키고 있는 것도 적었다 — 시연본 첫 판이 망가진 직접 원인이다
- README: 목업을 지울 때 1부를 docs/ 로 옮기라는 안내

검증: 규칙 16종 위반 0건 · audit_schedule 21/21 검수완료 · audit-all.mjs 34/34

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
minaChoiandClaude Opus 5 committed 2026-09-11 11:10:16 +09:00
1 parent b86a055278
commit 703f831273
5 files changed
+1047 -18

No files matched your search

@@ -161,6 +161,12 @@ WINDOW = {
"밤 산책": (18 * 60 + 30, 20 * 60),
}
DAY_ENDS_BY = 21 * 60
# ★ 끼니 사이 최소 간격 (2026-09-11 검수).
# 섬 코스에서 늦은 점심이 15:47 에 끝나고 저녁이 17:30 이었다 — 103분이다.
# 창(窓)만 지키면 통과한다: 늦은 점심은 15:00 까지, 저녁은 17:30 부터라 둘 다 합법인데
# 손님은 배가 안 꺼진 채 두 번째 상을 받는다. 창 밖에 이 규칙이 따로 필요하다.
MEAL_GAP = 180
MEAL_SLOTS = {"점심", "늦은 점심", "저녁"}
# 퇴실 시각. payload 의 check_out_time 과 같아야 한다 — 시간표가 규정을 어기면
# 사장님이 손님에게 설명할 수 없는 일정이 된다.
CHECK_OUT_BY = 11 * 60
@@ -233,6 +239,17 @@ def _note(slot: str, place: str, kind: str) -> str | None:
return PLACES[place][4]
def _window_of(slot: str, last_meal_end: int | None):
"""그 자리의 도착 창. 끼니는 **앞 끼니가 끝난 뒤 MEAL_GAP** 이 지나야 연다."""
window = WINDOW.get(slot)
if not window:
return None
early, late = window
if slot in MEAL_SLOTS and last_meal_end is not None:
early = max(early, last_meal_end + MEAL_GAP)
return (early, late) if early <= late else None
def plan_day(kind: str, places: list[str], label: str, start: int, pace: float):
"""하루 하나를 시각까지 계산한다. 창을 못 맞추면 None.
@@ -265,13 +282,16 @@ def plan_day(kind: str, places: list[str], label: str, start: int, pace: float):
clock = start
prev = BASE
last_meal_end = None
for index, row in enumerate(rows):
coords = (PLACES[row["place"]][0], PLACES[row["place"]][1])
# 하루의 1번은 머뭄이다 — 이미 그 자리에 있으니 이동시간이 없다.
row["move"] = 0 if index == 0 else move_minutes(prev, coords)
arrive = clock + row["move"]
window = WINDOW.get(row["slot"])
window = _window_of(row["slot"], last_meal_end)
if window is None and row["slot"] in WINDOW:
return None # 앞 끼니와 겹쳐 창이 닫혔다 — 이 조합은 포기한다
if window:
early, late = window
if arrive < early:
@@ -301,6 +321,8 @@ def plan_day(kind: str, places: list[str], label: str, start: int, pace: float):
return plan_day_fixed(rows, start)
clock = arrive + row["stay"]
if row["slot"] in MEAL_SLOTS:
last_meal_end = clock
prev = coords
if clock > DAY_ENDS_BY:
@@ -312,14 +334,17 @@ def plan_day_fixed(rows: list[dict], start: int):
"""체류시간을 고친 뒤 처음부터 다시 훑는다(앞 칸을 바꿨으니 뒤 시각이 전부 달라진다)."""
clock = start
prev = BASE
last_meal_end = None
for index, row in enumerate(rows):
coords = (PLACES[row["place"]][0], PLACES[row["place"]][1])
row["move"] = 0 if index == 0 else move_minutes(prev, coords)
arrive = clock + row["move"]
window = WINDOW.get(row["slot"])
if window and not (window[0] <= arrive <= window[1]):
window = _window_of(row["slot"], last_meal_end)
if row["slot"] in WINDOW and (window is None or not (window[0] <= arrive <= window[1])):
return None
clock = arrive + row["stay"]
if row["slot"] in MEAL_SLOTS:
last_meal_end = clock
prev = coords
if clock > DAY_ENDS_BY:
return None
@@ -589,6 +614,28 @@ def audit(built: list[dict]) -> list[str]:
if clock > DAY_ENDS_BY:
flag(item, day, f"{clock // 60}:{clock % 60:02d} 종료 — 21시 초과")
# ⑮ 끼니 사이 최소 간격 (2026-09-11 검수에서 걸린 것)
# 창만 지키면 통과한다 — 늦은 점심 15:47 종료, 저녁 17:30 시작이 둘 다 합법이었다.
# 손님은 배가 안 꺼진 채 두 번째 상을 받는다.
walk = _minutes(day["startTime"])
last_meal = None
for sl, stop in zip(slots, day["stops"]):
walk += stop["moveMinutes"]
if sl in FOOD_SLOTS:
if last_meal is not None and walk - last_meal < MEAL_GAP:
flag(item, day, f"앞 끼니 끝나고 {walk - last_meal}분 만에 {sl}")
last_meal = walk + stop["minutes"]
walk += stop["minutes"]
# ⑯ 볼거리는 **가는 시간보다 오래 머문다**
# 끼니는 뺀다 — 밥집은 목적지가 아니라 돌아오는 길에 들르는 자리다.
# (섬에서 85분 달려와 55분 먹는 것은 이상하지 않다. 섬에 30분 있으면 이상하다.)
for sl, pl, stop in zip(slots, places, day["stops"]):
if pl == STAY or sl in FOOD_SLOTS:
continue
if stop["minutes"] < stop["moveMinutes"]:
flag(item, day, f"{pl}: 이동 {stop['moveMinutes']}분인데 체류 {stop['minutes']}분")
# ⑨ 같은 날 같은 식당 두 번
meals = [p for sl, p in zip(slots, places) if sl in FOOD_SLOTS]
if len(meals) != len(set(meals)):
@@ -631,4 +678,4 @@ for item in items:
f"{clock // 60:02d}:{clock % 60:02d} {len(day['stops'])}칸")
DST.write_text(json.dumps(payload, ensure_ascii=False), encoding="utf-8")
print(f"\n테마 {len(items)}개 · 규칙 14종 위반 0건 · payload {DST.stat().st_size:,}B")
print(f"\n테마 {len(items)}개 · 규칙 16종 위반 0건 · payload {DST.stat().st_size:,}B")