Skip to content

Commit 142f897

Browse files
meganrmCopilot
andauthored
Update src/simulation/BindingSimulator2D.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 3e0de31 commit 142f897

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/simulation/BindingSimulator2D.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ export default class BindingSimulator implements IClientSimulatorImpl {
119119
];
120120
}
121121

122+
/**
123+
* Generates a unique type ID for a bound complex using a "magic formula":
124+
* 100 + id * 10 + partnerId
125+
* This formula assumes that both `id` and `partnerId` are single-digit integers (0-9).
126+
* This ensures that for any pair (id, partnerId), the result is unique as long as
127+
* id and partnerId are not greater than 9. If either value exceeds 9, collisions may occur.
128+
* The offset of 100 is used to avoid overlapping with other type IDs.
129+
* If agent IDs may exceed 9, this formula should be updated to avoid collisions.
130+
*/
122131
private getBoundTypeId(id: number, partnerId: number) {
123132
return 100 + id * 10 + partnerId;
124133
}

0 commit comments

Comments
 (0)