from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random author = 'ML' doc = """ Introduction """ class Constants(BaseConstants): name_in_url = 'ranking' players_per_group = None num_rounds = 1 axioms1 = ["Program X is preferable compared to program Y if the lowest income in program X is larger than the lowest income in program Y.","Program X is preferable compared to program Y if the lowest income in program X is smaller than the lowest income in program Y."] axioms2 = ["Program X is preferable compared to program Y if the sum of all incomes of program X is larger than the sum of all incomes of program Y.", "Program X is preferable compared to program Y if the sum of all incomes of program X is smaller than the sum of all incomes of program Y."] axioms3 = ["Consider two randomly chosen individuals in program X and two in program Y. Program X is preferable compared to program Y if the expected income difference between individuals (in proportion to the average income of the respective program) is smaller in program X than in Y.", "Consider two randomly chosen individuals in program X and two in program Y. Program X is preferable compared to program Y if the expected income difference between individuals (in proportion to the average income of the respective program) is larger in program X than in Y."] axioms4 = ["Program X is preferable compared to program Y if there is a way to re-allocate income starting from program Y and yielding program X such that re-allocations only involve transfers from individuals with higher incomes to individuals with lower incomes.", "Program X is preferable compared to program Y if there is a way to re-allocate income starting from program Y and yielding program X such that re-allocations only involve transfers from individuals with lower incomes to individuals with higher incomes."] axioms5 = ["Program X is preferable compared to program Y if there are two or more persons such that the poorest of them earns more in X than in Y, and the total earnings in X are at most as much as in Y. All other persons receive the same under both programs.", "Program X is preferable compared to program Y if there are two or more persons such that the poorest of them earns less in X than in Y, and the total earnings in X are at least as much as in Y. All other persons receive the same under both programs."] all_axioms = [axioms1, axioms2, axioms3, axioms4, axioms5] choices = ['A', 'B', 'C', 'D', 'E'] class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): def make_rank_field(label): return models.StringField(choices=Constants.choices, label=label) rank1 = make_rank_field("First") rank2 = make_rank_field("Second") rank3 = make_rank_field("Third") rank4 = make_rank_field("Fourth") rank5 = make_rank_field("Fifth") axord1 = models.IntegerField() axord2 = models.IntegerField() axord3 = models.IntegerField() axord4 = models.IntegerField() axord5 = models.IntegerField() def set_payoffs(self) -> object: self.payoff = 0