From 2442a87b4a7cac38b16425971062190a27ef605e Mon Sep 17 00:00:00 2001 From: Pranali Date: Fri, 6 Jan 2023 13:02:36 -0500 Subject: [PATCH] Fixed integer division on percent islands bug --- engine/src/main/battlecode/world/TeamInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/src/main/battlecode/world/TeamInfo.java b/engine/src/main/battlecode/world/TeamInfo.java index 4083fff8..b93223ad 100644 --- a/engine/src/main/battlecode/world/TeamInfo.java +++ b/engine/src/main/battlecode/world/TeamInfo.java @@ -187,7 +187,7 @@ private void checkWin (Team team){ public void placeAnchor(Team team) { this.totalAnchorsPlaced[team.ordinal()]++; this.currentAnchorsPlaced[team.ordinal()]++; - if (this.currentAnchorsPlaced[team.ordinal()]/gameWorld.getAllIslands().length >= GameConstants.WIN_PERCENTAGE_OF_ISLANDS_OCCUPIED) { + if (((float)this.currentAnchorsPlaced[team.ordinal()])/gameWorld.getAllIslands().length >= GameConstants.WIN_PERCENTAGE_OF_ISLANDS_OCCUPIED) { checkWin(team); // Do an extra check to make sure the win is correct } }