-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathPlayer.py
62 lines (46 loc) · 1.81 KB
/
Player.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# This file is intended to be a final submission. python tester.py Player.py
# should work at all times. If it does not, there is a bug.
# If you're just trying to test a solution, scroll down to the Player
# class.
# This file is intended to be in the same format as a valid solution, so
# that users can edit their solution into Player and then submit just this
# file to the contest. If you see any reason this would not work, please submit
# an Issue to https://github.com/ChadAMiller/hungergames/issues or email me.
# You can see more sample player classes in bots.py
class BasePlayer(object):
'''
Base class so I don't have to repeat bookkeeping stuff.
Do not edit unless you're working on the simulation.
'''
def __str__(self):
try:
return self.name
except AttributeError:
# Fall back on Python default
return super(BasePlayer, self).__repr__()
def hunt_choices(*args, **kwargs):
raise NotImplementedError("You must define a strategy!")
def hunt_outcomes(*args, **kwargs):
pass
def round_end(*args, **kwargs):
pass
class Player(BasePlayer):
'''
Your strategy starts here.
'''
def hunt_choices(
self,
round_number,
current_food,
current_reputation,
m,
player_reputations,
):
'''Required function defined in the rules'''
return ['s']*len(player_reputations)
def hunt_outcomes(self, food_earnings):
'''Required function defined in the rules'''
pass
def round_end(self, award, m, number_hunters):
'''Required function defined in the rules'''
pass