Changes in [3:1]
Legend:
- Unmodified
- Added
- Removed
-
main.py
r3 r1 10 10 11 11 def reveal_spies(self, spies): 12 """If this player is a spy, this method will be called to reveal the identities13 of *all* the spies (including this player).14 15 It is passed as an array of IDs.16 17 """18 12 pass 19 13 20 14 def propose_team(self, count): 21 """Asks the player to propose a team as a team-lead.22 23 Must return an array of `count` unique IDs. The proposed team may24 include the player, but does not need to.25 26 """27 15 team = list(range(self.count)) 28 16 shuffle(team) … … 30 18 31 19 def approve_team(self, team): 32 """Asks the player to vote on a proposed team.33 34 True indicates approval, False disapproval. The player will be asked35 to vote on all teams, even one that it proposes.36 37 """38 20 return True 39 21 40 22 def observe_team_vote(self, approved, votes): 41 """Allows the player to observe the outcome of a vote to approve a proposed42 team.43 44 The final result is given as `approved`, and individual votes (ordered45 by player ID) are given as an array as `votes`.46 47 """48 23 pass 49 24 50 25 def perform_mission(self): 51 """If this player is a spy, called to ask the player whether to fail the52 mission.53 54 True indicates that this player will not cause a failure, False that it55 will cause a failure.56 57 Note that some missions require 2 players to attempt a mission failure58 to actually fail the mission.59 60 """61 26 return False 62 27 63 28 def observe_mission(self, success, failures): 64 """Allows the player to observe the outcome of a mission.65 66 The final result is given as `success`. The number of failures is67 given (as an integer) as `failures`.68 69 """70 29 pass 71 30 72 31 def observe_game(self, success): 73 """Allows the player to observe the outcome of the game.74 75 True indicates the Resistance won, False the Government (spies).76 77 """78 32 pass 79 33 … … 104 58 def observe_mission(self, success, failures): 105 59 pass 60 106 61 107 62 … … 153 108 losses = 0 154 109 captain = 0 155 team_failures = 0156 110 157 111 for mission in range(1, 6): … … 175 129 captain = (captain + 1) % player_count 176 130 if approved: 177 team_failures = 0178 131 failures = 0 179 132 for i in team: … … 205 158 break 206 159 else: 207 team_failures += 1 208 if team_failures == 5: 209 print("The spies won!") 210 for p in players: 211 p.observe_game(False) 212 return 160 pass 213 161 214 215 if __name__ == '__main__': 216 main(10) 162 main(10)
Note: See TracChangeset
for help on using the changeset viewer.