PuzzlOR Matchup¶
In [1]:
from itertools import permutations
Personality Characteristics Key:¶
- L=Liberal, C=Conservative
- C=Chess, R=Running
- R=Rural, U=Urban
- O=Outgoing, I=Introverted
In [2]:
men = ["LRRI", "LCRO", "CRUI", "LRRI", "CRRI", "CCRI", "CCUI", "LCUI", "LRUI", "LRUO"]
women = ["CCRI", "LRRI", "CCRO", "CRUO", "CCUO", "LRUI", "CCUO", "CRUO", "LCUI", "LRRI"]
In [3]:
def matching(M, W):
score = 0
if M[0] == W[0]:
score = score + 1
if M[1] == W[1]:
score = score + 1
if M[2] == W[2]:
score = score + 1
if M[3] == W[3]:
score = score + 1
return score
In [4]:
best_score = 0
for config in permutations([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]):
score = 0
for m, w in zip(range(10), config):
score += matching(men[m], women[w])
if score > best_score:
best_score = score
print(config, best_score)
The maximum number of points that can be achieved is 33, with the following matches:
- Man 1 <--> Woman 2
- Man 2 <--> Woman 3
- Man 3 <--> Woman 4
- Man 4 <--> Woman 10
- Man 5 <--> Woman 1
- Man 6 <--> Woman 5
- Man 7 <--> Woman 7
- Man 8 <--> Woman 9
- Man 9 <--> Woman 6
- Man 10 <--> Woman 8