update win condtion: 80% non fallout tiles

This commit is contained in:
Evan
2025-01-24 08:41:19 -08:00
parent d009ef925c
commit 7a2f4210ed
11 changed files with 275 additions and 216 deletions
+6 -1
View File
@@ -27,8 +27,13 @@ export class WinCheckExecution implements Execution {
return
}
const max = sorted[0]
if (max.numTilesOwned() / this.mg.map().numLandTiles() * 100 > this.mg.config().percentageTilesOwnedToWin()) {
const numTilesWithoutFallout = this.mg.numLandTiles() - this.mg.numTilesWithFallout()
if (this.mg.ticks() % 10 == 0) {
console.log(`player: ${max.name()} owns ${max.numTilesOwned()} tiles, ${numTilesWithoutFallout}`)
}
if (max.numTilesOwned() / numTilesWithoutFallout * 100 > this.mg.config().percentageTilesOwnedToWin()) {
this.mg.setWinner(max)
console.log(`${max.name()} has won the game`)
this.active = false
}
}