You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
data = {(a, b): {'gain': 1, 'lose': -1}[s]*int(n) for a, s, n, b in re.findall(r'(\w+) would (\w+) (\d+) happiness units by sitting next to (\w+).', data)}
persons = set(['Me :('])
for a, b in data:
persons.add(a)
persons.add(b)
max_score = None
def get_score(c):
score = 0
for a, b in [(c[i - 1], c[i]) for i in xrange(len(c))]:
score += data.get((a, b), 0)+ data.get((b, a), 0)
return score
for configuration in itertools.permutations(persons):