-
Notifications
You must be signed in to change notification settings - Fork 0
/
agent.py
47 lines (41 loc) · 1.25 KB
/
agent.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
class Agent:
"""
An agent is a player in the game of Blackjack
such as a human player, a dealer (who follows
a set of hard-coded rules), or an AI-based player.
"""
def getNextAction(self, gameState, hand):
"""
Get the next action for the given gameState
and hand. The provided gameState contains all
of the hands of players participating in the
round. The returned action must be one of those
defined in the Actions class (see actions.py)
and must be valid for the agent's hand.
"""
return NotImplemented
def lose(self, gameState, hand):
"""
Notify this agent of a loss for the purpose
of record-keeping.
"""
def win(self, gameState, hand):
"""
Notify this agent of a win for the purpose
of record-keeping.
"""
def tie(self, gameState, hand):
"""
Notify this agent of a tie for the purpose
of record-keeping.
"""
def needsTraining(self):
"""
Whether or not the agent should participate in
training rounds.
"""
return False
def trainingOver(self):
"""
Notify the agent that training is over.
"""