Changeset 6.1.38
- Timestamp:
- 08/20/2016 09:21:54 PM (8 years ago)
- branch-nick:
- state
- revision id:
- dsowen@fugue88.ws-20160820212154-horha1cy20jzv10x
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main.py
r6.1.37 r6.1.38 38 38 class Shared(object): 39 39 40 def __init__(self, player_count ):40 def __init__(self, player_count, players): 41 41 self.player_count = player_count 42 self.players = players 42 43 self.mission = 0 43 44 self.captain = 0 … … 88 89 players[i].reveal_spies(spy_nums) 89 90 90 shared = Shared(player_count )91 shared = Shared(player_count, players) 91 92 92 93 wins = 0 … … 95 96 def assemble_team(): 96 97 print("Captain is {}".format(state.shared.captain)) 97 team = players[state.shared.captain].propose_team(state.team_size)98 team = state.shared.players[state.shared.captain].propose_team(state.team_size) 98 99 print("He proposed {}".format(team)) 99 100 100 votes = [p.approve_team(team) for p in players]101 votes = [p.approve_team(team) for p in state.shared.players] 101 102 approvals = sum(votes) 102 103 approved = approvals > state.team_size / 2 … … 107 108 )) 108 109 109 for p in players:110 for p in state.shared.players: 110 111 p.observe_team_vote(approved, votes) 111 112 … … 125 126 for i in state.team: 126 127 if role_deck[i] == "SPY": 127 if not players[i].perform_mission():128 if not state.shared.players[i].perform_mission(): 128 129 failures = failures + 1 129 130 130 131 success = failures < required_failures(state.shared.player_count, state.shared.mission) 131 132 132 for p in players:133 for p in state.shared.players: 133 134 p.observe_mission(success, failures) 134 135 … … 154 155 if shared.team_failures == 5: 155 156 print("The spies won!") 156 for p in players:157 for p in shared.players: 157 158 p.observe_game(False) 158 159 return 159 160 elif wins >= 3: 160 161 print("The Resistance won!") 161 for p in players:162 for p in shared.players: 162 163 p.observe_game(True) 163 164 return 164 165 elif losses >= 3: 165 166 print("The Spies won!") 166 for p in players:167 for p in shared.players: 167 168 p.observe_game(False) 168 169 return
Note: See TracChangeset
for help on using the changeset viewer.