Regarding MaxRepHunter, I don't really see much merit to it. Please correct
me if I'm wrong  though. The reputation is a continuous real variable H /
(H+S), so this hunter will typically only hunt with exactly one player of
the highest reputation, due to the notion of equality given by rep ==
max_reputation. Besides pathologically odd cases where several players have
the same rep, this hunter quickly converges to Freeloader bot as the # of
players P approaches infinity.



On Tue, Jul 23, 2013 at 12:31 PM, Sam Solomon <notifications@github.com>wrote:

> In bots.py:
>
> > @@ -52,4 +52,19 @@ def hunt_choices(
> >                      ):
> >          self.update_strat()
> >          return [self.moves[0]]*len(player_reputations)
> > +
> > +class MaxRepHunter(BasePlayer):
> > +    '''Player that hunts only with people with max reputation.'''
> > +    def __init__(self):
> > +        self.name = "MaxRepHunter"
> > +
> > +    def hunt_choices(
> > +                    self,
> > +                    round_number,
> > +                    current_food,
> > +                    current_reputation,
> > +                    m,
> > +                    player_reputations,
> > +                    ):
> > +        return ['h' if rep == max(player_reputations) else 's' for rep in player_reputations]
>
> Free performance tip of the day: If player_reputations is a long list,
> calculating max(player_reputations) in a loop of all player_reputationswill be costly (I believe O(N^2)). You can speed up this code easily by
> storing max(player_reputations) in a variable before the list
> comprehension:
>
> max_reputation = max(player_reputations)return ['h' if rep == max_reputation else 's' for rep in player_reputations]
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/ChadAMiller/hungergames/pull/21/files#r5349482>
> .
>