from matching import Player
= [Player(name="A"), Player(name="B"), Player(name="C")]
suitors = [Player(name="D"), Player(name="E"), Player(name="F")]
reviewers
= suitors, reviewers (A, B, C), (D, E, F)
Create a game from Player
instances
Any game in Matching can be made by manually creating instances of the Player
class (or its child classes) and setting their preferences using those instances.
Consider the following instance of SM.
The preferences are then set using the set_prefs
method of whichever Player
class you’re using.
A.set_prefs([D, E, F])
B.set_prefs([D, F, E])
C.set_prefs([F, D, E])
D.set_prefs([B, C, A])
E.set_prefs([A, C, B]) F.set_prefs([C, B, A])
Finally, the game can be made by passing the lists of players directly.
from matching.games import StableMarriage
= StableMarriage(suitors, reviewers) game