具有多个引用多个值的键的Python字典

时间:2016-08-22 19:27:18

标签: python-2.7

我正在尝试为游戏制作随机数发生器。只有比赛(列为R#)每个球员(P#)被允许比赛并交给他两个。谁可以发挥更多的重叠,我需要从玩家开始,选择最少并向上移动。我正在尝试利用一个词典将所有玩家放在一个变量中。

Players = {
    "P1": ['R1','R2','R3','R4'],
    "P2": ['R1','R2','R5','R6'],
    "P3": ['R7','R1','R2','R8','R9','R10','R11'],
    "P4": ['R7','R3','R5','R4','R12','R13','R14','R10','R11'],
    "P5": ['R1','R2','R5','R15','R14','R10','R16','R17','R11'],
    "P6": ['R7','R1','R2','R3','R5','R4','R6','R13','R14','R10','R16','R17','R11'],
    "P7": ['R7','R1','R2','R3','R4','R6','R13','R15','R9','R16','R17','R11'],
    "P8": ['R7','R1','R2','R8','R3','R5','R4','R6','R12','R9','R14','R10','R17'],
}

这是我第一次进入词典。有没有更好的方法来实现这一目标?

为了清晰起见,我尝试编辑。感谢您的关注,如果我能清除其他任何内容,请告诉我。

0 个答案:

没有答案