### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,115)
- misc (2)
- project euler (2)
- puzzle (29)
- site news (43)
- tantalizer (29)
- teaser (3)

### Site Stats

- 166,357 hits

Programming Enigma Puzzles

26 June 2017

Posted by on **From New Scientist #2265, 18th November 2000** [link]

At tennis a set is won by the first player to win 6 games, except that if the score goes to 5 games all, the set is won either by 7 games to 5 or by 7 games to 6. The first person to win three sets wins the match.

Sometimes at the end of a match each player has won exactly the same number of games. This happened when André beat Boris in a match in which no two sets contained the same number of games.

You will have to work out whether André won by 3 sets to 1 or by 3 sets to 2, but if I told you how many games in total each player won you would be able to deduce with certainty the score in each of the sets that André won and in the set or each of the sets that Boris won.

What was the score in each of the sets that André won? (Give each set’s score in the form

x-y, André’s score always comes first).

[enigma1109]

Advertisements

%d bloggers like this:

This Python program runs in 43ms.

Solution:Andre won his sets 6-3, 6-4, 7-6.Andre won 3 sets to 1. The score in the set Boris won was 0-6. So overall each player won 19 games.

I tried a game simulation in MiniZinc with a 3-1 win for Able using a winning sequence of A, A, B, A for the game order. Other possible winning sequences would have been A, B, A, A or B, A, A, A

My programme gave three answers, each of which seemed to fulfill the conditions that each player won the same number of games in the match and that no two sets contained the same number of games.

The three solutions include Jim’s solution – but I am not sure how to carry out further filtering in MiniZinc to reduce the three solutions to one solution.

Interesting that tie-breaks (leading to a 7-6 score) are not used in the final set in the Australian Open for singles, the French Open for singles, or Wimbledon (Wikipedia). This rule for Wimbledon led the longest men’s single in history in 2010 in a match (Isner v Mahut) when the fifth set score was 70 – 68!

Tie breaks seem very common in sets in ATP tennis.

@geoff: As you say there are three different ways that A can win 3-1, with each player winning 19, 20 or 21 games. But there are also 15 ways that A can win 3-2, and these have each player winning 20, 21, 22, 23, 24, 25 or 26 games.

Here are the different ways found by my program (ordered by the number of games each player wins):

Of these, only for 19 games is there a unique outcome, so this gives us the solution.

Here’s a MiniZinc model that finds all 18 outcomes. (It uses the same convention I used in my Python program, that the 5th game is indicated by 0-0 if it was not played):

I don’t know if there’s an easy way to add a constraint in MiniZinc to find a unique solution amongst all viable solutions. Here I wrap the MiniZinc model in a Python program (using the

minizinc.pywrapper) and use thefilter_unique()function from theenigma.pylibrary to select unique solutions: