from otree.api import * import random import time class C(BaseConstants): NAME_IN_URL = 'DiceTask_2023' PLAYERS_PER_GROUP = None NUM_ROUNDS = 10 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def make_field_2(label): return models.IntegerField(widget=widgets.RadioSelect, label = label, choices = [ [5, "5あてはまる"], [4, "4ややあてはまる"], [3, "3どちらともいえない"], [2, "2あまりあてはまらない"], [1, "1あてはまらない"] ] ) class Player(BasePlayer): あなたのId = models.StringField( label = "あなたのID" ) Gender = models.StringField( choices=[ [0, "男性"], [1, "女性"], [2, "その他"], ], label = "性別" ) Age = models.IntegerField( choices=[ [0, "20~29歳"], [1, "30~39歳"], [2, "40~49歳"], [3, "50~59歳"], [4, "60歳以上"], ], label = "年齢" ) Academic_history = models.StringField( choices=[ [0, "中学校"], [1, "高等学校or高等専門学校"], [2, "短期大学or四年制大学"], [3, "大学院"], ], label = "最終学歴" ) Marital_status = models.IntegerField( choices=[ [0, "既婚"], [1, "未婚"], [2, "答えたくない"], ], label = "婚姻状況" ) Children = models.IntegerField( choices=[ [0, "いない"], [1, "いる"], [2, "答えたくない"], ], label = "子供" ) Job = models.StringField( label = "職業" ) 個人年収 = models.StringField( choices=[ [0, "400万円未満"], [1, "400~600万円"], [2, "600~800万円"], [3, "800~1000万円"], [4, "1000万円以上"], [5, "わからない・答えたくない"], ], label = "個人年収" ) 体型 = models.IntegerField( choices=[ [0, "太っているorやや太っている"], [1, "筋肉質である"], [2, "痩せているorやや痩せている"], [3, "その他"], [4, "答えたくない"], ], label = "体型" ) シナリオ1 = models.IntegerField( choices=[ [0, "受理"], [1, "拒否"], ], label = "シナリオ1" ) シナリオ2 = models.IntegerField( choices=[ [0, "受理"], [1, "拒否"], ], label = "シナリオ2" ) シナリオ3 = models.IntegerField( choices=[ [0, "受理"], [1, "拒否"], ], label = "シナリオ3" ) シナリオ4 = models.IntegerField( choices=[ [0, "受理"], [1, "拒否"], ], label = "シナリオ4" ) シナリオ5 = models.IntegerField( choices=[ [0, "受理"], [1, "拒否"], ], label = "シナリオ5" ) シナリオ6 = models.IntegerField( choices=[ [0, "受理"], [1, "拒否"], ], label = "シナリオ6" ) シナリオ7 = models.IntegerField( choices=[ [0, "受理"], [1, "拒否"], ], label = "シナリオ7" ) シナリオ8 = models.IntegerField( choices=[ [0, "受理"], [1, "拒否"], ], label = "シナリオ8" ) シナリオ9 = models.IntegerField( choices=[ [0, "受理"], [1, "拒否"], ], label = "シナリオ9" ) シナリオ10 = models.IntegerField( choices=[ [0, "受理"], [1, "告発"], ], label = "シナリオ10" ) シナリオ11 = models.IntegerField( choices=[ [0, "受理"], [1, "告発"], ], label = "シナリオ11" ) シナリオ12 = models.IntegerField( choices=[ [0, "受理"], [1, "告発"], ], label = "シナリオ12" ) シナリオ13 = models.IntegerField( choices=[ [0, "受理"], [1, "告発"], ], label = "シナリオ13" ) シナリオ14 = models.IntegerField( choices=[ [0, "受理"], [1, "告発"], ], label = "シナリオ14" ) シナリオ15 = models.IntegerField( choices=[ [0, "受理"], [1, "告発"], ], label = "シナリオ15" ) シナリオ16 = models.IntegerField( choices=[ [0, "受理"], [1, "告発"], ], label = "シナリオ16" ) シナリオ17 = models.IntegerField( choices=[ [0, "受理"], [1, "告発"], ], label = "シナリオ17" ) シナリオ18 = models.IntegerField( choices=[ [0, "受理"], [1, "告発"], ], label = "シナリオ18" ) シナリオ19 = models.IntegerField( choices=[ [0, "受理"], [1, "告発"], ], label = "シナリオ19" ) シナリオ20 = models.IntegerField( choices=[ [0, "受理"], [1, "告発"], ], label = "シナリオ20" ) シナリオ21 = models.IntegerField( choices=[ [0, "受理"], [1, "告発"], ], label = "シナリオ21" ) さいころ1 = models.IntegerField( label = "さいころ1" ) さいころ2 = models.IntegerField( label = "さいころ2" ) さいころ3 = models.IntegerField( label = "さいころ3" ) さいころ4 = models.IntegerField( label = "さいころ4" ) さいころ5 = models.IntegerField( choices = [1, 2, 3, 4, 5, 6], label = "1-1(1回目)" ) さいころ6 = models.IntegerField( choices = [1, 2, 3, 4, 5, 6], label = "1-1(2回目)" ) さいころ7 = models.IntegerField( choices = [1, 2, 3, 4, 5, 6], label = "1-1(3回目)" ) さいころ8 = models.IntegerField( choices = [1, 2, 3, 4, 5, 6], label = "1-1(4回目)" ) さいころ11 = models.IntegerField( label = "さいころ11" ) さいころ12 = models.IntegerField( label = "さいころ12" ) さいころ13 = models.IntegerField( label = "さいころ13" ) さいころ14 = models.IntegerField( label = "さいころ14" ) さいころ15 = models.IntegerField( choices = [1, 2, 3, 4, 5, 6], label = "1-2(1回目)" ) さいころ16 = models.IntegerField( choices = [1, 2, 3, 4, 5, 6], label = "1-2(2回目)" ) さいころ17 = models.IntegerField( choices = [1, 2, 3, 4, 5, 6], label = "1-2(3回目)" ) さいころ18 = models.IntegerField( choices = [1, 2, 3, 4, 5, 6], label = "1-2(4回目)" ) さいころ21 = models.IntegerField( label = "さいころ21" ) さいころ22 = models.IntegerField( label = "さいころ22" ) さいころ23 = models.IntegerField( label = "さいころ23" ) さいころ24 = models.IntegerField( label = "さいころ24" ) さいころ25 = models.IntegerField( choices = [1, 2, 3, 4, 5, 6], label = "1-3(1回目)" ) さいころ26 = models.IntegerField( choices = [1, 2, 3, 4, 5, 6], label = "1-3(2回目)" ) さいころ27 = models.IntegerField( choices = [1, 2, 3, 4, 5, 6], label = "1-3(3回目)" ) さいころ28 = models.IntegerField( choices = [1, 2, 3, 4, 5, 6], label = "1-3(4回目)" ) Gender相手 = models.StringField( choices=[ [0, "男性"], [1, "女性"], ], label = "性別相手" ) Age相手 = models.IntegerField( choices=[ [0, "20~29歳"], [1, "30~39歳"], [2, "40~49歳"], [3, "40~59歳"], [4, "60歳以上"], ], label = "年齢" ) Academic_history相手 = models.IntegerField( choices=[ [0, "中学校"], [1, "高等学校or高等専門学校"], [2, "短期大学or四年制大学"], [3, "大学院"], ], label = "最終学歴" ) Marital_status相手 = models.IntegerField( choices=[ [0, "既婚"], [1, "未婚"], ], label = "婚姻状況" ) Children相手 = models.IntegerField( choices=[ [0, "いない"], [1, "いる"], ], label = "子供" ) 個人年収相手 = models.IntegerField( choices=[ [0, "400万円未満"], [1, "400~600万円"], [2, "600~800万円"], [3, "800~1000万円"], [4, "1000万円以上"], ], label = "個人年収" ) 体型相手 = models.IntegerField( choices=[ [0, "太っているorやや太っている"], [1, "筋肉質である"], [2, "痩せているorやや痩せている"], ], label = "体型" ) さいころa1 = models.IntegerField( label = "さいころa1" ) さいころa2 = models.IntegerField( label = "さいころa2" ) さいころa3 = models.IntegerField( label = "さいころa3" ) さいころa4 = models.IntegerField( label = "さいころa4" ) さいころb1 = models.IntegerField( label = "さいころb1" ) さいころb2 = models.IntegerField( label = "さいころb2" ) さいころb3 = models.IntegerField( label = "さいころb3" ) さいころb4 = models.IntegerField( label = "さいころb4" ) さいころc1 = models.IntegerField( label = "さいころc1" ) さいころc2 = models.IntegerField( label = "さいころc2" ) さいころc3 = models.IntegerField( label = "さいころc3" ) さいころc4 = models.IntegerField( label = "さいころc4" ) さいころd1 = models.IntegerField( label = "さいころd1" ) さいころd2 = models.IntegerField( label = "さいころd2" ) さいころd3 = models.IntegerField( label = "さいころd3" ) さいころd4 = models.IntegerField( label = "さいころd4" ) さいころe1 = models.IntegerField( label = "さいころe1" ) さいころe2 = models.IntegerField( label = "さいころe2" ) さいころe3 = models.IntegerField( label = "さいころe3" ) さいころe4 = models.IntegerField( label = "さいころe4" ) さいころf1 = models.IntegerField( label = "さいころf1" ) さいころf2 = models.IntegerField( label = "さいころf2" ) さいころf3 = models.IntegerField( label = "さいころf3" ) さいころf4 = models.IntegerField( label = "さいころf4" ) PSM_1 = make_field_2("学校、職場での生活に満足している(学生の場合は学校、社会人の場合は職場の生活)。") PSM_2 = make_field_2("日々の出来事から、私たちがいかに互いに依存しているかを思い知らされることが多い。") PSM_3 = make_field_2("社会に変化をもたらすことは、私にとって個人的な業績よりも重要な意味を持つ。") PSM_4 = make_field_2("自己の利益より他人、社会全体の利益を優先する。") PSM_5 = make_field_2("社会のために多大な犠牲を払う覚悟がある。") PSM_6 = make_field_2("汚職に興味がある、汚職はなくなるべきだと考えている。") PSM_7 = make_field_2("自身の利益のために虚偽申告を学校、職場での生活などでよく行う。") PSM_8= make_field_2("他人の虚偽報告を学校、職場での生活などでよく見かける。") PSM_9 = make_field_2("他人の虚偽報告を訂正・告発することに一切の躊躇がない。") PSM_10 = make_field_2("自身の利益のためでなくても、他人の虚偽報告を訂正・告発することができる。") def creating_session(subsession): for player in subsession.get_players(): player.さいころ1 = random.randint(1,6) player.さいころ2 = random.randint(1,6) player.さいころ3 = random.randint(1,6) player.さいころ4 = random.randint(1,6) player.さいころ11 = random.randint(1,6) player.さいころ12 = random.randint(1,6) player.さいころ13 = random.randint(1,6) player.さいころ14 = random.randint(1,6) player.さいころ21 = random.randint(1,6) player.さいころ22 = random.randint(1,6) player.さいころ23 = random.randint(1,6) player.さいころ24 = random.randint(1,6) player.Gender相手 = random.randint(0,1) player.Age相手 = random.randint(0,4) player.Academic_history相手 = random.randint(0,3) player.Marital_status相手 = random.randint(0,1) player.Children相手 = random.randint(0,1) player.個人年収相手 = random.randint(0,4) player.体型相手 = random.randint(0,2) player.さいころa1 = random.randint(0,3) player.さいころa2 = random.randint(0,3) player.さいころa3 = random.randint(0,3) player.さいころa4 = random.randint(0,3) player.さいころb1 = random.randint(0,3) player.さいころb2 = random.randint(0,3) player.さいころb3 = random.randint(0,3) player.さいころb4 = random.randint(0,3) player.さいころc1 = random.randint(0,3) player.さいころc2 = random.randint(0,3) player.さいころc3 = random.randint(0,3) player.さいころc4 = random.randint(0,3) player.さいころd1 = random.randint(0,3) player.さいころd2 = random.randint(0,3) player.さいころd3 = random.randint(0,3) player.さいころd4 = random.randint(0,3) player.さいころe1 = random.randint(0,3) player.さいころe2 = random.randint(0,3) player.さいころe3 = random.randint(0,3) player.さいころe4 = random.randint(0,3) player.さいころf1 = random.randint(0,3) player.さいころf2 = random.randint(0,3) player.さいころf3 = random.randint(0,3) player.さいころf4 = random.randint(0,3) # PAGES class Registration1(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['あなたのId'] class Registration(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['Gender', 'Age', 'Academic_history', 'Marital_status', 'Children', 'Job', '個人年収', '体型'] class RegistrationA(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' class Question10(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' class Question10a(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' class Question11(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' class Question11a(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['さいころ5', 'さいころ6', 'さいころ7', 'さいころ8'] class Question12(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' class Question12a(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['さいころ15', 'さいころ16', 'さいころ17', 'さいころ18'] class Question13(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' class Question13a(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['さいころ25', 'さいころ26', 'さいころ27', 'さいころ28'] class Question20(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' class Question21(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['シナリオ1', 'シナリオ2', 'シナリオ3'] class Question22(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['シナリオ4', 'シナリオ5', 'シナリオ6'] class Question22a(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['シナリオ7', 'シナリオ8', 'シナリオ9'] class Question30(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' class Question3(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['シナリオ10', 'シナリオ11', 'シナリオ12', 'シナリオ13'] class Question3a(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['シナリオ14', 'シナリオ15', 'シナリオ16', 'シナリオ17'] class Question3b(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['シナリオ18', 'シナリオ19', 'シナリオ20', 'シナリオ21'] class Basic_info(Page): @staticmethod def is_displayed(player): return player.round_number == 1 form_model = 'player' form_fields = ['PSM_1', 'PSM_2', 'PSM_3', 'PSM_4', 'PSM_5', 'PSM_6', 'PSM_7', 'PSM_8', 'PSM_9', 'PSM_10'] class Checkout(Page): @staticmethod def is_displayed(player): return player.round_number == 10 page_sequence = [Registration1, RegistrationA,Registration, Question10, Question10a, Question11, Question11a, Question12, Question12a, Question13, Question13a, Question20, Question21, Question22, Question22a, Question30, Question3, Question3a, Question3b, Basic_info, Checkout]