A regular player on AntGame reached out recently with a really good question, so I figured I’d make a post about it.

The question was: In the screenshot below, how can the home achieve a larger score than the sum of all food in it’s section?

A screenshot from AntGame showing a home receiving 22583 points

Adding up all the food in that section gives a score of 22582, so how did the home get 22583?

This is actually something I knew was possible when I was building the game, but I don’t know that I’ve ever seen it happen. It all comes down to how score in AntGame is calculated, and some unfavorable rounding.

Let’s dig in to exactly how it works.

The score of a run is calculated by taking the percentage of food returned, multiplying it by 100,000, then rounding to the nearest integer. This method is used both to calculate labels for groups of food, and homes. The inaccuracy introduced by rounding can cause inconsistencies like what’s shown above.

The map for September 27, 2023 has a total of 1727 blocks of food. This means each block of food is 0.057904% of the total, or worth 57.904 points.

To find the number of food blocks in a group we can count (I did this for the 1621 group to check my math, 2 rows of 10 and 1 row of 8) or calculate (groupLabel/scorePerFood, rounded).

Here is a table of all the groups, how many food blocks are in them, and how much score they’re actually worth.

Label Food blocks Score
10075 174 10075.2
1853 32 1852.9
4169 72 4169.0
1621 28 1621.3
2779 48 2779.3
2085 36 2084.5

Adding up the left and right column shows us what the issue is. The sum of the left column is the expected max score, 22582. The sum of the right column is the actual score for all food in that area, 22582.5. This will get rounded and ends up being 22583, one more than expected.

A small tangent

Using score per block of food only works here because we’re sure all of the food is being consumed. In reality, blocks are actually many ‘pieces’ of food. Each block has 20 pieces of food. This is why on the leaderboard for Sept. 27, the scores aren’t spaced out by 58 points, but by 3 (57.904 divided by 20, rounded).

However, there could also be scores spaced out by two, again because of rounding inaccuracy. The world record for that day (46671) is 16,120 pieces of food. The score for 16,617 pieces would be 46661 and for 16,616 pieces it would be 46659, a gap of 2