-- 경제 시뮬레이터 본체: 실제 게임 로직(src/shared/Shop)을 봇이 쉬지 않고 최적으로 플레이합니다. -- 실행은 tools/sim.luau, 검사는 tests/Sim.spec.luau -- 봇 가정: 조리대 <-> 테이블 편도 WALK/2초, 알바생이 있으면 직접 조리하지 않고 나르기만 합니다. local Economy = require("../src/shared/Economy") local Shop = require("../src/shared/Shop") local Sim = {} function Sim.run(mult: number, limit: number): { { t: number, id: string, cost: number } } local shop = Shop.new(0, 0, 0) shop.moneyMult = mult local dt = 0.1 local t = 0 local at = "stove" local busyUntil = 0 local pending: string? = nil -- 끝나면 할 일: "cook" | "arrive_tables" | "arrive_stove" local log = {} while t < limit and Shop.nextPurchase(shop) do Shop.tick(shop, t) if t >= busyUntil then if pending == "cook" then Shop.cook(shop) elseif pending == "arrive_tables" then at = "tables" elseif pending == "arrive_stove" then at = "stove" end pending = nil if at == "stove" then Shop.pickup(shop) local canCook = not shop.stats.helper and not Shop.handFull(shop) and Shop.nextCookMenu(shop) ~= nil if canCook then pending = "cook" busyUntil = t + shop.stats.cook elseif #shop.hand > 0 and (Shop.handFull(shop) or #shop.counter == 0) then pending = "arrive_tables" busyUntil = t + Economy.WALK / 2 end else for id, c in shop.customers do if c.state == "waiting" then Shop.serve(shop, id) end end if #shop.hand == 0 then pending = "arrive_stove" busyUntil = t + Economy.WALK / 2 end end end local p = Shop.nextPurchase(shop) if p and shop.money >= p.cost then Shop.buyNext(shop) table.insert(log, { t = t, id = p.id, cost = p.cost }) end t += dt end return log end return Sim