Revert "Change BorderTiles from Array to Set (#230)" (#238)

This reverts commit 8124651382 which
breaks compilation, has wrong indentation and uses flatMap without
Array.from which is also wrong.
This commit is contained in:
Ilan Schemoul
2025-03-13 22:51:35 +01:00
committed by GitHub
parent cb3f36a74f
commit 7ec3f0c81f
+5 -5
View File
@@ -73,12 +73,12 @@ export class BotExecution implements Execution {
this.neighborsTerraNullius = false;
}
const border = new Set(
this.bot.borderTiles().flatMap((t) => this.mg.neighbors(t)));
const enemies = Array.from(border).filter(
(t) => this.mg.hasOwner(t) && this.mg.owner(t) !== this.bot);
const border = Array.from(this.bot.borderTiles())
.flatMap((t) => this.mg.neighbors(t))
.filter((t) => this.mg.hasOwner(t) && this.mg.owner(t) != this.bot);
if (enemies.length === 0) return;
if (border.length == 0) {
return;
}
const toAttack = border[this.random.nextInt(0, border.length)];