Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Congratulations on your acceptance to the organising committee of the 2 0 2 4 CAB 2 0 3 Bonkers tournament! Bonkers is an extremely exciting
Congratulations on your acceptance to the organising committee of the CAB Bonkers tournament!
Bonkers is an extremely exciting and fictitious game.
There are many tasks that need to be done, which have been distributed amongst the organising committee
members. Your acumen with discrete structures is well known, and hence you have been assigned several
organisational tasks which will benefit from some computerisation.
All tasks are intended to make significant use of graph theoretic tools and problems.
The tournament structure needs to be set; that is to say, who plays who. For this tournament a
structure is used where all games are set at the beginning. Another committee member will propose
the tournament structure and your job is to determine whether it has the required properties. The
committee has determined that the following properties are sufficient:
For every pair of distinct players, either they play against each other, or there are at least two
other players that they both play against.
All players have the same number of games.
So for example, if Alice and Bob dont play against each other then its still OK as long as they both
play against two players in common, say, Charlie and Denise.
Your job is to find a method that, given a tournament structure, determines whether the above prop
erties hold.
Implement your method in a Python function like so:
def gamesOK games :
where games is a set of proposed games to play, given as pairs of players, like so:
games Alice Bob Charlie Bob
Note that the order of the players in a particular game does not matter: Alice'Bob' specifies
the same game as Bob'Alice' You may assume that in the games given no player plays against
themselves, every player plays in at least one game, there is at least one player, and no game is given
more than once.
Your function should return True if the required property holds for the games given, otherwise False.
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 players 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 referees games 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.
Referee Conflict Conflict Conflict Conflict
Alice Bob Dave Eve
Bob Dave Eve Fiona Jamal
Fiona
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 : referee
Ashley 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