Skip to content

Commit

Permalink
修正忽略强制组合的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Funny-ppt committed Nov 7, 2023
1 parent 7a1b85e commit 9670ec7
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void RecursivelyProc(OpEnumData[] comb, int init_size, Simulator simu, Efficienc
}
void Proc(OpEnumData[] comb, int init_size, Simulator simu, Efficiency base_eff) {
var gid = GetGroupId(comb);
if (!results.TryAdd(gid, default)) {
if (comb.Length != init_size && !results.TryAdd(gid, default)) {
return;
}
Efficiency eff;
Expand Down
158 changes: 158 additions & 0 deletions InfrastSimTest/SimulatorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,164 @@ public void TestEnumerate() {
]
}
""";

var input2 = """
{
"preset": {
"Control Center": {
"level": 5
},
"B103": {
"type": "Power",
"level": 3
},
"B203": {
"type": "Power",
"level": 3
},
"B101": {
"type": "Trading",
"level": 1
},
"B102": {
"type": "Trading",
"level": 1
},
"B201": {
"type": "Manufacturing",
"level": 3
},
"B202": {
"type": "Manufacturing",
"level": 3
},
"B301": {
"type": "Manufacturing",
"level": 3
},
"B302": {
"type": "Manufacturing",
"level": 3
},
"B303": {
"type": "Manufacturing",
"level": 3
},
"Dormitory 1": {
"level": 1
},
"Dormitory 2": {
"level": 1
},
"Dormitory 3": {
"level": 1
},
"Reception": {
"level": 3
},
"Crafting": {
"level": 3
},
"Office": {
"level": 3
},
"Training": {
"level": 3
}
},
"ops": [
{
"name": "森蚺",
"positions": [
"制造站",
"控制中枢"
],
"groups": [
"依赖设施数量",
"虚拟发电站"
],
"relevant": [
"依赖设施数量",
"Lancet-2"
],
"relevant_ops": [
"Lancet-2"
]
},
{
"name": "清流",
"positions": [
"制造站"
],
"groups": [
"依赖设施数量"
],
"relevant": [
"依赖设施数量"
]
},
{
"name": "温蒂",
"positions": [
"制造站"
],
"groups": [
"依赖设施数量"
],
"relevant": [
"依赖设施数量"
]
},
{
"name": "承曦格雷伊",
"positions": [
"发电站"
],
"groups": [
"作业平台",
"异格",
"虚拟发电站"
],
"relevant": [
"作业平台",
"异格"
]
},
{
"name": "Castle-3",
"positions": [
"制造站",
"发电站"
],
"prefer_product": [
[
"初级作战记录",
0.3
]
],
"groups": [
"作业平台"
],
"relevant": [
"作业平台"
]
},
{
"name": "Lancet-2",
"positions": [
"发电站",
"宿舍"
],
"groups": [
"作业平台"
],
"relevant": [
"作业平台"
]
}
]
}
""";
using var ms = new MemoryStream();
using var writer = new Utf8JsonWriter(ms);
EnumerateHelper.Enumerate(JsonDocument.Parse(input), writer);
Expand Down

0 comments on commit 9670ec7

Please sign in to comment.