# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1098: Soccer heroes

From New Scientist #2254, 2nd September 2000 [link]

There are seven teams in our local football league. Each team plays each of the others once during the season. We are approaching the end of the season and I have constructed a table of the situation so far, with the teams in alphabetical order.

Here are the first two rows of the table, but with digits consistently replaced by letters, different letters being used for different digits.

What was the score when Albion played Borough?

[enigma1098]

### One response to “Enigma 1098: Soccer heroes”

1. Jim Randell 11 September 2017 at 9:22 am

First we note that B’s “won” and “goals for” entries correspond to the same letter. To win a match you must score at least one goal, so any match that B has won must have been won 1-0.

From the table we can deduce various constraints. Here they are expressed as a run-file for the [[ `SubstitutedExpression()` ]] solver from the enigma.py library.

Run: [ @repl.it ]

```#!/usr/bin/env python -m enigma -r

SubstitutedExpression

# S, H are in the played column, so cannot be more than 6
--invalid="7-9,SH"

# won + lost + drawn = played
"O + C + C = S"
"E + R + O = H"

# to win a game you must score a goal, so: goals for >= won
"E >= O"

# to lose a game you must concede a goal, so: goals against >= lost
"R >= C"
"S >= R"
```

This executes in 85ms and provides us with the only viable assignment of letters to digits:

C=3 E=1 H=5 O=0 R=4 S=6

Which means the rows of the table we are given look like this:

From which we see that A has played all 6 of their games, so the AvB match must have been played.

A didn’t win the AvB match (as A won no matches), and the match cannot be drawn (as B had no draws), so B must have won the AvB match, which means the score must have been 1 goal to B and no goals to A.

Solution: Borough beat Albion 1-0.

There are only a couple of possibilities for the results in A’s and B’s matches:

A lost 3 of their matches and drew 3 of their matches, so the 1 goal they did score was either in a match they lost, which gives the results for A’s games as:

drawn = 0-0, 0-0, 0-0; lost = 0-1, 0-1, 1-2

Or, the goal scored was in a match they drew, giving results of:

drawn = 0-0, 0-0, 1-1; lost = 0-1, 0-1, 0-1

Whichever it is one of the 0-1 defeats was to B.

B has played 5 matches, and won one (which we know must have been with a result of 1-0), so B did not score in their remaining 4 matches, and they conceded 6 goals in those matches, so the possible results for B are:

won = 1-0; lost = 0-1, 0-1, 0-1, 0-3

won = 1-0; lost = 0-1, 0-1, 0-2, 0-2

The 1-0 win was over A.

This site uses Akismet to reduce spam. Learn how your comment data is processed.