-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgameTest.py
executable file
·35 lines (28 loc) · 902 Bytes
/
gameTest.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
#!/usr/bin/env python
from game import ResistanceGame
from KellyAIs import dullMuteDeaf
nSpies =0
nRes = 0
nGames = 10000
nPlayers = 8
players = [dullMuteDeaf("bot"+str(i)) for i in range(nPlayers)]
winCount = {player.getName():[0,0] for player in players}
for i in xrange(nGames):
game = ResistanceGame(players)
finalState = game.play()
winners = finalState.getWinners()
winnerNames = [winner.getName() for winner in winners]
#print " ".join(winnerNames)
if winners[0].getRole()=="spy":
nSpies+=1
for winnerName in winnerNames:
winCount[winnerName][1]+=1
else:
nRes +=1
for winnerName in winnerNames:
winCount[winnerName][0]+=1
print "spy wins: ",nSpies
print "resistance wins:",nRes
print "\n\n"
for player in players:
print "player: {}\twins:{}\n".format(player.getName(),winCount[player.getName()])