Help Needed: Resolving Tiebreakers in a Competition - Seeking a Solution

I have a case here to “break ties” between teams in a competition. The criteria are basic, but I’m having trouble finding a solution. The team with the most first-place wins in each position wins. So, if two teams have 10 points, and the first team has 1 first-place win, while the second has none, the first team wins.

I’ve managed to handle this scenario. However, when more than two teams are tied, it becomes more complex, as in the following case:

There are 5 teams with 16 points. Team 10 and Team 9 have the first position, but Team 10 also has 1 second-place win. So, the first two positions in the tiebreaker are Team 10 and Team 9 (that’s working so far).

Now comes the tiebreaker for Team 8, Team 6, and Team 2. All of them have 1 second-place win, and only Team 8 and 6 have a third-place win, so Team 2 ends up as the last. In this example, Team 8 and 6 are tied because their results are the same.

I’ll try to explain what I’ve done so far. Below, I’ve indicated the folder and the two workflows I’m using for this operation.

Basically, I pull a list of “Event Participation” sorted by “Score Total,” which is the sum of all the positions for each score. Then, I define the “Event Anterior,” “Posterior,” and “Atual” (red triangle) to determine whether there is a tie or not (first red arrow for a tie and the second for no tie). This continues for the entire list.

When I finish processing the list, I only take those marked as ties and proceed to the second workflow indicated by the arrow below.

Within the tiebreaker workflow, I loop through the positions. It starts by looking at everyone who has a “Score Total” of 16 (red square), for example, who is in first place, and then it assigns values where the red arrows are.

In the first pass, it looks like this:

Team - Score Total - Tiebreak_position - Tiebreak_score
Team 10 - 16 1 1
Team 9 - 16 1 1
Team 2 - 16 1 0
Team 8 - 16 1 0
Team 6 - 16 1 0

So, Team 10 and 9 have one first-place win each, and the other three teams have none.

Then, it goes back to the first workflow, checking only these 5 teams, and it recognizes that Team 10 and 9 are tied, and Teams 2, 8, and 6 are also tied, and so on.

The second pass would look like this:

Team - Score Total - Tiebreak_position - Tiebreak_score
Team 10 - 16 2 1
Team 9 - 16 2 0
Team 2 - 16 2 1
Team 8 - 16 2 1
Team 6 - 16 2 1

Team 10 and 9 break the tie, and Team 2 gets stuck in third place. (Team 8 and 6 remain tied because the tiebreaker criteria can’t resolve this case, but that’s another issue).

Team - Score Total - Tiebreak_position - Tiebreak_score
Team 10 - 16 2 1
Team 9 - 16 2 0
Team 2 - 16 3 0
Team 8 - 16 5 0
Team 6 - 16 5 0

I’m not sure if my explanation makes it more complicated, but thanks for your attention!

Here is the link for application - https://bubble.io/page?type=api&id=testscoreup&tab=tabs-2

Best regards

I’m unsure what you are asking. Are you asking how to determine who the winner is (between Teams 6 and 8) or how to get Bubble to consider them tied?

Thanks for the response! Apologies if my explanation seemed a bit messy! What I’m essentially looking to do is to determine the ranking without any ties. The criteria are based on the number of 1st places, 2nd places, and so on.

In the example I provided, the ranking would look like this:

  1. Team 10 (1x 1st, 1x 2nd)
  2. Team 9 (1x 1st, 0x 2nd)
  3. Team 8 and Team 6 (in this case, they would be tied because they have the same number of wins - I plan to handle this in a different way. I should also mention that I currently run the ranking algorithm until the 5th place. Beyond that, if there’s a tie, I’ll handle it in a different manner.

I hope this clears things up, and thank you for your patience!"

It’s not clear what you are trying to solve but, if I understand correctly, I think the best approach is to assign a value to each place finish greater than the max number of lower-level finishes.

So for simplicity sake I’m assuming max is 4 in each position, so for

  • 5th place= .1;
  • 4th = 3;
  • 3rd = 15;
  • 2nd = 75; and
  • 1st = 400.

You haven’t listed what number of place finishes each Team has, so I can’t do the math, but that should solve it and there wouldn’t be any need for a Tiebreak_position field as you can just sort by the tiebreak score.

Note: to avoid 2 levels of sorting you can throw the score total in there as well (give it a value of 2,500 per point) and rename it rank and then sort solely but that field.

1 Like

Okay, so as you can see in the image bellow, all teams inside the red square have the same points (16).
I need to find a way to determine the winner. In this case, Team 5 is the winner, but the 2nd, 3rd, and so on have the same score. To break a tie, I will use the number of wins for each place until it’s resolved.

Team 10 will be first because it has 1x 1st and 1x 2nd. Team 9 will be second because it has 1x 1st but 0x 2nd. Both are separated from Team 8, Team 6, and Team 2 because they have 0x 1st.

Then I have to follow the same logic to break the tie among Team 8, Team 6, and Team 2

image

Did you see my last response? You can just use that calculation and not keep looping thru. Just sort by tiebreaker total sum

Wow, I think I’ve got it…

So, for this case, I would have the following:

Team 10 - 1st (400) + 2nd (75) + 3rd (0) + 4th (0) + 5th (0) = 475
Team 9 - 1st (400) + 2nd (75) + 3rd (0) + 4th (0) + 5th (1 + 1) = 402
Team 8 - 1st (0) + 2nd (75) + 3rd (15) + 4th (3) + 5th (0) = 93
Team 6 - 1st (0) + 2nd (75) + 3rd (15) + 4th (3) + 5th (0) = 93
Team 2 - 1st (0) + 2nd (75) + 3rd (0) + 4th (3) + 5th (1 + 1) = 80

Nice! If I want to “dig deeper,” I can just increase the numbers…

You mentioned that “You can just use that calculation and not keep looping through.” However, to do that math, I will have to first “find the ties” and then loop through them to sum each one (as I did). There is no “cleaner” way, correct?

No need to find any ties. This is all irrelevant of that (of course if there are no ties you can skip this calculation).Sort by score and then tiebreaker score (or can combine 2 as I noted above).

1 Like

Thanks @code-escapee , It is a cleaner and easier solution! :clap:

This topic was automatically closed after 70 days. New replies are no longer allowed.