from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'ElFarol' players_per_group = 3 num_rounds = 2 endowment = 10 multiplier = 2 bar_full = 2 StandardChoices_1=[ [1, '0ポイント'], [2, '10ポイント'], [3, '20ポイント'], [4, '5ポイント'] ] Survey1Choices = StandardChoices_1 StandardChoices_2=[ [1, '0ポイント'], [2, '10ポイント'], [3, '20ポイント'], [4, '15ポイント'] ] Survey2Choices = StandardChoices_2 StandardChoices_3=[ [1,""], [2,""], [3,""], [4,""], [5,""], [6,""], [7,""] ] Survey3Choices = StandardChoices_3 StandardChoices_4=[ [1,""], [2,""], [3,""], [4,""], [5,""], [6,""], [7,""] ] Survey4Choices = StandardChoices_4 StandardChoices_5=[ [1,""], [2,""] ] Survey5Choices = StandardChoices_5 StandardChoices_6=[ [1,""], [2,""], [3,""], [4,""], [5,""], [6,""], [7,""] ] Survey6Choices = StandardChoices_6 StandardChoices_7=[ [1,""], [2,""], [3,""], [4,""], [5,""], [6,""], [7,""] ] Survey7Choices = StandardChoices_7 class Subsession(BaseSubsession): pass class Group(BaseGroup): total_customers = models.CurrencyField() def set_payoffs(self): self.total_customers = sum([p.decision for p in self.get_players()]) for p in self.get_players(): if self.total_customers > C.BAR_FULL: if p.decision == True: p.payoff = 0 else: p.payoff = C.ENDOWMENT #print("bar is full") else: if p.decision == True: p.payoff = C.ENDOWMENT * C.MULTIPLIER print("winner") else: p.payoff = C.ENDOWMENT print("loser") #print("bar looks great") p.curr_cumu_payoffs = sum([pp.payoff for pp in p.in_all_rounds()]) def total_payoff(self): for p in self.get_players(): p.total_payoffs = sum([pp.payoff for pp in p.in_all_rounds()]) p.total_money = (p.total_payoffs * 2) + 1000 class Player(BasePlayer): total_payoffs = models.CurrencyField() curr_cumu_payoffs = models.CurrencyField() total_money = models.CurrencyField() name = models.StringField( label='以下にご自分のお名前をお書きください' ) sex = models.IntegerField( label='以下にご自分の性別をお書きください', choices=[ [1,'男性'], [2,'女性'], [3,'その他'] ] ) age = models.IntegerField( label='以下にご自分の年齢をお書きください' ) name = models.StringField( label='以下にご自分のお名前をお書きください' ) studentID = models.StringField( label='以下にご自分の学籍番号をお書きください' ) decision = models.BooleanField( choices=[ [True, '参加する'], [False, '参加しない'], ], widget=widgets.RadioSelect ) consent_btn = models.BooleanField() # item1A = models.IntegerField( label='正しいと思う選択肢をお選びください', choices=C.SURVEY1CHOICES, widget=widgets.RadioSelect ) item2A = models.IntegerField( label='正しいと思う選択肢をお選びください', choices=C.SURVEY2CHOICES, widget=widgets.RadioSelect ) get_name = models.StringField( label='ここにお名前をお書きください' ) #Survey1 (Strategy) item3A = models.IntegerField( label='メンバー全員がイベントに均等に参加できること', choices=C.SURVEY3CHOICES, widget=widgets.RadioSelect ) item3B = models.IntegerField( label='自分の報酬が増えること', choices=C.SURVEY3CHOICES, widget=widgets.RadioSelect ) item3C = models.IntegerField( label='自分の報酬が他のメンバーより高くなること', choices=C.SURVEY3CHOICES, widget=widgets.RadioSelect ) item3D = models.IntegerField( label='他の人から利用されないに振る舞うこと', choices=C.SURVEY3CHOICES, widget=widgets.RadioSelect ) item3E = models.IntegerField( label='グループ全体の利益が高くなること', choices=C.SURVEY3CHOICES, widget=widgets.RadioSelect ) item3F = models.IntegerField( label='他のメンバーと協力し合うこと', choices=C.SURVEY3CHOICES, widget=widgets.RadioSelect ) #Survey2 (Davis) Davis1 = models.IntegerField( label='人を批判する前に、もし自分がその人であったらならば、どう思うであろうかと考えるようにしている', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis2 = models.IntegerField( label='すばらしい映画を見ていると、自分が主人公になったような気持ちになってしまう', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis3 = models.IntegerField( label='よい本や映画にのめり込むことは、めったにない', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis4 = models.IntegerField( label='状態になると、ひどくビクビクする', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis5 = models.IntegerField( label='目の前で起こったことに感動することがよくある', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis6 = models.IntegerField( label='感情が高ぶると、無力感に襲われる', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis7 = models.IntegerField( label='客観的な立場から物事を見ることは難しいと思う', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis8 = models.IntegerField( label='不公平に扱われている人たちを見ても、あまり可哀想だとは思えない', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis9 = models.IntegerField( label='困っている人たちがいてもあまり可哀想だとは思わない', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis10 = models.IntegerField( label='緊急事態で助けを必要とする人を見ると、取り乱してしまう', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis11 = models.IntegerField( label='自分たちより不幸な人たちのことを考えると、優しくしたくなる', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis12 = models.IntegerField( label='劇や映画を見ると、自分が登場人物のひとりになったように感じる', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis13 = models.IntegerField( label='何かを決定する時には、反対の立場から考えることもしようと考えている', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis14 = models.IntegerField( label='誰かに対してイライラしても、少しその人の立場になって考えようとする', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis15 = models.IntegerField( label='傷ついた人を見ても、冷静でいられる', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis16 = models.IntegerField( label='小説を読んでいて、登場人物に感情移入することがある', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis17 = models.IntegerField( label='不利な立場にいる人を見ると、その人を守ってあげたいような気持ちになる', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis18 = models.IntegerField( label='時にはどうしていいかわからなくなる', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis19 = models.IntegerField( label='自分はとても思いやりのある人間だと思う', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis20 = models.IntegerField( label='自分の判断が正しいと思う時には、他の人たちの意見は聞かない', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis21 = models.IntegerField( label='自分の身には起こりそうにない頃をあれこれ想像したり空想にふけったりする', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis22 = models.IntegerField( label='周りの人たちが不幸でも、自分は平気でいられる', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis23 = models.IntegerField( label='緊急な状況では、どうしようもなく平安な気持ちになる', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis24 = models.IntegerField( label='映画や劇を見ても、平常心で、のめり込むことはない', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis25 = models.IntegerField( label='緊急状態でも、比較的上手く対処できる', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis26 = models.IntegerField( label='私はあらゆる問題には2種類の立場があると信じており、それぞれの立場に立ってみようと思う', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis27 = models.IntegerField( label='友達をよく理解するために、彼らの立場になって考えようとする', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) Davis28 = models.IntegerField( label='面白い小説を読んでいる時、もしその中の出来事が自分に怒ったらどうするだろうと、よく想像する', choices=C.SURVEY4CHOICES, widget=widgets.RadioSelect ) #Survey3 (FNE) 2択(はい・いいえ) FNE1 = models.IntegerField( label='人に馬鹿だと思われるのではないかと心配することは、ほとんどない', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE2 = models.IntegerField( label='人がなんと思おうと、どういうことはないと分かっていても、自分のことを人がどう思うか気になる', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE3 = models.IntegerField( label='誰かが私のことを評価していることがわかると、緊張して神経過敏になる', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE4 = models.IntegerField( label='人が私についてよくない印象を持ちつつあると分かっても気にしない', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE5 = models.IntegerField( label='人前で失敗するとひどくうろたえてしまう', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE6 = models.IntegerField( label='自分にとって大切な人たちが私をどう思うか不安になることはほとんどない', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE7 = models.IntegerField( label='馬鹿げたように見えないかとか、馬鹿な真似をして物笑いにならないかとよく心配する', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE8 = models.IntegerField( label='自分のことを、他の人が認めてくれなくてもほとんど動じない', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE9 = models.IntegerField( label='他の人が私の欠点に気づくのではないかとしばしば心配する', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE10 = models.IntegerField( label='他の人が自分のことを認めてくれなくても、あまり気にならない', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE11 = models.IntegerField( label='誰かが私のことを評価していると、最悪の場合を予想しがちである', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE12 = models.IntegerField( label='どんな印象を人に与えているか、ほとんど気にしない', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE13 = models.IntegerField( label='他の人が私を認めてくれないではないかと思う', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE14 = models.IntegerField( label='人に自分の欠点を、見つけられるのではないかと心配だ', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE15 = models.IntegerField( label='他の人が私をどう思うかが、私を左右することはない', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE16 = models.IntegerField( label='人に気に入られなくても、必ずしもうろたえたりしない', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE17 = models.IntegerField( label='誰かと話している時、その人が自分のことをどう思っているか心配だ', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE18 = models.IntegerField( label='誰だって時には失敗することがあるのだから、私は失敗を気にする必要はないと思う', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE19 = models.IntegerField( label='自分がどんな印象を与えているのかいつも気になる', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE20 = models.IntegerField( label='自分の目上の人が私のことをどう思っているか、ひどく気になる', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE21 = models.IntegerField( label='もし誰かが私のことを評価していると分かっても、私にはほとんど関係ない', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE22 = models.IntegerField( label='他の人が私のことを価値がないと思うのではないかと心配だ', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE23 = models.IntegerField( label='他の人が私のことをどう思うかはほとんど気にならない', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE24 = models.IntegerField( label='他の人が私にことをどう思っているか、気にしすぎると思うことがときどきある', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE25 = models.IntegerField( label='間違ったことを言ったり、したりするのではないかとしばしば心配になる', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE26 = models.IntegerField( label='他の人が私をどう思っているか気にかけない方である', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE27 = models.IntegerField( label='たいていの場合、他の人が私に対していい印象を持つだろうという自信がある', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE28 = models.IntegerField( label='私にとって大切な人が、私のことを気にかけてくれないのではないかと思うことが多い', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE29 = models.IntegerField( label='私の友達が自分をどう思っているかあれこれ考えてしまう', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) FNE30 = models.IntegerField( label='目上の人が私を評価していると分かると緊張して神経過敏になる', choices=C.SURVEY5CHOICES, widget=widgets.RadioSelect ) #Survey4 (Trust) 7段階(1全くそう思わない〜7強くそう思う) Trust1 = models.IntegerField( label='私は人を信頼する方である', choices=C.SURVEY6CHOICES, widget=widgets.RadioSelect ) Trust2 = models.IntegerField( label='ほとんどの人は基本的に正直である', choices=C.SURVEY6CHOICES, widget=widgets.RadioSelect ) Trust3 = models.IntegerField( label='ほとんどの人は基本的に善良で親切である', choices=C.SURVEY6CHOICES, widget=widgets.RadioSelect ) Trust4 = models.IntegerField( label='私がまわりの人に対して持っている印象は、ほとんどいつも正しい', choices=C.SURVEY6CHOICES, widget=widgets.RadioSelect ) Trust5 = models.IntegerField( label='ほとんどの人は信用できる', choices=C.SURVEY6CHOICES, widget=widgets.RadioSelect ) Trust6 = models.IntegerField( label='ほとんどの人は他人を信頼している', choices=C.SURVEY6CHOICES, widget=widgets.RadioSelect) #Survey5 (Big Five) 7段階(1全くそう思わない〜7強くそう思う) BigFive1 = models.IntegerField( label='私は自分自身のことを、活発で、外交的だと思う', choices=C.SURVEY7CHOICES, widget=widgets.RadioSelect ) BigFive2 = models.IntegerField( label='私は自分自身のことを、他人に不満を持ち、もめ事を起こしやすい人だと思う', choices=C.SURVEY7CHOICES, widget=widgets.RadioSelect ) BigFive3 = models.IntegerField( label='私は自分自身のことを、しっかりしていて、自分に厳しいと思う', choices=C.SURVEY7CHOICES, widget=widgets.RadioSelect ) BigFive4 = models.IntegerField( label='私は自分自身のことを、心配性で、うろたえやすいと思う', choices=C.SURVEY7CHOICES, widget=widgets.RadioSelect ) BigFive5 = models.IntegerField( label='私は自分自身のことを、新しいことが好きで、変わった考えを持つと思う', choices=C.SURVEY7CHOICES, widget=widgets.RadioSelect ) BigFive6 = models.IntegerField( label='私は自分自身のことを、控えめで、おとなしいと思う', choices=C.SURVEY7CHOICES, widget=widgets.RadioSelect ) BigFive7 = models.IntegerField( label='私は自分自身のことを、人に気をつかう、優しい人間だと思う', choices=C.SURVEY7CHOICES, widget=widgets.RadioSelect ) BigFive8 = models.IntegerField( label='私は自分自身のことを、だらしなく、うっかりしていると思う', choices=C.SURVEY7CHOICES, widget=widgets.RadioSelect ) BigFive9 = models.IntegerField( label='私は自分自身のことを、冷静で、気分が安定していると思う', choices=C.SURVEY7CHOICES, widget=widgets.RadioSelect ) BigFive10 = models.IntegerField( label='私は自分自身のことを、発想力に欠けた、平凡な人間だと思う', choices=C.SURVEY7CHOICES, widget=widgets.RadioSelect )