Answered step by step
Verified Expert Solution
Question
1 Approved Answer
All Bonkers games must have a referee, but the referee for each game cannot have any conflicts of interest for the game. In particular, the
All Bonkers games must have a referee, but the referee for each game cannot have any conflicts of interest for the game. In particular, the referee cannot be a player in the game, and the referee must also declare any other conflicts of interest eg cannot be a player's relative, friend, boss, etc.. In order to minimise the burden on any individual referee, the policy is to assign each referee at most one game.
Your task is to determine a method for assigning referees to games, given the games, referees, and conflicts of interest for each referee. You must assign at most one game to each referee, and exactly one referee to each game, or determine that it is impossible to do so
Implement your solution as a Python function of the form
def refereesgames refereecsvfilename:
games is structured the same as in the previous question. refereecsvfilename is the name for a CSV file which you should read to obtain the list of referees and their declared conflicts of interest. Below is a sample CSV file showing the structure.You may assume that for each referee there is exactly one row giving their conflicts of interest. Your function should return a data structure of games and assigned referees similar to:# dictionary of all player player : refereeAshley 'Bob': 'Rene' or None if it is not possible.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started