Add a real model
This commit is contained in:
parent
12316a9238
commit
8b7cab4c59
7 changed files with 432 additions and 10 deletions
|
|
@ -12,8 +12,8 @@ def ResistanceGame(n_players):
|
|||
|
||||
|
||||
def AvalonGame(n_players):
|
||||
full_set = [("Merlin", True), ("G", True), ("G", True),
|
||||
("E", False), ("ELance", False), ("GLance", True),
|
||||
full_set = [("Merlin", True), ("Percival", True), ("G", True),
|
||||
("Morgana", False), ("ELance", False), ("GLance", True),
|
||||
("Mordred", False), ("G", True), ("G", True),
|
||||
("Oberon", False)]
|
||||
return full_set[:n_players]
|
||||
|
|
@ -35,6 +35,13 @@ class DeceptionGame(object):
|
|||
self.tid = 0
|
||||
self.lancelots_switch_at = []
|
||||
|
||||
def get_fail_req(self, rnd):
|
||||
if rnd is not 4:
|
||||
return 1
|
||||
if self.n_players >= 7:
|
||||
return 2
|
||||
return 1
|
||||
|
||||
def player_is_good(self, deal, player, round):
|
||||
if round is None:
|
||||
return deal[player][1]
|
||||
|
|
@ -150,13 +157,14 @@ class DeceptionGame(object):
|
|||
"round"]})
|
||||
self.tid += 1
|
||||
|
||||
def do_vote(self, team, votes, fail_req, r):
|
||||
def do_vote(self, team, votes, fail_req, r, v, proposer):
|
||||
transaction = []
|
||||
rnd = r - 1
|
||||
voten = v - 1
|
||||
|
||||
def obs(deal):
|
||||
self.model.set_deal(deal)
|
||||
return self.model.votes(team, votes, fail_req, rnd)
|
||||
return self.model.votes(team, votes, fail_req, rnd, voten, proposer)
|
||||
|
||||
transaction.append(obs)
|
||||
self.observations.append(transaction)
|
||||
|
|
@ -164,6 +172,8 @@ class DeceptionGame(object):
|
|||
"team": team,
|
||||
"votes": votes,
|
||||
"round": r,
|
||||
"voten": v,
|
||||
"proposer": proposer,
|
||||
"fails required": fail_req,
|
||||
"print_order": ["team", "votes", "round"]})
|
||||
self.tid += 1
|
||||
|
|
@ -175,7 +185,9 @@ class DeceptionGame(object):
|
|||
self.do_vote(statement["team"],
|
||||
statement["votes"],
|
||||
statement["fails required"],
|
||||
statement["round"])
|
||||
statement["round"],
|
||||
statement["voten"],
|
||||
statement["proposer"])
|
||||
if type == "switch":
|
||||
self.switch_lancelots(statement["round"])
|
||||
elif type == "mission":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue