""" constants.py — All configurable input tables and static parameters for the norm experiment. Edit the tables here; the rest of the app reads from them automatically. """ from itertools import combinations # --------------------------------------------------------------------------- # Experiment-level constants # --------------------------------------------------------------------------- NUM_ROUNDS = 1 # Single-round experiment NUM_CONDITIONS = 3 # threshold, staircase, full_MPL CONDITIONS = ['threshold', 'staircase', 'full_MPL'] MU_TO_GBP = 0.50 # adjust as needed # --------------------------------------------------------------------------- # DICTATOR GAME OPTIONS TABLE # own_payoff is NOT specified here — it is derived automatically as: # own_payoff = DICTATOR_ENDOWMENT - transfer # other_payoff (used at payout time) = transfer * multiplier # # Add / remove rows to change the option set. # All pairwise comparisons (C(n,2)) are generated automatically. # --------------------------------------------------------------------------- # Starting endowment for the dictator game (in Monetary Units). # Change this one value to rescale all options at once. DICTATOR_ENDOWMENT = 10 DICTATOR_OPTIONS = [ # option_id | transfer | multiplier {'option_id': 'D1', 'transfer': 3, 'multiplier': 2.0}, {'option_id': 'D2', 'transfer': 5, 'multiplier': 2.0}, {'option_id': 'D3', 'transfer': 10, 'multiplier': 2.0}, {'option_id': 'D4', 'transfer': 3, 'multiplier': 2.5}, {'option_id': 'D5', 'transfer': 5, 'multiplier': 2.5}, {'option_id': 'D6', 'transfer': 0, 'multiplier': 2.0}, ] # Attach derived own_payoff to each option dict so the rest of the app # can access it as opt['own_payoff'] without repeating the formula. for _opt in DICTATOR_OPTIONS: _opt['own_payoff'] = DICTATOR_ENDOWMENT - _opt['transfer'] # --------------------------------------------------------------------------- # RISK TASK OPTIONS TABLE # --------------------------------------------------------------------------- RISK_OPTIONS = [ # option_id | left_outcome | right_outcome | probability_left_outcome (0–1) {'option_id': 'R1', 'left_outcome': 10, 'right_outcome': 10, 'probability_left': 1.0}, {'option_id': 'R2', 'left_outcome': 11, 'right_outcome': 9, 'probability_left': 0.5}, {'option_id': 'R3', 'left_outcome': 13, 'right_outcome': 8, 'probability_left': 0.5}, {'option_id': 'R4', 'left_outcome': 17, 'right_outcome': 7, 'probability_left': 0.5}, {'option_id': 'R5', 'left_outcome': 12, 'right_outcome': 9, 'probability_left': 0.8}, {'option_id': 'R6', 'left_outcome': 15, 'right_outcome': 5, 'probability_left': 0.8}, ] # --------------------------------------------------------------------------- # ACTUAL DESCRIPTIVE NORMS TABLE # Provide the real-world norm data here before running the final experiment. # Format: (task, option_a_id, option_b_id) -> number of people (out of 10) who chose option_a # --------------------------------------------------------------------------- ACTUAL_NORMS = { # Example entries — replace with real data # Key: (task_type, option_a_id, option_b_id) Value: n_chose_a (integer 0–10) # Dictator pairs ('dictator', 'D1', 'D2'): 9, ('dictator', 'D1', 'D3'): 10, ('dictator', 'D1', 'D4'): 0, ('dictator', 'D1', 'D5'): 9, ('dictator', 'D1', 'D6'): 5, ('dictator', 'D2', 'D3'): 10, ('dictator', 'D2', 'D4'): 1, ('dictator', 'D2', 'D5'): 2, ('dictator', 'D2', 'D6'): 3, ('dictator', 'D3', 'D4'): 0, ('dictator', 'D3', 'D5'): 1, ('dictator', 'D3', 'D6'): 3, ('dictator', 'D4', 'D5'): 9, ('dictator', 'D4', 'D6'): 5, ('dictator', 'D5', 'D6'): 3, # Risk pairs ('risk', 'R1', 'R2'): 5, ('risk', 'R1', 'R3'): 5, ('risk', 'R1', 'R4'): 2, ('risk', 'R1', 'R5'): 4, ('risk', 'R1', 'R6'): 3, ('risk', 'R2', 'R3'): 1, ('risk', 'R2', 'R4'): 3, ('risk', 'R2', 'R5'): 4, ('risk', 'R2', 'R6'): 4, ('risk', 'R3', 'R4'): 0, ('risk', 'R3', 'R5'): 1, ('risk', 'R3', 'R6'): 2, ('risk', 'R4', 'R5'): 6, ('risk', 'R4', 'R6'): 5, ('risk', 'R5', 'R6'): 4, } # --------------------------------------------------------------------------- # CONSISTENCY CHECK SITUATIONS TABLE # Manually specify which 8 decision situations are shown as consistency checks. # Format: list of dicts with task_type, option_a_id, option_b_id # --------------------------------------------------------------------------- CONSISTENCY_CHECKS = [ {'task_type': 'dictator', 'option_a_id': 'D1', 'option_b_id': 'D6'}, {'task_type': 'dictator', 'option_a_id': 'D3', 'option_b_id': 'D6'}, {'task_type': 'dictator', 'option_a_id': 'D6', 'option_b_id': 'D5'}, {'task_type': 'dictator', 'option_a_id': 'D1', 'option_b_id': 'D4'}, {'task_type': 'risk', 'option_a_id': 'R1', 'option_b_id': 'R2'}, {'task_type': 'risk', 'option_a_id': 'R1', 'option_b_id': 'R6'}, {'task_type': 'risk', 'option_a_id': 'R4', 'option_b_id': 'R5'}, {'task_type': 'risk', 'option_a_id': 'R4', 'option_b_id': 'R6'}, ] # --------------------------------------------------------------------------- # Helper: generate all pairwise decision situations from an options list # --------------------------------------------------------------------------- def generate_pairs(options, task_type): """Return list of dicts describing every unique (A, B) pair from options.""" pairs = [] for opt_a, opt_b in combinations(options, 2): pairs.append({ 'task_type': task_type, 'option_a': opt_a, 'option_b': opt_b, }) return pairs DICTATOR_PAIRS = generate_pairs(DICTATOR_OPTIONS, 'dictator') # 15 pairs RISK_PAIRS = generate_pairs(RISK_OPTIONS, 'risk') # 15 pairs # Build lookup dicts for fast option retrieval by option_id DICTATOR_BY_ID = {o['option_id']: o for o in DICTATOR_OPTIONS} RISK_BY_ID = {o['option_id']: o for o in RISK_OPTIONS}