-
Notifications
You must be signed in to change notification settings - Fork 0
/
KellyAIs.py
89 lines (67 loc) · 2.08 KB
/
KellyAIs.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
from player import player
from random import sample
class dullMuteDeaf(player):
# dullMuteDeaf is an AI that can't:
# think intelligently
# speak to other players
# hear what other players say
def __init__(self,name):
self.name = name
def setRole(self,role):
self.role = role
def getRole(self):
return self.role
def getName(self):
return self.name
def setState(self):
return
def proposeTeam(self,plan,players):
nMembers = plan[0]
#return players[1:nMembers]
return sample(players,nMembers)
def vote(self,team):
#print self.name + ": Aye!"
return True
def throwCard(self):
if self.role=="spy":
#print "failed the mission!"
return False
if self.role=="resistance":
#print "a good resistance member"
return True
else:
#print "got confused, threw success"
return True
class dullMuteDeaf(player):
# dullMuteDeaf is an AI that can't:
# speak to other players
# hear what other players say
# possibleBot CAN however, identify if a proposed team is possible
# based on previous game state
def __init__(self,name):
self.name = name
def setRole(self,role):
self.role = role
def getRole(self):
return self.role
def getName(self):
return self.name
def setState(self,gameState):
self.gameState = gameState
def proposeTeam(self,plan,players):
nMembers = plan[0]
#return players[1:nMembers]
return sample(players,nMembers)
def vote(self,team):
#print self.name + ": Aye!"
return True
def throwCard(self):
if self.role=="spy":
#print "failed the mission!"
return False
if self.role=="resistance":
#print "a good resistance member"
return True
else:
#print "got confused, threw success"
return True