It's possible for both the territory and the territory integral of two players to be the same. (Especially when someone is testing versions of their bots locally -- they may behave identically.)
Such ties should be broken randomly (instead of based on player index).
I believe the relevant piece of code is at:
https://github.com/HaliteChallenge/Halite/blob/master/environment/core/Halite.cpp#L347
Which I think could be replaced with something like this, except I'm not a C++ person. Presumably we also need to import some PRNG function and seed it at some point...
// Sort newRankings by last territory count. If it's the same, use the territory integral instead to break that tie.
// But if that's the same, flip a coin.
std::stable_sort(newRankings.begin(), newRankings.end(), [&](const unsigned int & u1, const unsigned int & u2) -> bool {
if (last_territory_count[u1] != last_territory_count[u2]) {
return last_territory_count[u1] < last_territory_count[u2];
}
if (full_territory_count[u1] != full_territory_count[u2]) {
return full_territory_count[u1] < full_territory_count[u2];
}
return RESULT_OF_SOME_COIN_FLIP; // Don't know the C++ way to do this.
});
It's possible for both the territory and the territory integral of two players to be the same. (Especially when someone is testing versions of their bots locally -- they may behave identically.)
Such ties should be broken randomly (instead of based on player index).
I believe the relevant piece of code is at:
https://github.com/HaliteChallenge/Halite/blob/master/environment/core/Halite.cpp#L347
Which I think could be replaced with something like this, except I'm not a C++ person. Presumably we also need to import some PRNG function and seed it at some point...