### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,158)
- misc (2)
- project euler (2)
- puzzle (40)
- site news (44)
- tantalizer (42)
- teaser (3)

### Site Stats

- 177,959 hits

Advertisements

Programming Enigma Puzzles

31 December 2013

Posted by on **From New Scientist #2518, 24th September 2005**

Some married couples (including my husband and me) entered a “round-robin” squash tournament at our local club. In such a tournament each individual plays each of the others once.

At the end of the tournament my husband had won a prime number of games and so had I. As you might expect, women did much better than men: the number of games won by the worst-performing female was over three times the number of games won by the best-performing male.

How many married couples entered the tournament? In how many games did a man beat a woman?

[enigma1359]

Advertisements

%d bloggers like this:

This Python 3 program uses analysis to narrow down possible scoring patterns, then constructs a pattern to show the solution is achievable. It runs in 58ms.

This program also uses the

first()routine from theenigma.pylibrary, which returns the first few items of an iterator (defaulting to 1 item) as a list. It is a simplification ofitertools.islice().Solution:There were 5 couples in the tournament (10 individual players). There were no games in which a man beat a woman.The following diagram shows the winner in each of the matches. The male players are numbered from 1 to 5, and male vs. male matches are shown in blue. The female players are numbered from 6 to 10, and female vs. female matches are show in pink. The remaining matches, shown in orange, are male vs. female matches (and are always won by the female player). The column on the right hand side shows the number of matches won by each player.