BattleSimulator icon indicating copy to clipboard operation
BattleSimulator copied to clipboard

Error in simulate_k with more than two teams

Open kmcnayr opened this issue 2 years ago • 1 comments

I am trying to run a k simulations with more than two teams and am receiving this error:

ValueError: Shape of passed values is (30, 2), indices imply (30, 3)

I tracked it down to this line in _battle.simulate_k

runs = np.zeros((k, 2), dtype=np.int64)

it is assuming the results have only two teams. I think a quick fix is to change to the below which is the number of teams:

runs = np.zeros((k, np.unique(self._teams).shape[0]), dtype=np.int64)

the team_counts results returned by simulate_battle contain a records for each unique team in M.

This appears to work for up to 30+ teams/allegiances

kmcnayr avatar Oct 29 '23 19:10 kmcnayr

Thank you for this issue.

Changes have been made as you suggested:

runs = np.zeros((k, np.unique(self._teams).shape[0]), dtype=np.int64)

Please pull the latest, and re-build your version using the Anaconda instructions, or via pip3 install . within a suitable environment.

gregparkes avatar Aug 18 '24 21:08 gregparkes