Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def assign_crew(crew):
- """
- If there are commanders in the roll, it is responsible for updating the
- crew and, in any case, calls the functions of each crew member with
- the number of them available.
- Parameters
- ----------
- crew : array
- Result of the dice roll.
- Returns
- -------
- None.
- """
- # The new crew
- ncrew = []
- # Number of crew members of each type
- tacticn = 0
- doctorn = 0
- scientistn = 0
- engineern = 0
- # in search of the commander
- for i in range(len(crew)):
- if crew[i] == 1:
- ncrew = commander(crew)
- # Crew update if modified
- if len(ncrew) != 0:
- crew = ncrew
- # For the rest of the tasks, the appropriate functions are called
- # with the number of crew members of each type.
- for i in range(len(crew)):
- if crew[i] == 2:
- tacticn += 1
- elif crew[i] == 3:
- doctorn += 1
- elif crew[i] == 4:
- scientistn += 1
- elif crew[i] == 5:
- engineern += 1
- if tacticn > 0:
- tactic(tacticn)
- if doctorn > 0:
- doctor(doctorn)
- if scientistn > 0:
- scientist(scientistn)
- if engineern > 0:
- engineer(engineern)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement