- Timestamp:
- 08/20/2016 05:42:19 PM (8 years ago)
- branch-nick:
- state
- revision id:
- dsowen@fugue88.ws-20160820174219-zya5nxnxevphj8an
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main.py
r6.1.3 r6.1.4 59 59 mission = 1 60 60 61 def perform_mission(): 62 nonlocal wins, losses, mission 63 64 failures = 0 65 for i in team: 66 if role_deck[i] == "SPY": 67 if not players[i].perform_mission(): 68 failures = failures + 1 69 70 success = failures < required_failures(player_count, mission) 71 72 for p in players: 73 p.observe_mission(success, failures) 74 75 if success: 76 print("Mission succeeded") 77 wins += 1 78 else: 79 print("Mission had {} failures".format(failures)) 80 losses += 1 81 82 mission += 1 83 61 84 while True: 62 85 team_size = mission_size(player_count, mission) … … 80 103 if approved: 81 104 team_failures = 0 82 failures = 0 83 for i in team: 84 if role_deck[i] == "SPY": 85 if not players[i].perform_mission(): 86 failures = failures + 1 87 success = failures < required_failures(player_count, mission) 105 perform_mission() 88 106 89 for p in players: 90 p.observe_mission(success, failures) 91 92 if success: 93 print("Mission succeeded") 94 wins += 1 95 mission += 1 96 if wins >= 3: 97 print("The Resistance won!") 98 for p in players: 99 p.observe_game(True) 100 return 101 else: 102 print("Mission had {} failures".format(failures)) 103 losses += 1 104 mission += 1 105 if losses >= 3: 106 print("The Spies won!") 107 for p in players: 108 p.observe_game(False) 109 return 107 if wins >= 3: 108 print("The Resistance won!") 109 for p in players: 110 p.observe_game(True) 111 return 112 elif losses >= 3: 113 print("The Spies won!") 114 for p in players: 115 p.observe_game(False) 116 return 110 117 111 118 break
Note: See TracChangeset
for help on using the changeset viewer.