Skip to content

Sunday Times Teaser 3215 – Darts League

by BRG on May 3, 2024

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?

From → Uncategorized

14 Comments Leave one →
  1. BRG permalink

  2. John Z permalink

    • Frits permalink

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

  3. John Z permalink

    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.

    • Frits permalink

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

  4. John Z permalink

    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.

  5. John Z permalink

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

  6. BRG permalink

    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

  7. Frits permalink

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

  8. Frits permalink

    Shorter and faster (even without calculating the fourth entry)

    • BRG permalink

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

  9. John Z permalink

    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.

    • BRG permalink

      It is quite tedious to do decent alignments with tuples since it becomes
      necessary to format the internals of the tuples themselves.

  10. John Z permalink

    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.

Leave a Reply

Note: HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS