- Timestamp:
- 08/20/2016 08:58:20 PM (8 years ago)
- branch-nick:
- state
- revision id:
- dsowen@fugue88.ws-20160820205820-d9bci6m3gdn1yu8k
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main.py
r6.1.27 r6.1.28 50 50 class AssembleTeam(object): 51 51 52 def __init__(self, shared ):52 def __init__(self, shared, team_size): 53 53 self.shared = shared 54 self.team_size = team_size 54 55 55 56 … … 86 87 team = None 87 88 approved = None 88 team_size = None89 89 90 90 def advance_mission(): 91 nonlocal team_size92 91 team_size = mission_size(player_count, mission) 93 92 print("Mission {} needs {} members".format(mission, team_size)) 94 return AssembleTeam(shared )93 return AssembleTeam(shared, team_size) 95 94 96 95 def assemble_team(): … … 98 97 99 98 print("Captain is {}".format(captain)) 100 team = players[captain].propose_team( team_size)99 team = players[captain].propose_team(state.team_size) 101 100 print("He proposed {}".format(team)) 102 101 103 102 votes = [p.approve_team(team) for p in players] 104 103 approvals = sum(votes) 105 approved = approvals > team_size / 2104 approved = approvals > state.team_size / 2 106 105 107 106 print("Team {}: {} for, {} against".format( … … 120 119 else: 121 120 team_failures += 1 122 return AssembleTeam(shared )121 return AssembleTeam(shared, state.team_size) 123 122 124 123 def perform_mission():
Note: See TracChangeset
for help on using the changeset viewer.