Brain-Teaser 458: [Football tournament]
From The Sunday Times, 1st March 1970 [link]
The table gives the results of an all-play-all soccer tournament is South America.
If I tell you the number of scores of one goal by either side in the 3 games played by Brazil you can deduce the scores of the games between Argentine and Peru and Argentine and Ecuador.
What are they?
This puzzle was originally published with no title.
[teaser458]

Jim Randell 8:55 am on 2 March 2019 Permalink |
The enigma.py library includes the [[
Football()]] class to help in solving puzzles involving football tables, and the [[filter_unique()]] function to help in solving puzzles of the form “… if I told you this, then you could work out that…”. We can use both of these to solve this puzzle.This Python program runs in 98ms.
Run: [ @repl.it ]
from enigma import Football, filter_unique, unpack # record possible outcomes rs = list() # scoring system football = Football(games='wdl') # the order of the teams in the table (B, A, P, E) = (0, 1, 2, 3) # digits in the table stand for themselves d = dict((x, int(x)) for x in "01234789") # the columns of the table (table, gf, ga) = (dict(w="3100", d="0121", l="0112"), "9724", "3847") # find possible match outcomes for (ms, _) in football.substituted_table(table, d=d): # find possible scorelines using the goals for/against columns for ss in football.substituted_table_goals(gf, ga, ms, d=d): # record outcomes rs.append((ms, ss)) # if I told you... # the number of scores of 1 goal by either side in the games played by B... f = unpack(lambda ms, ss: sum(v.count(1) for (k, v) in ss.items() if B in k)) # you can deduce the scores in the AvP and AvE match g = unpack(lambda ms, ss: (ss[(A, P)], ss[(A, E)])) # find the unique solutions (rs, _) = filter_unique(rs, f, g) # output solutions for (ms, ss) in rs: football.output_matches(ms, ss, "BAPE")Solution: A vs P = 1-1. A vs E = 5-3.
The scores in all matches are uniquely determined. They are:
LikeLike