pep8 and better lady model

This commit is contained in:
Barak Michener 2013-07-29 19:36:54 -04:00
parent 9eb3625393
commit b9f07c85fa

16
tim.py
View file

@ -25,7 +25,7 @@ class DeceptionGame(object):
self.observations = [] self.observations = []
self.seen = [] self.seen = []
self.tid = 0 self.tid = 0
self.lady_will_duck = mc.Bernoulli("lady_will_duck", 0.5) self.lady_will_duck = mc.Bernoulli("lady_will_duck", 0.8)
self.mission_ducks_on_round = [None] * 5 self.mission_ducks_on_round = [None] * 5
self.mission_ducks_on_round[0] = mc.Bernoulli("missionduck_on_0", 0.5) self.mission_ducks_on_round[0] = mc.Bernoulli("missionduck_on_0", 0.5)
self.mission_ducks_on_round[1] = mc.Bernoulli("missionduck_on_1", 0.5) self.mission_ducks_on_round[1] = mc.Bernoulli("missionduck_on_1", 0.5)
@ -78,16 +78,16 @@ class DeceptionGame(object):
else: else:
return None return None
else: else:
if self.lady_will_duck.rand(): if self.player_is_good(deal, p2):
if self.player_is_good(deal, p2) == claim: if claim == True:
return True return self.lady_will_duck.rand()
else: else:
return False return not self.lady_will_duck.rand()
else: else:
if self.player_is_good(deal, p2) == claim: if claim == False:
return False return self.lady_will_duck.rand()
else: else:
return True return not self.lady_will_duck.rand()
transaction.append(obs) transaction.append(obs)
self.observations.append(transaction) self.observations.append(transaction)
self.seen.append(["Lady:", p1, "says", p2 , "is", "Good" if claim else "Evil"]) self.seen.append(["Lady:", p1, "says", p2 , "is", "Good" if claim else "Evil"])