From 2ea48832730080f225524e134aeb163fe1ddd81f Mon Sep 17 00:00:00 2001 From: umsangdon Date: Thu, 1 Oct 2026 16:21:55 +0900 Subject: [PATCH] =?UTF-8?q?fix(M02-CostFlow):=20FuncPanel=20=EC=B9=B8=20?= =?UTF-8?q?=EC=97=86=EB=8A=94=20=EB=B0=9B=EB=8A=94=20=EC=95=8C=EC=95=BD?= =?UTF-8?q?=EC=9D=84=20=EC=95=84=EC=A7=81=20=EC=95=88=20=EB=86=93=EC=9D=80?= =?UTF-8?q?=20=EC=95=8C=EC=95=BD=EC=9C=BC=EB=A1=9C=20=EB=B3=B4=EC=9E=84=20?= =?UTF-8?q?-=20=EC=84=A0=20=EC=97=86=EC=9D=B4=EB=8F=84=20=EB=B3=B4?= =?UTF-8?q?=EC=9D=B4=EA=B3=A0=20=EC=B9=B8=EC=97=90=20=EB=86=93=EC=9C=BC?= =?UTF-8?q?=EB=A9=B4=20=EC=9E=A0=EA=B8=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01D2nUMUMTsqm93PbQtipo6c --- M02_MasterTemplete/CostFlow/M02_CF_FuncPanel.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/M02_MasterTemplete/CostFlow/M02_CF_FuncPanel.ts b/M02_MasterTemplete/CostFlow/M02_CF_FuncPanel.ts index f43861d16..84dad666f 100644 --- a/M02_MasterTemplete/CostFlow/M02_CF_FuncPanel.ts +++ b/M02_MasterTemplete/CostFlow/M02_CF_FuncPanel.ts @@ -24,7 +24,7 @@ const TEXT = { GotHint: ["누르거나 칸에 끌어 놓음", "Click, or drag onto a cell"], NoGot: ["선으로 들어온 알약이 없음", "No pill has come in yet"], Placed: ["놓임", "placed"], - Free: ["놓을 칸 없음", "not placed"], + Free: ["아직 안 놓은 알약", "not placed yet"], Busy: ["이미 쓰는 칸", "That cell is already in use"], Locked: [ "받은 알약이 놓인 칸은 선의 값으로 채워짐 — 직접 못 고침", @@ -260,6 +260,8 @@ function incoming(st: State): { port: string; unit: string }[] { "-"); out.set(l.to.name, unit || "-"); } + // 선 없이 칸 없는 받는 알약만 있어도 보임(새 함수 상자가 먼저 만든 자리) + for (const i of funcOf(st)?.inputs ?? []) if (!out.has(i.port)) out.set(i.port, "-"); return [...out].map(([port, unit]) => ({ port, unit })); } @@ -273,7 +275,7 @@ function problems(st: State): string[] { } } for (const p of incoming(st)) { - if (!f.inputs.some((i) => i.port === p.port)) out.push(`${p.port}${tf("Unplaced")}`); + if (!f.inputs.some((i) => i.port === p.port && i.cell)) out.push(`${p.port}${tf("Unplaced")}`); } if (!f.output.cell) out.push(tf("OutNone")); return out; @@ -285,12 +287,13 @@ function applyMarks(st: State): void { const f = funcOf(st); if (!f) return; const marks = new Map(); - for (const i of f.inputs) marks.set(i.cell, { kind: "in", label: `${tf("Got")} ${i.port}` }); + for (const i of f.inputs.filter((x) => x.cell)) + marks.set(i.cell, { kind: "in", label: `${tf("Got")} ${i.port}` }); for (const v of f.variables) if (v.cell) marks.set(v.cell, { kind: "var", label: `${tf("Vars")} ${v.name}` }); if (f.output.cell) marks.set(f.output.cell, { kind: "out", label: `${tf("OutNow")} ${f.output.name}` }); - const locked = new Set(f.inputs.map((i) => i.cell)); + const locked = new Set(f.inputs.filter((i) => i.cell).map((i) => i.cell)); const list = problems(st); const bad = new Set(list.map((p) => p.split(" ")[0])); for (const c of st.parts.sheet.querySelectorAll(".aislo-cell")) { @@ -581,7 +584,7 @@ function onBook(st: State, book: Workbook): void { if (!f) return; const sheet = plain(structuredClone(book.시트[0])); const hit = f.inputs.find( - (i) => JSON.stringify(f.sheet.칸[i.cell]) !== JSON.stringify(sheet.칸[i.cell]), + (i) => i.cell && JSON.stringify(f.sheet.칸[i.cell]) !== JSON.stringify(sheet.칸[i.cell]), ); if (hit) { showToast(tf("Locked"), "error");