# Sunday Times Teaser 3215 – Darts League

*by Andrew Skidmore*

#### Published Friday May 03 2024 (link)

In our darts league, each team plays each other once. The result of each match is decided by the number of legs won, and each match involves the same number of legs. If both teams win the same number of legs, the match is drawn. The final league table shows the games won, drawn or lost, and the number of legs won for and against the team. The Dog suffered the most humiliating defeat, winning only one leg of that match. Curiously, no two matches had the same score.

What was the score in the match between The Crown and The Eagle?

14 Comments
Leave one →

@John, nice solution but not entirely correct (“each team plays each other once”).

Frits, each does play every other team just once. The four scores on the line with the team’s name are the scores from its point of view with every other team. Each score has a corresponding score that is reversed on the printout line of one of the other teams. Sorry that the printout is rather unformatted.

In the exampe you give I can only conclude that The Dog played twice against The Anchor.

Frits: you’re right; there was a bug. Thanks for bringing it to my attention.

Here is the corrected code with a few other tweeks.

Moving the ‘one to one’ check into the function saves execution time and reduces code length.

Congratulations on an excellent approach to this teaser John. I copied Frits approach so I thought I would provide a version of your own too. I hope the reasons for the changes I made are clear but I am happy to explain them if not

A variation on Brian’s program. Instead of selecting 3 or 4 scores we can select 2 or 3 scores and calculate the fourth.

Shorter and faster (even without calculating the fourth entry)

That is the approach I used when I got round to doing this one myself.

Thanks Brian for the improvements. Your comment writing is streets ahead of mine. I’ve rewritten the printout to give a more conventional score table with a few minor column alignment problems.

It is quite tedious to do decent alignments with tuples since it becomes

necessary to format the internals of the tuples themselves.

I managed to distill the five lines of code in 50-60 above into a 2 line comprehension using a dictionary. This permits insertion of values into the score table in any order. Some preformatting for printout is also done in the comprehension to get proper column alignment.

To cut down on indentation, I joined up the 2 ‘if’ statements back into 1, leaving plenty of space for readability.