feat(p10.2): add Siltwake mid-market authority

This commit is contained in:
2026-08-15 23:54:07 +08:00
parent 25488d3da2
commit 24b22f01ae
9 changed files with 1171 additions and 0 deletions
+334
View File
@@ -0,0 +1,334 @@
{
"schema": 1,
"contract_revision": "p10.2-siltwake-mid-contract-r1",
"source": {
"region_catalog_path": "docs/content/REGION_CATALOG.md",
"region_catalog_blob": "2ca533feb82bdedf6f141c6381319c3a56759ba3",
"enemy_catalog_path": "docs/content/ENEMY_CATALOG.md",
"enemy_catalog_blob": "cdf05128cfd1832835712e37c3eb200595983613",
"equipment_catalog_path": "docs/content/EQUIPMENT_CATALOG.md",
"equipment_catalog_blob": "3fd34ef951056b02749137f7bff2e66fb94b8375",
"economy_path": "docs/product/ECONOMY_AND_BALANCE.md",
"economy_blob": "0cb57e7b44d983f61c27e8b60da43d4728950e33"
},
"names_zh": {
"RG-02": "淤潮沼泽",
"CTR-R2-01": "淤潮初渡",
"EQ-049": "借护坠饰",
"EQ-050": "破阵盔",
"EQ-051": "静默拦截盾",
"EQ-052": "蓄热斗篷",
"EQ-053": "空护笼",
"EQ-054": "三击灯台",
"EQ-055": "邻誓护板",
"EQ-056": "反推架",
"EN-R2-08": "沉籽荚",
"EN-R2-09": "泥沼医师",
"EN-R2-10": "雾颚兽",
"RO-R2-M02-Q0": "潮玻边洲",
"RO-R2-M02-Q1": "笛沼回湾",
"RO-R2-M02-Q2": "沉籽堤渡",
"RO-R2-M03-Q0": "静水浅台",
"RO-R2-M03-Q1": "泥医泽道",
"RO-R2-M03-Q2": "雾颚切口",
"RO-R2-M04-Q0": "钩籽河汊",
"RO-R2-M04-Q1": "镜雾滩",
"RO-R2-M04-Q2": "沉育池"
},
"region": {
"id": "RG-02",
"name": "Siltwake Fens",
"preview": "Read the changing safe index, target access and recovery timing before committing each route.",
"response_tags": ["stable_order", "deliberate_movement", "focus_timing"]
},
"contract": {
"id": "CTR-R2-01",
"name": "First Siltwake Contract",
"region_id": "RG-02",
"slice_start_market": 2,
"slice_end_market": 5,
"boss_executable": false,
"preview": "Clear Rounds 2 through 4, restore the Reed Ferry and preserve the Run at Market 5.",
"response_tags": ["three_round_arc", "capacity_growth", "ferry_restoration"]
},
"equipment": [
{
"id": "EQ-049",
"name": "Borrowed Cover",
"fit": "charm; any",
"class": "B",
"effect": "When the wearer steps behind a Guarded ally, copy one Guard token.",
"tradeoff": "The copied token expires on the wearer's next movement.",
"preview": "Move behind protection to borrow it once, then decide whether another movement is worth losing it.",
"response_tags": ["deliberate_movement", "guard_copy", "neighbor_protection"]
},
{
"id": "EQ-050",
"name": "Strike-Open Helm",
"fit": "guard; pressure",
"class": "B",
"effect": "Becoming Exposed advances the wearer's next basic action.",
"tradeoff": "Exposed cannot be cleansed before that basic action.",
"preview": "Accept one disclosed vulnerable window to reach the next target sooner.",
"response_tags": ["exposed_timing", "action_advance", "focus_window"]
},
{
"id": "EQ-051",
"name": "Quiet Interceptor",
"fit": "guard; any",
"class": "B",
"effect": "The first intercepted hit generates no enemy on-hit resource.",
"tradeoff": "The wearer's own on-hit resource also does not trigger.",
"preview": "Silence the first enemy rider, but give up the wearer's matching resource trigger.",
"response_tags": ["intercept", "resource_denial", "stable_order"]
},
{
"id": "EQ-052",
"name": "Heatcatch Mantle",
"fit": "garb; any",
"class": "B",
"effect": "Store the first area burst and release it after the wearer moves.",
"tradeoff": "If the wearer cannot move within two cadences, the burst resolves on the wearer.",
"preview": "Turn a planned movement into delayed area retaliation before the stored burst backfires.",
"response_tags": ["deliberate_movement", "area_storage", "countdown"]
},
{
"id": "EQ-053",
"name": "Empty Guard Cage",
"fit": "guard; any",
"class": "B",
"effect": "With zero Guard, incoming Guard strip becomes one Guard instead.",
"tradeoff": "The wearer cannot receive normal Guard during that cadence.",
"preview": "Invert one protection strip only when the wearer enters it with no Guard.",
"response_tags": ["guard_inversion", "timing", "resource_control"]
},
{
"id": "EQ-054",
"name": "Three-Hit Sconce",
"fit": "charm; front",
"class": "B",
"effect": "The third direct hit lights a screen against the next spell.",
"tradeoff": "Moving resets the direct-hit count.",
"preview": "Hold the front through three hits to gain a spell screen, or move and lose the count.",
"response_tags": ["stable_order", "hit_count", "spell_screen"]
},
{
"id": "EQ-055",
"name": "Adjacent Oathplate",
"fit": "guard; any",
"class": "B",
"effect": "Choose ahead or behind in Prepare; protection flows only in that direction and lasts longer.",
"tradeoff": "The wearer cannot protect the other neighbor.",
"preview": "Commit protection toward the threatened side and leave the opposite neighbor exposed.",
"response_tags": ["directional_guard", "neighbor_protection", "prepare_choice"]
},
{
"id": "EQ-056",
"name": "Pushback Frame",
"fit": "guard; front",
"class": "B",
"effect": "Reflect the first blocked push onto its source when that movement is legal.",
"tradeoff": "The reflection consumes all Guard on the wearer.",
"preview": "Reverse one push at the cost of all current front-line Guard.",
"response_tags": ["push_reflect", "front_guard", "displacement"]
}
],
"enemies": [
{
"id": "EN-R2-08",
"name": "Drownseed Pod",
"class": "ordinary",
"rule": "On defeat, place a visible seed at the defeating ally's position; it bursts after two cadences unless that ally moves.",
"responses": "Move after the defeat, or delay the final hit until movement is ready.",
"preview": "The defeating ally has two cadences to leave the marked seed position.",
"response_tags": ["deliberate_movement", "defeat_trigger", "countdown"]
},
{
"id": "EN-R2-09",
"name": "Mire Medic",
"class": "ordinary",
"rule": "Restore the enemy with the oldest hindrance, shortening that hindrance with every heal.",
"responses": "Focus the Medic, or use a short hindrance so its heal removes the enemy setup.",
"preview": "Its heal targets the oldest hindered enemy and shortens that same hindrance.",
"response_tags": ["focus_source", "hindrance_timing", "enemy_healing"]
},
{
"id": "EN-R2-10",
"name": "Fogjaw",
"class": "ordinary",
"rule": "It cannot be targeted beyond reach one until it attacks; that attack reveals it for one cadence and targets the center band.",
"responses": "Hold a short-reach counter, or bait the reveal with a guarded center target.",
"preview": "A center attack opens one short reveal window for every legal attacker.",
"response_tags": ["center_protection", "reveal_window", "short_reach"]
}
],
"routes": [
{
"id": "RO-R2-M02-Q0",
"name": "Tideglass Verge",
"market_index": 2,
"round_index": 2,
"risk": 0,
"enemy_ids": ["EN-R2-01", "EN-R2-03"],
"wave_order": [{"tick": 0, "enemy_id": "EN-R2-01"}, {"tick": 16, "enemy_id": "EN-R2-03"}],
"reward_coin": 24,
"recovery_coin": 6,
"pressure": "Rear pull changes the Mimic's legal mirrored target.",
"failure_cause": "The pulled rear exposed an unguarded mirrored target.",
"preview": "A durable stable rear makes the first copied target predictable.",
"response_tags": ["stable_order", "rear_durability", "target_rule"]
},
{
"id": "RO-R2-M02-Q1",
"name": "Piper's Backwater",
"market_index": 2,
"round_index": 2,
"risk": 1,
"enemy_ids": ["EN-R2-05", "EN-R2-07"],
"wave_order": [{"tick": 0, "enemy_id": "EN-R2-05"}, {"tick": 12, "enemy_id": "EN-R2-07"}],
"reward_coin": 31,
"recovery_coin": 8,
"pressure": "Enemy reorder preserves the first attacker's tether through the line.",
"failure_cause": "Rigid targeting followed the Crab into an unsafe rear attack.",
"preview": "Interrupt the Piper or keep a flexible attacker ready for the reordered Crab.",
"response_tags": ["interrupt", "flexible_target", "enemy_reorder"]
},
{
"id": "RO-R2-M02-Q2",
"name": "Seedbank Crossing",
"market_index": 2,
"round_index": 2,
"risk": 2,
"enemy_ids": ["EN-R2-04", "EN-R2-08"],
"wave_order": [{"tick": 0, "enemy_id": "EN-R2-04"}, {"tick": 8, "enemy_id": "EN-R2-08"}],
"reward_coin": 38,
"recovery_coin": 10,
"pressure": "Defeating the Pod forces movement across a marked index.",
"failure_cause": "The seed burst pulled both neighbors into indexed mud.",
"preview": "Delay the final hit or preserve a legal move away from the seed.",
"response_tags": ["deliberate_movement", "indexed_hazard", "countdown"]
},
{
"id": "RO-R2-M03-Q0",
"name": "Stillwater Shelf",
"market_index": 3,
"round_index": 3,
"risk": 0,
"enemy_ids": ["EN-R2-06", "EN-R2-09"],
"wave_order": [{"tick": 0, "enemy_id": "EN-R2-06"}, {"tick": 18, "enemy_id": "EN-R2-09"}],
"reward_coin": 26,
"recovery_coin": 7,
"pressure": "Cleanse timing changes which hindered enemy receives healing.",
"failure_cause": "An early cleanse strengthened the hindrance before the Medic restored it.",
"preview": "Wait for the midpoint, or focus the Medic before cleansing.",
"response_tags": ["delay_cleanse", "focus_source", "hindrance_timing"]
},
{
"id": "RO-R2-M03-Q1",
"name": "Medic's Mire",
"market_index": 3,
"round_index": 3,
"risk": 1,
"enemy_ids": ["EN-R2-02", "EN-R2-09"],
"wave_order": [{"tick": 0, "enemy_id": "EN-R2-02"}, {"tick": 10, "enemy_id": "EN-R2-09"}],
"reward_coin": 33,
"recovery_coin": 9,
"pressure": "Source focus decides whether healing is converted or restored.",
"failure_cause": "Healing into the Leech fed Guard while the Medic erased damage.",
"preview": "Remove the Leech or Medic before committing the next heal.",
"response_tags": ["focus_source", "healing_denial", "healing_timing"]
},
{
"id": "RO-R2-M03-Q2",
"name": "Fogjaw Cut",
"market_index": 3,
"round_index": 3,
"risk": 2,
"enemy_ids": ["EN-R2-10", "EN-R2-05", "EN-R2-07"],
"wave_order": [{"tick": 0, "enemy_id": "EN-R2-10"}, {"tick": 9, "enemy_id": "EN-R2-05"}, {"tick": 20, "enemy_id": "EN-R2-07"}],
"reward_coin": 40,
"recovery_coin": 11,
"pressure": "Center bait and enemy reorder create one short reveal window.",
"failure_cause": "The line had no legal short-reach answer during Fogjaw's reveal.",
"preview": "Guard the center and hold one close attacker for the reveal cadence.",
"response_tags": ["center_protection", "short_reach", "enemy_reorder"]
},
{
"id": "RO-R2-M04-Q0",
"name": "Hookseed Reach",
"market_index": 4,
"round_index": 4,
"risk": 0,
"enemy_ids": ["EN-R2-01", "EN-R2-08"],
"wave_order": [{"tick": 0, "enemy_id": "EN-R2-01"}, {"tick": 15, "enemy_id": "EN-R2-08"}],
"reward_coin": 28,
"recovery_coin": 8,
"pressure": "Pull competes with the movement needed to disarm the seed.",
"failure_cause": "A reserved move was consumed by the Hook before the seed burst.",
"preview": "Brace the Hook or delay the Pod defeat until movement is free.",
"response_tags": ["pull_resist", "deliberate_movement", "countdown"]
},
{
"id": "RO-R2-M04-Q1",
"name": "Mirrored Fog",
"market_index": 4,
"round_index": 4,
"risk": 1,
"enemy_ids": ["EN-R2-03", "EN-R2-10"],
"wave_order": [{"tick": 0, "enemy_id": "EN-R2-03"}, {"tick": 14, "enemy_id": "EN-R2-10"}],
"reward_coin": 35,
"recovery_coin": 10,
"pressure": "Target-rule feeding must preserve a guarded center reveal.",
"failure_cause": "The Mimic copied a rule that left Fogjaw's center target unprotected.",
"preview": "Feed the Mimic a safe target before Fogjaw opens the center.",
"response_tags": ["target_rule", "center_protection", "guarded_candidate"]
},
{
"id": "RO-R2-M04-Q2",
"name": "Sinking Nursery",
"market_index": 4,
"round_index": 4,
"risk": 2,
"enemy_ids": ["EN-R2-04", "EN-R2-08", "EN-R2-09"],
"wave_order": [{"tick": 0, "enemy_id": "EN-R2-04"}, {"tick": 8, "enemy_id": "EN-R2-08"}, {"tick": 21, "enemy_id": "EN-R2-09"}],
"reward_coin": 42,
"recovery_coin": 12,
"pressure": "Indexed mud, seed movement and enemy sustain overlap.",
"failure_cause": "The seed forced a marked crossing while the Medic restored the Pod.",
"preview": "Focus the Medic, then defeat the Pod with an unmarked move available.",
"response_tags": ["focus_source", "indexed_hazard", "deliberate_movement"]
}
],
"markets": [
{
"market_index": 2,
"round_index": 2,
"cleared_rounds_before": 1,
"line_capacity": 4,
"offer_level": 1,
"route_ids": ["RO-R2-M02-Q0", "RO-R2-M02-Q1", "RO-R2-M02-Q2"],
"required_equipment_ids": ["EQ-049", "EQ-055"],
"first_order_changer_id": "EN-R2-01"
},
{
"market_index": 3,
"round_index": 3,
"cleared_rounds_before": 2,
"line_capacity": 5,
"offer_level": 1,
"route_ids": ["RO-R2-M03-Q0", "RO-R2-M03-Q1", "RO-R2-M03-Q2"],
"required_equipment_ids": ["EQ-050", "EQ-051"],
"first_order_changer_id": "EN-R2-05"
},
{
"market_index": 4,
"round_index": 4,
"cleared_rounds_before": 3,
"line_capacity": 5,
"offer_level": 2,
"route_ids": ["RO-R2-M04-Q0", "RO-R2-M04-Q1", "RO-R2-M04-Q2"],
"required_equipment_ids": ["EQ-052", "EQ-056"],
"first_order_changer_id": "EN-R2-01"
}
]
}
+367
View File
@@ -0,0 +1,367 @@
class_name P102ContentRegistry
extends RefCounted
const CATALOG_PATH := "res://p10_2/catalog.json"
const SCHEMA_VERSION := 1
const CONTRACT_REVISION := "p10.2-siltwake-mid-contract-r1"
const SOURCE_AUTHORITY := {
"region_catalog_path": "docs/content/REGION_CATALOG.md",
"region_catalog_blob": "2ca533feb82bdedf6f141c6381319c3a56759ba3",
"enemy_catalog_path": "docs/content/ENEMY_CATALOG.md",
"enemy_catalog_blob": "cdf05128cfd1832835712e37c3eb200595983613",
"equipment_catalog_path": "docs/content/EQUIPMENT_CATALOG.md",
"equipment_catalog_blob": "3fd34ef951056b02749137f7bff2e66fb94b8375",
"economy_path": "docs/product/ECONOMY_AND_BALANCE.md",
"economy_blob": "0cb57e7b44d983f61c27e8b60da43d4728950e33",
}
const EXPECTED_IDS := {
"equipment": ["EQ-049", "EQ-050", "EQ-051", "EQ-052", "EQ-053", "EQ-054", "EQ-055", "EQ-056"],
"enemies": ["EN-R2-08", "EN-R2-09", "EN-R2-10"],
"routes": [
"RO-R2-M02-Q0", "RO-R2-M02-Q1", "RO-R2-M02-Q2",
"RO-R2-M03-Q0", "RO-R2-M03-Q1", "RO-R2-M03-Q2",
"RO-R2-M04-Q0", "RO-R2-M04-Q1", "RO-R2-M04-Q2",
],
}
const REQUIRED_FIELDS := {
"equipment": ["fit", "class", "effect", "tradeoff"],
"enemies": ["class", "rule", "responses"],
"routes": [
"market_index", "round_index", "risk", "enemy_ids", "wave_order",
"reward_coin", "recovery_coin", "pressure", "failure_cause",
],
}
const ALLOWED_ENEMY_IDS := [
"EN-R2-01", "EN-R2-02", "EN-R2-03", "EN-R2-04", "EN-R2-05",
"EN-R2-06", "EN-R2-07", "EN-R2-08", "EN-R2-09", "EN-R2-10",
]
const FILLER_TERMS := ["todo", "tbd", "placeholder", "same as", "generic"]
static func snapshot(path: String = CATALOG_PATH) -> Dictionary:
var text := FileAccess.get_file_as_string(path)
if text.is_empty():
return {"load_error": "catalog_unreadable:%s" % path}
var parsed = JSON.parse_string(text)
if not parsed is Dictionary:
return {"load_error": "catalog_not_dictionary"}
var content: Dictionary = parsed.duplicate(true)
_enrich(content)
content["catalog_hash"] = _hash(content)
return content
static func validate(content: Dictionary) -> Dictionary:
var errors: Array[String] = []
if content.has("load_error"):
errors.append(String(content.load_error))
return {"ok": false, "errors": errors}
if int(content.get("schema", -1)) != SCHEMA_VERSION:
errors.append("schema")
if String(content.get("contract_revision", "")) != CONTRACT_REVISION:
errors.append("contract_revision")
_validate_source(content.get("source", {}), errors)
var names = content.get("names_zh", {})
if not names is Dictionary:
errors.append("names_zh_type")
names = {}
var all_ids: Array[String] = []
_validate_singleton(content.get("region", {}), "RG-02", names, all_ids, errors)
_validate_singleton(content.get("contract", {}), "CTR-R2-01", names, all_ids, errors)
var families := {}
for family in EXPECTED_IDS:
var rows = content.get(family, [])
if not rows is Array:
errors.append("family_type:%s" % family)
continue
var by_id := {}
for row in rows:
_validate_row(row, String(family), names, all_ids, by_id, errors)
families[family] = by_id
var actual: Array = by_id.keys()
actual.sort()
var expected: Array = Array(EXPECTED_IDS[family]).duplicate()
expected.sort()
if actual != expected:
errors.append("family_ids:%s" % family)
var expected_names: Array = all_ids.duplicate()
expected_names.sort()
var actual_names: Array = names.keys()
actual_names.sort()
if actual_names != expected_names:
errors.append("names_zh_ids")
_validate_contract(content, errors)
_validate_routes(families, errors)
_validate_markets(content, families, errors)
_validate_catalog_hash(content, errors)
return {"ok": errors.is_empty(), "errors": errors}
static func rows_by_id(content: Dictionary, family: String) -> Dictionary:
var result := {}
for row in content.get(family, []):
if row is Dictionary:
result[String(row.get("id", ""))] = row
return result
static func markets_by_index(content: Dictionary) -> Dictionary:
var result := {}
for row in content.get("markets", []):
if row is Dictionary:
result[int(row.get("market_index", -1))] = row
return result
static func localized_name(content: Dictionary, row_id: String, locale: String) -> String:
if locale == "zh_CN":
return String(content.get("names_zh", {}).get(row_id, ""))
for key in ["region", "contract"]:
var singleton = content.get(key, {})
if singleton is Dictionary and String(singleton.get("id", "")) == row_id:
return String(singleton.get("name", ""))
for family in EXPECTED_IDS:
for row in content.get(family, []):
if row is Dictionary and String(row.get("id", "")) == row_id:
return String(row.get("name", ""))
return ""
static func _enrich(content: Dictionary) -> void:
var names: Dictionary = content.get("names_zh", {})
for key in ["region", "contract"]:
var singleton = content.get(key, {})
if singleton is Dictionary:
_enrich_row(singleton, names)
for family in EXPECTED_IDS:
for row in content.get(family, []):
if row is Dictionary:
_enrich_row(row, names)
static func _enrich_row(row: Dictionary, names: Dictionary) -> void:
var row_id := String(row.get("id", ""))
row["name_en"] = String(row.get("name", ""))
row["name_zh"] = String(names.get(row_id, ""))
row["execution_key"] = "execute.%s" % row_id.to_lower().replace("-", "_")
row["mechanic_signature"] = _signature(row)
static func _validate_source(source, errors: Array[String]) -> void:
if not source is Dictionary:
errors.append("source_type")
return
for key in SOURCE_AUTHORITY:
if String(source.get(key, "")) != String(SOURCE_AUTHORITY[key]):
errors.append("source:%s" % key)
static func _validate_singleton(
row,
expected_id: String,
names: Dictionary,
all_ids: Array[String],
errors: Array[String]
) -> void:
if not row is Dictionary:
errors.append("singleton_type:%s" % expected_id)
return
_validate_common(row, names, all_ids, errors)
if String(row.get("id", "")) != expected_id:
errors.append("singleton_id:%s" % expected_id)
static func _validate_row(
row,
family: String,
names: Dictionary,
all_ids: Array[String],
by_id: Dictionary,
errors: Array[String]
) -> void:
if not row is Dictionary:
errors.append("row_type:%s" % family)
return
_validate_common(row, names, all_ids, errors)
var row_id := String(row.get("id", ""))
if by_id.has(row_id):
errors.append("duplicate_id:%s" % row_id)
by_id[row_id] = row
for field in REQUIRED_FIELDS[family]:
if not row.has(field) or (row[field] is String and String(row[field]).strip_edges().is_empty()):
errors.append("field:%s:%s" % [row_id, field])
static func _validate_common(
row: Dictionary,
names: Dictionary,
all_ids: Array[String],
errors: Array[String]
) -> void:
var row_id := String(row.get("id", ""))
if row_id.is_empty():
errors.append("empty_id")
return
if row_id in all_ids:
errors.append("duplicate_global_id:%s" % row_id)
all_ids.append(row_id)
if String(row.get("name_en", row.get("name", ""))).strip_edges().is_empty():
errors.append("name_en:%s" % row_id)
if String(row.get("name_zh", names.get(row_id, ""))).strip_edges().is_empty():
errors.append("name_zh:%s" % row_id)
if String(row.get("preview", "")).strip_edges().is_empty():
errors.append("preview:%s" % row_id)
var tags = row.get("response_tags", [])
if not tags is Array or tags.size() < 3 or not _unique(tags):
errors.append("response_tags:%s" % row_id)
if String(row.get("execution_key", "")) != "execute.%s" % row_id.to_lower().replace("-", "_"):
errors.append("execution_key:%s" % row_id)
if String(row.get("mechanic_signature", "")) != _signature(row):
errors.append("mechanic_signature:%s" % row_id)
var prose := JSON.stringify(row).to_lower()
for term in FILLER_TERMS:
if prose.contains(term):
errors.append("filler:%s:%s" % [row_id, term])
static func _validate_contract(content: Dictionary, errors: Array[String]) -> void:
var contract: Dictionary = content.get("contract", {})
if String(contract.get("region_id", "")) != "RG-02":
errors.append("contract_region")
if int(contract.get("slice_start_market", 0)) != 2 or int(contract.get("slice_end_market", 0)) != 5:
errors.append("contract_markets")
if bool(contract.get("boss_executable", true)):
errors.append("boss_boundary")
static func _validate_routes(families: Dictionary, errors: Array[String]) -> void:
var routes: Dictionary = families.get("routes", {})
var new_enemy_usage := {"EN-R2-08": 0, "EN-R2-09": 0, "EN-R2-10": 0}
for route_id in routes:
var route: Dictionary = routes[route_id]
var market_index := int(route.get("market_index", -1))
var round_index := int(route.get("round_index", -1))
var risk := int(route.get("risk", -1))
if market_index < 2 or market_index > 4 or round_index != market_index:
errors.append("route_round:%s" % route_id)
if risk < 0 or risk > 2 or route_id != "RO-R2-M%02d-Q%d" % [market_index, risk]:
errors.append("route_identity:%s" % route_id)
var enemy_ids = route.get("enemy_ids", [])
if not enemy_ids is Array or enemy_ids.size() < 2 or enemy_ids.size() > 3 or not _unique(enemy_ids):
errors.append("route_composition:%s" % route_id)
else:
for enemy_id in enemy_ids:
if String(enemy_id) not in ALLOWED_ENEMY_IDS:
errors.append("route_enemy:%s:%s" % [route_id, enemy_id])
if new_enemy_usage.has(String(enemy_id)):
new_enemy_usage[String(enemy_id)] += 1
var waves = route.get("wave_order", [])
if not waves is Array or waves.size() != enemy_ids.size():
errors.append("route_waves:%s" % route_id)
else:
var wave_ids: Array = []
var previous_tick := -1
for wave in waves:
if not wave is Dictionary:
errors.append("route_wave_type:%s" % route_id)
continue
var tick := int(wave.get("tick", -1))
wave_ids.append(String(wave.get("enemy_id", "")))
if tick <= previous_tick:
errors.append("route_wave_order:%s" % route_id)
previous_tick = tick
if wave_ids != enemy_ids:
errors.append("route_wave_enemy:%s" % route_id)
var expected_reward := 18 + 2 * round_index + 2 + 7 * risk
if int(route.get("reward_coin", -1)) != expected_reward:
errors.append("route_reward:%s" % route_id)
var recovery := int(route.get("recovery_coin", -1))
if recovery <= 0 or recovery > expected_reward:
errors.append("route_recovery:%s" % route_id)
for enemy_id in new_enemy_usage:
if int(new_enemy_usage[enemy_id]) < 2:
errors.append("new_enemy_underused:%s" % enemy_id)
static func _validate_markets(
content: Dictionary,
families: Dictionary,
errors: Array[String]
) -> void:
var markets = content.get("markets", [])
if not markets is Array or markets.size() != 3:
errors.append("market_count")
return
var routes: Dictionary = families.get("routes", {})
var equipment: Dictionary = families.get("equipment", {})
var seen_markets := {}
for market in markets:
if not market is Dictionary:
errors.append("market_type")
continue
var market_index := int(market.get("market_index", -1))
if seen_markets.has(market_index):
errors.append("market_duplicate:%d" % market_index)
seen_markets[market_index] = true
var cleared := int(market.get("cleared_rounds_before", -1))
var expected_capacity := mini(10, 4 + cleared / 2)
var expected_level := mini(10, 1 + (market_index - 1) / 3)
if market_index < 2 or market_index > 4 or int(market.get("round_index", -1)) != market_index:
errors.append("market_index:%d" % market_index)
if cleared != market_index - 1 or int(market.get("line_capacity", -1)) != expected_capacity:
errors.append("market_capacity:%d" % market_index)
if int(market.get("offer_level", -1)) != expected_level:
errors.append("market_offer_level:%d" % market_index)
var route_ids = market.get("route_ids", [])
if not route_ids is Array or route_ids.size() != 3:
errors.append("market_routes:%d" % market_index)
else:
for risk in range(3):
var expected_id := "RO-R2-M%02d-Q%d" % [market_index, risk]
if String(route_ids[risk]) != expected_id or not routes.has(expected_id):
errors.append("market_route:%d:%d" % [market_index, risk])
var required_items = market.get("required_equipment_ids", [])
if not required_items is Array or required_items.size() != 2 or not _unique(required_items):
errors.append("market_required_equipment:%d" % market_index)
else:
for item_id in required_items:
if not equipment.has(String(item_id)):
errors.append("market_equipment:%d:%s" % [market_index, item_id])
if String(market.get("first_order_changer_id", "")) not in ALLOWED_ENEMY_IDS:
errors.append("market_order_changer:%d" % market_index)
if seen_markets.keys().size() != 3 or not seen_markets.has(2) or not seen_markets.has(3) or not seen_markets.has(4):
errors.append("market_indices")
static func _validate_catalog_hash(content: Dictionary, errors: Array[String]) -> void:
var candidate := content.duplicate(true)
var stored := String(candidate.get("catalog_hash", ""))
candidate.erase("catalog_hash")
if stored.length() != 64 or stored != _hash(candidate):
errors.append("catalog_hash")
static func _signature(row: Dictionary) -> String:
var projection := row.duplicate(true)
for key in ["name_en", "name_zh", "execution_key", "mechanic_signature"]:
projection.erase(key)
return _hash(projection)
static func _unique(values: Array) -> bool:
var seen := {}
for value in values:
var key := String(value)
if seen.has(key):
return false
seen[key] = true
return true
static func _hash(value) -> String:
var context := HashingContext.new()
context.start(HashingContext.HASH_SHA256)
context.update(JSON.stringify(value).to_utf8_buffer())
return context.finish().hex_encode()
+1
View File
@@ -0,0 +1 @@
uid://d6p2s8m4v7k1q
+210
View File
@@ -0,0 +1,210 @@
class_name P102MidMarketGenerator
extends RefCounted
const ContentRegistry = preload("res://p10_2/content_registry.gd")
const CONTRACT_ID := "CTR-R2-01"
const EQUIPMENT_PRICE := 15
var _catalog: Dictionary
var _validation: Dictionary
func _init(catalog: Dictionary = {}) -> void:
_catalog = ContentRegistry.snapshot() if catalog.is_empty() else catalog.duplicate(true)
_validation = ContentRegistry.validate(_catalog)
func validation() -> Dictionary:
return _validation.duplicate(true)
func generate(run_seed: String, market_index: int, refresh_index: int = 0) -> Dictionary:
if not bool(_validation.get("ok", false)):
return {
"ok": false,
"code": "invalid_catalog",
"errors": _validation.get("errors", []).duplicate(),
}
if not _is_seed(run_seed):
return {"ok": false, "code": "invalid_run_seed"}
if market_index < 2 or market_index > 4:
return {"ok": false, "code": "outside_mid_contract_market"}
if refresh_index < 0:
return {"ok": false, "code": "invalid_refresh_index"}
var market_rows := ContentRegistry.markets_by_index(_catalog)
var market: Dictionary = market_rows.get(market_index, {})
if market.is_empty():
return {"ok": false, "code": "market_authority_missing"}
var tide := _tide_disclosure(run_seed, market)
var board := {
"board_id": _low128(_digest(run_seed, "p10.2.market-board", [market_index, refresh_index])),
"run_seed": run_seed,
"contract_id": CONTRACT_ID,
"region_id": "RG-02",
"market_index": market_index,
"round_index": int(market.round_index),
"cleared_rounds_before": int(market.cleared_rounds_before),
"line_capacity": int(market.line_capacity),
"offer_level": int(market.offer_level),
"refresh_index": refresh_index,
"recruit_slots": _recruit_slots(run_seed, market, refresh_index),
"tide_disclosure": tide,
"equipment_offers": _equipment_offers(run_seed, market, refresh_index),
"battle_offers": _route_offers(run_seed, market, tide),
}
board["board_hash"] = _hash(board)
return {"ok": true, "code": "ok", "board": board}
func _recruit_slots(run_seed: String, market: Dictionary, refresh_index: int) -> Array[Dictionary]:
var slots: Array[Dictionary] = []
for slot in range(3):
var generation_key := _digest(
run_seed,
"p10.2.recruit-slot",
[int(market.market_index), refresh_index, slot]
)
slots.append({
"slot": slot,
"slot_id": _low128(generation_key),
"generation_key": generation_key,
"offer_level": int(market.offer_level),
"binding": "p10.2-step-2-recruit-materialization",
"base_profession_required": slot == 0,
})
return slots
func _equipment_offers(
run_seed: String,
market: Dictionary,
refresh_index: int
) -> Array[Dictionary]:
var equipment := ContentRegistry.rows_by_id(_catalog, "equipment")
var selected: Array[String] = []
for item_id in market.required_equipment_ids:
selected.append(String(item_id))
var remaining: Array[String] = []
for item_id in equipment:
if item_id not in selected:
remaining.append(String(item_id))
remaining.sort()
var offset := (
_index(run_seed, "p10.2.equipment-offset.%d" % int(market.market_index), remaining.size())
+ refresh_index
) % remaining.size()
selected.append(remaining[offset])
selected.append(remaining[(offset + 1) % remaining.size()])
var offers: Array[Dictionary] = []
for slot in range(selected.size()):
var catalog_id := selected[slot]
var row: Dictionary = equipment[catalog_id]
var offer := {
"offer_id": _low128(_digest(
run_seed,
"p10.2.equipment-offer",
[int(market.market_index), refresh_index, slot, catalog_id]
)),
"slot": slot,
"catalog_id": catalog_id,
"name_en": row.name_en,
"name_zh": row.name_zh,
"fit": row.fit,
"effect": row.effect,
"tradeoff": row.tradeoff,
"preview": row.preview,
"response_tags": Array(row.response_tags).duplicate(),
"region_band": 1,
"item_tier": 0,
"list_price": EQUIPMENT_PRICE,
}
offer["offer_hash"] = _hash(offer)
offers.append(offer)
return offers
func _route_offers(
run_seed: String,
market: Dictionary,
tide: Dictionary
) -> Array[Dictionary]:
var rows := ContentRegistry.rows_by_id(_catalog, "routes")
var offers: Array[Dictionary] = []
for route_id in market.route_ids:
var row: Dictionary = rows[String(route_id)]
var offer := {
"offer_id": _low128(_digest(run_seed, "p10.2.route-offer", [route_id])),
"route_id": String(route_id),
"market_index": int(row.market_index),
"round_index": int(row.round_index),
"risk": int(row.risk),
"name_en": row.name_en,
"name_zh": row.name_zh,
"enemy_ids": Array(row.enemy_ids).duplicate(),
"wave_order": Array(row.wave_order).duplicate(true),
"pressure": row.pressure,
"failure_cause": row.failure_cause,
"preview": row.preview,
"response_tags": Array(row.response_tags).duplicate(),
"reward_coin": int(row.reward_coin),
"recovery_coin": int(row.recovery_coin),
"tide_disclosure": tide.duplicate(true),
}
offer["offer_hash"] = _hash(offer)
offers.append(offer)
return offers
func _tide_disclosure(run_seed: String, market: Dictionary) -> Dictionary:
var position_count := int(market.line_capacity)
var label := "p10.2.tide.%d" % int(market.market_index)
var current_safe_index := 1 + _index(run_seed, "%s.current" % label, position_count)
var direction := -1 if _index(run_seed, "%s.direction" % label, 2) == 0 else 1
var next_safe_index := current_safe_index + direction
if next_safe_index < 1:
next_safe_index = position_count
elif next_safe_index > position_count:
next_safe_index = 1
return {
"position_count": position_count,
"current_safe_index": current_safe_index,
"next_safe_index": next_safe_index,
"shift_tick": 50,
"warning_ticks": 20,
"fixed_tick_ms": 100,
"unsafe_status": "wet",
"unsafe_threshold": 3,
"threshold_result": "pull_toward_safe_index",
"first_order_changer_id": String(market.first_order_changer_id),
}
func _index(seed: String, label: String, size: int) -> int:
return int(("0x" + _digest(seed, label).substr(0, 8)).hex_to_int() % size)
func _digest(seed: String, label: String, parts: Array = []) -> String:
return _hash({"seed": seed, "label": label, "parts": parts})
func _is_seed(value: String) -> bool:
if value.length() != 32:
return false
for character in value:
if character not in "0123456789abcdef":
return false
return true
func _low128(value: String) -> String:
return value.substr(0, 32)
func _hash(value) -> String:
var context := HashingContext.new()
context.start(HashingContext.HASH_SHA256)
context.update(JSON.stringify(value).to_utf8_buffer())
return context.finish().hex_encode()
@@ -0,0 +1 @@
uid://c4w9n2h6r8t5y
@@ -0,0 +1,136 @@
extends SceneTree
const Content = preload("res://p10_2/content_registry.gd")
var failures: Array[String] = []
var rejected_cases := 0
func _initialize() -> void:
call_deferred("run_test")
func run_test() -> void:
var first := Content.snapshot()
var second := Content.snapshot()
var validation := Content.validate(first)
expect(validation.ok, "canonical P10.2 registry validates: %s" % str(validation.errors))
expect(first == second, "catalog loading and enrichment are byte-identical")
expect(String(first.catalog_hash).length() == 64, "catalog has a canonical SHA-256")
verify_counts_and_identity(first)
verify_route_and_market_authority(first)
verify_negative_boundaries(first)
if failures.is_empty():
print("ABG_P10_2_CONTENT_REGISTRY_OK region=1 contract=1 equipment=8 enemies=3 routes=9 markets=3 localized=22 source=exact formulas=coin,capacity,offer_level negative_cases=%d" % rejected_cases)
quit(0)
else:
for failure in failures:
push_error(failure)
quit(1)
func verify_counts_and_identity(content: Dictionary) -> void:
expect(content.region.id == "RG-02", "Region identity is exact")
expect(content.contract.id == "CTR-R2-01" and content.contract.region_id == "RG-02", "Contract and Region reference are exact")
expect(content.contract.slice_start_market == 2 and content.contract.slice_end_market == 5, "mid-Contract boundary is exact")
expect(not content.contract.boss_executable, "Boss execution remains frozen")
expect(content.equipment.size() == 8, "EQ-049..EQ-056 are exposed")
expect(content.enemies.size() == 3, "EN-R2-08..EN-R2-10 are exposed")
expect(content.routes.size() == 9 and content.markets.size() == 3, "nine routes and three Markets are exposed")
expect(content.names_zh.size() == 22, "every bounded content identity has zh_CN authority")
expect(content.source == Content.SOURCE_AUTHORITY, "four source blobs are bound exactly")
var ids := {}
for singleton in [content.region, content.contract]:
verify_row(singleton, ids)
for family in [content.equipment, content.enemies, content.routes]:
for row in family:
verify_row(row, ids)
expect(ids.size() == 22, "all runtime identities are unique")
func verify_route_and_market_authority(content: Dictionary) -> void:
var routes := Content.rows_by_id(content, "routes")
var markets := Content.markets_by_index(content)
expect(markets.keys().size() == 3, "Market index lookup is complete")
var seen_new_enemies := {"EN-R2-08": 0, "EN-R2-09": 0, "EN-R2-10": 0}
for market_index in [2, 3, 4]:
var market: Dictionary = markets[market_index]
expect(market.round_index == market_index, "Market %d binds the same Round" % market_index)
expect(market.cleared_rounds_before == market_index - 1, "Market %d clear lineage is exact" % market_index)
expect(market.line_capacity == [4, 5, 5][market_index - 2], "Market %d capacity follows authority" % market_index)
expect(market.offer_level == [1, 1, 2][market_index - 2], "Market %d offer level follows authority" % market_index)
expect(market.route_ids.size() == 3 and market.required_equipment_ids.size() == 2, "Market %d owns exact board rows" % market_index)
for risk in range(3):
var route: Dictionary = routes[market.route_ids[risk]]
expect(route.market_index == market_index and route.round_index == market_index and route.risk == risk, "Market %d risk %d identity is exact" % [market_index, risk])
expect(route.reward_coin == 18 + 2 * market_index + 2 + 7 * risk, "Market %d risk %d reward formula is exact" % [market_index, risk])
expect(route.wave_order.map(func(wave): return wave.enemy_id) == route.enemy_ids, "Market %d risk %d wave order binds composition" % [market_index, risk])
for enemy_id in route.enemy_ids:
if seen_new_enemies.has(enemy_id):
seen_new_enemies[enemy_id] += 1
for enemy_id in seen_new_enemies:
expect(seen_new_enemies[enemy_id] >= 2, "%s appears in at least two route decisions" % enemy_id)
func verify_row(row: Dictionary, ids: Dictionary) -> void:
expect(not ids.has(row.id), "%s is globally unique" % row.id)
ids[row.id] = true
expect(not String(row.name_en).is_empty() and not String(row.name_zh).is_empty(), "%s has both names" % row.id)
expect(not String(row.preview).is_empty() and row.response_tags.size() >= 3, "%s has preview and response tags" % row.id)
expect(String(row.execution_key).begins_with("execute.") and String(row.mechanic_signature).length() == 64, "%s has runtime dispatch and signature" % row.id)
func verify_negative_boundaries(canonical: Dictionary) -> void:
var source_drift := canonical.duplicate(true)
source_drift.source.economy_blob = "0".repeat(40)
expect_rejected(source_drift, "source drift", "source:economy_blob")
var locale_missing := canonical.duplicate(true)
locale_missing.names_zh.erase("EN-R2-10")
expect_rejected(locale_missing, "missing locale", "names_zh_ids")
var duplicate_item := canonical.duplicate(true)
duplicate_item.equipment[1].id = "EQ-049"
expect_rejected(duplicate_item, "duplicate item", "duplicate_global_id:EQ-049")
var unknown_enemy := canonical.duplicate(true)
unknown_enemy.routes[0].enemy_ids[0] = "EN-R2-99"
unknown_enemy.routes[0].wave_order[0].enemy_id = "EN-R2-99"
expect_rejected(unknown_enemy, "unknown route enemy", "route_enemy:RO-R2-M02-Q0")
var reward_drift := canonical.duplicate(true)
reward_drift.routes[4].reward_coin += 1
expect_rejected(reward_drift, "reward drift", "route_reward:RO-R2-M03-Q1")
var executable_boss := canonical.duplicate(true)
executable_boss.contract.boss_executable = true
expect_rejected(executable_boss, "Boss execution leak", "boss_boundary")
var route_mismatch := canonical.duplicate(true)
route_mismatch.markets[1].route_ids[0] = "RO-R2-M02-Q0"
expect_rejected(route_mismatch, "wrong Market route", "market_route:3:0")
var item_mismatch := canonical.duplicate(true)
item_mismatch.markets[2].required_equipment_ids[0] = "EQ-999"
expect_rejected(item_mismatch, "unknown required item", "market_equipment:4:EQ-999")
var filler := canonical.duplicate(true)
filler.enemies[0].rule = "TODO placeholder"
expect_rejected(filler, "filler mechanic", "filler:EN-R2-08:todo")
func expect_rejected(content: Dictionary, label: String, expected_error: String) -> void:
var result := Content.validate(content)
var found := false
for error in result.errors:
if String(error).begins_with(expected_error):
found = true
expect(not result.ok and found, "%s rejects with %s; got %s" % [label, expected_error, str(result.errors)])
if not result.ok and found:
rejected_cases += 1
func expect(condition: bool, message: String) -> void:
if not condition:
failures.append("P10.2 content registry: %s" % message)
@@ -0,0 +1 @@
uid://b7m3q9x1v5k8p
@@ -0,0 +1,120 @@
extends SceneTree
const Content = preload("res://p10_2/content_registry.gd")
const Generator = preload("res://p10_2/mid_market_generator.gd")
const SEED_A := "0123456789abcdef0123456789abcdef"
const SEED_B := "fedcba9876543210fedcba9876543210"
var failures: Array[String] = []
var rejected_cases := 0
func _initialize() -> void:
call_deferred("run_test")
func run_test() -> void:
var generator = Generator.new()
expect(generator.validation().ok, "generator accepts canonical catalog")
verify_three_markets(generator)
verify_refresh_and_seed_boundaries(generator)
verify_negative_boundaries(generator)
if failures.is_empty():
print("ABG_P10_2_MID_MARKETS_OK markets=2,3,4 boards=3 shape=3,4,3 routes=9 risks=0,1,2 capacities=4,5,5 offer_levels=1,1,2 equipment_price=15 rewards=24..42 refresh=recruit,equipment_only route_reroll=false tide_reroll=false same_input=byte_identical negative_cases=%d" % rejected_cases)
quit(0)
else:
for failure in failures:
push_error(failure)
quit(1)
func verify_three_markets(generator) -> void:
var expected_rewards := {
2: [24, 31, 38],
3: [26, 33, 40],
4: [28, 35, 42],
}
var expected_capacities := {2: 4, 3: 5, 4: 5}
var expected_levels := {2: 1, 3: 1, 4: 2}
var required_items := {
2: ["EQ-049", "EQ-055"],
3: ["EQ-050", "EQ-051"],
4: ["EQ-052", "EQ-056"],
}
for market_index in [2, 3, 4]:
var first: Dictionary = generator.generate(SEED_A, market_index)
var second: Dictionary = Generator.new().generate(SEED_A, market_index)
expect(first.ok and first == second, "Market %d is byte-identical for the same seed" % market_index)
var board: Dictionary = first.board
expect(board.region_id == "RG-02" and board.contract_id == "CTR-R2-01", "Market %d identity is exact" % market_index)
expect(board.market_index == market_index and board.round_index == market_index, "Market %d binds Round %d" % [market_index, market_index])
expect(board.cleared_rounds_before == market_index - 1, "Market %d stores clear lineage" % market_index)
expect(board.line_capacity == expected_capacities[market_index] and board.offer_level == expected_levels[market_index], "Market %d capacity and level are exact" % market_index)
expect(board.recruit_slots.size() == 3 and board.equipment_offers.size() == 4 and board.battle_offers.size() == 3, "Market %d has exact 3/4/3 shape" % market_index)
expect(String(board.board_id).length() == 32 and String(board.board_hash).length() == 64, "Market %d has stable IDs" % market_index)
var slot_ids: Array = board.recruit_slots.map(func(slot): return slot.slot_id)
expect(unique_count(slot_ids) == 3, "Market %d Recruit slots are unique" % market_index)
expect(board.recruit_slots.all(func(slot): return slot.offer_level == expected_levels[market_index] and String(slot.generation_key).length() == 64), "Market %d Recruit slots bind level and generation" % market_index)
expect(board.recruit_slots.filter(func(slot): return slot.base_profession_required).size() == 1, "Market %d reserves one base-Profession slot" % market_index)
var item_ids: Array = board.equipment_offers.map(func(offer): return offer.catalog_id)
expect(unique_count(item_ids) == 4, "Market %d equipment offers are unique" % market_index)
for item_id in required_items[market_index]:
expect(item_id in item_ids, "Market %d includes required %s" % [market_index, item_id])
expect(board.equipment_offers.all(func(offer): return offer.list_price == 15 and offer.region_band == 1 and offer.item_tier == 0), "Market %d item formula is exact" % market_index)
expect(board.equipment_offers.all(func(offer): return not String(offer.name_en).is_empty() and not String(offer.name_zh).is_empty() and offer.response_tags.size() >= 3), "Market %d items expose consequences" % market_index)
expect(board.battle_offers.map(func(offer): return offer.risk) == [0, 1, 2], "Market %d route risks are ordered" % market_index)
expect(board.battle_offers.map(func(offer): return offer.reward_coin) == expected_rewards[market_index], "Market %d route rewards are exact" % market_index)
expect(board.battle_offers.all(func(offer): return offer.market_index == market_index and offer.round_index == market_index), "Market %d routes bind the current Round" % market_index)
expect(board.battle_offers.all(func(offer): return offer.tide_disclosure == board.tide_disclosure and not String(offer.failure_cause).is_empty()), "Market %d routes repeat tide and failure authority" % market_index)
var tide: Dictionary = board.tide_disclosure
expect(tide.position_count == expected_capacities[market_index], "Market %d tide matches Line capacity" % market_index)
expect(tide.current_safe_index >= 1 and tide.current_safe_index <= tide.position_count, "Market %d current safe index is bounded" % market_index)
expect(tide.next_safe_index >= 1 and tide.next_safe_index <= tide.position_count and tide.next_safe_index != tide.current_safe_index, "Market %d next safe index is distinct" % market_index)
expect(tide.shift_tick == 50 and tide.warning_ticks == 20 and tide.fixed_tick_ms == 100, "Market %d tide clock is exact" % market_index)
func verify_refresh_and_seed_boundaries(generator) -> void:
for market_index in [2, 3, 4]:
var original: Dictionary = generator.generate(SEED_A, market_index, 0).board
var refreshed: Dictionary = generator.generate(SEED_A, market_index, 1).board
expect(original.recruit_slots != refreshed.recruit_slots, "Market %d refresh changes Recruit generation slots" % market_index)
expect(original.equipment_offers != refreshed.equipment_offers, "Market %d refresh changes equipment offers" % market_index)
expect(original.battle_offers == refreshed.battle_offers, "Market %d refresh never rerolls routes" % market_index)
expect(original.tide_disclosure == refreshed.tide_disclosure, "Market %d refresh never rerolls tide" % market_index)
var other_seed: Dictionary = generator.generate(SEED_B, market_index).board
expect(original != other_seed and original.board_hash != other_seed.board_hash, "Market %d Run seed changes owned identities" % market_index)
func verify_negative_boundaries(generator) -> void:
expect_rejected(generator.generate("bad-seed", 2), "malformed seed", "invalid_run_seed")
expect_rejected(generator.generate(SEED_A, 1), "before bounded Markets", "outside_mid_contract_market")
expect_rejected(generator.generate(SEED_A, 5), "after bounded Markets", "outside_mid_contract_market")
expect_rejected(generator.generate(SEED_A, 2, -1), "negative refresh", "invalid_refresh_index")
var malformed := Content.snapshot()
malformed.routes[0].reward_coin += 1
var rejected_generator = Generator.new(malformed)
expect_rejected(rejected_generator.generate(SEED_A, 2), "malformed catalog", "invalid_catalog")
func expect_rejected(result: Dictionary, label: String, expected_code: String) -> void:
var accepted := not bool(result.get("ok", false)) and String(result.get("code", "")) == expected_code
expect(accepted, "%s rejects with %s; got %s" % [label, expected_code, str(result)])
if accepted:
rejected_cases += 1
func unique_count(values: Array) -> int:
var unique := {}
for value in values:
unique[value] = true
return unique.size()
func expect(condition: bool, message: String) -> void:
if not condition:
failures.append("P10.2 mid Markets: %s" % message)
@@ -0,0 +1 @@
uid://d9h4s2n7w6r1m