We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 142f897 commit ec81d10Copy full SHA for ec81d10
1 file changed
src/simulation/BindingSimulator2D.ts
@@ -107,9 +107,14 @@ export default class BindingSimulator implements IClientSimulatorImpl {
107
private getProductColor(id: number, partnerId: number) {
108
// one and only one of the agents should have a product color
109
// so the order here is not important
110
- return (
111
- this.productColor.get(partnerId) || this.productColor.get(id) || ""
112
- );
+ const color1 = this.productColor.get(id);
+ const color2 = this.productColor.get(partnerId);
+ if (color1 && color2) {
113
+ throw new Error(
114
+ `Both agents (${id} and ${partnerId}) have a product color defined. Only one should have a product color.`
115
+ );
116
+ }
117
+ return color2 || color1 || "";
118
}
119
120
private getRandomPoint() {
0 commit comments