-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqPlaying.py
59 lines (46 loc) · 1.9 KB
/
qPlaying.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
from qOutput import *
from qTraining import *
from agents import *
from game import *
import pickle
random.seed(10)
def play1():
pBot2 = RandomAgent("Hmm")
# qBot1 = RandomAgent("random")
qBot1 = QPlayer('qPlayer', featureSet1, pickle.loads(trainingWeights1), pBot2) #default values
random.seed(183)
g = Game([qBot1, pBot2], True)
g.playGame(100)
# #print stats
for player in g.players:
print player.name
print player.wins
if type(player) == LearningAgent or type(player) == RandomAgent or type(player) == HmmAgent or type(player) == HeuristicAgent or type(player) == QPlayer:
print np.average(player.validPercentByRound)
def play2(agent):
pBot2 = agent
# qBot1 = RandomAgent("random")
qBot1 = QPlayer('qPlayer', featureSet5, pickle.loads(trainingWeights5), pBot2) #default values
random.seed(183)
g = Game([qBot1, pBot2], True)
g.playGame(100)
# #print stats
for player in g.players:
print player.name
print player.wins
if type(player) == LearningAgent or type(player) == RandomAgent or type(player) == HmmAgent or type(player) == HeuristicAgent or type(player) == QPlayer:
print np.average(player.validPercentByRound)
def play3():
pBot2 = HmmAgent("Hmm")
# qBot1 = RandomAgent("random")
# qBot1 = QPlayer('qPlayer', featureSet5, pickle.loads(trainingWeights5), pBot2) #default values
qBot1 = QCheater("QCheater", featureSet4, pickle.loads(trainingWeights7))
random.seed(183)
g = Game([qBot1, pBot2], True)
g.playGame(100)
# #print stats
for player in g.players:
print player.name
print player.wins
if type(player) == LearningAgent or type(player) == RandomAgent or type(player) == HmmAgent or type(player) == HeuristicAgent or type(player) == QPlayer:
print np.average(player.validPercentByRound)