29 lines
845 B
Python
29 lines
845 B
Python
from itertools import combinations
|
|
|
|
names = ["Eisstedt", "Frostberg", "Gletscherdorf", "Kaltburg", "Schneeheim", "Winterthal"]
|
|
games = list(combinations(names, 2))
|
|
table = {name: 0 for name in names}
|
|
|
|
|
|
def play(idx):
|
|
if idx >= len(games):
|
|
yield []
|
|
else:
|
|
[a, b] = games[idx]
|
|
table[a] += 3
|
|
yield from map(lambda x: ["{} > {}".format(a[0], b[0])] + x, play(idx+1))
|
|
table[a] -= 2
|
|
table[b] += 1
|
|
yield from map(lambda x: ["{} = {}".format(a[0], b[0])] + x, play(idx+1))
|
|
table[a] -= 1
|
|
table[b] += 2
|
|
yield from map(lambda x: ["{} < {}".format(a[0], b[0])] + x, play(idx+1))
|
|
table[b] -= 3
|
|
|
|
|
|
for playouts in play(0):
|
|
success = all(table[a]-2 == table[b] for a, b in zip(names[:-1], names[1:]))
|
|
if success:
|
|
print(table)
|
|
print(playouts)
|