Question: Problem # 2 : Robotics Match Suppose you are running a competitive robotics league and want to determine how many ranking levels each team in

Problem #2: Robotics Match
Suppose you are running a competitive robotics league and want to determine how many ranking levels each team in a competition is going to earn during a given two-team match. A team receives 1 ranking level for tying, or 2 ranking levels for winning. There is a possibility to get 2 more bonus ranking levels: 1 for achieving a special bonus called strike, and another 1 level for excelling at climbing. Your function, ranking_levels, should take in the following parameters, which represent the scoring activity of the two teams: Red and Blue.
red_points: a list of scores (integers) in the following order [auto, drilling, climbing]
blue_points: a list of the same format
red_foul: True if the Red team committed a foul
blue_foul: True if the Blue team committed a foul
Note: the function is called "ranking_points" by mistake in CodeGrade. Pretend it says "ranking_levels", but don't change the name of the function in your code.
The score of each team is simply the sum of its auto, drilling, and climbing scores. The team with the higher total score wins (+2 ranking levels for the winner). If the total scores match, the teams tie (+1 ranking level each).
For a team to earn the bonus ranking level for the strike bonus, the following must be true: drilling must be greater than 20; OR auto must be greater than 5 and drilling must be greater than 14.
For a team to earn the bonus ranking level for excelling in climbing, the climbing score for the team must be greater than 15, OR a foul must have been committed by the other team. If both of these possibilities have happened, the team still only gets 1 additional ranking level, not 2.
Your function should return the number of ranking levels earned by the Red team, followed by the number of ranking levels earned by the Blue team.
Let's look at an example in detail: ranking_levels([6,21,4],[6,15,18], False, True)
Blue earns 2 ranking levels for having the higher score. (Levels: 0 vs.2 for Red vs. Blue)
Red earns 1 ranking level for having a drilling score >20, and Blue earns 1 ranking level for having an auto score >5 and a drilling score >14.(Levels: 1 vs.3)
Blue committed a foul, so Red earns 1 ranking level. (Levels: 2 vs.3)
Blue's climbing score is greater than 15, so it earns 1 ranking level. (Levels: 2 vs.4)
The function returns 2,4.
Function Call
Expected Return Value (pair)
ranking_levels([4,5,8],[5,6,9], False, False)
(0,2)
ranking_levels([4,21,16],[6,15,18], False, False)
(4,2)
ranking_levels([6,21,4],[6,15,18], False, True)
(2,4)
ranking_levels([10,15,6],[3,20,12], True, False)
(1,3)
ranking_levels([8,6,14],[13,11,4], True, True)
(2,2)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!