bcollazo / catanatron

Settlers of Catan Bot Simulator and Strong AI Player
https://catanatron.com
GNU General Public License v3.0
278 stars 64 forks source link

Implement returning all players points vs winner player colour #269

Open lpoblet opened 6 months ago

lpoblet commented 6 months ago

I'm interested in generating player statistics randomly. It'd be much better for me to know the points of all players instead of the winner

bcollazo commented 6 months ago

Hello lpoblet,

There is a state function called get_actual_victory_points (https://github.com/bcollazo/catanatron/blob/2a4f078ba17bd4d7916fea7dfa625e4ccb97e586/catanatron_core/catanatron/state_functions.py#L80) that you can call at the end of the game with the particular color you are interested in. You can also iterate over the colors in the game with game.state.colors.

This is similar to how the StatisticsAccumulator (catanatron_experimental/cli/accumulators.py) keeps track of several statistics and shows them at the end of a run when using the CLI. You could also register your own custom accumulator (https://github.com/bcollazo/catanatron/tree/master?tab=readme-ov-file#accumulators) depending on the need.