Skip to content

Commit

Permalink
Fixed integer division on percent islands bug
Browse files Browse the repository at this point in the history
  • Loading branch information
pv711 committed Jan 6, 2023
1 parent 9fea4db commit 2442a87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion engine/src/main/battlecode/world/TeamInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 2442a87

Please sign in to comment.