Changeset 6.1.28 for main.py


Ignore:
Timestamp:
08/20/2016 08:58:20 PM (8 years ago)
Author:
David Owen <dsowen@fugue88.ws>
branch-nick:
state
revision id:
dsowen@fugue88.ws-20160820205820-d9bci6m3gdn1yu8k
Message:

Moved team_size into state

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main.py

    r6.1.27 r6.1.28  
    5050class AssembleTeam(object):
    5151
    52     def __init__(self, shared):
     52    def __init__(self, shared, team_size):
    5353        self.shared = shared
     54        self.team_size = team_size
    5455
    5556
     
    8687    team = None
    8788    approved = None
    88     team_size = None
    8989
    9090    def advance_mission():
    91         nonlocal team_size
    9291        team_size = mission_size(player_count, mission)
    9392        print("Mission {} needs {} members".format(mission, team_size))
    94         return AssembleTeam(shared)
     93        return AssembleTeam(shared, team_size)
    9594
    9695    def assemble_team():
     
    9897
    9998        print("Captain is {}".format(captain))
    100         team = players[captain].propose_team(team_size)
     99        team = players[captain].propose_team(state.team_size)
    101100        print("He proposed {}".format(team))
    102101
    103102        votes = [p.approve_team(team) for p in players]
    104103        approvals = sum(votes)
    105         approved = approvals > team_size / 2
     104        approved = approvals > state.team_size / 2
    106105
    107106        print("Team {}: {} for, {} against".format(
     
    120119        else:
    121120            team_failures += 1
    122             return AssembleTeam(shared)
     121            return AssembleTeam(shared, state.team_size)
    123122
    124123    def perform_mission():
Note: See TracChangeset for help on using the changeset viewer.