from enum import Enum class DecisionOrder(Enum): SEQUENTIAL = 0 SIMULTANEOUS = 1 INDIVIDUAL = 2 class MatchingType(Enum): PARTNER = 0 STRANGER = 1 class TreatmentName(Enum): BASE = "Base" SIM = "Simultaneous" COMM = "Communication" IND = "Individual" FOR = "Forced New Partner" class Treatment: """ Defines the attributes of a treatment. Parameters: decision_order (bool): Whether players decide after each other or not (simultaneous) communication (bool): Whether players communicate witch partner before decision matching_type (bool): Whether players keep one partner throughout rounds or not (stranger_matching) """ name: TreatmentName decision_order: DecisionOrder matching_type: MatchingType communication: bool def __init__(self, name: TreatmentName, decision_order: DecisionOrder, communication: bool, matching_type: MatchingType): self.name = name self.decision_order = decision_order self.communication = communication self.matching_type = matching_type class BaseTreatment(Treatment): def __init__(self): decision_order, communication, matching_type = DecisionOrder.SEQUENTIAL, False, MatchingType.PARTNER super().__init__(TreatmentName.BASE, decision_order, communication, matching_type) def __str__(self): return "Base" class SimultaneousTreatment(Treatment): def __init__(self): decision_order, communication, matching_type = DecisionOrder.SIMULTANEOUS, False, MatchingType.PARTNER super().__init__(TreatmentName.SIM, decision_order, communication, matching_type) def __str__(self): return "Simultaneous" class CommunicationTreatment(Treatment): def __init__(self): decision_order, communication, matching_type = DecisionOrder.SEQUENTIAL, True, MatchingType.PARTNER super().__init__(TreatmentName.COMM, decision_order, communication, matching_type) def __str__(self): return "Communication" class IndividualTreatment(Treatment): def __init__(self): decision_order, communication, matching_type = DecisionOrder.INDIVIDUAL, False, MatchingType.PARTNER super().__init__(TreatmentName.IND, decision_order, communication, matching_type) def __str__(self): return "Individual" class ForcedNewPartnerTreatment(Treatment): def __init__(self): decision_order, communication, matching_type = DecisionOrder.SEQUENTIAL, False, MatchingType.STRANGER super().__init__(TreatmentName.FOR, decision_order, communication, matching_type) def __str__(self): return "ForcedNewPartner"